Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/doclet/testCopyFiles/TestCopyFiles.java
40971 views
1
/*
2
* Copyright (c) 2016, 2020, 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 8157349 8185985 8194953 8214738
27
* @summary test copy of doc-files, and its contents for HTML meta content.
28
* @library ../../lib
29
* @modules jdk.javadoc/jdk.javadoc.internal.tool
30
* @build javadoc.tester.*
31
* @run main TestCopyFiles
32
*/
33
34
import javadoc.tester.JavadocTester;
35
36
public class TestCopyFiles extends JavadocTester {
37
38
public static void main(String... args) throws Exception {
39
TestCopyFiles tester = new TestCopyFiles();
40
tester.runTests();
41
}
42
43
@Test
44
public void testDocFilesInModulePackages() {
45
javadoc("-d", "modules-out",
46
"-top", "phi-TOP-phi",
47
"-bottom", "phi-BOTTOM-phi",
48
"-header", "phi-HEADER-phi",
49
"-footer", "phi-FOOTER-phi",
50
"-windowtitle", "phi-WINDOW-TITLE-phi",
51
"--module-source-path", testSrc("modules"),
52
"--module", "acme.mdle");
53
checkExit(Exit.OK);
54
checkOrder("acme.mdle/p/doc-files/inpackage.html",
55
"""
56
"Hello World" (phi-WINDOW-TITLE-phi)""",
57
"phi-TOP-phi",
58
// check top navbar
59
"phi-HEADER-phi",
60
"""
61
<a href="../../module-summary.html">Module</a>""",
62
"""
63
<a href="../package-summary.html">Package</a>""",
64
"""
65
<a href="../../../overview-tree.html">Tree</a>""",
66
"""
67
<a href="../../../deprecated-list.html">Deprecated</a>""",
68
"""
69
<a href="../../../index-all.html">Index</a>""",
70
"""
71
In a named module acme.module and named package <a href="../package-summary.html"><code>p</code></a>.""",
72
"<dt>Since:</",
73
"forever",
74
// check footer
75
"phi-BOTTOM-phi"
76
);
77
}
78
79
@Test
80
public void testDocFilesInMultiModulePackagesWithRecursiveCopy() {
81
javadoc("-d", "multi-modules-out-recursive",
82
"-docfilessubdirs",
83
"-top", "phi-TOP-phi",
84
"-bottom", "phi-BOTTOM-phi",
85
"-header", "phi-HEADER-phi",
86
"-footer", "phi-FOOTER-phi",
87
"-windowtitle", "phi-WINDOW-TITLE-phi",
88
"--module-source-path", testSrc("modules"),
89
"--module", "acme.mdle,acme2.mdle");
90
checkExit(Exit.OK);
91
checkOrder("acme.mdle/p/doc-files/inpackage.html",
92
"""
93
"Hello World" (phi-WINDOW-TITLE-phi)""",
94
"phi-TOP-phi",
95
// check top navbar
96
"phi-HEADER-phi",
97
"""
98
<a href="../../module-summary.html">Module</a>""",
99
"""
100
<a href="../package-summary.html">Package</a>""",
101
"""
102
<a href="../../../overview-tree.html">Tree</a>""",
103
"""
104
<a href="../../../deprecated-list.html">Deprecated</a>""",
105
"""
106
<a href="../../../index-all.html">Index</a>""",
107
"""
108
In a named module acme.module and named package <a href="../package-summary.html"><code>p</code></a>.""",
109
"<dt>Since:</",
110
"forever",
111
// check footer
112
"phi-BOTTOM-phi"
113
);
114
115
// check the bottom most doc file
116
checkOrder("acme2.mdle/p2/doc-files/sub-dir/sub-dir-1/SubSubReadme.html",
117
"SubSubReadme (phi-WINDOW-TITLE-phi)",
118
"phi-TOP-phi",
119
// check top navbar
120
"phi-HEADER-phi",
121
"""
122
<a href="../../../../module-summary.html">Module</a>""",
123
"""
124
<a href="../../../package-summary.html">Package</a>""",
125
"""
126
<a href="../../../../../overview-tree.html">Tree</a>""",
127
"""
128
<a href="../../../../../deprecated-list.html">Deprecated</a>""",
129
"""
130
<a href="../../../../../index-all.html">Index</a>""",
131
"SubSubReadme.html at third level of doc-file directory.",
132
// check footer
133
"phi-BOTTOM-phi"
134
);
135
}
136
137
@Test
138
public void testDocFilesInModulePackagesWithRecursiveCopy() {
139
javadoc("-d", "modules-out-recursive",
140
"-docfilessubdirs",
141
"--module-source-path", testSrc("modules"),
142
"--module", "acme.mdle");
143
checkExit(Exit.OK);
144
checkOutput("acme.mdle/p/doc-files/inpackage.html", true,
145
"""
146
In a named module acme.module and named package <a href="../package-summary.html"><code>p</code></a>."""
147
);
148
}
149
150
@Test
151
public void testDocFilesInModulePackagesWithRecursiveCopyWithExclusion() {
152
javadoc("-d", "modules-out-recursive-with-exclusion",
153
"-docfilessubdirs",
154
"-excludedocfilessubdir", "sub-dir",
155
"--module-source-path", testSrc("modules"),
156
"--module", "acme.mdle");
157
checkExit(Exit.OK);
158
checkOutput("acme.mdle/p/doc-files/inpackage.html", true,
159
"""
160
In a named module acme.module and named package <a href="../package-summary.html"><code>p</code></a>."""
161
);
162
}
163
164
@Test
165
public void testDocFilesInPackages() {
166
javadoc("-d", "packages-out",
167
"-sourcepath", testSrc("packages"),
168
"p1");
169
checkExit(Exit.OK);
170
checkOutput("p1/doc-files/inpackage.html", true,
171
"A named package in an unnamed module"
172
);
173
}
174
175
@Test
176
public void testDocFilesInPackagesWithRecursiveCopy() {
177
javadoc("-d", "packages-out-recursive",
178
"-docfilessubdirs",
179
"-sourcepath", testSrc("packages"),
180
"p1");
181
checkExit(Exit.OK);
182
183
checkOutput("p1/doc-files/inpackage.html", true,
184
"A named package in an unnamed module"
185
);
186
187
checkOutput("p1/doc-files/sub-dir/SubReadme.html", true,
188
"<title>SubReadme</title>",
189
"SubReadme.html at second level of doc-file directory."
190
);
191
}
192
193
@Test
194
public void testDocFilesInPackagesWithRecursiveCopyWithExclusion() {
195
javadoc("-d", "packages-out-recursive-with-exclusion",
196
"-docfilessubdirs",
197
"-excludedocfilessubdir", "sub-dir",
198
"-sourcepath", testSrc("packages"),
199
"p1");
200
checkExit(Exit.OK);
201
202
checkOutput("p1/doc-files/inpackage.html", true,
203
"A named package in an unnamed module"
204
);
205
}
206
207
@Test
208
public void testDocFilesInUnnamedPackages() {
209
javadoc("-d", "unnamed-out",
210
"-windowtitle", "phi-WINDOW-TITLE-phi",
211
"-sourcepath", testSrc("unnamed"),
212
testSrc("unnamed/Foo.java")
213
);
214
checkExit(Exit.OK);
215
checkOutput("doc-files/inpackage.html", true,
216
"""
217
<title>(phi-WINDOW-TITLE-phi)</title>
218
""",
219
"In an unnamed package"
220
);
221
}
222
223
@Test
224
public void testDocFilesInUnnamedPackagesWithRecursiveCopy() {
225
javadoc("-d", "unnamed-out-recursive",
226
"-docfilessubdirs",
227
"-windowtitle", "phi-WINDOW-TITLE-phi",
228
"-sourcepath", testSrc("unnamed"),
229
testSrc("unnamed/Foo.java")
230
);
231
checkExit(Exit.OK);
232
checkOutput("doc-files/inpackage.html", true,
233
"""
234
<title>(phi-WINDOW-TITLE-phi)</title>
235
""",
236
"In an unnamed package"
237
);
238
checkOutput("doc-files/doc-file/SubReadme.html", true,
239
"""
240
<title>Beep Beep (phi-WINDOW-TITLE-phi)</title>
241
""",
242
"SubReadme.html at second level of doc-file directory for unnamed package."
243
);
244
}
245
246
@Test
247
public void testDocFilesInPackagesSource7() {
248
javadoc("-d", "packages-out-src7",
249
"-source", "7",
250
"-sourcepath", testSrc("packages"),
251
"p1");
252
checkExit(Exit.OK);
253
checkOutput("p1/doc-files/inpackage.html", true,
254
"A named package in an unnamed module"
255
);
256
}
257
258
@Test
259
public void testDocFilesInPackagesSource7UsingClassPath() {
260
javadoc("-d", "packages-out-src7-cp",
261
"-source", "7",
262
"-classpath", testSrc("packages"),
263
"p1");
264
checkExit(Exit.OK);
265
checkOutput("p1/doc-files/inpackage.html", true,
266
"A named package in an unnamed module"
267
);
268
}
269
270
@Test
271
public void testCopyThrough() {
272
javadoc("-d", "copy",
273
"-sourcepath", testSrc("packages"),
274
"p2");
275
checkExit(Exit.OK);
276
checkOutput("p2/doc-files/case2.html", true,
277
"<!-- Generated by javadoc",
278
"""
279
<style type="text/css">
280
body {
281
font-family: Helvetica, Arial, sans-serif;
282
font-size: 14px;
283
}
284
</style>""");
285
checkOutput("p2/doc-files/case3.html", true,
286
"<!-- Generated by javadoc",
287
"""
288
<style>
289
h1 {color:red;}
290
p {color:blue;}
291
</style>""");
292
checkOutput("p2/doc-files/case4.html", true,
293
"<!-- Generated by javadoc",
294
"""
295
<link rel="stylesheet" type="text/css" href="theme.css">""");
296
}
297
}
298
299