test/langtools/jdk/javadoc/doclet/testDocRootLink/TestDocRootLink.java
author jjg
Fri, 21 Dec 2018 10:38:33 -0800
changeset 53097 2e82ca64b25d
parent 47216 71c04702a3d5
child 53391 a99bd2570660
permissions -rw-r--r--
8215516: Move JavadocTester to a named package 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
/*
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 47216
diff changeset
     2
 * Copyright (c) 2011, 2018, 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();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    40
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    41
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    42
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    43
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 47216
diff changeset
    44
    public void test1() {
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    45
        javadoc("-d", "out-1",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    46
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    47
                "pkg1", "pkg2");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    48
        checkExit(Exit.OK);
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
        checkOutput("pkg1/C1.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
            "Refer <a href=\"../../technotes/guides/index.html\">Here</a>",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 22160
diff changeset
    52
            "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
    53
            " with an absolute link.",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 22160
diff changeset
    54
            "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
    55
            " <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
    56
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    57
        checkOutput("pkg1/package-summary.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    58
            "<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
    59
            "            Test document 1</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    60
            "<a href=\"../pkg2/C2.html\">\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    61
            "            Another Test document 1</a>",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 22160
diff changeset
    62
            "<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
    63
            "            Another Test document 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
        // 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
    66
        checkOutput("pkg1/C1.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    67
            "<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
    68
            "<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
    69
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    70
        checkOutput("pkg1/package-summary.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    71
            "<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
    72
            "<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
    73
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    74
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    75
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 47216
diff changeset
    76
    public void test2() {
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    77
        javadoc("-d", "out-2",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    78
                "-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
    79
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    80
                "pkg1", "pkg2");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    81
        checkExit(Exit.OK);
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
    82
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    83
        checkOutput("pkg2/C2.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    84
            "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
    85
            "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
    86
            " with an absolute link.",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    87
            "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
    88
            " <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
    89
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    90
        checkOutput("pkg2/package-summary.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    91
            "<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
    92
            "            Test document 1</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    93
            "<a href=\"../pkg1/C1.html\">\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    94
            "            Another Test document 1</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    95
            "<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
    96
            "            Another Test document 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/C2.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    99
            "<a href=\"../../technotes/guides/index.html\">",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   100
            "<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
   101
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   102
        checkOutput("pkg2/package-summary.html", false,
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\">",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   104
            "<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
   105
    }
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents:
diff changeset
   106
}