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