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

Fri, 30 Aug 2013 17:36:47 -0700

author
jjg
date
Fri, 30 Aug 2013 17:36:47 -0700
changeset 1999
7993cfab8610
parent 1993
240f424cc0d5
child 2036
8df12c315ea3
permissions
-rw-r--r--

8015663: Need to supply tests to provide javadoc for profiles support code coverage
Reviewed-by: jjg
Contributed-by: evgeniya.stepanova@oracle.com

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

mercurial