1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/com/sun/javadoc/testProfiles/TestProfiles.java Mon Jan 21 00:45:35 2013 -0500 1.3 @@ -0,0 +1,186 @@ 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 1.30 + * @summary Test javadoc support for profiles. 1.31 + * @author Bhavesh Patel 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"; 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", SRC_DIR + FS 1.45 + + "profile-rtjar-includes.txt", "pkg1", "pkg2", "pkg3", "pkg4", "pkg5" 1.46 + }; 1.47 + private static final String[] ARGS2 = new String[]{ 1.48 + "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5" 1.49 + }; 1.50 + //Input for string tests for profiles. 1.51 + private static final String[][] PROFILES_TEST = { 1.52 + // Tests for profile-overview-frame.html listing all profiles. 1.53 + {PROFILE_BUG_ID + FS + "profile-overview-frame.html", 1.54 + "<span><a href=\"overview-frame.html\" " 1.55 + + "target=\"profileListFrame\">All Packages</a></span>" 1.56 + }, 1.57 + {PROFILE_BUG_ID + FS + "profile-overview-frame.html", 1.58 + "<li><a href=\"compact1-frame.html\" target=\"profileListFrame\">" 1.59 + + "compact1</a></li>" 1.60 + }, 1.61 + // Tests for profileName-frame.html listing all packages in a profile. 1.62 + {PROFILE_BUG_ID + FS + "compact2-frame.html", 1.63 + "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">" 1.64 + + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" " 1.65 + + "target=\"profileListFrame\">All Profiles</a></span>" 1.66 + }, 1.67 + {PROFILE_BUG_ID + FS + "compact2-frame.html", 1.68 + "<li><a href=\"pkg4/compact2-package-frame.html\" " 1.69 + + "target=\"packageFrame\">pkg4</a></li>" 1.70 + }, 1.71 + // Test for profileName-package-frame.html listing all types in a 1.72 + // package of a profile. 1.73 + {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html", 1.74 + "<a href=\"../compact2-summary.html\" target=\"classFrame\">" 1.75 + + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" " 1.76 + + "target=\"classFrame\">pkg2</a>" 1.77 + }, 1.78 + // Tests for profileName-summary.html listing the summary for a profile. 1.79 + {PROFILE_BUG_ID + FS + "compact2-summary.html", 1.80 + "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL 1.81 + + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>" 1.82 + }, 1.83 + {PROFILE_BUG_ID + FS + "compact2-summary.html", 1.84 + "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>" 1.85 + }, 1.86 + {PROFILE_BUG_ID + FS + "compact2-summary.html", 1.87 + "<h3><a href=\"pkg2/compact2-package-summary.html\" " 1.88 + + "target=\"classFrame\">pkg2</a></h3>" 1.89 + }, 1.90 + // Tests for profileName-package-summary.html listing the summary for a 1.91 + // package in a profile. 1.92 + {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", 1.93 + "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package" 1.94 + + "</a></li>" 1.95 + }, 1.96 + {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", 1.97 + "<div class=\"subTitle\">compact3</div>" 1.98 + }, 1.99 + //Test for "overview-frame.html" showing the "All Profiles" link. 1.100 + {PROFILE_BUG_ID + FS + "overview-frame.html", 1.101 + "<span><a href=\"profile-overview-frame.html\" " 1.102 + + "target=\"profileListFrame\">All Profiles</a></span>" 1.103 + }, 1.104 + //Test for "className.html" showing the profile information for the type. 1.105 + {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html", 1.106 + "<div class=\"subTitle\">compact1, compact2, compact3</div>" 1.107 + } 1.108 + }; 1.109 + private static final String[][] PROFILES_NEGATED_TEST = { 1.110 + {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html", 1.111 + "<div class=\"subTitle\">compact1" 1.112 + }, 1.113 + {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html", 1.114 + "<div class=\"subTitle\">compact1" 1.115 + }, 1.116 + {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html", 1.117 + "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" " 1.118 + + "target=\"classFrame\">Anno1Pkg4</a></li>" 1.119 + } 1.120 + }; 1.121 + private static final String[][] PACKAGES_TEST = { 1.122 + {PACKAGE_BUG_ID + FS + "overview-frame.html", 1.123 + "<h2 title=\"Packages\">Packages</h2>" 1.124 + }, 1.125 + {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html", 1.126 + "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" " 1.127 + + "target=\"classFrame\">pkg4</a></h1>" 1.128 + }, 1.129 + {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html", 1.130 + "<div class=\"header\">" + NL + "<h1 title=\"Package\" " 1.131 + + "class=\"title\">Package pkg4</h1>" + NL + "</div>" 1.132 + } 1.133 + }; 1.134 + private static final String[][] PACKAGES_NEGATED_TEST = { 1.135 + {PACKAGE_BUG_ID + FS + "profile-overview-frame.html", 1.136 + "<span><a href=\"overview-frame.html\" " 1.137 + + "target=\"profileListFrame\">All Packages</a></span>" 1.138 + }, 1.139 + {PACKAGE_BUG_ID + FS + "compact2-frame.html", 1.140 + "<span><a href=\"overview-frame.html\" target=\"profileListFrame\">" 1.141 + + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" " 1.142 + + "target=\"profileListFrame\">All Profiles</a></span>" 1.143 + }, 1.144 + {PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html", 1.145 + "<a href=\"../compact2-summary.html\" target=\"classFrame\">" 1.146 + + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" " 1.147 + + "target=\"classFrame\">pkg2</a>" 1.148 + }, 1.149 + {PACKAGE_BUG_ID + FS + "compact2-summary.html", 1.150 + "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>" 1.151 + }, 1.152 + {PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", 1.153 + "<div class=\"subTitle\">compact3</div>" 1.154 + }, 1.155 + {PACKAGE_BUG_ID + FS + "overview-frame.html", 1.156 + "<span><a href=\"profile-overview-frame.html\" " 1.157 + + "target=\"profileListFrame\">All Profiles</a></span>" 1.158 + }, 1.159 + {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html", 1.160 + "<div class=\"subTitle\">compact1, compact2, compact3</div>" 1.161 + } 1.162 + }; 1.163 + 1.164 + /** 1.165 + * The entry point of the test. 1.166 + * 1.167 + * @param args the array of command line arguments. 1.168 + */ 1.169 + public static void main(String[] args) { 1.170 + TestProfiles tester = new TestProfiles(); 1.171 + run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST); 1.172 + run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST); 1.173 + tester.printSummary(); 1.174 + } 1.175 + 1.176 + /** 1.177 + * {@inheritDoc} 1.178 + */ 1.179 + public String getBugId() { 1.180 + return BUG_ID; 1.181 + } 1.182 + 1.183 + /** 1.184 + * {@inheritDoc} 1.185 + */ 1.186 + public String getBugName() { 1.187 + return getClass().getName(); 1.188 + } 1.189 +}