1 /* 2 * Copyright (c) 2011, 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 */ 23 24 /* 25 * @test 26 * @bug 6492694 8026567 27 * @summary Test package deprecation. 28 * @author bpatel 29 * @library ../lib/ 30 * @build JavadocTester TestPackageDeprecation 31 * @run main TestPackageDeprecation 32 */ 33 34 public class TestPackageDeprecation extends JavadocTester { 35 36 //Test information. 37 private static final String BUG_ID = "6492694"; 38 39 //Javadoc arguments. 40 private static final String[] ARGS1 = new String[]{ 41 "-d", BUG_ID + "-1", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1", 42 SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java" 43 }; 44 private static final String[] ARGS2 = new String[]{ 45 "-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-use", "-nodeprecated", 46 "pkg", "pkg1", SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java" 47 }; 48 49 //Input for string search tests. 50 private static final String[][] TEST1 = { 51 {BUG_ID + "-1" + FS + "pkg1" + FS + "package-summary.html", 52 "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>" + NL + 53 "<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." + 54 "</span></div>" 55 }, 56 {BUG_ID + "-1" + FS + "deprecated-list.html", 57 "<li><a href=\"#package\">Deprecated Packages</a></li>" 58 } 59 }; 60 private static final String[][] TEST2 = NO_TEST; 61 private static final String[][] NEGATED_TEST1 = NO_TEST; 62 private static final String[][] NEGATED_TEST2 = { 63 {BUG_ID + "-2" + FS + "overview-summary.html", "pkg1"}, 64 {BUG_ID + "-2" + FS + "allclasses-frame.html", "FooDepr"} 65 }; 66 67 /** 68 * The entry point of the test. 69 * @param args the array of command line arguments. 70 */ 71 public static void main(String[] args) { 72 TestPackageDeprecation tester = new TestPackageDeprecation(); 73 run(tester, ARGS1, TEST1, NEGATED_TEST1); 74 run(tester, ARGS2, TEST2, NEGATED_TEST2); 75 if ((new java.io.File(BUG_ID + "-2" + FS + "pkg1" + FS + 76 "package-summary.html")).exists()) { 77 throw new Error("Test Fails: packages summary should not be" + 78 "generated for deprecated package."); 79 } else { 80 System.out.println("Test passes: package-summary.html not found."); 81 } 82 if ((new java.io.File(BUG_ID + "-2" + FS + "FooDepr.html")).exists()) { 83 throw new Error("Test Fails: FooDepr should not be" + 84 "generated as it is deprecated."); 85 } else { 86 System.out.println("Test passes: FooDepr.html not found."); 87 } 88 tester.printSummary(); 89 } 90 91 /** 92 * {@inheritDoc} 93 */ 94 public String getBugId() { 95 return BUG_ID; 96 } 97 98 /** 99 * {@inheritDoc} 100 */ 101 public String getBugName() { 102 return getClass().getName(); 103 } 104 }