50421
|
1 |
/*
|
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
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
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
* @test
|
|
26 |
* @bug 8190875
|
|
27 |
* @summary modules not listed in overview/index page
|
|
28 |
* @library /tools/lib ../lib
|
|
29 |
* @modules
|
|
30 |
* jdk.javadoc/jdk.javadoc.internal.tool
|
|
31 |
* jdk.compiler/com.sun.tools.javac.api
|
|
32 |
* jdk.compiler/com.sun.tools.javac.main
|
|
33 |
* @build JavadocTester
|
|
34 |
* @run main TestIndexWithModules
|
|
35 |
*/
|
|
36 |
|
|
37 |
import java.nio.file.Path;
|
|
38 |
import java.nio.file.Paths;
|
|
39 |
|
|
40 |
import builder.ClassBuilder;
|
|
41 |
import toolbox.ModuleBuilder;
|
|
42 |
import toolbox.ToolBox;
|
|
43 |
|
|
44 |
|
|
45 |
public class TestIndexWithModules extends JavadocTester {
|
|
46 |
|
|
47 |
final ToolBox tb;
|
|
48 |
private final Path src;
|
|
49 |
|
|
50 |
public static void main(String... args) throws Exception {
|
|
51 |
TestIndexWithModules tester = new TestIndexWithModules();
|
|
52 |
tester.runTests(m -> new Object[]{Paths.get(m.getName())});
|
|
53 |
}
|
|
54 |
|
|
55 |
TestIndexWithModules() throws Exception{
|
|
56 |
tb = new ToolBox();
|
|
57 |
src = Paths.get("src");
|
|
58 |
initModules();
|
|
59 |
}
|
|
60 |
|
|
61 |
@Test
|
|
62 |
void testIndexWithOverviewPath(Path base) throws Exception {
|
|
63 |
Path out = base.resolve("out");
|
|
64 |
|
|
65 |
tb.writeFile("overview.html",
|
|
66 |
"<html><body>The overview summary page header</body></html>");
|
|
67 |
|
|
68 |
javadoc("-d", out.toString(),
|
|
69 |
"-overview", "overview.html",
|
|
70 |
"--module-source-path", src.toString(),
|
|
71 |
"--module", "m1");
|
|
72 |
|
|
73 |
checkExit(Exit.OK);
|
|
74 |
checkOrder("index.html",
|
|
75 |
"The overview summary page header",
|
|
76 |
"Modules",
|
|
77 |
"<a href=\"m1/module-summary.html\">m1</a>");
|
|
78 |
|
|
79 |
}
|
|
80 |
|
|
81 |
//multiple modules with frames
|
|
82 |
@Test
|
|
83 |
void testIndexWithMultipleModules1(Path base) throws Exception {
|
|
84 |
Path out = base.resolve("out");
|
|
85 |
javadoc("-d", out.toString(),
|
|
86 |
"--module-source-path", src.toString(),
|
|
87 |
"--module", "m1,m3,m4",
|
|
88 |
"--frames");
|
|
89 |
|
|
90 |
checkExit(Exit.OK);
|
|
91 |
|
|
92 |
checkOutput("index.html", true,
|
|
93 |
"window.location.replace('overview-summary.html')");
|
|
94 |
checkOrder("overview-summary.html",
|
|
95 |
"Modules",
|
|
96 |
"<a href=\"m1/module-summary.html\">m1</a>",
|
|
97 |
"<a href=\"m3/module-summary.html\">m3</a>",
|
|
98 |
"<a href=\"m4/module-summary.html\">m4</a>");
|
|
99 |
}
|
|
100 |
|
|
101 |
//multiple modules with out frames
|
|
102 |
@Test
|
|
103 |
void testIndexWithMultipleModules2(Path base) throws Exception {
|
|
104 |
Path out = base.resolve("out");
|
|
105 |
javadoc("-d", out.toString(),
|
|
106 |
"--module-source-path", src.toString(),
|
|
107 |
"--module", "m1,m3,m4",
|
|
108 |
"--no-frames");
|
|
109 |
|
|
110 |
checkExit(Exit.OK);
|
|
111 |
checkOrder("index.html",
|
|
112 |
"Modules",
|
|
113 |
"<a href=\"m1/module-summary.html\">m1</a>",
|
|
114 |
"<a href=\"m3/module-summary.html\">m3</a>",
|
|
115 |
"<a href=\"m4/module-summary.html\">m4</a>");
|
|
116 |
}
|
|
117 |
|
|
118 |
@Test
|
|
119 |
void testIndexWithSingleModule(Path base) throws Exception {
|
|
120 |
Path out = base.resolve("out");
|
|
121 |
javadoc("-d", out.toString(),
|
|
122 |
"--module-source-path", src.toString(),
|
|
123 |
"--module", "m2");
|
|
124 |
|
|
125 |
checkExit(Exit.OK);
|
|
126 |
checkOutput("index.html", true,
|
|
127 |
"window.location.replace('m2/module-summary.html')");
|
|
128 |
}
|
|
129 |
|
|
130 |
//no modules and multiple packages
|
|
131 |
@Test
|
|
132 |
void testIndexWithNoModules1(Path base) throws Exception{
|
|
133 |
Path out = base.resolve("out");
|
|
134 |
new ClassBuilder(tb, "P1.A1")
|
|
135 |
.setModifiers("public","class")
|
|
136 |
.write(src);
|
|
137 |
|
|
138 |
new ClassBuilder(tb, "P2.A2")
|
|
139 |
.setModifiers("public","class")
|
|
140 |
.write(src);
|
|
141 |
|
|
142 |
javadoc("-d", out.toString(),
|
|
143 |
"--no-frames",
|
|
144 |
"-sourcepath", src.toString(),
|
|
145 |
"P1","P2");
|
|
146 |
|
|
147 |
checkExit(Exit.OK);
|
|
148 |
checkOrder("index.html",
|
|
149 |
"Packages",
|
|
150 |
"<a href=\"P1/package-summary.html\">P1</a>",
|
|
151 |
"<a href=\"P2/package-summary.html\">P2</a>");
|
|
152 |
|
|
153 |
}
|
|
154 |
|
|
155 |
//no modules and one package
|
|
156 |
@Test
|
|
157 |
void testIndexWithNoModules2(Path base) throws Exception{
|
|
158 |
Path out = base.resolve("out");
|
|
159 |
new ClassBuilder(tb, "P1.A1")
|
|
160 |
.setModifiers("public","class")
|
|
161 |
.write(src);
|
|
162 |
|
|
163 |
javadoc("-d", out.toString(),
|
|
164 |
"--no-frames",
|
|
165 |
"-sourcepath", src.toString(),
|
|
166 |
"P1");
|
|
167 |
|
|
168 |
checkExit(Exit.OK);
|
|
169 |
checkOrder("index.html",
|
|
170 |
"window.location.replace('P1/package-summary.html')");
|
|
171 |
}
|
|
172 |
|
|
173 |
void initModules() throws Exception {
|
|
174 |
new ModuleBuilder(tb, "m1")
|
|
175 |
.exports("p1")
|
|
176 |
.classes("package p1; public class c1{}")
|
|
177 |
.write(src);
|
|
178 |
|
|
179 |
new ModuleBuilder(tb, "m2")
|
|
180 |
.exports("p1")
|
|
181 |
.exports("p2")
|
|
182 |
.classes("package p1; public class c1{}")
|
|
183 |
.classes("package p2; public class c2{}")
|
|
184 |
.write(src);
|
|
185 |
|
|
186 |
new ModuleBuilder(tb, "m3").write(src);
|
|
187 |
|
|
188 |
new ModuleBuilder(tb, "m4").write(src);
|
|
189 |
}
|
|
190 |
}
|