langtools/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java
author vtewari
Tue, 24 May 2016 12:31:30 +0100
changeset 38477 f462865d453d
parent 30730 d3ce7619db2c
permissions -rw-r--r--
8143923: java.net socket supportedOptions set depends on call order Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 24399
diff changeset
     2
 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
     4
 *
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
     8
 *
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    13
 * accompanied this code).
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    14
 *
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    18
 *
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    21
 * questions.
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    22
 */
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    23
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    24
/*
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    25
 * @test
19920
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 14262
diff changeset
    26
 * @bug 8000418 8024288
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    27
 * @summary Verify that files use a common Generated By string
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    28
 * @library ../lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 24399
diff changeset
    29
 * @modules jdk.javadoc
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    30
 * @build JavadocTester
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    31
 * @run main TestGeneratedBy
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    32
 */
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    33
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    34
public class TestGeneratedBy extends JavadocTester {
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    35
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    36
    public static void main(String... args) throws Exception {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    37
        TestGeneratedBy tester = new TestGeneratedBy();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    38
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    39
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    40
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    41
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    42
    void testTimestamp() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    43
        javadoc("-d", "out-timestamp",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    44
            "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    45
            "pkg");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    46
        checkExit(Exit.OK);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    47
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    48
        checkTimestamps(true);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    49
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    50
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    51
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    52
    void testNoTimestamp() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    53
        javadoc("-d", "out-notimestamp",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    54
            "-notimestamp",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    55
            "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    56
            "pkg");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    57
        checkExit(Exit.OK);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    58
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    59
        checkTimestamps(false);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    60
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    61
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    62
    void checkTimestamps(boolean timestamp) {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    63
        checkTimestamps(timestamp,
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    64
        "pkg/MyClass.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    65
        "pkg/package-summary.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    66
        "pkg/package-frame.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    67
        "pkg/package-tree.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    68
        "allclasses-noframe.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    69
        "constant-values.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    70
        "allclasses-frame.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    71
        "overview-tree.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    72
        "deprecated-list.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    73
        "serialized-form.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    74
        "help-doc.html",
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    75
        "index-all.html",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    76
        "index.html");
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    77
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    78
    }
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    79
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    80
    void checkTimestamps(boolean timestamp, String... files) {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    81
        String version = System.getProperty("java.version");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    82
        String genBy = "Generated by javadoc";
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    83
        if (timestamp) genBy += " (" + version + ") on ";
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    84
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    85
        for (String file: files) {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    86
            // genBy is the current standard "Generated by" text
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    87
            checkOutput(file, true, genBy);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    88
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    89
            // These are older versions of the "Generated by" text
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    90
            checkOutput(file, false,
19920
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 14262
diff changeset
    91
                (timestamp
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 14262
diff changeset
    92
                    ? "Generated by javadoc (version"
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 14262
diff changeset
    93
                    : "Generated by javadoc ("),
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    94
                "Generated by javadoc on");
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    95
        }
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    96
    }
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    97
}
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff changeset
    98