test/langtools/jdk/javadoc/doclet/testDocRootLink/TestDocRootLink.java
author jjg
Fri, 18 Jan 2019 11:26:30 -0800
changeset 53391 a99bd2570660
parent 53097 2e82ca64b25d
permissions -rw-r--r--
8217034: JavadocTester should check for missing files by default Reviewed-by: hannesw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
     1
/*
53391
a99bd2570660 8217034: JavadocTester should check for missing files by default
jjg
parents: 53097
diff changeset
     2
 * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
     4
 *
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
     8
 *
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    13
 * accompanied this code).
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    14
 *
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    18
 *
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    21
 * questions.
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    22
 */
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    23
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    24
/*
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    25
 * @test
22160
fe9f4b305bcf 8029504: Regression: TestDocRootLink test fails on Windows
ksrini
parents: 22005
diff changeset
    26
 * @bug 6553182 8025416 8029504
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    27
 * @summary This test verifies the -Xdocrootparent option.
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    28
 * @author Bhavesh Patel
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 47216
diff changeset
    29
 * @library ../../lib
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    30
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 47216
diff changeset
    31
 * @build javadoc.tester.*
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    32
 * @run main TestDocRootLink
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    33
 */
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 47216
diff changeset
    34
import javadoc.tester.JavadocTester;
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 47216
diff changeset
    35
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    36
public class TestDocRootLink extends JavadocTester {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    37
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    38
    public static void main(String... args) throws Exception {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    39
        TestDocRootLink tester = new TestDocRootLink();
53391
a99bd2570660 8217034: JavadocTester should check for missing files by default
jjg
parents: 53097
diff changeset
    40
a99bd2570660 8217034: JavadocTester should check for missing files by default
jjg
parents: 53097
diff changeset
    41
        // The test files intentionally contain examples of links that should
a99bd2570660 8217034: JavadocTester should check for missing files by default
jjg
parents: 53097
diff changeset
    42
        // or should not be affected by the -Xdocrootparent option, and the
a99bd2570660 8217034: JavadocTester should check for missing files by default
jjg
parents: 53097
diff changeset
    43
        // results are checked explicitly; so, disable the automatic link
a99bd2570660 8217034: JavadocTester should check for missing files by default
jjg
parents: 53097
diff changeset
    44
        // checker to prevent spurious "missing files" errors from some of
a99bd2570660 8217034: JavadocTester should check for missing files by default
jjg
parents: 53097
diff changeset
    45
        // these links.
a99bd2570660 8217034: JavadocTester should check for missing files by default
jjg
parents: 53097
diff changeset
    46
        tester.setAutomaticCheckLinks(false);
a99bd2570660 8217034: JavadocTester should check for missing files by default
jjg
parents: 53097
diff changeset
    47
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    48
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    49
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    50
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 47216
diff changeset
    52
    public void test1() {
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    53
        javadoc("-d", "out-1",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    54
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    55
                "pkg1", "pkg2");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
        checkExit(Exit.OK);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    57
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    58
        checkOutput("pkg1/C1.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    59
            "Refer <a href=\"../../technotes/guides/index.html\">Here</a>",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 22160
diff changeset
    60
            "This <a href=\"../pkg2/C2.html\">Here</a> should not be replaced\n" +
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    61
            " with an absolute link.",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 22160
diff changeset
    62
            "Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    63
            " <a href=\"../pkg2/C2.html\">Link 2</a>.");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    64
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    65
        checkOutput("pkg1/package-summary.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    66
            "<a href=\"../../technotes/guides/index.html\">\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    67
            "            Test document 1</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    68
            "<a href=\"../pkg2/C2.html\">\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    69
            "            Another Test document 1</a>",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 22160
diff changeset
    70
            "<a href=\"../technotes/guides/index.html\">\n" +
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    71
            "            Another Test document 2.</a>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    72
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    73
        // TODO: should this check *any* reference to http://download.oracle.com/
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    74
        checkOutput("pkg1/C1.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    75
            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    76
            "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    77
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    78
        checkOutput("pkg1/package-summary.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    79
            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    80
            "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    81
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    82
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    83
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 47216
diff changeset
    84
    public void test2() {
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    85
        javadoc("-d", "out-2",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    86
                "-Xdocrootparent", "http://download.oracle.com/javase/7/docs",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    87
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    88
                "pkg1", "pkg2");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    89
        checkExit(Exit.OK);
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    90
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    91
        checkOutput("pkg2/C2.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    92
            "Refer <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    93
            "This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    94
            " with an absolute link.",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    95
            "Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    96
            " <a href=\"../pkg1/C1.html\">Link 2</a>.");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    97
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    98
        checkOutput("pkg2/package-summary.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    99
            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   100
            "            Test document 1</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   101
            "<a href=\"../pkg1/C1.html\">\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   102
            "            Another Test document 1</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   103
            "<a href=\"../technotes/guides/index.html\">\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   104
            "            Another Test document 2.</a>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   105
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   106
        checkOutput("pkg2/C2.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   107
            "<a href=\"../../technotes/guides/index.html\">",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   108
            "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   109
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   110
        checkOutput("pkg2/package-summary.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   111
            "<a href=\"../../technotes/guides/index.html\">",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   112
            "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">");
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
   113
    }
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
   114
}