author | jjg |
Fri, 18 Jan 2019 11:26:30 -0800 | |
changeset 53391 | a99bd2570660 |
parent 53097 | 2e82ca64b25d |
child 54350 | 4f9772f4403d |
permissions | -rw-r--r-- |
50421 | 1 |
/* |
53391
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
50421 | 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 |
|
53097 | 28 |
* @library /tools/lib ../../lib |
50421 | 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 |
|
53097 | 33 |
* @build javadoc.tester.* |
50421 | 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 |
||
53097 | 45 |
import javadoc.tester.JavadocTester; |
46 |
||
50421 | 47 |
public class TestIndexWithModules extends JavadocTester { |
48 |
||
49 |
final ToolBox tb; |
|
50 |
private final Path src; |
|
51 |
||
52 |
public static void main(String... args) throws Exception { |
|
53 |
TestIndexWithModules tester = new TestIndexWithModules(); |
|
54 |
tester.runTests(m -> new Object[]{Paths.get(m.getName())}); |
|
55 |
} |
|
56 |
||
57 |
TestIndexWithModules() throws Exception{ |
|
58 |
tb = new ToolBox(); |
|
59 |
src = Paths.get("src"); |
|
60 |
initModules(); |
|
61 |
} |
|
62 |
||
63 |
@Test |
|
53097 | 64 |
public void testIndexWithOverviewPath(Path base) throws Exception { |
50421 | 65 |
Path out = base.resolve("out"); |
66 |
||
67 |
tb.writeFile("overview.html", |
|
68 |
"<html><body>The overview summary page header</body></html>"); |
|
69 |
||
70 |
javadoc("-d", out.toString(), |
|
71 |
"-overview", "overview.html", |
|
72 |
"--module-source-path", src.toString(), |
|
73 |
"--module", "m1"); |
|
74 |
||
75 |
checkExit(Exit.OK); |
|
76 |
checkOrder("index.html", |
|
77 |
"The overview summary page header", |
|
78 |
"Modules", |
|
79 |
"<a href=\"m1/module-summary.html\">m1</a>"); |
|
80 |
||
81 |
} |
|
82 |
||
83 |
//multiple modules with frames |
|
84 |
@Test |
|
53097 | 85 |
public void testIndexWithMultipleModules1(Path base) throws Exception { |
53391
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
86 |
setAutomaticCheckLinks(false); // @ignore 8217013 |
50421 | 87 |
Path out = base.resolve("out"); |
88 |
javadoc("-d", out.toString(), |
|
89 |
"--module-source-path", src.toString(), |
|
90 |
"--module", "m1,m3,m4", |
|
91 |
"--frames"); |
|
92 |
||
93 |
checkExit(Exit.OK); |
|
94 |
||
95 |
checkOutput("index.html", true, |
|
96 |
"window.location.replace('overview-summary.html')"); |
|
97 |
checkOrder("overview-summary.html", |
|
98 |
"Modules", |
|
99 |
"<a href=\"m1/module-summary.html\">m1</a>", |
|
100 |
"<a href=\"m3/module-summary.html\">m3</a>", |
|
101 |
"<a href=\"m4/module-summary.html\">m4</a>"); |
|
53391
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
102 |
setAutomaticCheckLinks(true); // @ignore 8217013 |
50421 | 103 |
} |
104 |
||
105 |
//multiple modules with out frames |
|
106 |
@Test |
|
53097 | 107 |
public void testIndexWithMultipleModules2(Path base) throws Exception { |
50421 | 108 |
Path out = base.resolve("out"); |
109 |
javadoc("-d", out.toString(), |
|
110 |
"--module-source-path", src.toString(), |
|
111 |
"--module", "m1,m3,m4", |
|
112 |
"--no-frames"); |
|
113 |
||
114 |
checkExit(Exit.OK); |
|
115 |
checkOrder("index.html", |
|
116 |
"Modules", |
|
117 |
"<a href=\"m1/module-summary.html\">m1</a>", |
|
118 |
"<a href=\"m3/module-summary.html\">m3</a>", |
|
119 |
"<a href=\"m4/module-summary.html\">m4</a>"); |
|
120 |
} |
|
121 |
||
122 |
@Test |
|
53097 | 123 |
public void testIndexWithSingleModule(Path base) throws Exception { |
50421 | 124 |
Path out = base.resolve("out"); |
125 |
javadoc("-d", out.toString(), |
|
126 |
"--module-source-path", src.toString(), |
|
127 |
"--module", "m2"); |
|
128 |
||
129 |
checkExit(Exit.OK); |
|
130 |
checkOutput("index.html", true, |
|
131 |
"window.location.replace('m2/module-summary.html')"); |
|
132 |
} |
|
133 |
||
134 |
//no modules and multiple packages |
|
135 |
@Test |
|
53097 | 136 |
public void testIndexWithNoModules1(Path base) throws Exception{ |
50421 | 137 |
Path out = base.resolve("out"); |
138 |
new ClassBuilder(tb, "P1.A1") |
|
139 |
.setModifiers("public","class") |
|
140 |
.write(src); |
|
141 |
||
142 |
new ClassBuilder(tb, "P2.A2") |
|
143 |
.setModifiers("public","class") |
|
144 |
.write(src); |
|
145 |
||
146 |
javadoc("-d", out.toString(), |
|
147 |
"--no-frames", |
|
148 |
"-sourcepath", src.toString(), |
|
149 |
"P1","P2"); |
|
150 |
||
151 |
checkExit(Exit.OK); |
|
152 |
checkOrder("index.html", |
|
153 |
"Packages", |
|
154 |
"<a href=\"P1/package-summary.html\">P1</a>", |
|
155 |
"<a href=\"P2/package-summary.html\">P2</a>"); |
|
156 |
||
157 |
} |
|
158 |
||
159 |
//no modules and one package |
|
160 |
@Test |
|
53097 | 161 |
public void testIndexWithNoModules2(Path base) throws Exception{ |
50421 | 162 |
Path out = base.resolve("out"); |
163 |
new ClassBuilder(tb, "P1.A1") |
|
164 |
.setModifiers("public","class") |
|
165 |
.write(src); |
|
166 |
||
167 |
javadoc("-d", out.toString(), |
|
168 |
"--no-frames", |
|
169 |
"-sourcepath", src.toString(), |
|
170 |
"P1"); |
|
171 |
||
172 |
checkExit(Exit.OK); |
|
173 |
checkOrder("index.html", |
|
174 |
"window.location.replace('P1/package-summary.html')"); |
|
175 |
} |
|
176 |
||
177 |
void initModules() throws Exception { |
|
178 |
new ModuleBuilder(tb, "m1") |
|
179 |
.exports("p1") |
|
180 |
.classes("package p1; public class c1{}") |
|
181 |
.write(src); |
|
182 |
||
183 |
new ModuleBuilder(tb, "m2") |
|
184 |
.exports("p1") |
|
185 |
.exports("p2") |
|
186 |
.classes("package p1; public class c1{}") |
|
187 |
.classes("package p2; public class c2{}") |
|
188 |
.write(src); |
|
189 |
||
190 |
new ModuleBuilder(tb, "m3").write(src); |
|
191 |
||
192 |
new ModuleBuilder(tb, "m4").write(src); |
|
193 |
} |
|
194 |
} |