52685
|
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 8213957 8213958
|
|
27 |
* @summary Test use of at-index in package-iinfo and doc-files
|
|
28 |
* @library /tools/lib ../lib
|
|
29 |
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
|
30 |
* @build toolbox.ToolBox JavadocTester
|
|
31 |
* @run main TestIndexInPackageFiles
|
|
32 |
*/
|
|
33 |
|
|
34 |
import java.io.IOException;
|
|
35 |
import java.nio.file.Path;
|
|
36 |
import toolbox.ToolBox;
|
|
37 |
|
|
38 |
public class TestIndexInPackageFiles extends JavadocTester {
|
|
39 |
|
|
40 |
public static void main(String... args) throws Exception {
|
|
41 |
TestIndexInPackageFiles tester = new TestIndexInPackageFiles ();
|
|
42 |
tester.runTests();
|
|
43 |
}
|
|
44 |
|
|
45 |
ToolBox tb = new ToolBox();
|
|
46 |
|
|
47 |
@Test
|
|
48 |
public void test() throws IOException {
|
|
49 |
Path src = Path.of("src");
|
|
50 |
tb.writeJavaFiles(src,
|
|
51 |
"/**\n"
|
|
52 |
+ " * Summary.\n"
|
|
53 |
+ " * {@index test.name.1 additional info}\n"
|
|
54 |
+ " * {@systemProperty test.property.1}\n"
|
|
55 |
+ " */\n"
|
|
56 |
+ "package p.q;",
|
|
57 |
"package p.q;\n"
|
|
58 |
+ "/** This is a class in p.q. */\n"
|
|
59 |
+ "public class C { }\n");
|
|
60 |
|
|
61 |
tb.writeFile(src.resolve("p/q/doc-files/extra.html"),
|
|
62 |
"<html><head><title>Extra</title></head><body>\n"
|
|
63 |
+ "<h1>Extra</h1>\n"
|
|
64 |
+ "{@index test.name.2 additional info}\n"
|
|
65 |
+ "{@systemProperty test.property.2}\n"
|
|
66 |
+ "</body></html>\n");
|
|
67 |
|
|
68 |
tb.writeFile("overview.html",
|
|
69 |
"<html><head><title>Overview</title></head><body>\n"
|
|
70 |
+ "<h1>Overview</h1>\n"
|
|
71 |
+ "{@index test.name.3 additional info}\n"
|
|
72 |
+ "</body></html>\n");
|
|
73 |
|
|
74 |
|
|
75 |
javadoc("-d", "out",
|
|
76 |
"-sourcepath", src.toString(),
|
|
77 |
"-overview", "overview.html",
|
|
78 |
"p.q");
|
|
79 |
|
|
80 |
checkExit(Exit.OK);
|
|
81 |
|
|
82 |
// Note there is an implicit call to checkLinks, but that only
|
|
83 |
// checks the links are valid if they are actually present.
|
|
84 |
// Here, we specifically check for both ends of each link.
|
|
85 |
// However, we assume the search index files are generated appropriately,
|
|
86 |
// to match the A-Z index files checked here.
|
|
87 |
|
|
88 |
checkOutput("p/q/package-summary.html", true,
|
|
89 |
"<a id=\"test.name.1\" class=\"searchTagResult\">test.name.1</a>",
|
|
90 |
"<a id=\"test.property.1\" class=\"searchTagResult\">test.property.1</a>");
|
|
91 |
|
|
92 |
checkOutput("p/q/doc-files/extra.html", true,
|
|
93 |
"<a id=\"test.name.2\" class=\"searchTagResult\">test.name.2</a>",
|
|
94 |
"<a id=\"test.property.2\" class=\"searchTagResult\">test.property.2</a>");
|
|
95 |
|
|
96 |
checkOutput("index.html", true,
|
|
97 |
"<a id=\"test.name.3\" class=\"searchTagResult\">test.name.3</a>");
|
|
98 |
|
|
99 |
checkOutput("index-all.html", true,
|
|
100 |
"<span class=\"searchTagLink\"><a href=\"p/q/package-summary.html#test.name.1\">test.name.1</a></span>",
|
|
101 |
"<span class=\"searchTagLink\"><a href=\"p/q/doc-files/extra.html#test.name.2\">test.name.2</a></span>",
|
|
102 |
"<span class=\"searchTagLink\"><a href=\"index.html#test.name.3\">test.name.3</a></span> - Search tag in Overview</dt>",
|
|
103 |
"<span class=\"searchTagLink\"><a href=\"p/q/package-summary.html#test.property.1\">test.property.1</a></span>",
|
|
104 |
"<span class=\"searchTagLink\"><a href=\"p/q/doc-files/extra.html#test.property.2\">test.property.2</a></span>");
|
|
105 |
}
|
|
106 |
}
|
|
107 |
|