Mon, 23 Jan 2017 17:03:12 -0800
Merge
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 */
24 /*
25 * @test
26 * @bug 8006124 8009684 8016921 8023700 8024096 8008164 8026567 8026770
27 * @summary Test javadoc support for profiles.
28 * @author Bhavesh Patel, Evgeniya Stepanova
29 * @library ../lib/
30 * @build JavadocTester TestProfiles
31 * @run main TestProfiles
32 */
33 public class TestProfiles extends JavadocTester {
35 //Test information.
36 private static final String BUG_ID = "8006124-8009684-8016921";
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",
42 SRC_DIR + FS + "profile-rtjar-includes.txt", "pkg1", "pkg2",
43 "pkg3", "pkg4", "pkg5", "pkgDeprecated"
44 };
45 private static final String[] ARGS2 = new String[]{
46 "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
47 };
48 //Input for string tests for profiles.
49 private static final String[][] PROFILES_TEST = {
50 // Tests for profile-overview-frame.html listing all profiles.
51 {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
52 "<span><a href=\"overview-frame.html\" "
53 + "target=\"packageListFrame\">All Packages</a></span>"
54 },
55 {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
56 "<li><a href=\"compact1-frame.html\" target=\"packageListFrame\">"
57 + "compact1</a></li>"
58 },
59 // Tests for profileName-frame.html listing all packages in a profile.
60 {PROFILE_BUG_ID + FS + "compact2-frame.html",
61 "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">"
62 + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
63 + "target=\"packageListFrame\">All Profiles</a></span>"
64 },
65 {PROFILE_BUG_ID + FS + "compact2-frame.html",
66 "<li><a href=\"pkg4/compact2-package-frame.html\" "
67 + "target=\"packageFrame\">pkg4</a></li>"
68 },
69 // Test for profileName-package-frame.html listing all types in a
70 // package of a profile.
71 {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
72 "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
73 + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
74 + "target=\"classFrame\">pkg2</a>"
75 },
76 // Tests for profileName-summary.html listing the summary for a profile.
77 {PROFILE_BUG_ID + FS + "compact2-summary.html",
78 "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL
79 + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>"
80 },
81 {PROFILE_BUG_ID + FS + "compact2-summary.html",
82 "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>"
83 },
84 {PROFILE_BUG_ID + FS + "compact2-summary.html",
85 "<h3><a href=\"pkg2/compact2-package-summary.html\" "
86 + "target=\"classFrame\">pkg2</a></h3>"
87 },
88 {PROFILE_BUG_ID + FS + "compact2-summary.html",
89 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
90 + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">"
91 + "pkg2</a></h3>" + NL + "<table class=\"typeSummary\" border=\"0\" "
92 + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
93 + "listing classes, and an explanation\">"
94 },
95 {PROFILE_BUG_ID + FS + "compact2-summary.html",
96 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
97 + "<h3><a href=\"pkg4/compact2-package-summary.html\" target=\"classFrame\">"
98 + "pkg4</a></h3>" + NL + "<table class=\"typeSummary\" border=\"0\" "
99 + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
100 + "listing classes, and an explanation\">"
101 },
102 // Tests for profileName-package-summary.html listing the summary for a
103 // package in a profile.
104 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
105 "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package"
106 + "</a></li>"
107 },
108 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
109 "<div class=\"subTitle\">compact3</div>"
110 },
111 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
112 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
113 + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
114 + "cellspacing=\"0\" summary=\"Interface Summary table, listing "
115 + "interfaces, and an explanation\">"
116 },
117 //Test for "overview-frame.html" showing the "All Profiles" link.
118 {PROFILE_BUG_ID + FS + "overview-frame.html",
119 "<span><a href=\"profile-overview-frame.html\" "
120 + "target=\"packageListFrame\">All Profiles</a></span>"
121 },
122 //Test for "className.html" showing the profile information for the type.
123 {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
124 "<div class=\"subTitle\">compact1, compact2, compact3</div>"
125 },
126 {PROFILE_BUG_ID + FS + "index.html",
127 "<frame src=\"overview-frame.html\" name=\"packageListFrame\" " +
128 "title=\"All Packages\">"
129 },
130 //Test for "overview-summary.html" showing the profile list.
131 {PROFILE_BUG_ID + FS + "overview-summary.html",
132 "<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
133 "compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " +
134 "target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" +
135 "compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL +
136 "</ul>"
137 },
138 //Test deprecated class in profiles
139 {PROFILE_BUG_ID + FS + "compact1-summary.html","<td class=\"colFirst\">"
140 + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">Class1Pkg2</a></td>"
141 + NL + "<td class=\"colLast\">Deprecated"
142 },
143 {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
144 + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">pkg2.Class1Pkg2</a>"
145 + NL +"<div class=\"block\"><span class=\"deprecationComment\">Class1Pkg2. This class is deprecated</span></div>"
146 },
147 //Test deprecated package in profile
148 {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
149 + "<a href=\"pkgDeprecated/package-summary.html\">pkgDeprecated</a>"
150 + NL +"<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
151 + " Use pkg1.</span></div>"
152 },
153 {PROFILE_BUG_ID + FS + "pkgDeprecated" + FS + "package-summary.html",
154 "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>"
155 + NL + "<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
156 + " Use pkg1.</span></div>"
157 },
158 // need to add teststring when JDK-8015496 will be fixed
159 //Test exception in profiles
160 {PROFILE_BUG_ID + FS + "compact1-summary.html","<table class=\"typeSummary\" "
161 + "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
162 + "summary=\"Exception Summary table, listing exceptions, and an explanation\">"
163 + NL + "<caption><span>Exception Summary</span><span class=\"tabEnd\">"
164 + " </span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\" "
165 + "scope=\"col\">Exception</th>" + NL + "<th class=\"colLast\" scope=\"col\">"
166 + "Description</th>" + NL + "</tr>" + NL + "<tbody>" + NL + "<tr class=\"altColor\">"
167 + NL + "<td class=\"colFirst\"><a href=\"pkg2/ClassException.html\""
168 + " title=\"class in pkg2\">ClassException</a></td>"
169 },
170 //Test errors in profiles
171 {PROFILE_BUG_ID + FS + "compact1-summary.html",
172 "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
173 + "summary=\"Error Summary table, listing errors, and an explanation\">"
174 + NL + "<caption><span>Error Summary</span><span class=\"tabEnd\"> "
175 + "</span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\""
176 + " scope=\"col\">Error</th>" + NL + "<th class=\"colLast\" "
177 + "scope=\"col\">Description</th>" + NL + "</tr>" + NL + "<tbody>"
178 + NL + "<tr class=\"altColor\">" + NL + "<td class=\"colFirst\">"
179 + "<a href=\"pkg2/ClassError.html\" title=\"class in pkg2\">ClassError</a></td>"
180 }
181 };
182 private static final String[][] PROFILES_NEGATED_TEST = {
183 {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html",
184 "<div class=\"subTitle\">compact1"
185 },
186 {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html",
187 "<div class=\"subTitle\">compact1"
188 },
189 {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html",
190 "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
191 + "target=\"classFrame\">Anno1Pkg4</a></li>"
192 },
193 {PROFILE_BUG_ID + FS + "compact1-summary.html","<li>Use</li>"
194 },
195 {PROFILE_BUG_ID + FS + "compact2-summary.html",
196 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
197 + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">"
198 + "pkg2</a></h3>" + NL + "<li class=\"blockList\">" + NL
199 + "<table class=\"typeSummary\" border=\"0\" "
200 + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
201 + "listing classes, and an explanation\">"
202 },
203 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
204 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
205 + "<li class=\"blockList\">" + NL
206 + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
207 + "cellspacing=\"0\" summary=\"Interface Summary table, listing "
208 + "interfaces, and an explanation\">"
209 }
210 };
211 private static final String[][] PACKAGES_TEST = {
212 {PACKAGE_BUG_ID + FS + "overview-frame.html",
213 "<h2 title=\"Packages\">Packages</h2>"
214 },
215 {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html",
216 "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
217 + "target=\"classFrame\">pkg4</a></h1>"
218 },
219 {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html",
220 "<div class=\"header\">" + NL + "<h1 title=\"Package\" "
221 + "class=\"title\">Package pkg4</h1>" + NL + "</div>"
222 }
223 };
224 private static final String[][] PACKAGES_NEGATED_TEST = {
225 {PACKAGE_BUG_ID + FS + "overview-frame.html",
226 "<span><a href=\"profile-overview-frame.html\" "
227 + "target=\"packageListFrame\">All Profiles</a></span>"
228 },
229 {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
230 "<div class=\"subTitle\">compact1, compact2, compact3</div>"
231 },
232 {PACKAGE_BUG_ID + FS + "overview-summary.html",
233 "<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
234 "compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " +
235 "target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" +
236 "compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL +
237 "</ul>"
238 }
239 };
240 private static final String[] PACKAGES_NEGATED_FILE_TEST = {
241 PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
242 PACKAGE_BUG_ID + FS + "compact2-frame.html",
243 PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
244 PACKAGE_BUG_ID + FS + "compact2-summary.html",
245 PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html"
246 };
248 /**
249 * The entry point of the test.
250 *
251 * @param args the array of command line arguments.
252 */
253 public static void main(String[] args) {
254 TestProfiles tester = new TestProfiles();
255 run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST);
256 run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST, NO_FILE_TEST, PACKAGES_NEGATED_FILE_TEST);
257 tester.printSummary();
258 }
260 /**
261 * {@inheritDoc}
262 */
263 public String getBugId() {
264 return BUG_ID;
265 }
267 /**
268 * {@inheritDoc}
269 */
270 public String getBugName() {
271 return getClass().getName();
272 }
273 }