langtools/test/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java
author ksrini
Mon, 14 Mar 2016 15:04:57 -0700
changeset 36705 890c250d8da8
parent 35426 374342e56a56
child 36709 f9f252088afa
permissions -rw-r--r--
8071982: Update tests for revamped Doclet API 8071984: Update test cases for repeating and type annotations output in javadoc Reviewed-by: ksrini, bpatel Contributed-by: oleg.barbashov@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
     2
 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    21
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 * @test
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    26
 * @bug 4341304 4485668 4966728 8032066 8071982
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 * @summary Test that methods readResolve and writeReplace show
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 * up in serialized-form.html the same way that readObject and writeObject do.
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 * If the doclet includes readResolve and writeReplace in the serialized-form
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
 * documentation that same way the it includes readObject and writeObject, the
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
 * test passes.  This also tests that throws tag information is correctly shown
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 * in the serialized form page.
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * Make sure see tags work in serialized form.
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * @author jamieh
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * @library ../lib/
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 24399
diff changeset
    36
 * @modules jdk.javadoc
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * @build JavadocTester
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * @build TestSerializedForm
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * @run main TestSerializedForm
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    42
import java.io.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    44
public class TestSerializedForm extends JavadocTester {
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    45
    public static void main(String... args) throws Exception {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    46
        TestSerializedForm tester = new TestSerializedForm();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    47
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    48
//        tester.run(ARGS, TEST, NEGATED_TEST);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    49
//        tester.run(ARGS_PRIVATE, TEST_PRIVATE, NEGATED_TEST_PRIVATE);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    50
//        tester.printSummary();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    53
    // @ignore 8146022
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    54
    // @Test
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    55
    void testDefault() {
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    56
        javadoc("-d", "out-default", "-serialwarn", "-Xdoclint:none",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    57
                "-sourcepath", testSrc,
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    58
                testSrc("SerializedForm.java"), testSrc("ExternalizedForm.java"), "pkg1");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    59
        checkExit(Exit.OK);
23805
3ef77c1ebf0b 8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents: 7681
diff changeset
    60
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    61
        checkOutput("serialized-form.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    62
                "protected java.lang.Object readResolve()",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    63
                "protected java.lang.Object writeReplace()",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    64
                "protected java.lang.Object readObjectNoData()",
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    65
                "<h3>Serialization Overview</h3>\n<ul class=\"blockList\">\n"
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    66
                + "<li class=\"blockListLast\">\n<div class=\"block\">"
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    67
                + "<span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>\n"
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    68
                + "<dl>\n<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    69
                + "<dd><code>TestSerializedForm</code></dd>\n</dl>",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    70
                "<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    71
                + "extends java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    72
                "<h3>Class pkg1.PrivateIncludeInnerClass.PriInnerClass extends "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    73
                + "java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    74
                "<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    75
                + "java.lang.Object implements Serializable</h3>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    77
        checkOutput("serialized-form.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    78
                "<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    79
                + "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    80
                + "extends java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    81
                "<h3>Class <a href=\"pkg1/PrivateInnerClass.PriInnerClass.html\" title=\"class in pkg1\">"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    82
                + "pkg1.PrivateInnerClass.PriInnerClass</a> extends java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    83
                "<h3>Class <a href=\"pkg1/ProtectedInnerClass.ProInnerClass.html\" title=\"class in pkg1\">"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    84
                + "pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    85
                "<h3>Class pkg1.PublicExcludeInnerClass.PubInnerClass extends java.lang.Object implements "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    86
                + "Serializable</h3>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    87
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    88
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    89
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    90
    void testPrivate() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    91
        javadoc("-private",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    92
                "-d", "out-private",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    93
                "-sourcepath", testSrc,
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    94
                testSrc("SerializedForm.java"), testSrc("ExternalizedForm.java"), "pkg1");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    95
        checkExit(Exit.OK);
23805
3ef77c1ebf0b 8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents: 7681
diff changeset
    96
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    97
        checkOutput("serialized-form.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    98
                "<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    99
                + "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   100
                + "extends java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   101
                "<h3>Class <a href=\"pkg1/PrivateIncludeInnerClass.PriInnerClass.html\" title=\"class in pkg1\">"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   102
                + "pkg1.PrivateIncludeInnerClass.PriInnerClass</a> extends java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   103
                "<h3>Class <a href=\"pkg1/ProtectedInnerClass.ProInnerClass.html\" title=\"class in pkg1\">"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   104
                + "pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implements Serializable</h3>");
23805
3ef77c1ebf0b 8032066: Serialized form has broken links to non private inner classes of package private
bpatel
parents: 7681
diff changeset
   105
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   106
        checkOutput("serialized-form.html", false,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   107
                "<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   108
                + "extends java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   109
                "<h3>Class pkg1.PrivateInnerClass.PriInnerClass extends "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   110
                + "java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   111
                "<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   112
                + "java.lang.Object implements Serializable</h3>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   113
                "<h3>Class <a href=\"pkg1/PublicExcludeInnerClass.PubInnerClass.html\" "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   114
                + "title=\"class in pkg1\">pkg1.PublicExcludeInnerClass.PubInnerClass</a> "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   115
                + "extends java.lang.Object implements Serializable</h3>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   116
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
}