test/com/sun/javadoc/testProfiles/TestProfiles.java

Wed, 27 Apr 2016 01:34:52 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:34:52 +0800
changeset 0
959103a6100f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 */
aoqi@0 23
aoqi@0 24 /*
aoqi@0 25 * @test
aoqi@0 26 * @bug 8006124 8009684 8016921 8023700 8024096 8008164 8026567 8026770
aoqi@0 27 * @summary Test javadoc support for profiles.
aoqi@0 28 * @author Bhavesh Patel, Evgeniya Stepanova
aoqi@0 29 * @library ../lib/
aoqi@0 30 * @build JavadocTester TestProfiles
aoqi@0 31 * @run main TestProfiles
aoqi@0 32 */
aoqi@0 33 public class TestProfiles extends JavadocTester {
aoqi@0 34
aoqi@0 35 //Test information.
aoqi@0 36 private static final String BUG_ID = "8006124-8009684-8016921";
aoqi@0 37 private static final String PROFILE_BUG_ID = BUG_ID + "-1";
aoqi@0 38 private static final String PACKAGE_BUG_ID = BUG_ID + "-2";
aoqi@0 39 //Javadoc arguments.
aoqi@0 40 private static final String[] ARGS1 = new String[]{
aoqi@0 41 "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath",
aoqi@0 42 SRC_DIR + FS + "profile-rtjar-includes.txt", "pkg1", "pkg2",
aoqi@0 43 "pkg3", "pkg4", "pkg5", "pkgDeprecated"
aoqi@0 44 };
aoqi@0 45 private static final String[] ARGS2 = new String[]{
aoqi@0 46 "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
aoqi@0 47 };
aoqi@0 48 //Input for string tests for profiles.
aoqi@0 49 private static final String[][] PROFILES_TEST = {
aoqi@0 50 // Tests for profile-overview-frame.html listing all profiles.
aoqi@0 51 {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
aoqi@0 52 "<span><a href=\"overview-frame.html\" "
aoqi@0 53 + "target=\"packageListFrame\">All&nbsp;Packages</a></span>"
aoqi@0 54 },
aoqi@0 55 {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
aoqi@0 56 "<li><a href=\"compact1-frame.html\" target=\"packageListFrame\">"
aoqi@0 57 + "compact1</a></li>"
aoqi@0 58 },
aoqi@0 59 // Tests for profileName-frame.html listing all packages in a profile.
aoqi@0 60 {PROFILE_BUG_ID + FS + "compact2-frame.html",
aoqi@0 61 "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">"
aoqi@0 62 + "All&nbsp;Packages</a></span><span><a href=\"profile-overview-frame.html\" "
aoqi@0 63 + "target=\"packageListFrame\">All&nbsp;Profiles</a></span>"
aoqi@0 64 },
aoqi@0 65 {PROFILE_BUG_ID + FS + "compact2-frame.html",
aoqi@0 66 "<li><a href=\"pkg4/compact2-package-frame.html\" "
aoqi@0 67 + "target=\"packageFrame\">pkg4</a></li>"
aoqi@0 68 },
aoqi@0 69 // Test for profileName-package-frame.html listing all types in a
aoqi@0 70 // package of a profile.
aoqi@0 71 {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
aoqi@0 72 "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
aoqi@0 73 + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
aoqi@0 74 + "target=\"classFrame\">pkg2</a>"
aoqi@0 75 },
aoqi@0 76 // Tests for profileName-summary.html listing the summary for a profile.
aoqi@0 77 {PROFILE_BUG_ID + FS + "compact2-summary.html",
aoqi@0 78 "<li><a href=\"compact1-summary.html\">Prev&nbsp;Profile</a></li>" + NL
aoqi@0 79 + "<li><a href=\"compact3-summary.html\">Next&nbsp;Profile</a></li>"
aoqi@0 80 },
aoqi@0 81 {PROFILE_BUG_ID + FS + "compact2-summary.html",
aoqi@0 82 "<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
aoqi@0 83 },
aoqi@0 84 {PROFILE_BUG_ID + FS + "compact2-summary.html",
aoqi@0 85 "<h3><a href=\"pkg2/compact2-package-summary.html\" "
aoqi@0 86 + "target=\"classFrame\">pkg2</a></h3>"
aoqi@0 87 },
aoqi@0 88 {PROFILE_BUG_ID + FS + "compact2-summary.html",
aoqi@0 89 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
aoqi@0 90 + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">"
aoqi@0 91 + "pkg2</a></h3>" + NL + "<table class=\"typeSummary\" border=\"0\" "
aoqi@0 92 + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
aoqi@0 93 + "listing classes, and an explanation\">"
aoqi@0 94 },
aoqi@0 95 {PROFILE_BUG_ID + FS + "compact2-summary.html",
aoqi@0 96 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
aoqi@0 97 + "<h3><a href=\"pkg4/compact2-package-summary.html\" target=\"classFrame\">"
aoqi@0 98 + "pkg4</a></h3>" + NL + "<table class=\"typeSummary\" border=\"0\" "
aoqi@0 99 + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
aoqi@0 100 + "listing classes, and an explanation\">"
aoqi@0 101 },
aoqi@0 102 // Tests for profileName-package-summary.html listing the summary for a
aoqi@0 103 // package in a profile.
aoqi@0 104 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
aoqi@0 105 "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev&nbsp;Package"
aoqi@0 106 + "</a></li>"
aoqi@0 107 },
aoqi@0 108 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
aoqi@0 109 "<div class=\"subTitle\">compact3</div>"
aoqi@0 110 },
aoqi@0 111 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
aoqi@0 112 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
aoqi@0 113 + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
aoqi@0 114 + "cellspacing=\"0\" summary=\"Interface Summary table, listing "
aoqi@0 115 + "interfaces, and an explanation\">"
aoqi@0 116 },
aoqi@0 117 //Test for "overview-frame.html" showing the "All Profiles" link.
aoqi@0 118 {PROFILE_BUG_ID + FS + "overview-frame.html",
aoqi@0 119 "<span><a href=\"profile-overview-frame.html\" "
aoqi@0 120 + "target=\"packageListFrame\">All&nbsp;Profiles</a></span>"
aoqi@0 121 },
aoqi@0 122 //Test for "className.html" showing the profile information for the type.
aoqi@0 123 {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
aoqi@0 124 "<div class=\"subTitle\">compact1, compact2, compact3</div>"
aoqi@0 125 },
aoqi@0 126 {PROFILE_BUG_ID + FS + "index.html",
aoqi@0 127 "<frame src=\"overview-frame.html\" name=\"packageListFrame\" " +
aoqi@0 128 "title=\"All Packages\">"
aoqi@0 129 },
aoqi@0 130 //Test for "overview-summary.html" showing the profile list.
aoqi@0 131 {PROFILE_BUG_ID + FS + "overview-summary.html",
aoqi@0 132 "<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
aoqi@0 133 "compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " +
aoqi@0 134 "target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" +
aoqi@0 135 "compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL +
aoqi@0 136 "</ul>"
aoqi@0 137 },
aoqi@0 138 //Test deprecated class in profiles
aoqi@0 139 {PROFILE_BUG_ID + FS + "compact1-summary.html","<td class=\"colFirst\">"
aoqi@0 140 + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">Class1Pkg2</a></td>"
aoqi@0 141 + NL + "<td class=\"colLast\">Deprecated"
aoqi@0 142 },
aoqi@0 143 {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
aoqi@0 144 + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">pkg2.Class1Pkg2</a>"
aoqi@0 145 + NL +"<div class=\"block\"><span class=\"deprecationComment\">Class1Pkg2. This class is deprecated</span></div>"
aoqi@0 146 },
aoqi@0 147 //Test deprecated package in profile
aoqi@0 148 {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
aoqi@0 149 + "<a href=\"pkgDeprecated/package-summary.html\">pkgDeprecated</a>"
aoqi@0 150 + NL +"<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
aoqi@0 151 + " Use pkg1.</span></div>"
aoqi@0 152 },
aoqi@0 153 {PROFILE_BUG_ID + FS + "pkgDeprecated" + FS + "package-summary.html",
aoqi@0 154 "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>"
aoqi@0 155 + NL + "<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
aoqi@0 156 + " Use pkg1.</span></div>"
aoqi@0 157 },
aoqi@0 158 // need to add teststring when JDK-8015496 will be fixed
aoqi@0 159 //Test exception in profiles
aoqi@0 160 {PROFILE_BUG_ID + FS + "compact1-summary.html","<table class=\"typeSummary\" "
aoqi@0 161 + "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
aoqi@0 162 + "summary=\"Exception Summary table, listing exceptions, and an explanation\">"
aoqi@0 163 + NL + "<caption><span>Exception Summary</span><span class=\"tabEnd\">"
aoqi@0 164 + "&nbsp;</span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\" "
aoqi@0 165 + "scope=\"col\">Exception</th>" + NL + "<th class=\"colLast\" scope=\"col\">"
aoqi@0 166 + "Description</th>" + NL + "</tr>" + NL + "<tbody>" + NL + "<tr class=\"altColor\">"
aoqi@0 167 + NL + "<td class=\"colFirst\"><a href=\"pkg2/ClassException.html\""
aoqi@0 168 + " title=\"class in pkg2\">ClassException</a></td>"
aoqi@0 169 },
aoqi@0 170 //Test errors in profiles
aoqi@0 171 {PROFILE_BUG_ID + FS + "compact1-summary.html",
aoqi@0 172 "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
aoqi@0 173 + "summary=\"Error Summary table, listing errors, and an explanation\">"
aoqi@0 174 + NL + "<caption><span>Error Summary</span><span class=\"tabEnd\">&nbsp;"
aoqi@0 175 + "</span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\""
aoqi@0 176 + " scope=\"col\">Error</th>" + NL + "<th class=\"colLast\" "
aoqi@0 177 + "scope=\"col\">Description</th>" + NL + "</tr>" + NL + "<tbody>"
aoqi@0 178 + NL + "<tr class=\"altColor\">" + NL + "<td class=\"colFirst\">"
aoqi@0 179 + "<a href=\"pkg2/ClassError.html\" title=\"class in pkg2\">ClassError</a></td>"
aoqi@0 180 }
aoqi@0 181 };
aoqi@0 182 private static final String[][] PROFILES_NEGATED_TEST = {
aoqi@0 183 {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html",
aoqi@0 184 "<div class=\"subTitle\">compact1"
aoqi@0 185 },
aoqi@0 186 {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html",
aoqi@0 187 "<div class=\"subTitle\">compact1"
aoqi@0 188 },
aoqi@0 189 {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html",
aoqi@0 190 "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
aoqi@0 191 + "target=\"classFrame\">Anno1Pkg4</a></li>"
aoqi@0 192 },
aoqi@0 193 {PROFILE_BUG_ID + FS + "compact1-summary.html","<li>Use</li>"
aoqi@0 194 },
aoqi@0 195 {PROFILE_BUG_ID + FS + "compact2-summary.html",
aoqi@0 196 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
aoqi@0 197 + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">"
aoqi@0 198 + "pkg2</a></h3>" + NL + "<li class=\"blockList\">" + NL
aoqi@0 199 + "<table class=\"typeSummary\" border=\"0\" "
aoqi@0 200 + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
aoqi@0 201 + "listing classes, and an explanation\">"
aoqi@0 202 },
aoqi@0 203 {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
aoqi@0 204 "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
aoqi@0 205 + "<li class=\"blockList\">" + NL
aoqi@0 206 + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
aoqi@0 207 + "cellspacing=\"0\" summary=\"Interface Summary table, listing "
aoqi@0 208 + "interfaces, and an explanation\">"
aoqi@0 209 }
aoqi@0 210 };
aoqi@0 211 private static final String[][] PACKAGES_TEST = {
aoqi@0 212 {PACKAGE_BUG_ID + FS + "overview-frame.html",
aoqi@0 213 "<h2 title=\"Packages\">Packages</h2>"
aoqi@0 214 },
aoqi@0 215 {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html",
aoqi@0 216 "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
aoqi@0 217 + "target=\"classFrame\">pkg4</a></h1>"
aoqi@0 218 },
aoqi@0 219 {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html",
aoqi@0 220 "<div class=\"header\">" + NL + "<h1 title=\"Package\" "
aoqi@0 221 + "class=\"title\">Package&nbsp;pkg4</h1>" + NL + "</div>"
aoqi@0 222 }
aoqi@0 223 };
aoqi@0 224 private static final String[][] PACKAGES_NEGATED_TEST = {
aoqi@0 225 {PACKAGE_BUG_ID + FS + "overview-frame.html",
aoqi@0 226 "<span><a href=\"profile-overview-frame.html\" "
aoqi@0 227 + "target=\"packageListFrame\">All&nbsp;Profiles</a></span>"
aoqi@0 228 },
aoqi@0 229 {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
aoqi@0 230 "<div class=\"subTitle\">compact1, compact2, compact3</div>"
aoqi@0 231 },
aoqi@0 232 {PACKAGE_BUG_ID + FS + "overview-summary.html",
aoqi@0 233 "<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
aoqi@0 234 "compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " +
aoqi@0 235 "target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" +
aoqi@0 236 "compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL +
aoqi@0 237 "</ul>"
aoqi@0 238 }
aoqi@0 239 };
aoqi@0 240 private static final String[] PACKAGES_NEGATED_FILE_TEST = {
aoqi@0 241 PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
aoqi@0 242 PACKAGE_BUG_ID + FS + "compact2-frame.html",
aoqi@0 243 PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
aoqi@0 244 PACKAGE_BUG_ID + FS + "compact2-summary.html",
aoqi@0 245 PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html"
aoqi@0 246 };
aoqi@0 247
aoqi@0 248 /**
aoqi@0 249 * The entry point of the test.
aoqi@0 250 *
aoqi@0 251 * @param args the array of command line arguments.
aoqi@0 252 */
aoqi@0 253 public static void main(String[] args) {
aoqi@0 254 TestProfiles tester = new TestProfiles();
aoqi@0 255 run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST);
aoqi@0 256 run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST, NO_FILE_TEST, PACKAGES_NEGATED_FILE_TEST);
aoqi@0 257 tester.printSummary();
aoqi@0 258 }
aoqi@0 259
aoqi@0 260 /**
aoqi@0 261 * {@inheritDoc}
aoqi@0 262 */
aoqi@0 263 public String getBugId() {
aoqi@0 264 return BUG_ID;
aoqi@0 265 }
aoqi@0 266
aoqi@0 267 /**
aoqi@0 268 * {@inheritDoc}
aoqi@0 269 */
aoqi@0 270 public String getBugName() {
aoqi@0 271 return getClass().getName();
aoqi@0 272 }
aoqi@0 273 }

mercurial