test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java
changeset 49139 771616d26ca1
parent 48759 ffa68af7da87
child 52616 1a395165c09b
equal deleted inserted replaced
49138:67912cbf784a 49139:771616d26ca1
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8178067 8192007
    26  * @bug 8178067 8192007 8182765
    27  * @summary tests the module's services, such as provides and uses
    27  * @summary tests the module's services, such as provides and uses
    28  * @modules jdk.javadoc/jdk.javadoc.internal.api
    28  * @modules jdk.javadoc/jdk.javadoc.internal.api
    29  *          jdk.javadoc/jdk.javadoc.internal.tool
    29  *          jdk.javadoc/jdk.javadoc.internal.tool
    30  *          jdk.compiler/com.sun.tools.javac.api
    30  *          jdk.compiler/com.sun.tools.javac.api
    31  *          jdk.compiler/com.sun.tools.javac.main
    31  *          jdk.compiler/com.sun.tools.javac.main
   115                         + "public class ServiceUserNoDescription {\n"
   115                         + "public class ServiceUserNoDescription {\n"
   116                         + "}");
   116                         + "}");
   117         mb.write(src);
   117         mb.write(src);
   118 
   118 
   119         javadoc("-d", base.resolve("out").toString(),
   119         javadoc("-d", base.resolve("out").toString(),
   120                 "-quiet", "-noindex",
   120                 "-quiet",
       
   121                 "-noindex",
   121                 "--module-source-path", src.toString(),
   122                 "--module-source-path", src.toString(),
   122                 "--module", "moduleService,moduleServiceProvider,moduleServiceUser,moduleServiceUserNoDescription",
   123                 "--module", "moduleService,moduleServiceProvider,moduleServiceUser,moduleServiceUserNoDescription",
   123                 "pkgService", "moduleServiceProvider/pkgServiceProvider", "moduleServiceUser/pkgServiceUser",
   124                 "pkgService", "moduleServiceProvider/pkgServiceProvider", "moduleServiceUser/pkgServiceUser",
   124                 "moduleServiceUserNoDescription/pkgServiceUserNoDescription");
   125                 "moduleServiceUserNoDescription/pkgServiceUserNoDescription");
   125         checkExit(Exit.OK);
   126         checkExit(Exit.OK);
   192 
   193 
   193         checkOutput("m/module-summary.html", true,
   194         checkOutput("m/module-summary.html", true,
   194                 "<h3>Services</h3>");
   195                 "<h3>Services</h3>");
   195 
   196 
   196         checkOutput("m/module-summary.html", true,
   197         checkOutput("m/module-summary.html", true,
   197                 "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
   198                 "<table class=\"usesSummary\">\n" +
   198                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   199                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   199                 "<tr>\n" +
   200                 "<tr>\n" +
   200                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
   201                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
   201                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
   202                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
   202                 "</tr>\n" +
   203                 "</tr>\n" +
   209                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/B.html\" title=\"class in p1\">B</a></th>\n" +
   210                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/B.html\" title=\"class in p1\">B</a></th>\n" +
   210                 "<td class=\"colLast\">&nbsp;</td>\n" +
   211                 "<td class=\"colLast\">&nbsp;</td>\n" +
   211                 "</tr>\n" +
   212                 "</tr>\n" +
   212                 "</tbody>\n" +
   213                 "</tbody>\n" +
   213                 "</table>\n");
   214                 "</table>\n");
       
   215 
       
   216         javadoc("-d", base.toString() + "/out-html4",
       
   217                 "-html4",
       
   218                 "-quiet",
       
   219                 "--show-module-contents", "all",
       
   220                 "--module-source-path", base.toString(),
       
   221                 "--module", "m");
       
   222         checkExit(Exit.OK);
       
   223 
       
   224         checkOutput("m/module-summary.html", true,
       
   225                 "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
       
   226                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
       
   227                 "<tr>\n" +
       
   228                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
       
   229                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
       
   230                 "</tr>\n" +
       
   231                 "<tbody>\n" +
       
   232                 "<tr class=\"altColor\">\n" +
       
   233                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"class in p1\">A</a></th>\n" +
       
   234                 "<td class=\"colLast\">&nbsp;</td>\n" +
       
   235                 "</tr>\n" +
       
   236                 "<tr class=\"rowColor\">\n" +
       
   237                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/B.html\" title=\"class in p1\">B</a></th>\n" +
       
   238                 "<td class=\"colLast\">&nbsp;</td>\n" +
       
   239                 "</tr>\n" +
       
   240                 "</tbody>\n" +
       
   241                 "</table>\n");
   214     }
   242     }
   215 
   243 
   216     @Test
   244     @Test
   217     public void checkUsesWithApiTagModuleModeDefault(Path base) throws Exception {
   245     public void checkUsesWithApiTagModuleModeDefault(Path base) throws Exception {
   218         ModuleBuilder mb = new ModuleBuilder(tb, "m")
   246         ModuleBuilder mb = new ModuleBuilder(tb, "m")
   230                 "--module", "m");
   258                 "--module", "m");
   231         checkExit(Exit.OK);
   259         checkExit(Exit.OK);
   232 
   260 
   233         checkOutput("m/module-summary.html", true,
   261         checkOutput("m/module-summary.html", true,
   234                 "<h3>Services</h3>");
   262                 "<h3>Services</h3>");
       
   263 
       
   264         checkOutput("m/module-summary.html", true,
       
   265                 "<table class=\"usesSummary\">\n" +
       
   266                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
       
   267                 "<tr>\n" +
       
   268                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
       
   269                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
       
   270                 "</tr>\n" +
       
   271                 "<tbody>\n" +
       
   272                 "<tr class=\"altColor\">\n" +
       
   273                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"class in p1\">A</a></th>\n" +
       
   274                 "<td class=\"colLast\">&nbsp;</td>\n" +
       
   275                 "</tr>\n" +
       
   276                 "</tbody>\n" +
       
   277                 "</table>\n");
       
   278 
       
   279         javadoc("-d", base.toString() + "/out-html4",
       
   280                 "-html4",
       
   281                 "-quiet",
       
   282                 "--module-source-path", base.toString(),
       
   283                 "--module", "m");
       
   284         checkExit(Exit.OK);
   235 
   285 
   236         checkOutput("m/module-summary.html", true,
   286         checkOutput("m/module-summary.html", true,
   237                 "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
   287                 "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
   238                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   288                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   239                 "<tr>\n" +
   289                 "<tr>\n" +
   298 
   348 
   299         checkOutput("m/module-summary.html", true,
   349         checkOutput("m/module-summary.html", true,
   300                 "<h3>Services</h3>");
   350                 "<h3>Services</h3>");
   301 
   351 
   302         checkOutput("m/module-summary.html", true,
   352         checkOutput("m/module-summary.html", true,
       
   353                 "<table class=\"providesSummary\">\n" +
       
   354                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
       
   355                 "<tr>\n" +
       
   356                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
       
   357                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
       
   358                 "</tr>\n" +
       
   359                 "<tbody>\n" +
       
   360                 "<tr class=\"altColor\">\n" +
       
   361                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
       
   362                 "<td class=\"colLast\">&nbsp;<br>(<span class=\"implementationLabel\">Implementation(s):</span>&nbsp;<a href=\"p1/B.html\" title=\"class in p1\">B</a>)</td>\n" +
       
   363                 "</tr>\n" +
       
   364                 "<tr class=\"rowColor\">\n" +
       
   365                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p2/A.html\" title=\"interface in p2\">A</a></th>\n" +
       
   366                 "<td class=\"colLast\">&nbsp;<br>(<span class=\"implementationLabel\">Implementation(s):</span>&nbsp;<a href=\"p2/B.html\" title=\"class in p2\">B</a>)</td>\n" +
       
   367                 "</tr>\n" +
       
   368                 "</tbody>\n");
       
   369 
       
   370         javadoc("-d", base.toString() + "/out-html4",
       
   371                 "-html4",
       
   372                 "-quiet",
       
   373                 "--show-module-contents", "all",
       
   374                 "--module-source-path", base.toString(),
       
   375                 "--module", "m");
       
   376 
       
   377         checkExit(Exit.OK);
       
   378 
       
   379         checkOutput("m/module-summary.html", true,
   303                 "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
   380                 "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
   304                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   381                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   305                 "<tr>\n" +
   382                 "<tr>\n" +
   306                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
   383                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
   307                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
   384                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
   339 
   416 
   340         checkExit(Exit.OK);
   417         checkExit(Exit.OK);
   341 
   418 
   342         checkOutput("m/module-summary.html", true,
   419         checkOutput("m/module-summary.html", true,
   343                 "<h3>Services</h3>");
   420                 "<h3>Services</h3>");
       
   421 
       
   422         checkOutput("m/module-summary.html", true,
       
   423                 "<table class=\"providesSummary\">\n" +
       
   424                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
       
   425                 "<tr>\n" +
       
   426                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
       
   427                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
       
   428                 "</tr>\n" +
       
   429                 "<tbody>\n" +
       
   430                 "<tr class=\"altColor\">\n" +
       
   431                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
       
   432                 "<td class=\"colLast\">\n" +
       
   433                 "<div class=\"block\">abc</div>\n</td>\n" +
       
   434                 "</tr>\n" +
       
   435                 "</tbody>\n" +
       
   436                 "</table>\n");
       
   437 
       
   438         javadoc("-d", base.toString() + "/out-html4",
       
   439                 "-html4",
       
   440                 "-quiet",
       
   441                 "--module-source-path", base.toString(),
       
   442                 "--module", "m");
       
   443 
       
   444         checkExit(Exit.OK);
   344 
   445 
   345         checkOutput("m/module-summary.html", true,
   446         checkOutput("m/module-summary.html", true,
   346                 "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
   447                 "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
   347                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   448                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   348                 "<tr>\n" +
   449                 "<tr>\n" +
   383 
   484 
   384         checkOutput("m/module-summary.html", true,
   485         checkOutput("m/module-summary.html", true,
   385                 "<h3>Services</h3>");
   486                 "<h3>Services</h3>");
   386 
   487 
   387         checkOutput("m/module-summary.html", true,
   488         checkOutput("m/module-summary.html", true,
   388                 "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
   489                 "<table class=\"providesSummary\">\n" +
   389                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   490                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   390                 "<tr>\n" +
   491                 "<tr>\n" +
   391                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
   492                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
   392                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
   493                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
   393                 "</tr>\n" +
   494                 "</tr>\n" +
   397                 "<td class=\"colLast\">\n" +
   498                 "<td class=\"colLast\">\n" +
   398                 "<div class=\"block\">abc</div>\n</td>\n" +
   499                 "<div class=\"block\">abc</div>\n</td>\n" +
   399                 "</tr>\n" +
   500                 "</tr>\n" +
   400                 "</tbody>\n" +
   501                 "</tbody>\n" +
   401                 "</table>",
   502                 "</table>",
   402                 "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
   503                 "<table class=\"usesSummary\">\n" +
   403                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   504                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
   404                 "<tr>\n" +
   505                 "<tr>\n" +
   405                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
   506                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
   406                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
   507                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
   407                 "</tr>\n" +
   508                 "</tr>\n" +
   411                 "<td class=\"colLast\">\n" +
   512                 "<td class=\"colLast\">\n" +
   412                 "<div class=\"block\">def</div>\n</td>\n" +
   513                 "<div class=\"block\">def</div>\n</td>\n" +
   413                 "</tr>\n" +
   514                 "</tr>\n" +
   414                 "</tbody>\n" +
   515                 "</tbody>\n" +
   415                 "</table>\n");
   516                 "</table>\n");
       
   517 
       
   518         javadoc("-d", base.toString() + "/out-html4",
       
   519                 "-html4",
       
   520                 "-quiet",
       
   521                 "--module-source-path", base.toString(),
       
   522                 "--module", "m");
       
   523 
       
   524         checkExit(Exit.OK);
       
   525 
       
   526         checkOutput("m/module-summary.html", true,
       
   527                 "<table class=\"providesSummary\" summary=\"Provides table, listing types, and an explanation\">\n" +
       
   528                 "<caption><span>Provides</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
       
   529                 "<tr>\n" +
       
   530                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
       
   531                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
       
   532                 "</tr>\n" +
       
   533                 "<tbody>\n" +
       
   534                 "<tr class=\"altColor\">\n" +
       
   535                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
       
   536                 "<td class=\"colLast\">\n" +
       
   537                 "<div class=\"block\">abc</div>\n</td>\n" +
       
   538                 "</tr>\n" +
       
   539                 "</tbody>\n" +
       
   540                 "</table>",
       
   541                 "<table class=\"usesSummary\" summary=\"Uses table, listing types, and an explanation\">\n" +
       
   542                 "<caption><span>Uses</span><span class=\"tabEnd\">&nbsp;</span></caption>\n" +
       
   543                 "<tr>\n" +
       
   544                 "<th class=\"colFirst\" scope=\"col\">Type</th>\n" +
       
   545                 "<th class=\"colLast\" scope=\"col\">Description</th>\n" +
       
   546                 "</tr>\n" +
       
   547                 "<tbody>\n" +
       
   548                 "<tr class=\"altColor\">\n" +
       
   549                 "<th class=\"colFirst\" scope=\"row\"><a href=\"p2/B.html\" title=\"class in p2\">B</a></th>\n" +
       
   550                 "<td class=\"colLast\">\n" +
       
   551                 "<div class=\"block\">def</div>\n</td>\n" +
       
   552                 "</tr>\n" +
       
   553                 "</tbody>\n" +
       
   554                 "</table>\n");
   416     }
   555     }
   417 
   556 
   418 }
   557 }