test/langtools/jdk/javadoc/doclet/testModules/TestModulePackages.java
changeset 48759 ffa68af7da87
parent 48340 959f2f7cbaa6
child 50167 cc705c956798
equal deleted inserted replaced
48758:ba19a21d727d 48759:ffa68af7da87
     1 /*
     1 /*
     2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2018, 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.
    68                 "-noindex",
    68                 "-noindex",
    69                 "--module-source-path", src.toString(),
    69                 "--module-source-path", src.toString(),
    70                 "--module", "m");
    70                 "--module", "m");
    71 
    71 
    72         checkExit(Exit.OK);
    72         checkExit(Exit.OK);
    73         checkOutput("m-summary.html", false,
    73         checkOutput("m/module-summary.html", false,
    74                 "<h3>Packages</h3>\n"
    74                 "<h3>Packages</h3>\n"
    75                 + "<table class=\"packagesSummary\" summary=\"Packages table, "
    75                 + "<table class=\"packagesSummary\" summary=\"Packages table, "
    76                 + "listing packages, and an explanation\">");
    76                 + "listing packages, and an explanation\">");
    77     }
    77     }
    78 
    78 
   157         checkExit(Exit.OK);
   157         checkExit(Exit.OK);
   158         checkCaption("m", TabKind.EXPORTS);
   158         checkCaption("m", TabKind.EXPORTS);
   159         checkTableHead("m", ColKind.EXPORTED_TO);
   159         checkTableHead("m", ColKind.EXPORTED_TO);
   160         checkPackageRow("m", "p", "i0", "All Modules", null, "&nbsp;");
   160         checkPackageRow("m", "p", "i0", "All Modules", null, "&nbsp;");
   161         checkPackageRow("m", "q", "i1",
   161         checkPackageRow("m", "q", "i1",
   162                 "<a href=\"other-summary.html\">other</a>", null, "&nbsp;");
   162                 "<a href=\"../other/module-summary.html\">other</a>", null, "&nbsp;");
   163     }
   163     }
   164 
   164 
   165     @Test
   165     @Test
   166     public void exportWithConcealed(Path base) throws Exception {
   166     public void exportWithConcealed(Path base) throws Exception {
   167         Path src = base.resolve("src");
   167         Path src = base.resolve("src");
   245         checkCaption("m", TabKind.EXPORTS, TabKind.OPENS, TabKind.CONCEALED);
   245         checkCaption("m", TabKind.EXPORTS, TabKind.OPENS, TabKind.CONCEALED);
   246         checkTableHead("m", ColKind.EXPORTED_TO, ColKind.OPENED_TO);
   246         checkTableHead("m", ColKind.EXPORTED_TO, ColKind.OPENED_TO);
   247         checkPackageRow("m", "c", "i0", "None", "None", "&nbsp;");
   247         checkPackageRow("m", "c", "i0", "None", "None", "&nbsp;");
   248         checkPackageRow("m", "e.all", "i1", "All Modules", "None", "&nbsp;");
   248         checkPackageRow("m", "e.all", "i1", "All Modules", "None", "&nbsp;");
   249         checkPackageRow("m", "e.other", "i2",
   249         checkPackageRow("m", "e.other", "i2",
   250                 "<a href=\"other-summary.html\">other</a>", "None", "&nbsp;");
   250                 "<a href=\"../other/module-summary.html\">other</a>", "None", "&nbsp;");
   251         checkPackageRow("m", "eo", "i3", "All Modules", "All Modules", "&nbsp;");
   251         checkPackageRow("m", "eo", "i3", "All Modules", "All Modules", "&nbsp;");
   252         checkPackageRow("m", "o.all", "i4", "None", "All Modules", "&nbsp;");
   252         checkPackageRow("m", "o.all", "i4", "None", "All Modules", "&nbsp;");
   253         checkPackageRow("m", "o.other", "i5", "None",
   253         checkPackageRow("m", "o.other", "i5", "None",
   254                 "<a href=\"other-summary.html\">other</a>", "&nbsp;");
   254                 "<a href=\"../other/module-summary.html\">other</a>", "&nbsp;");
   255     }
   255     }
   256 
   256 
   257     @Test
   257     @Test
   258     public void openModule(Path base) throws Exception {
   258     public void openModule(Path base) throws Exception {
   259         Path src = base.resolve("src");
   259         Path src = base.resolve("src");
   365         checkExit(Exit.OK);
   365         checkExit(Exit.OK);
   366         checkCaption("m", TabKind.OPENS);
   366         checkCaption("m", TabKind.OPENS);
   367         checkTableHead("m", ColKind.OPENED_TO);
   367         checkTableHead("m", ColKind.OPENED_TO);
   368         checkPackageRow("m", "p", "i0", null, "All Modules", "&nbsp;");
   368         checkPackageRow("m", "p", "i0", null, "All Modules", "&nbsp;");
   369         checkPackageRow("m", "q", "i1", null,
   369         checkPackageRow("m", "q", "i1", null,
   370                 "<a href=\"other-summary.html\">other</a>", "&nbsp;");
   370                 "<a href=\"../other/module-summary.html\">other</a>", "&nbsp;");
   371     }
   371     }
   372 
   372 
   373     @Test
   373     @Test
   374     public void openWithConcealed(Path base) throws Exception {
   374     public void openWithConcealed(Path base) throws Exception {
   375         Path src = base.resolve("src");
   375         Path src = base.resolve("src");
   441                         + "<span>" + name + "</span>"
   441                         + "<span>" + name + "</span>"
   442                         + "<span class=\"tabEnd\">&nbsp;</span>"
   442                         + "<span class=\"tabEnd\">&nbsp;</span>"
   443                         + "</caption>";
   443                         + "</caption>";
   444         }
   444         }
   445 
   445 
   446         checkOutput(moduleName + "-summary.html", true, expect);
   446         checkOutput(moduleName + "/module-summary.html", true, expect);
   447     }
   447     }
   448 
   448 
   449 
   449 
   450     private void checkTableHead(String moduleName, ColKind... kinds) {
   450     private void checkTableHead(String moduleName, ColKind... kinds) {
   451         Set<ColKind> kindSet = Set.of(kinds);
   451         Set<ColKind> kindSet = Set.of(kinds);
   459             sb.append("<th class=\"colSecond\" scope=\"col\">Opened To Modules</th>\n");
   459             sb.append("<th class=\"colSecond\" scope=\"col\">Opened To Modules</th>\n");
   460         }
   460         }
   461         sb.append("<th class=\"colLast\" scope=\"col\">Description</th>\n"
   461         sb.append("<th class=\"colLast\" scope=\"col\">Description</th>\n"
   462             + "</tr>");
   462             + "</tr>");
   463 
   463 
   464         checkOutput(moduleName + "-summary.html", true, sb.toString());
   464         checkOutput(moduleName + "/module-summary.html", true, sb.toString());
   465     }
   465     }
   466 
   466 
   467     private void checkPackageRow(String moduleName, String packageName,
   467     private void checkPackageRow(String moduleName, String packageName,
   468             String id, String exportedTo, String openedTo, String desc) {
   468             String id, String exportedTo, String openedTo, String desc) {
   469         StringBuilder sb = new StringBuilder();
   469         StringBuilder sb = new StringBuilder();
   479         if (openedTo != null) {
   479         if (openedTo != null) {
   480             sb.append("<td class=\"colSecond\">" + openedTo + "</td>\n");
   480             sb.append("<td class=\"colSecond\">" + openedTo + "</td>\n");
   481         }
   481         }
   482         sb.append("<td class=\"colLast\">" + desc + "</td>");
   482         sb.append("<td class=\"colLast\">" + desc + "</td>");
   483 
   483 
   484         checkOutput(moduleName + "-summary.html", true, sb.toString());
   484         checkOutput(moduleName + "/module-summary.html", true, sb.toString());
   485     }
   485     }
   486 
   486 
   487 }
   487 }
   488 
   488