test/langtools/jdk/javadoc/doclet/testGroupName/TestGroupName.java
author jjg
Wed, 25 Oct 2017 17:16:18 -0700
changeset 47449 afa66f3c34c1
permissions -rw-r--r--
8189841: Error in alternate row coloring in package-summary files Reviewed-by: bpatel, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47449
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
     1
/*
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
     4
 *
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
     8
 *
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    13
 * accompanied this code).
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    14
 *
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    18
 *
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    21
 * questions.
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    22
 */
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    23
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    24
/*
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    25
 * @test
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    26
 * @bug 8190003
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    27
 * @summary Special characters in group names should be escaped
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    28
 * @library /tools/lib ../lib
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    29
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    30
 * @build toolbox.ToolBox JavadocTester
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    31
 * @run main TestGroupName
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    32
 */
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    33
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    34
import java.io.IOException;
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    35
import java.nio.file.Path;
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    36
import java.nio.file.Paths;
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    37
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    38
import toolbox.*;
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    39
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    40
public class TestGroupName extends JavadocTester {
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    41
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    42
    public final ToolBox tb;
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    43
    public static void main(String... args) throws Exception {
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    44
        TestGroupName tester = new TestGroupName();
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    45
        tester.runTests(m -> new Object[] { Paths.get(m.getName()) });
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    46
    }
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    47
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    48
    public TestGroupName() {
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    49
        tb = new ToolBox();
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    50
    }
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    51
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    52
    @Test
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    53
    public void testPackageGroups(Path base) throws IOException {
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    54
        Path src = base.resolve("src");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    55
        tb.writeJavaFiles(src,
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    56
                "package p1; public class C1 { }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    57
                "package p2; public class C2 { }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    58
                "package p3; public class C3 { }");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    59
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    60
        javadoc("-d", base.resolve("out").toString(),
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    61
                "-sourcepath", src.toString(),
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    62
                "-group", "abc < & > def", "p1",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    63
                "p1", "p2", "p3");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    64
        checkExit(Exit.OK);
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    65
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    66
        checkOutput("overview-summary.html", true,
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    67
                "summary=\"abc &lt; &amp; &gt; def table",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    68
                "<span>abc &lt; &amp; &gt; def</span>");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    69
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    70
        checkOutput("overview-summary.html", false,
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    71
                "abc < & > def");The name should be wrapped in a StringContent node instead.
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    72
    }
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    73
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    74
    @Test
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    75
    public void testModuleGroups(Path base) throws IOException {
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    76
        Path src = base.resolve("src");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    77
        tb.writeJavaFiles(src.resolve("ma"),
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    78
                "module ma { exports pa1; }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    79
                "package pa1; public class CA1 { }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    80
                "package pa2; public class CA2 { }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    81
                "package pa3; public class CA3 { }");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    82
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    83
        tb.writeJavaFiles(src.resolve("mb"),
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    84
                "module mb { exports pb1; }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    85
                "package pb1; public class CB1 { }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    86
                "package pb2; public class CB2 { }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    87
                "package pb3; public class CB3 { }");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    88
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    89
        tb.writeJavaFiles(src.resolve("mc"),
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    90
                "module mc { exports pc1; }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    91
                "package pc1; public class CC1 { }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    92
                "package pc2; public class CC2 { }",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    93
                "package pc3; public class CC3 { }");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    94
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    95
        javadoc("-d", base.resolve("out").toString(),
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    96
                "--module-source-path", src.toString(),
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    97
                "-group", "abc < & > def", "ma",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    98
                "--module", "ma,mb,mc");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
    99
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   100
        checkExit(Exit.OK);
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   101
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   102
        checkOutput("overview-summary.html", true,
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   103
                "summary=\"abc &lt; &amp; &gt; def table",
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   104
                "<span>abc &lt; &amp; &gt; def</span>");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   105
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   106
        checkOutput("overview-summary.html", false,
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   107
                "abc < & > def");
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   108
    }
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   109
}
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents:
diff changeset
   110