test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java
changeset 48295 c79d31ba84b9
parent 47216 71c04702a3d5
child 48654 36f58bd6269f
equal deleted inserted replaced
48294:2608240fc957 48295:c79d31ba84b9
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 4720957 5020118 8026567 8038976 8184969
    26  * @bug 4720957 5020118 8026567 8038976 8184969 8164407
    27  * @summary Test to make sure that -link and -linkoffline link to
    27  * @summary Test to make sure that -link and -linkoffline link to
    28  * right files, and URLs with and without trailing slash are accepted.
    28  * right files, and URLs with and without trailing slash are accepted.
    29  * @author jamieh
    29  * @author jamieh
    30  * @library ../lib
    30  * @library ../lib
    31  * @modules jdk.javadoc/jdk.javadoc.internal.tool
    31  * @modules jdk.javadoc/jdk.javadoc.internal.tool
    68                 "pkg", "mylib.lang");
    68                 "pkg", "mylib.lang");
    69         checkExit(Exit.OK);
    69         checkExit(Exit.OK);
    70 
    70 
    71         checkOutput("pkg/C.html", true,
    71         checkOutput("pkg/C.html", true,
    72                 "<a href=\"" + url + "java/lang/String.html?is-external=true\" "
    72                 "<a href=\"" + url + "java/lang/String.html?is-external=true\" "
    73                 + "title=\"class or interface in java.lang\"><code>Link to String Class</code></a>",
    73                 + "title=\"class or interface in java.lang\" class=\"externalLink\"><code>Link to String Class</code></a>",
    74                 //Make sure the parameters are indented properly when the -link option is used.
    74                 //Make sure the parameters are indented properly when the -link option is used.
    75                 "(int&nbsp;p1,\n"
    75                 "(int&nbsp;p1,\n"
    76                 + "      int&nbsp;p2,\n"
    76                 + "      int&nbsp;p2,\n"
    77                 + "      int&nbsp;p3)",
    77                 + "      int&nbsp;p3)",
    78                 "(int&nbsp;p1,\n"
    78                 "(int&nbsp;p1,\n"
    79                 + "      int&nbsp;p2,\n"
    79                 + "      int&nbsp;p2,\n"
    80                 + "      <a href=\"" + url + "java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">"
    80                 + "      <a href=\"" + url + "java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\" class=\"externalLink\">"
    81                 + "Object</a>&nbsp;p3)");
    81                 + "Object</a>&nbsp;p3)");
    82 
    82 
    83         checkOutput("pkg/B.html", true,
    83         checkOutput("pkg/B.html", true,
    84                 "<div class=\"block\">A method with html tag the method "
    84                 "<div class=\"block\">A method with html tag the method "
    85                 + "<a href=\"" + url + "java/lang/ClassLoader.html?is-external=true#getSystemClassLoader--\""
    85                 + "<a href=\"" + url + "java/lang/ClassLoader.html?is-external=true#getSystemClassLoader--\""
    86                 + " title=\"class or interface in java.lang\"><code><tt>getSystemClassLoader()</tt>"
    86                 + " title=\"class or interface in java.lang\" class=\"externalLink\"><code><tt>getSystemClassLoader()</tt>"
    87                 + "</code></a> as the parent class loader.</div>",
    87                 + "</code></a> as the parent class loader.</div>",
    88                 "<div class=\"block\">is equivalent to invoking <code>"
    88                 "<div class=\"block\">is equivalent to invoking <code>"
    89                 + "<a href=\"../pkg/B.html#createTempFile-java.lang.String-java.lang.String-java.io.File-\">"
    89                 + "<a href=\"../pkg/B.html#createTempFile-java.lang.String-java.lang.String-java.io.File-\">"
    90                 + "<code>createTempFile(prefix,&nbsp;suffix,&nbsp;null)</code></a></code>.</div>",
    90                 + "<code>createTempFile(prefix,&nbsp;suffix,&nbsp;null)</code></a></code>.</div>",
    91                 "<a href=\"" + url + "java/lang/String.html?is-external=true\" "
    91                 "<a href=\"" + url + "java/lang/String.html?is-external=true\" "
    92                 + "title=\"class or interface in java.lang\">Link-Plain to String Class</a>",
    92                 + "title=\"class or interface in java.lang\" class=\"externalLink\">Link-Plain to String Class</a>",
    93                 "<code><tt>getSystemClassLoader()</tt></code>",
    93                 "<code><tt>getSystemClassLoader()</tt></code>",
    94                 "<code>createTempFile(prefix,&nbsp;suffix,&nbsp;null)</code>",
    94                 "<code>createTempFile(prefix,&nbsp;suffix,&nbsp;null)</code>",
    95                 "<dd><a href=\"http://www.ietf.org/rfc/rfc2279.txt\"><i>RFC&nbsp;2279: UTF-8, a\n" +
    95                 "<dd><a href=\"http://www.ietf.org/rfc/rfc2279.txt\"><i>RFC&nbsp;2279: UTF-8, a\n" +
    96                 " transformation format of ISO 10646</i></a>, <br><a " +
    96                 " transformation format of ISO 10646</i></a>, <br><a " +
    97                 "href=\"http://www.ietf.org/rfc/rfc2373.txt\"><i>RFC&nbsp;2373: IPv6 Addressing\n" +
    97                 "href=\"http://www.ietf.org/rfc/rfc2373.txt\"><i>RFC&nbsp;2373: IPv6 Addressing\n" +
   104                 "</dl>");
   104                 "</dl>");
   105 
   105 
   106         checkOutput("mylib/lang/StringBuilderChild.html", true,
   106         checkOutput("mylib/lang/StringBuilderChild.html", true,
   107                 "<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>\n"
   107                 "<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>\n"
   108                 + "extends <a href=\"" + url + "java/lang/Object.html?is-external=true\" "
   108                 + "extends <a href=\"" + url + "java/lang/Object.html?is-external=true\" "
   109                 + "title=\"class or interface in java.lang\">Object</a></pre>"
   109                 + "title=\"class or interface in java.lang\" class=\"externalLink\">Object</a></pre>"
   110         );
   110         );
   111 
   111 
   112         // Generate the documentation using -linkoffline and a relative path as the first parameter.
   112         // Generate the documentation using -linkoffline and a relative path as the first parameter.
   113         // We will try linking to the docs generated in test 1 with a relative path.
   113         // We will try linking to the docs generated in test 1 with a relative path.
   114         String out2 = "out2";
   114         String out2 = "out2";
   118                 "-package",
   118                 "-package",
   119                 "pkg2");
   119                 "pkg2");
   120         checkExit(Exit.OK);
   120         checkExit(Exit.OK);
   121         checkOutput("pkg2/C2.html", true,
   121         checkOutput("pkg2/C2.html", true,
   122             "This is a link to <a href=\"../../" + out1 + "/pkg/C.html?is-external=true\" " +
   122             "This is a link to <a href=\"../../" + out1 + "/pkg/C.html?is-external=true\" " +
   123             "title=\"class or interface in pkg\"><code>Class C</code></a>."
   123             "title=\"class or interface in pkg\" class=\"externalLink\"><code>Class C</code></a>."
   124         );
   124         );
   125 
   125 
   126         String out3 = "out3";
   126         String out3 = "out3";
   127         javadoc(createArguments(out3, out1, true));  // with trailing slash
   127         javadoc(createArguments(out3, out1, true));  // with trailing slash
   128         checkExit(Exit.OK);
   128         checkExit(Exit.OK);
   147                 "<pre>public class <span class=\"typeNameLabel\">A</span>\n"
   147                 "<pre>public class <span class=\"typeNameLabel\">A</span>\n"
   148                 + "extends java.lang.Object</pre>\n"
   148                 + "extends java.lang.Object</pre>\n"
   149                 + "<div class=\"block\">Test links.\n"
   149                 + "<div class=\"block\">Test links.\n"
   150                 + " <br>\n"
   150                 + " <br>\n"
   151                 + " <a href=\"../../out2/pkg2/C2.html?is-external=true\" "
   151                 + " <a href=\"../../out2/pkg2/C2.html?is-external=true\" "
   152                 + "title=\"class or interface in pkg2\"><code>link to pkg2.C2</code></a>\n"
   152                 + "title=\"class or interface in pkg2\" class=\"externalLink\"><code>link to pkg2.C2</code></a>\n"
   153                 + " <br>\n"
   153                 + " <br>\n"
   154                 + " <a href=\"../../out1/mylib/lang/StringBuilderChild.html?is-external=true\" "
   154                 + " <a href=\"../../out1/mylib/lang/StringBuilderChild.html?is-external=true\" "
   155                 + "title=\"class or interface in mylib.lang\">"
   155                 + "title=\"class or interface in mylib.lang\" class=\"externalLink\">"
   156                 + "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n"
   156                 + "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n"
   157         );
   157         );
   158 
   158 
   159         // check multiple linkoffline options
   159         // check multiple linkoffline options
   160         javadoc("-d", "out6",
   160         javadoc("-d", "out6",
   167                 "<pre>public class <span class=\"typeNameLabel\">A</span>\n"
   167                 "<pre>public class <span class=\"typeNameLabel\">A</span>\n"
   168                         + "extends java.lang.Object</pre>\n"
   168                         + "extends java.lang.Object</pre>\n"
   169                         + "<div class=\"block\">Test links.\n"
   169                         + "<div class=\"block\">Test links.\n"
   170                         + " <br>\n"
   170                         + " <br>\n"
   171                         + " <a href=\"../../copy/out2/pkg2/C2.html?is-external=true\" "
   171                         + " <a href=\"../../copy/out2/pkg2/C2.html?is-external=true\" "
   172                         + "title=\"class or interface in pkg2\"><code>link to pkg2.C2</code></a>\n"
   172                         + "title=\"class or interface in pkg2\" class=\"externalLink\"><code>link to pkg2.C2</code></a>\n"
   173                         + " <br>\n"
   173                         + " <br>\n"
   174                         + " <a href=\"../../copy/out1/mylib/lang/StringBuilderChild.html?is-external=true\" "
   174                         + " <a href=\"../../copy/out1/mylib/lang/StringBuilderChild.html?is-external=true\" "
   175                         + "title=\"class or interface in mylib.lang\">"
   175                         + "title=\"class or interface in mylib.lang\" class=\"externalLink\">"
   176                         + "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n"
   176                         + "<code>link to mylib.lang.StringBuilderChild</code></a>.</div>\n"
   177         );
   177         );
   178     }
   178     }
   179 
   179 
   180     /*
   180     /*