langtools/test/jdk/javadoc/tool/modules/PackageOptions.java
author jjg
Fri, 26 Aug 2016 15:54:36 -0700
changeset 40599 be40838eb215
parent 40508 74ef30d16fb9
child 44288 c33a416cfcf8
permissions -rw-r--r--
8164887: update tests to remove use of old-style options Reviewed-by: mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     1
/*
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     4
 *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     7
 * published by the Free Software Foundation.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     8
 *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    13
 * accompanied this code).
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    14
 *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    18
 *
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    21
 * questions.
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    22
 */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    23
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    24
/**
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    25
 * @test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    26
 * @bug 8159305
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    27
 * @summary Test modules with packages and subpackages filtering
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    28
 * @modules
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    29
 *      jdk.javadoc/jdk.javadoc.internal.api
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    30
 *      jdk.javadoc/jdk.javadoc.internal.tool
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    31
 *      jdk.compiler/com.sun.tools.javac.api
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    32
 *      jdk.compiler/com.sun.tools.javac.main
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    33
 * @library /tools/lib
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    34
 * @build toolbox.ToolBox toolbox.TestRunner
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    35
 * @run main PackageOptions
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    36
 */
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    37
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    38
import java.io.IOException;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    39
import java.nio.file.DirectoryIteratorException;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    40
import java.nio.file.DirectoryStream;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    41
import java.nio.file.Files;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    42
import java.nio.file.Path;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    43
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    44
import toolbox.*;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    45
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    46
public class PackageOptions extends ModuleTestBase {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    47
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    48
    public static void main(String... args) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    49
        new PackageOptions().runTests();
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    50
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    51
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    52
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    53
    public void testExportedNonQualifiedPackagesLegacyMode(Path base)  throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    54
        execTask("--module-source-path", createSources(base.resolve("src")),
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    55
                "--add-modules", "m1",
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    56
                "m1pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    57
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    58
        checkModulesNotSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    59
        checkModulesIncluded("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    60
        checkPackagesSpecified("m1pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    61
        checkPackagesIncluded("m1pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    62
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    63
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    64
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    65
    public void testExportedQualifiedPackagesLegacyMode(Path base)  throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    66
        execTask("--module-source-path", createSources(base.resolve("src")),
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    67
                "--add-modules", "m1",
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    68
                "m1/m1pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    69
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    70
        checkModulesNotSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    71
        checkModulesIncluded("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    72
        checkPackagesSpecified("m1pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    73
        checkPackagesIncluded("m1pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    74
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    75
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    76
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    77
    public void testNonExportedQualifedPackagesLegacyMode(Path base)  throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    78
        execTask("--module-source-path", createSources(base.resolve("src")),
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    79
                "--add-modules", "m1",
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    80
                "m1/m1pro.pro1" /* not exported, therefore qualify with module */);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    81
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    82
        checkModulesNotSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    83
        checkModulesIncluded("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    84
        checkPackagesSpecified("m1pro.pro1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    85
        checkPackagesIncluded("m1pro.pro1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    86
        checkPackagesNotIncluded("m1pro.pro2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    87
        checkPackagesNotIncluded("m1pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    88
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    89
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    90
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    91
    public void testTypesLegacyMode(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    92
        Path srcPath = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    93
        Path typPath = srcPath.resolve("m1/m1pub/A.java");
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    94
        execTask("--module-source-path", createSources(srcPath),
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
    95
                "--add-modules", "m1",
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    96
                typPath.toString());
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    97
        checkModulesNotSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    98
        checkModulesIncluded("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
    99
        checkPackagesIncluded("m1pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   100
        checkPackagesNotIncluded("m1pro");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   101
        checkTypesSpecified("m1pub.A");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   102
        checkTypesIncluded("m1pub.A");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   103
        checkTypesNotIncluded("m1pub.B");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   104
        checkTypesNotIncluded("m1pub.C");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   105
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   106
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   107
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   108
    public void testSubclassedTypesLegacyMode(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   109
        Path srcPath = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   110
        Path typPath = srcPath.resolve("m1/m1pub/B.java");
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   111
        execTask("--module-source-path", createSources(srcPath),
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   112
                "--add-modules", "m1",
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   113
                typPath.toString());
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   114
        checkModulesNotSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   115
        checkModulesIncluded("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   116
        checkPackagesIncluded("m1pub");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   117
        checkPackagesNotIncluded("m1pro");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   118
        checkTypesSpecified("m1pub.B");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   119
        checkTypesIncluded("m1pub.B");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   120
        checkTypesNotIncluded("m1pub.A");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   121
        checkTypesNotIncluded("m1pub.C");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   122
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   123
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   124
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   125
    public void testDefaultPackages(Path base) throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   126
        execTask("--module-source-path", createSources(base.resolve("src")),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   127
                "--module", "m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   128
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   129
        checkModulesSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   130
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   131
        checkPackagesIncluded("m1pub", "m1pub.pub1", "m1pub.pub1.pub11",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   132
                              "m1pub.pub1.pub12", "m1pub.pub2.pub21");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   133
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   134
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   135
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   136
    public void testEmptyPackageDirectory(Path base) throws Exception {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   137
        Path src = base.resolve("src");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   138
        createSources(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   139
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   140
        // need an empty package directory, to check whether
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   141
        // the behavior of subpackage and package
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   142
        Path pkgdir = src.resolve("m1/m1pro/");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   143
        try (DirectoryStream<Path> stream = Files.newDirectoryStream(pkgdir, "*.java")) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   144
            for (Path entry : stream) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   145
                Files.deleteIfExists(entry);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   146
            }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   147
        } catch (DirectoryIteratorException ex) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   148
            // I/O error encounted during the iteration
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   149
            throw ex.getCause();
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   150
        }
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   151
        execTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   152
                "-subpackages", "m1/m1pro");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   153
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   154
        checkPackagesSpecified("m1pro", "m1pro.pro1", "m1pro.pro2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   155
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   156
        // empty package directory should cause an error
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   157
        execNegativeTask("--module-source-path", src.toString(),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   158
                         "m1/m1pro");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   159
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   160
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   161
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   162
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   163
    public void testExportedQualifiedSubpackageWithMultipleModules(Path base) throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   164
        execTask("--module-source-path", createSources(base.resolve("src"), 2),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   165
                "--module", "m1",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   166
                "-subpackages", "m1/m1pro.pro1:m1/m1pro.pro2:m2/m2pub.pub1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   167
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   168
        checkModulesSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   169
        checkPackagesSpecified("m1pro", "m1pro.pro2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   170
        checkPackagesSpecified("m2pub.pub1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   171
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   172
        checkPackagesIncluded("m1pub", "m1pub.pub1", "m1pub.pub1.pub11",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   173
                              "m1pub.pub1.pub12", "m1pub.pub2.pub21");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   174
        checkPackagesIncluded("m2pub.pub1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   175
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   176
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   177
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   178
    public void testUnexportedUnqualifiedSubpackages(Path base) throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   179
        execNegativeTask("--module-source-path", createSources(base.resolve("src")),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   180
                         "--module", "m1",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   181
                         "-subpackages", "m1pub.pub1:pro");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   182
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   183
        assertErrorPresent("javadoc: error - No source files for package pro");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   184
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   185
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   186
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   187
    public void testUnexportedQualifiedPackage(Path base) throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   188
        execTask("--module-source-path", createSources(base.resolve("src")),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   189
                "--module", "m1",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   190
                "m1/m1pro");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   191
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   192
        checkModulesSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   193
        checkPackagesSpecified("m1pro");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   194
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   195
        checkPackagesIncluded("m1pub", "m1pub.pub1", "m1pub.pub1.pub11",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   196
                              "m1pub.pub1.pub12", "m1pub.pub2.pub21");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   197
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   198
        checkTypesIncluded("m1pro.L");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   199
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   200
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   201
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   202
    public void testUnexportedQualifiedSubpackage(Path base) throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   203
        execTask("--module-source-path", createSources(base.resolve("src")),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   204
                "--module", "m1",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   205
                "-subpackages", "m1/m1pro");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   206
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   207
        checkModulesSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   208
        checkPackagesSpecified("m1pro", "m1pro.pro1", "m1pro.pro2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   209
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   210
        checkPackagesIncluded("m1pub", "m1pub.pub1", "m1pub.pub1.pub11",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   211
                              "m1pub.pub1.pub12", "m1pub.pub2.pub21");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   212
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   213
        checkTypesIncluded("m1pro.L", "m1pro.pro1.M", "m1pro.pro2.O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   214
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   215
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   216
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   217
    public void testUnexportedQualifiedSubpackageExcludeQualified(Path base) throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   218
        execTask("--module-source-path", createSources(base.resolve("src")),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   219
                "--module", "m1",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   220
                "-subpackages", "m1/m1pro",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   221
                "-exclude", "m1/m1pro.pro1.pro11:m1/m1pro.pro2.pro21");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   222
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   223
        checkModulesSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   224
        checkPackagesSpecified("m1pro", "m1pro.pro1", "m1pro.pro2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   225
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   226
        checkPackagesIncluded("m1pub", "m1pub.pub1", "m1pub.pub1.pub11",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   227
                              "m1pub.pub1.pub12", "m1pub.pub2.pub21");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   228
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   229
        checkTypesIncluded("m1pro.L", "m1pro.pro1.M", "m1pro.pro2.O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   230
        checkPackagesNotSpecified(".*pro11.*", ".*pro21.*");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   231
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   232
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   233
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   234
    public void testUnexportedQualifiedSubpackageExcludeUnqualified(Path base) throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   235
        execTask("--module-source-path", createSources(base.resolve("src")),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   236
                "--module", "m1",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   237
                "-subpackages", "m1/m1pro",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   238
                "-exclude", "m1pro.pro1.pro11:m1pro.pro2.pro21");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   239
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   240
        checkModulesSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   241
        checkPackagesSpecified("m1pro", "m1pro.pro1", "m1pro.pro2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   242
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   243
        checkPackagesIncluded("m1pub", "m1pub.pub1", "m1pub.pub1.pub11",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   244
                              "m1pub.pub1.pub12", "m1pub.pub2.pub21");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   245
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   246
        checkTypesIncluded("m1pro.L", "m1pro.pro1.M", "m1pro.pro2.O");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   247
        checkPackagesNotSpecified(".*pro11.*", ".*pro21.*");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   248
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   249
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   250
    @Test
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   251
    public void testUnexportedQualifiedSubpackages(Path base) throws Exception {
40599
be40838eb215 8164887: update tests to remove use of old-style options
jjg
parents: 40508
diff changeset
   252
        execTask("--module-source-path", createSources(base.resolve("src")),
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   253
                "--module", "m1",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   254
                "-subpackages", "m1/m1pro.pro1:m1/m1pro.pro2");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   255
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   256
        checkModulesSpecified("m1");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   257
        checkPackagesSpecified("m1pro.pro1.pro11");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   258
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   259
        checkPackagesIncluded("m1pub", "m1pub.pub1", "m1pub.pub1.pub11",
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   260
                               "m1pub.pub1.pub12", "m1pub.pub2.pub21");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   261
        checkTypesIncluded("m1pro.pro1.pro11.N", "m1pro.pro2.pro21.P");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   262
        checkTypesNotIncluded("m1pro.L");
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   263
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   264
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   265
    String createSources(Path src) throws IOException {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   266
        return createSources0(src, 1);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   267
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   268
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   269
    String createSources(Path src, int n) throws IOException {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   270
        for (int i = 1 ; i <= n ; i++) {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   271
            createSources0(src, i);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   272
        }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   273
        return src.toString();
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   274
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   275
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   276
    String createSources0(Path src, int n) throws IOException {
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   277
        String mn = "m" + n;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   278
        String pn = "package " + mn;
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   279
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   280
        ModuleBuilder mb1 = new ModuleBuilder(tb, mn);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   281
        mb1.comment("The module #" + n)
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   282
                .classes(pn + "pub; /** Klass A */ public class A {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   283
                .classes(pn + "pub; /** Klass B */ public class B extends A{}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   284
                .classes(pn + "pub; /** Klass C */ public class C {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   285
                .classes(pn + "pub;")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   286
                .classes(pn + "pub.pub1; /** Klass B */ public class B {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   287
                .classes(pn + "pub.pub1.pub11; /** Klass C */ public class C {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   288
                .classes(pn + "pub.pub1.pub12; /** Klass C */ public class C {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   289
                .classes(pn + "pub.pub2.pub21; /** Klass C */ public class C {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   290
                .classes(pn + "pro; /** Klass L */ public class L {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   291
                .classes(pn + "pro.pro1; /** Klass M */ public class M {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   292
                .classes(pn + "pro.pro1.pro11; /** Klass N */ public class N {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   293
                .classes(pn + "pro.pro2; /** Klass O */ public class O {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   294
                .classes(pn + "pro.pro2.pro21; /** Klass P */ public class P {}")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   295
                .exports(mn + "pub")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   296
                .exports(mn + "pub.pub1")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   297
                .exports(mn + "pub.pub1.pub11")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   298
                .exports(mn + "pub.pub1.pub12")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   299
                .exports(mn + "pub.pub2.pub21")
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   300
                .write(src);
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   301
        return src.toString();
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   302
    }
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
diff changeset
   303
}