author | bpatel |
Thu, 17 May 2018 12:59:53 -0700 | |
changeset 50167 | cc705c956798 |
parent 48654 | 36f58bd6269f |
child 52616 | 1a395165c09b |
permissions | -rw-r--r-- |
10 | 1 |
/* |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
* |
|
5520 | 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. |
|
10 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
26 |
* @bug 4492643 4689286 8196201 |
10 | 27 |
* @summary Test that a package page is properly generated when a .java file |
28 |
* passed to Javadoc. Also test that the proper package links are generated |
|
29 |
* when single or multiple packages are documented. |
|
30 |
* @author jamieh |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
31 |
* @library ../lib |
36526 | 32 |
* @modules jdk.javadoc/jdk.javadoc.internal.tool |
10 | 33 |
* @build JavadocTester |
34 |
* @run main TestPackagePage |
|
35 |
*/ |
|
36 |
||
37 |
public class TestPackagePage extends JavadocTester { |
|
38 |
||
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
39 |
public static void main(String... args) throws Exception { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
40 |
TestPackagePage tester = new TestPackagePage(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
41 |
tester.runTests(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
42 |
} |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
43 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
44 |
@Test |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
45 |
void testSinglePackage() { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
46 |
javadoc("-d", "out-1", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
47 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
48 |
testSrc("com/pkg/C.java")); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
49 |
checkExit(Exit.OK); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
50 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
51 |
checkOutput("com/pkg/package-summary.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
52 |
"This is a package page."); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
53 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
54 |
// With just one package, all general pages link to the single package page. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
55 |
checkOutput("com/pkg/C.html", true, |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
47216
diff
changeset
|
56 |
"<a href=\"package-summary.html\">Package</a>"); |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
57 |
checkOutput("com/pkg/package-tree.html", true, |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
47216
diff
changeset
|
58 |
"<li><a href=\"package-summary.html\">Package</a></li>"); |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
59 |
checkOutput("deprecated-list.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
60 |
"<li><a href=\"com/pkg/package-summary.html\">Package</a></li>"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
61 |
checkOutput("index-all.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
62 |
"<li><a href=\"com/pkg/package-summary.html\">Package</a></li>"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
63 |
checkOutput("help-doc.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
64 |
"<li><a href=\"com/pkg/package-summary.html\">Package</a></li>"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
65 |
} |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
66 |
|
10 | 67 |
private static final String[][] TEST1 = { |
68 |
}; |
|
69 |
||
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
70 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
71 |
@Test |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
72 |
void testMultiplePackages() { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
73 |
javadoc("-d", "out-2", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
74 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
75 |
"com.pkg", "pkg2"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
76 |
checkExit(Exit.OK); |
10 | 77 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
78 |
//With multiple packages, there is no package link in general pages. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
79 |
checkOutput("deprecated-list.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
80 |
"<li>Package</li>"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
81 |
checkOutput("index-all.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
82 |
"<li>Package</li>"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
83 |
checkOutput("help-doc.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
84 |
"<li>Package</li>"); |
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
85 |
checkOutput("allclasses-index.html", true, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
86 |
"<table class=\"typeSummary\">\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
87 |
+ "<caption><span>Class Summary</span><span class=\"tabEnd\"> </span></caption>\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
88 |
+ "<tr>\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
89 |
+ "<th class=\"colFirst\" scope=\"col\">Class</th>\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
90 |
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
91 |
+ "</tr>\n"); |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
92 |
checkOutput("allpackages-index.html", true, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
93 |
"<table class=\"packagesSummary\">\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
94 |
+ "<caption><span>Package Summary</span><span class=\"tabEnd\"> </span></caption>\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
95 |
+ "<tr>\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
96 |
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
97 |
+ "<th class=\"colLast\" scope=\"col\">Description</th>\n" |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
98 |
+ "</tr>\n"); |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
99 |
checkOutput("type-search-index.js", true, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
100 |
"{\"l\":\"All Classes\",\"url\":\"allclasses-index.html\"}"); |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
101 |
checkOutput("package-search-index.js", true, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
102 |
"{\"l\":\"All Packages\",\"url\":\"allpackages-index.html\"}"); |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
103 |
checkOutput("index-all.html", true, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
104 |
"<br><a href=\"allclasses-index.html\">All Classes</a> " |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
48654
diff
changeset
|
105 |
+ "<a href=\"allpackages-index.html\">All Packages</a>"); |
10 | 106 |
} |
107 |
} |