1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/com/sun/javadoc/testProfiles/TestProfiles.java Wed Apr 27 01:34:52 2016 +0800 1.3 @@ -0,0 +1,273 @@ 1.4 +/* 1.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + */ 1.26 + 1.27 +/* 1.28 + * @test 1.29 + * @bug 8006124 8009684 8016921 8023700 8024096 8008164 8026567 8026770 1.30 + * @summary Test javadoc support for profiles. 1.31 + * @author Bhavesh Patel, Evgeniya Stepanova 1.32 + * @library ../lib/ 1.33 + * @build JavadocTester TestProfiles 1.34 + * @run main TestProfiles 1.35 + */ 1.36 +public class TestProfiles extends JavadocTester { 1.37 + 1.38 + //Test information. 1.39 + private static final String BUG_ID = "8006124-8009684-8016921"; 1.40 + private static final String PROFILE_BUG_ID = BUG_ID + "-1"; 1.41 + private static final String PACKAGE_BUG_ID = BUG_ID + "-2"; 1.42 + //Javadoc arguments. 1.43 + private static final String[] ARGS1 = new String[]{ 1.44 + "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath", 1.45 + SRC_DIR + FS + "profile-rtjar-includes.txt", "pkg1", "pkg2", 1.46 + "pkg3", "pkg4", "pkg5", "pkgDeprecated" 1.47 + }; 1.48 + private static final String[] ARGS2 = new String[]{ 1.49 + "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5" 1.50 + }; 1.51 + //Input for string tests for profiles. 1.52 + private static final String[][] PROFILES_TEST = { 1.53 + // Tests for profile-overview-frame.html listing all profiles. 1.54 + {PROFILE_BUG_ID + FS + "profile-overview-frame.html", 1.55 + "<span><a href=\"overview-frame.html\" " 1.56 + + "target=\"packageListFrame\">All Packages</a></span>" 1.57 + }, 1.58 + {PROFILE_BUG_ID + FS + "profile-overview-frame.html", 1.59 + "<li><a href=\"compact1-frame.html\" target=\"packageListFrame\">" 1.60 + + "compact1</a></li>" 1.61 + }, 1.62 + // Tests for profileName-frame.html listing all packages in a profile. 1.63 + {PROFILE_BUG_ID + FS + "compact2-frame.html", 1.64 + "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">" 1.65 + + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" " 1.66 + + "target=\"packageListFrame\">All Profiles</a></span>" 1.67 + }, 1.68 + {PROFILE_BUG_ID + FS + "compact2-frame.html", 1.69 + "<li><a href=\"pkg4/compact2-package-frame.html\" " 1.70 + + "target=\"packageFrame\">pkg4</a></li>" 1.71 + }, 1.72 + // Test for profileName-package-frame.html listing all types in a 1.73 + // package of a profile. 1.74 + {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html", 1.75 + "<a href=\"../compact2-summary.html\" target=\"classFrame\">" 1.76 + + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" " 1.77 + + "target=\"classFrame\">pkg2</a>" 1.78 + }, 1.79 + // Tests for profileName-summary.html listing the summary for a profile. 1.80 + {PROFILE_BUG_ID + FS + "compact2-summary.html", 1.81 + "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL 1.82 + + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>" 1.83 + }, 1.84 + {PROFILE_BUG_ID + FS + "compact2-summary.html", 1.85 + "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>" 1.86 + }, 1.87 + {PROFILE_BUG_ID + FS + "compact2-summary.html", 1.88 + "<h3><a href=\"pkg2/compact2-package-summary.html\" " 1.89 + + "target=\"classFrame\">pkg2</a></h3>" 1.90 + }, 1.91 + {PROFILE_BUG_ID + FS + "compact2-summary.html", 1.92 + "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL 1.93 + + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">" 1.94 + + "pkg2</a></h3>" + NL + "<table class=\"typeSummary\" border=\"0\" " 1.95 + + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, " 1.96 + + "listing classes, and an explanation\">" 1.97 + }, 1.98 + {PROFILE_BUG_ID + FS + "compact2-summary.html", 1.99 + "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL 1.100 + + "<h3><a href=\"pkg4/compact2-package-summary.html\" target=\"classFrame\">" 1.101 + + "pkg4</a></h3>" + NL + "<table class=\"typeSummary\" border=\"0\" " 1.102 + + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, " 1.103 + + "listing classes, and an explanation\">" 1.104 + }, 1.105 + // Tests for profileName-package-summary.html listing the summary for a 1.106 + // package in a profile. 1.107 + {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", 1.108 + "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package" 1.109 + + "</a></li>" 1.110 + }, 1.111 + {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", 1.112 + "<div class=\"subTitle\">compact3</div>" 1.113 + }, 1.114 + {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", 1.115 + "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL 1.116 + + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" " 1.117 + + "cellspacing=\"0\" summary=\"Interface Summary table, listing " 1.118 + + "interfaces, and an explanation\">" 1.119 + }, 1.120 + //Test for "overview-frame.html" showing the "All Profiles" link. 1.121 + {PROFILE_BUG_ID + FS + "overview-frame.html", 1.122 + "<span><a href=\"profile-overview-frame.html\" " 1.123 + + "target=\"packageListFrame\">All Profiles</a></span>" 1.124 + }, 1.125 + //Test for "className.html" showing the profile information for the type. 1.126 + {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html", 1.127 + "<div class=\"subTitle\">compact1, compact2, compact3</div>" 1.128 + }, 1.129 + {PROFILE_BUG_ID + FS + "index.html", 1.130 + "<frame src=\"overview-frame.html\" name=\"packageListFrame\" " + 1.131 + "title=\"All Packages\">" 1.132 + }, 1.133 + //Test for "overview-summary.html" showing the profile list. 1.134 + {PROFILE_BUG_ID + FS + "overview-summary.html", 1.135 + "<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" + 1.136 + "compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " + 1.137 + "target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" + 1.138 + "compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL + 1.139 + "</ul>" 1.140 + }, 1.141 + //Test deprecated class in profiles 1.142 + {PROFILE_BUG_ID + FS + "compact1-summary.html","<td class=\"colFirst\">" 1.143 + + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">Class1Pkg2</a></td>" 1.144 + + NL + "<td class=\"colLast\">Deprecated" 1.145 + }, 1.146 + {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">" 1.147 + + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">pkg2.Class1Pkg2</a>" 1.148 + + NL +"<div class=\"block\"><span class=\"deprecationComment\">Class1Pkg2. This class is deprecated</span></div>" 1.149 + }, 1.150 + //Test deprecated package in profile 1.151 + {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">" 1.152 + + "<a href=\"pkgDeprecated/package-summary.html\">pkgDeprecated</a>" 1.153 + + NL +"<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>." 1.154 + + " Use pkg1.</span></div>" 1.155 + }, 1.156 + {PROFILE_BUG_ID + FS + "pkgDeprecated" + FS + "package-summary.html", 1.157 + "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>" 1.158 + + NL + "<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>." 1.159 + + " Use pkg1.</span></div>" 1.160 + }, 1.161 + // need to add teststring when JDK-8015496 will be fixed 1.162 + //Test exception in profiles 1.163 + {PROFILE_BUG_ID + FS + "compact1-summary.html","<table class=\"typeSummary\" " 1.164 + + "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " 1.165 + + "summary=\"Exception Summary table, listing exceptions, and an explanation\">" 1.166 + + NL + "<caption><span>Exception Summary</span><span class=\"tabEnd\">" 1.167 + + " </span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\" " 1.168 + + "scope=\"col\">Exception</th>" + NL + "<th class=\"colLast\" scope=\"col\">" 1.169 + + "Description</th>" + NL + "</tr>" + NL + "<tbody>" + NL + "<tr class=\"altColor\">" 1.170 + + NL + "<td class=\"colFirst\"><a href=\"pkg2/ClassException.html\"" 1.171 + + " title=\"class in pkg2\">ClassException</a></td>" 1.172 + }, 1.173 + //Test errors in profiles 1.174 + {PROFILE_BUG_ID + FS + "compact1-summary.html", 1.175 + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " 1.176 + + "summary=\"Error Summary table, listing errors, and an explanation\">" 1.177 + + NL + "<caption><span>Error Summary</span><span class=\"tabEnd\"> " 1.178 + + "</span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\"" 1.179 + + " scope=\"col\">Error</th>" + NL + "<th class=\"colLast\" " 1.180 + + "scope=\"col\">Description</th>" + NL + "</tr>" + NL + "<tbody>" 1.181 + + NL + "<tr class=\"altColor\">" + NL + "<td class=\"colFirst\">" 1.182 + + "<a href=\"pkg2/ClassError.html\" title=\"class in pkg2\">ClassError</a></td>" 1.183 + } 1.184 + }; 1.185 + private static final String[][] PROFILES_NEGATED_TEST = { 1.186 + {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html", 1.187 + "<div class=\"subTitle\">compact1" 1.188 + }, 1.189 + {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html", 1.190 + "<div class=\"subTitle\">compact1" 1.191 + }, 1.192 + {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html", 1.193 + "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" " 1.194 + + "target=\"classFrame\">Anno1Pkg4</a></li>" 1.195 + }, 1.196 + {PROFILE_BUG_ID + FS + "compact1-summary.html","<li>Use</li>" 1.197 + }, 1.198 + {PROFILE_BUG_ID + FS + "compact2-summary.html", 1.199 + "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL 1.200 + + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">" 1.201 + + "pkg2</a></h3>" + NL + "<li class=\"blockList\">" + NL 1.202 + + "<table class=\"typeSummary\" border=\"0\" " 1.203 + + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, " 1.204 + + "listing classes, and an explanation\">" 1.205 + }, 1.206 + {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", 1.207 + "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL 1.208 + + "<li class=\"blockList\">" + NL 1.209 + + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" " 1.210 + + "cellspacing=\"0\" summary=\"Interface Summary table, listing " 1.211 + + "interfaces, and an explanation\">" 1.212 + } 1.213 + }; 1.214 + private static final String[][] PACKAGES_TEST = { 1.215 + {PACKAGE_BUG_ID + FS + "overview-frame.html", 1.216 + "<h2 title=\"Packages\">Packages</h2>" 1.217 + }, 1.218 + {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html", 1.219 + "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" " 1.220 + + "target=\"classFrame\">pkg4</a></h1>" 1.221 + }, 1.222 + {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html", 1.223 + "<div class=\"header\">" + NL + "<h1 title=\"Package\" " 1.224 + + "class=\"title\">Package pkg4</h1>" + NL + "</div>" 1.225 + } 1.226 + }; 1.227 + private static final String[][] PACKAGES_NEGATED_TEST = { 1.228 + {PACKAGE_BUG_ID + FS + "overview-frame.html", 1.229 + "<span><a href=\"profile-overview-frame.html\" " 1.230 + + "target=\"packageListFrame\">All Profiles</a></span>" 1.231 + }, 1.232 + {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html", 1.233 + "<div class=\"subTitle\">compact1, compact2, compact3</div>" 1.234 + }, 1.235 + {PACKAGE_BUG_ID + FS + "overview-summary.html", 1.236 + "<ul>" + NL +"<li><a href=\"compact1-summary.html\" target=\"classFrame\">" + 1.237 + "compact1</a></li>" + NL + "<li><a href=\"compact2-summary.html\" " + 1.238 + "target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" + 1.239 + "compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL + 1.240 + "</ul>" 1.241 + } 1.242 + }; 1.243 + private static final String[] PACKAGES_NEGATED_FILE_TEST = { 1.244 + PACKAGE_BUG_ID + FS + "profile-overview-frame.html", 1.245 + PACKAGE_BUG_ID + FS + "compact2-frame.html", 1.246 + PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html", 1.247 + PACKAGE_BUG_ID + FS + "compact2-summary.html", 1.248 + PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html" 1.249 + }; 1.250 + 1.251 + /** 1.252 + * The entry point of the test. 1.253 + * 1.254 + * @param args the array of command line arguments. 1.255 + */ 1.256 + public static void main(String[] args) { 1.257 + TestProfiles tester = new TestProfiles(); 1.258 + run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST); 1.259 + run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST, NO_FILE_TEST, PACKAGES_NEGATED_FILE_TEST); 1.260 + tester.printSummary(); 1.261 + } 1.262 + 1.263 + /** 1.264 + * {@inheritDoc} 1.265 + */ 1.266 + public String getBugId() { 1.267 + return BUG_ID; 1.268 + } 1.269 + 1.270 + /** 1.271 + * {@inheritDoc} 1.272 + */ 1.273 + public String getBugName() { 1.274 + return getClass().getName(); 1.275 + } 1.276 +}