Mon, 23 Jan 2017 17:03:12 -0800
Merge
bpatel@995 | 1 | /* |
bpatel@1935 | 2 | * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
bpatel@995 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
bpatel@995 | 4 | * |
bpatel@995 | 5 | * This code is free software; you can redistribute it and/or modify it |
bpatel@995 | 6 | * under the terms of the GNU General Public License version 2 only, as |
bpatel@995 | 7 | * published by the Free Software Foundation. |
bpatel@995 | 8 | * |
bpatel@995 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
bpatel@995 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
bpatel@995 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
bpatel@995 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
bpatel@995 | 13 | * accompanied this code). |
bpatel@995 | 14 | * |
bpatel@995 | 15 | * You should have received a copy of the GNU General Public License version |
bpatel@995 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
bpatel@995 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
bpatel@995 | 18 | * |
bpatel@995 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
bpatel@995 | 20 | * or visit www.oracle.com if you need additional information or have any |
bpatel@995 | 21 | * questions. |
bpatel@995 | 22 | */ |
bpatel@995 | 23 | |
bpatel@995 | 24 | /* |
bpatel@995 | 25 | * @test |
bpatel@2147 | 26 | * @bug 6492694 8026567 |
bpatel@995 | 27 | * @summary Test package deprecation. |
bpatel@995 | 28 | * @author bpatel |
bpatel@995 | 29 | * @library ../lib/ |
bpatel@995 | 30 | * @build JavadocTester TestPackageDeprecation |
bpatel@995 | 31 | * @run main TestPackageDeprecation |
bpatel@995 | 32 | */ |
bpatel@995 | 33 | |
bpatel@995 | 34 | public class TestPackageDeprecation extends JavadocTester { |
bpatel@995 | 35 | |
bpatel@995 | 36 | //Test information. |
bpatel@995 | 37 | private static final String BUG_ID = "6492694"; |
bpatel@995 | 38 | |
bpatel@995 | 39 | //Javadoc arguments. |
bpatel@995 | 40 | private static final String[] ARGS1 = new String[]{ |
bpatel@995 | 41 | "-d", BUG_ID + "-1", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1", |
bpatel@995 | 42 | SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java" |
bpatel@995 | 43 | }; |
bpatel@995 | 44 | private static final String[] ARGS2 = new String[]{ |
bpatel@995 | 45 | "-d", BUG_ID + "-2", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "-nodeprecated", |
bpatel@995 | 46 | "pkg", "pkg1", SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java" |
bpatel@995 | 47 | }; |
bpatel@995 | 48 | |
bpatel@995 | 49 | //Input for string search tests. |
bpatel@995 | 50 | private static final String[][] TEST1 = { |
bpatel@995 | 51 | {BUG_ID + "-1" + FS + "pkg1" + FS + "package-summary.html", |
bpatel@2147 | 52 | "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>" + NL + |
bpatel@2147 | 53 | "<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." + |
bpatel@1935 | 54 | "</span></div>" |
bpatel@995 | 55 | }, |
bpatel@995 | 56 | {BUG_ID + "-1" + FS + "deprecated-list.html", |
bpatel@995 | 57 | "<li><a href=\"#package\">Deprecated Packages</a></li>" |
bpatel@995 | 58 | } |
bpatel@995 | 59 | }; |
bpatel@995 | 60 | private static final String[][] TEST2 = NO_TEST; |
bpatel@995 | 61 | private static final String[][] NEGATED_TEST1 = NO_TEST; |
bpatel@995 | 62 | private static final String[][] NEGATED_TEST2 = { |
bpatel@995 | 63 | {BUG_ID + "-2" + FS + "overview-summary.html", "pkg1"}, |
bpatel@995 | 64 | {BUG_ID + "-2" + FS + "allclasses-frame.html", "FooDepr"} |
bpatel@995 | 65 | }; |
bpatel@995 | 66 | |
bpatel@995 | 67 | /** |
bpatel@995 | 68 | * The entry point of the test. |
bpatel@995 | 69 | * @param args the array of command line arguments. |
bpatel@995 | 70 | */ |
bpatel@995 | 71 | public static void main(String[] args) { |
bpatel@995 | 72 | TestPackageDeprecation tester = new TestPackageDeprecation(); |
bpatel@995 | 73 | run(tester, ARGS1, TEST1, NEGATED_TEST1); |
bpatel@995 | 74 | run(tester, ARGS2, TEST2, NEGATED_TEST2); |
bpatel@995 | 75 | if ((new java.io.File(BUG_ID + "-2" + FS + "pkg1" + FS + |
bpatel@995 | 76 | "package-summary.html")).exists()) { |
bpatel@995 | 77 | throw new Error("Test Fails: packages summary should not be" + |
bpatel@995 | 78 | "generated for deprecated package."); |
bpatel@995 | 79 | } else { |
bpatel@995 | 80 | System.out.println("Test passes: package-summary.html not found."); |
bpatel@995 | 81 | } |
bpatel@995 | 82 | if ((new java.io.File(BUG_ID + "-2" + FS + "FooDepr.html")).exists()) { |
bpatel@995 | 83 | throw new Error("Test Fails: FooDepr should not be" + |
bpatel@995 | 84 | "generated as it is deprecated."); |
bpatel@995 | 85 | } else { |
bpatel@995 | 86 | System.out.println("Test passes: FooDepr.html not found."); |
bpatel@995 | 87 | } |
bpatel@995 | 88 | tester.printSummary(); |
bpatel@995 | 89 | } |
bpatel@995 | 90 | |
bpatel@995 | 91 | /** |
bpatel@995 | 92 | * {@inheritDoc} |
bpatel@995 | 93 | */ |
bpatel@995 | 94 | public String getBugId() { |
bpatel@995 | 95 | return BUG_ID; |
bpatel@995 | 96 | } |
bpatel@995 | 97 | |
bpatel@995 | 98 | /** |
bpatel@995 | 99 | * {@inheritDoc} |
bpatel@995 | 100 | */ |
bpatel@995 | 101 | public String getBugName() { |
bpatel@995 | 102 | return getClass().getName(); |
bpatel@995 | 103 | } |
bpatel@995 | 104 | } |