langtools/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java
author prr
Tue, 26 Jun 2012 09:54:29 -0700
changeset 13140 5c57c463f224
parent 9606 e5a619cb5dd3
child 19253 b97b3e18547f
permissions -rw-r--r--
7164282: check for NULL return from malloc is testing wrong variable name. Reviewed-by: igor, flar
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
/*
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
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
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    26
 * @bug      6492694
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",
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    52
            "<div class=\"deprecatedContent\"><span class=\"strong\">Deprecated.</span>" + NL +
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    53
            "<div class=\"block\"><i>This package is Deprecated.</i></div>"
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    54
        },
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    55
        {BUG_ID + "-1" + FS + "deprecated-list.html",
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    56
            "<li><a href=\"#package\">Deprecated Packages</a></li>"
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    57
        }
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
    private static final String[][] TEST2 = NO_TEST;
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    60
    private static final String[][] NEGATED_TEST1 = NO_TEST;
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    61
    private static final String[][] NEGATED_TEST2 = {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    62
        {BUG_ID + "-2" + FS + "overview-summary.html", "pkg1"},
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    63
        {BUG_ID + "-2" + FS + "allclasses-frame.html", "FooDepr"}
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    64
    };
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
     * The entry point of the test.
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    68
     * @param args the array of command line arguments.
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    69
     */
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    70
    public static void main(String[] args) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    71
        TestPackageDeprecation tester = new TestPackageDeprecation();
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    72
        run(tester, ARGS1, TEST1, NEGATED_TEST1);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    73
        run(tester, ARGS2, TEST2, NEGATED_TEST2);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    74
        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
    75
                "package-summary.html")).exists()) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    76
            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
    77
                    "generated for deprecated package.");
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    78
        } else {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    79
            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
    80
        }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    81
        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
    82
            throw new Error("Test Fails: FooDepr should not be" +
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    83
                    "generated as it is deprecated.");
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    84
        } else {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    85
            System.out.println("Test passes:  FooDepr.html not found.");
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    86
        }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    87
        tester.printSummary();
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    88
    }
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
     * {@inheritDoc}
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    92
     */
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    93
    public String getBugId() {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    94
        return BUG_ID;
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    95
    }
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
     * {@inheritDoc}
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
    99
     */
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
   100
    public String getBugName() {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
   101
        return getClass().getName();
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
   102
    }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
diff changeset
   103
}