|
1 /* |
|
2 * Copyright (c) 2013, 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 8006124 |
|
27 * @summary Test javadoc support for profiles. |
|
28 * @author Bhavesh Patel |
|
29 * @library ../lib/ |
|
30 * @build JavadocTester TestProfiles |
|
31 * @run main TestProfiles |
|
32 */ |
|
33 public class TestProfiles extends JavadocTester { |
|
34 |
|
35 //Test information. |
|
36 private static final String BUG_ID = "8006124"; |
|
37 private static final String PROFILE_BUG_ID = BUG_ID + "-1"; |
|
38 private static final String PACKAGE_BUG_ID = BUG_ID + "-2"; |
|
39 //Javadoc arguments. |
|
40 private static final String[] ARGS1 = new String[]{ |
|
41 "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath", SRC_DIR + FS |
|
42 + "profile-rtjar-includes.txt", "pkg1", "pkg2", "pkg3", "pkg4", "pkg5" |
|
43 }; |
|
44 private static final String[] ARGS2 = new String[]{ |
|
45 "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5" |
|
46 }; |
|
47 //Input for string tests for profiles. |
|
48 private static final String[][] PROFILES_TEST = { |
|
49 // Tests for profile-overview-frame.html listing all profiles. |
|
50 {PROFILE_BUG_ID + FS + "profile-overview-frame.html", |
|
51 "<span><a href=\"overview-frame.html\" " |
|
52 + "target=\"profileListFrame\">All Packages</a></span>" |
|
53 }, |
|
54 {PROFILE_BUG_ID + FS + "profile-overview-frame.html", |
|
55 "<li><a href=\"compact1-frame.html\" target=\"profileListFrame\">" |
|
56 + "compact1</a></li>" |
|
57 }, |
|
58 // Tests for profileName-frame.html listing all packages in a profile. |
|
59 {PROFILE_BUG_ID + FS + "compact2-frame.html", |
|
60 "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">" |
|
61 + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" " |
|
62 + "target=\"profileListFrame\">All Profiles</a></span>" |
|
63 }, |
|
64 {PROFILE_BUG_ID + FS + "compact2-frame.html", |
|
65 "<li><a href=\"pkg4/compact2-package-frame.html\" " |
|
66 + "target=\"packageFrame\">pkg4</a></li>" |
|
67 }, |
|
68 // Test for profileName-package-frame.html listing all types in a |
|
69 // package of a profile. |
|
70 {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html", |
|
71 "<a href=\"../compact2-summary.html\" target=\"classFrame\">" |
|
72 + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" " |
|
73 + "target=\"classFrame\">pkg2</a>" |
|
74 }, |
|
75 // Tests for profileName-summary.html listing the summary for a profile. |
|
76 {PROFILE_BUG_ID + FS + "compact2-summary.html", |
|
77 "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL |
|
78 + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>" |
|
79 }, |
|
80 {PROFILE_BUG_ID + FS + "compact2-summary.html", |
|
81 "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>" |
|
82 }, |
|
83 {PROFILE_BUG_ID + FS + "compact2-summary.html", |
|
84 "<h3><a href=\"pkg2/compact2-package-summary.html\" " |
|
85 + "target=\"classFrame\">pkg2</a></h3>" |
|
86 }, |
|
87 // Tests for profileName-package-summary.html listing the summary for a |
|
88 // package in a profile. |
|
89 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", |
|
90 "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package" |
|
91 + "</a></li>" |
|
92 }, |
|
93 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", |
|
94 "<div class=\"subTitle\">compact3</div>" |
|
95 }, |
|
96 //Test for "overview-frame.html" showing the "All Profiles" link. |
|
97 {PROFILE_BUG_ID + FS + "overview-frame.html", |
|
98 "<span><a href=\"profile-overview-frame.html\" " |
|
99 + "target=\"profileListFrame\">All Profiles</a></span>" |
|
100 }, |
|
101 //Test for "className.html" showing the profile information for the type. |
|
102 {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html", |
|
103 "<div class=\"subTitle\">compact1, compact2, compact3</div>" |
|
104 } |
|
105 }; |
|
106 private static final String[][] PROFILES_NEGATED_TEST = { |
|
107 {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html", |
|
108 "<div class=\"subTitle\">compact1" |
|
109 }, |
|
110 {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html", |
|
111 "<div class=\"subTitle\">compact1" |
|
112 }, |
|
113 {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html", |
|
114 "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" " |
|
115 + "target=\"classFrame\">Anno1Pkg4</a></li>" |
|
116 } |
|
117 }; |
|
118 private static final String[][] PACKAGES_TEST = { |
|
119 {PACKAGE_BUG_ID + FS + "overview-frame.html", |
|
120 "<h2 title=\"Packages\">Packages</h2>" |
|
121 }, |
|
122 {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html", |
|
123 "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" " |
|
124 + "target=\"classFrame\">pkg4</a></h1>" |
|
125 }, |
|
126 {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html", |
|
127 "<div class=\"header\">" + NL + "<h1 title=\"Package\" " |
|
128 + "class=\"title\">Package pkg4</h1>" + NL + "</div>" |
|
129 } |
|
130 }; |
|
131 private static final String[][] PACKAGES_NEGATED_TEST = { |
|
132 {PACKAGE_BUG_ID + FS + "profile-overview-frame.html", |
|
133 "<span><a href=\"overview-frame.html\" " |
|
134 + "target=\"profileListFrame\">All Packages</a></span>" |
|
135 }, |
|
136 {PACKAGE_BUG_ID + FS + "compact2-frame.html", |
|
137 "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">" |
|
138 + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" " |
|
139 + "target=\"profileListFrame\">All Profiles</a></span>" |
|
140 }, |
|
141 {PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html", |
|
142 "<a href=\"../compact2-summary.html\" target=\"classFrame\">" |
|
143 + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" " |
|
144 + "target=\"classFrame\">pkg2</a>" |
|
145 }, |
|
146 {PACKAGE_BUG_ID + FS + "compact2-summary.html", |
|
147 "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>" |
|
148 }, |
|
149 {PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", |
|
150 "<div class=\"subTitle\">compact3</div>" |
|
151 }, |
|
152 {PACKAGE_BUG_ID + FS + "overview-frame.html", |
|
153 "<span><a href=\"profile-overview-frame.html\" " |
|
154 + "target=\"profileListFrame\">All Profiles</a></span>" |
|
155 }, |
|
156 {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html", |
|
157 "<div class=\"subTitle\">compact1, compact2, compact3</div>" |
|
158 } |
|
159 }; |
|
160 |
|
161 /** |
|
162 * The entry point of the test. |
|
163 * |
|
164 * @param args the array of command line arguments. |
|
165 */ |
|
166 public static void main(String[] args) { |
|
167 TestProfiles tester = new TestProfiles(); |
|
168 run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST); |
|
169 run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST); |
|
170 tester.printSummary(); |
|
171 } |
|
172 |
|
173 /** |
|
174 * {@inheritDoc} |
|
175 */ |
|
176 public String getBugId() { |
|
177 return BUG_ID; |
|
178 } |
|
179 |
|
180 /** |
|
181 * {@inheritDoc} |
|
182 */ |
|
183 public String getBugName() { |
|
184 return getClass().getName(); |
|
185 } |
|
186 } |