langtools/test/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java
author ksrini
Fri, 28 Jul 2017 15:00:53 -0700
changeset 46079 059faa5e1267
parent 36526 3b41f1c69604
permissions -rw-r--r--
8184969: Cannot specify multiple -link to jdk9 javadoc Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
     2
 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2216
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2216
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2216
diff changeset
    21
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 * @test
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
    26
 * @bug 4720957 5020118 8026567 8038976 8184969
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 * @summary Test to make sure that -link and -linkoffline link to
23974
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
    28
 * right files, and URLs with and without trailing slash are accepted.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 * @author jamieh
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    30
 * @library ../lib
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    31
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    32
 * @build JavadocTester
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * @run main TestLinkOption
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
23974
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
    36
import java.io.File;
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
    37
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
public class TestLinkOption extends JavadocTester {
24399
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
     * The entry point of the test.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    41
     * @param args the array of command line arguments.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    42
     */
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    43
    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
    44
        TestLinkOption tester = new TestLinkOption();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    45
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    46
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    48
    // The following test runs javadoc multiple times; it is important that the
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    49
    // first one is run first, since the subsequent runs refer to the output
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    50
    // it generates. Therefore we run everything serially in a single @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    51
    // method and not in independent @Test methods.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    52
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    53
    void test() {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    54
        String mylib = "mylib";
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    55
        String[] javacArgs = {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    56
            "-d", mylib, testSrc + "/extra/StringBuilder.java"
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    57
        };
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    58
        com.sun.tools.javac.Main.compile(javacArgs);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    59
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    60
        // Generate the documentation using -linkoffline and a URL as the first parameter.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    61
        String out1 = "out1";
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    62
        String url = "http://acme.com/jdk/";
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    63
        javadoc("-d", out1,
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    64
                "-classpath", mylib,
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    65
                "-sourcepath", testSrc,
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    66
                "-linkoffline", url, testSrc + "/jdk",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    67
                "-package",
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    68
                "pkg", "mylib.lang");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    69
        checkExit(Exit.OK);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    71
        checkOutput("pkg/C.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    72
                "<a href=\"" + url + "java/lang/String.html?is-external=true\" "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    73
                + "title=\"class or interface in java.lang\"><code>Link to String Class</code></a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    74
                //Make sure the parameters are indented properly when the -link option is used.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    75
                "(int&nbsp;p1,\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    76
                + "      int&nbsp;p2,\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    77
                + "      int&nbsp;p3)",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    78
                "(int&nbsp;p1,\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    79
                + "      int&nbsp;p2,\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    80
                + "      <a href=\"" + url + "java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    81
                + "Object</a>&nbsp;p3)");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
    82
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    83
        checkOutput("pkg/B.html", true,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    84
                "<div class=\"block\">A method with html tag the method "
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    85
                + "<a href=\"" + url + "java/lang/ClassLoader.html?is-external=true#getSystemClassLoader--\""
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    86
                + " title=\"class or interface in java.lang\"><code><tt>getSystemClassLoader()</tt>"
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    87
                + "</code></a> as the parent class loader.</div>",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    88
                "<div class=\"block\">is equivalent to invoking <code>"
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    89
                + "<a href=\"../pkg/B.html#createTempFile-java.lang.String-java.lang.String-java.io.File-\">"
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    90
                + "<code>createTempFile(prefix,&nbsp;suffix,&nbsp;null)</code></a></code>.</div>",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    91
                "<a href=\"" + url + "java/lang/String.html?is-external=true\" "
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    92
                + "title=\"class or interface in java.lang\">Link-Plain to String Class</a>",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    93
                "<code><tt>getSystemClassLoader()</tt></code>",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    94
                "<code>createTempFile(prefix,&nbsp;suffix,&nbsp;null)</code>",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    95
                "<dd><a href=\"http://www.ietf.org/rfc/rfc2279.txt\"><i>RFC&nbsp;2279: UTF-8, a\n" +
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    96
                " transformation format of ISO 10646</i></a>, <br><a " +
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    97
                "href=\"http://www.ietf.org/rfc/rfc2373.txt\"><i>RFC&nbsp;2373: IPv6 Addressing\n" +
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    98
                " Architecture</i></a>, <br><a href=\"http://www.ietf.org/rfc/rfc2396.txt\">" +
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    99
                "<i>RFC&nbsp;2396: Uniform\n" +
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   100
                " Resource Identifiers (URI): Generic Syntax</i></a>, " +
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   101
                "<br><a href=\"http://www.ietf.org/rfc/rfc2732.txt\"><i>RFC&nbsp;2732: Format for\n" +
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   102
                " Literal IPv6 Addresses in URLs</i></a>, <br><a href=\"URISyntaxException.html\">" +
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   103
                "URISyntaxException</a></dd>\n" +
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   104
                "</dl>");
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   105
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   106
        checkOutput("mylib/lang/StringBuilderChild.html", true,
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   107
                "<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   108
                + "extends <a href=\"" + url + "java/lang/Object.html?is-external=true\" "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   109
                + "title=\"class or interface in java.lang\">Object</a></pre>"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   110
        );
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   112
        // Generate the documentation using -linkoffline and a relative path as the first parameter.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   113
        // We will try linking to the docs generated in test 1 with a relative path.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   114
        String out2 = "out2";
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   115
        javadoc("-d", out2,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   116
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   117
                "-linkoffline", "../" + out1, out1,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   118
                "-package",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   119
                "pkg2");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   120
        checkExit(Exit.OK);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   121
        checkOutput("pkg2/C2.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   122
            "This is a link to <a href=\"../../" + out1 + "/pkg/C.html?is-external=true\" " +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   123
            "title=\"class or interface in pkg\"><code>Class C</code></a>."
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   124
        );
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   126
        String out3 = "out3";
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   127
        javadoc(createArguments(out3, out1, true));  // with trailing slash
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   128
        checkExit(Exit.OK);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   130
        String out4 = "out4";
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   131
        javadoc(createArguments(out4, out1, false)); // without trailing slash
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   132
        checkExit(Exit.OK);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   133
        // Note: the following test is very weak, and will fail if ever the text
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   134
        // of the message is changed. We should have a separate test to verify
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   135
        // this is the text that is given when there is a problem with a URL
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   136
        checkOutput(Output.OUT, false,
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   137
                "warning - Error fetching URL");
46079
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   138
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   139
        // check multiple link options
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   140
        javadoc("-d", "out5",
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   141
                "-sourcepath", testSrc,
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   142
                "-link", "../" + "out1",
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   143
                "-link", "../" + "out2",
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   144
                "pkg3");
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   145
        checkExit(Exit.OK);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   146
        checkOutput("pkg3/A.html", true,
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   147
                "<pre>public class <span class=\"typeNameLabel\">A</span>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   148
                + "extends java.lang.Object</pre>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   149
                + "<div class=\"block\">Test links.\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   150
                + " <br>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   151
                + " <a href=\"../../out2/pkg2/C2.html?is-external=true\" "
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   152
                + "title=\"class or interface in pkg2\"><code>link to pkg2.C2</code></a>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   153
                + " <br>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   154
                + " <a href=\"../../out1/mylib/lang/StringBuilderChild.html?is-external=true\" "
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   155
                + "title=\"class or interface in mylib.lang\">"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   156
                + "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   157
        );
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   158
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   159
        // check multiple linkoffline options
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   160
        javadoc("-d", "out6",
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   161
                "-sourcepath", testSrc,
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   162
                "-linkoffline", "../copy/out1", "out1",
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   163
                "-linkoffline", "../copy/out2", "out2",
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   164
                "pkg3");
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   165
        checkExit(Exit.OK);
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   166
        checkOutput("pkg3/A.html", true,
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   167
                "<pre>public class <span class=\"typeNameLabel\">A</span>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   168
                        + "extends java.lang.Object</pre>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   169
                        + "<div class=\"block\">Test links.\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   170
                        + " <br>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   171
                        + " <a href=\"../../copy/out2/pkg2/C2.html?is-external=true\" "
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   172
                        + "title=\"class or interface in pkg2\"><code>link to pkg2.C2</code></a>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   173
                        + " <br>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   174
                        + " <a href=\"../../copy/out1/mylib/lang/StringBuilderChild.html?is-external=true\" "
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   175
                        + "title=\"class or interface in mylib.lang\">"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   176
                        + "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n"
059faa5e1267 8184969: Cannot specify multiple -link to jdk9 javadoc
ksrini
parents: 36526
diff changeset
   177
        );
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   178
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   179
23974
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   180
    /*
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   181
     * Create the documentation using the -link option, vary the behavior with
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   182
     * both trailing and no trailing slash. We are only interested in ensuring
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   183
     * that the command executes with no errors or related warnings.
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   184
     */
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   185
    static String[] createArguments(String outDir, String packageDir, boolean withTrailingSlash) {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   186
        String packagePath = new File(packageDir).getAbsolutePath();
23974
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   187
        if (withTrailingSlash) {
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   188
            // add the trailing slash, if it is not present!
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   189
            if (!packagePath.endsWith(FS)) {
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   190
                packagePath = packagePath + FS;
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   191
            }
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   192
        } else {
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   193
            // remove the trailing slash, if it is present!
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   194
            if (packagePath.endsWith(FS)) {
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   195
                packagePath = packagePath.substring(0, packagePath.length() - 1);
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   196
            }
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   197
        }
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   198
        String args[] = {
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   199
            "-d", outDir,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   200
            "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   201
            "-link", "file:///" + packagePath,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   202
            "-package",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24217
diff changeset
   203
            "pkg2"
23974
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   204
        };
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   205
        System.out.println("packagePath: " + packagePath);
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   206
        return args;
d53628eda3d1 8038976: javadoc requires a trailing / for links where java 7's javadoc didn't
ksrini
parents: 23971
diff changeset
   207
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
}