langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
changeset 44195 5860769fe2f4
parent 42842 2f0b2a65b284
child 44196 f88c0e9cb102
equal deleted inserted replaced
44194:c868c8c24e18 44195:5860769fe2f4
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 8160196
    26  * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 8160196 8175799
    27  * @summary Test modules support in javadoc.
    27  * @summary Test modules support in javadoc.
    28  * @author bpatel
    28  * @author bpatel
    29  * @library ../lib
    29  * @library ../lib
    30  * @modules jdk.javadoc/jdk.javadoc.internal.tool
    30  * @modules jdk.javadoc/jdk.javadoc.internal.tool
    31  * @build JavadocTester
    31  * @build JavadocTester
    42      * Test generated module pages for HTML 4.
    42      * Test generated module pages for HTML 4.
    43      */
    43      */
    44     @Test
    44     @Test
    45     void testHtml4() {
    45     void testHtml4() {
    46         javadoc("-d", "out", "-use",
    46         javadoc("-d", "out", "-use",
       
    47                 "-overview", testSrc("overview.html"),
    47                 "--module-source-path", testSrc,
    48                 "--module-source-path", testSrc,
    48                 "--module", "moduleA,moduleB",
    49                 "--module", "moduleA,moduleB",
    49                 "testpkgmdlA", "testpkgmdlB");
    50                 "testpkgmdlA", "testpkgmdlB");
    50         checkExit(Exit.OK);
    51         checkExit(Exit.OK);
    51         checkDescription(true);
    52         checkDescription(true);
    63      * Test generated module pages for HTML 5.
    64      * Test generated module pages for HTML 5.
    64      */
    65      */
    65     @Test
    66     @Test
    66     void testHtml5() {
    67     void testHtml5() {
    67         javadoc("-d", "out-html5", "-html5", "-use",
    68         javadoc("-d", "out-html5", "-html5", "-use",
       
    69                 "-overview", testSrc("overview.html"),
    68                 "--module-source-path", testSrc,
    70                 "--module-source-path", testSrc,
    69                 "--module", "moduleA,moduleB",
    71                 "--module", "moduleA,moduleB",
    70                 "testpkgmdlA", "testpkgmdlB");
    72                 "testpkgmdlA", "testpkgmdlB");
    71         checkExit(Exit.OK);
    73         checkExit(Exit.OK);
    72         checkHtml5Description(true);
    74         checkHtml5Description(true);
    84      * Test generated module pages for HTML 4 with -nocomment option.
    86      * Test generated module pages for HTML 4 with -nocomment option.
    85      */
    87      */
    86     @Test
    88     @Test
    87     void testHtml4NoComment() {
    89     void testHtml4NoComment() {
    88         javadoc("-d", "out-nocomment", "-nocomment", "-use",
    90         javadoc("-d", "out-nocomment", "-nocomment", "-use",
       
    91                 "-overview", testSrc("overview.html"),
    89                 "--module-source-path", testSrc,
    92                 "--module-source-path", testSrc,
    90                 "--module", "moduleA,moduleB",
    93                 "--module", "moduleA,moduleB",
    91                 "testpkgmdlA", "testpkgmdlB");
    94                 "testpkgmdlA", "testpkgmdlB");
    92         checkExit(Exit.OK);
    95         checkExit(Exit.OK);
    93         checkDescription(false);
    96         checkDescription(false);
   101      * Test generated module pages for HTML 5 with -nocomment option.
   104      * Test generated module pages for HTML 5 with -nocomment option.
   102      */
   105      */
   103     @Test
   106     @Test
   104     void testHtml5NoComment() {
   107     void testHtml5NoComment() {
   105         javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use",
   108         javadoc("-d", "out-html5-nocomment", "-nocomment", "-html5", "-use",
       
   109                 "-overview", testSrc("overview.html"),
   106                 "--module-source-path", testSrc,
   110                 "--module-source-path", testSrc,
   107                 "--module", "moduleA,moduleB",
   111                 "--module", "moduleA,moduleB",
   108                 "testpkgmdlA", "testpkgmdlB");
   112                 "testpkgmdlA", "testpkgmdlB");
   109         checkExit(Exit.OK);
   113         checkExit(Exit.OK);
   110         checkHtml5Description(false);
   114         checkHtml5Description(false);
   118      * Test generated pages, in an unnamed module, for HTML 4.
   122      * Test generated pages, in an unnamed module, for HTML 4.
   119      */
   123      */
   120     @Test
   124     @Test
   121     void testHtml4UnnamedModule() {
   125     void testHtml4UnnamedModule() {
   122         javadoc("-d", "out-nomodule", "-use",
   126         javadoc("-d", "out-nomodule", "-use",
       
   127                 "-overview", testSrc("overview.html"),
   123                 "-sourcepath", testSrc,
   128                 "-sourcepath", testSrc,
   124                 "testpkgnomodule", "testpkgnomodule1");
   129                 "testpkgnomodule", "testpkgnomodule1");
   125         checkExit(Exit.OK);
   130         checkExit(Exit.OK);
   126         checkOverviewSummaryPackages();
   131         checkOverviewSummaryPackages();
   127         checkModuleClickThrough(false);
   132         checkModuleClickThrough(false);
   134      * Test generated pages, in an unnamed module, for HTML 5.
   139      * Test generated pages, in an unnamed module, for HTML 5.
   135      */
   140      */
   136     @Test
   141     @Test
   137     void testHtml5UnnamedModule() {
   142     void testHtml5UnnamedModule() {
   138         javadoc("-d", "out-html5-nomodule", "-html5", "-use",
   143         javadoc("-d", "out-html5-nomodule", "-html5", "-use",
       
   144                 "-overview", testSrc("overview.html"),
   139                 "-sourcepath", testSrc,
   145                 "-sourcepath", testSrc,
   140                 "testpkgnomodule", "testpkgnomodule1");
   146                 "testpkgnomodule", "testpkgnomodule1");
   141         checkExit(Exit.OK);
   147         checkExit(Exit.OK);
   142         checkHtml5OverviewSummaryPackages();
   148         checkHtml5OverviewSummaryPackages();
   143         checkModuleFilesAndLinks(false);
   149         checkModuleFilesAndLinks(false);
   263                 + "<a name=\"module.description\">\n"
   269                 + "<a name=\"module.description\">\n"
   264                 + "<!--   -->\n"
   270                 + "<!--   -->\n"
   265                 + "</a>\n"
   271                 + "</a>\n"
   266                 + "<div class=\"block\">This is a test description for the moduleB module. Search "
   272                 + "<div class=\"block\">This is a test description for the moduleB module. Search "
   267                 + "word <a id=\"search_word\">search_word</a> with no description.</div>");
   273                 + "word <a id=\"search_word\">search_word</a> with no description.</div>");
       
   274         checkOutput("overview-summary.html", found,
       
   275                 "</script>\n"
       
   276                 + "<div class=\"contentContainer\">\n"
       
   277                 + "<div class=\"block\">The overview summary page header.</div>\n"
       
   278                 + "</div>\n"
       
   279                 + "<div class=\"contentContainer\">\n"
       
   280                 + "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
       
   281                 + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
       
   282         checkOutput("overview-summary.html", false,
       
   283                 "</table>\n"
       
   284                 + "</div>\n"
       
   285                 + "<div class=\"contentContainer\">\n"
       
   286                 + "<div class=\"block\">The overview summary page header.</div>\n"
       
   287                 + "</div>\n"
       
   288                 + "<div class=\"contentContainer\">\n"
       
   289                 + "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
       
   290                 + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
   268     }
   291     }
   269 
   292 
   270     void checkNoDescription(boolean found) {
   293     void checkNoDescription(boolean found) {
   271         checkOutput("moduleA-summary.html", found,
   294         checkOutput("moduleA-summary.html", found,
   272                 "<div class=\"contentContainer\">\n"
   295                 "<div class=\"contentContainer\">\n"
   303                 + "<a id=\"module.description\">\n"
   326                 + "<a id=\"module.description\">\n"
   304                 + "<!--   -->\n"
   327                 + "<!--   -->\n"
   305                 + "</a>\n"
   328                 + "</a>\n"
   306                 + "<div class=\"block\">This is a test description for the moduleB module. Search "
   329                 + "<div class=\"block\">This is a test description for the moduleB module. Search "
   307                 + "word <a id=\"search_word\">search_word</a> with no description.</div>");
   330                 + "word <a id=\"search_word\">search_word</a> with no description.</div>");
       
   331         checkOutput("overview-summary.html", found,
       
   332                 "</nav>\n"
       
   333                 + "</header>\n"
       
   334                 + "<main role=\"main\">\n"
       
   335                 + "<div class=\"contentContainer\">\n"
       
   336                 + "<div class=\"block\">The overview summary page header.</div>\n"
       
   337                 + "</div>\n"
       
   338                 + "<div class=\"contentContainer\">\n"
       
   339                 + "<table class=\"overviewSummary\">\n"
       
   340                 + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
       
   341         checkOutput("overview-summary.html", false,
       
   342                 "</table>\n"
       
   343                 + "</div>\n"
       
   344                 + "</main>\n"
       
   345                 + "<main role=\"main\">\n"
       
   346                 + "<div class=\"contentContainer\">\n"
       
   347                 + "<div class=\"block\">The overview summary page header.</div>\n"
       
   348                 + "</div>\n"
       
   349                 + "<div class=\"contentContainer\">\n"
       
   350                 + "<table class=\"overviewSummary\">\n"
       
   351                 + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
   308     }
   352     }
   309 
   353 
   310     void checkHtml5NoDescription(boolean found) {
   354     void checkHtml5NoDescription(boolean found) {
   311         checkOutput("moduleA-summary.html", found,
   355         checkOutput("moduleA-summary.html", found,
   312                 "<div class=\"contentContainer\">\n"
   356                 "<div class=\"contentContainer\">\n"
   401                 "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
   445                 "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
   402                 + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
   446                 + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
   403                 + "<tr>\n"
   447                 + "<tr>\n"
   404                 + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
   448                 + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
   405                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
   449                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
   406                 + "</tr>");
   450                 + "</tr>",
       
   451                 "</table>\n"
       
   452                 + "</div>\n"
       
   453                 + "<div class=\"contentContainer\">\n"
       
   454                 + "<div class=\"block\">The overview summary page header.</div>\n"
       
   455                 + "</div>\n"
       
   456                 + "<div class=\"contentContainer\">\n"
       
   457                 + "<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
       
   458                 + "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
   407         checkOutput("overview-summary.html", true,
   459         checkOutput("overview-summary.html", true,
   408                 "<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
   460                 "<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
   409                 + "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
   461                 + "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
   410                 + "<tr>\n"
   462                 + "<tr>\n"
   411                 + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
   463                 + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
   412                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
   464                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
   413                 + "</tr>");
   465                 + "</tr>",
       
   466                 "</script>\n"
       
   467                 + "<div class=\"contentContainer\">\n"
       
   468                 + "<div class=\"block\">The overview summary page header.</div>\n"
       
   469                 + "</div>\n"
       
   470                 + "<div class=\"contentContainer\">\n"
       
   471                 + "<table class=\"overviewSummary\" summary=\"Packages table, listing packages, and an explanation\">\n"
       
   472                 + "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
   414     }
   473     }
   415 
   474 
   416     void checkHtml5OverviewSummaryModules() {
   475     void checkHtml5OverviewSummaryModules() {
   417         checkOutput("overview-summary.html", true,
   476         checkOutput("overview-summary.html", true,
   418                 "<table class=\"overviewSummary\">\n"
   477                 "<table class=\"overviewSummary\">\n"
   435                 "<table class=\"overviewSummary\">\n"
   494                 "<table class=\"overviewSummary\">\n"
   436                 + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
   495                 + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
   437                 + "<tr>\n"
   496                 + "<tr>\n"
   438                 + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
   497                 + "<th class=\"colFirst\" scope=\"col\">Module</th>\n"
   439                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
   498                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
   440                 + "</tr>");
   499                 + "</tr>",
       
   500                 "</table>\n"
       
   501                 + "</div>\n"
       
   502                 + "</main>\n"
       
   503                 + "<main role=\"main\">\n"
       
   504                 + "<div class=\"contentContainer\">\n"
       
   505                 + "<div class=\"block\">The overview summary page header.</div>\n"
       
   506                 + "</div>\n"
       
   507                 + "<div class=\"contentContainer\">\n"
       
   508                 + "<table class=\"overviewSummary\">\n"
       
   509                 + "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
   441         checkOutput("overview-summary.html", true,
   510         checkOutput("overview-summary.html", true,
   442                 "<table class=\"overviewSummary\">\n"
   511                 "<table class=\"overviewSummary\">\n"
   443                 + "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
   512                 + "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
   444                 + "<tr>\n"
   513                 + "<tr>\n"
   445                 + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
   514                 + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
   446                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
   515                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
   447                 + "</tr>");
   516                 + "</tr>",
       
   517                 "</script>\n"
       
   518                 + "</nav>\n"
       
   519                 + "</header>\n"
       
   520                 + "<main role=\"main\">\n"
       
   521                 + "<div class=\"contentContainer\">\n"
       
   522                 + "<div class=\"block\">The overview summary page header.</div>\n"
       
   523                 + "</div>\n"
       
   524                 + "<div class=\"contentContainer\">\n"
       
   525                 + "<table class=\"overviewSummary\">\n"
       
   526                 + "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
   448     }
   527     }
   449 
   528 
   450     void checkModuleSummary() {
   529     void checkModuleSummary() {
   451         checkOutput("moduleA-summary.html", true,
   530         checkOutput("moduleA-summary.html", true,
   452                 "<ul class=\"subNavList\">\n"
   531                 "<ul class=\"subNavList\">\n"