langtools/test/jdk/javadoc/tool/modules/ReleaseOptions.java
author ksrini
Thu, 16 Mar 2017 18:50:50 -0700
changeset 44301 2f97c71f06f4
child 44450 eb4f067bae4c
permissions -rw-r--r--
8175346: javadoc does not handle Locations correctly with --patch-module Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44301
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
     1
/*
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
     4
 *
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
     8
 *
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    13
 * accompanied this code).
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    14
 *
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    18
 *
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    21
 * questions.
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    22
 */
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    23
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    24
/**
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    25
 * @test
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    26
 * @bug 8175346
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    27
 * @summary Test release option interactions
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    28
 * @modules
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    29
 *      jdk.javadoc/jdk.javadoc.internal.api
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    30
 *      jdk.javadoc/jdk.javadoc.internal.tool
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    31
 *      jdk.compiler/com.sun.tools.javac.api
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    32
 *      jdk.compiler/com.sun.tools.javac.main
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    33
 * @library /tools/lib
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    34
 * @build toolbox.ToolBox toolbox.TestRunner
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    35
 * @run main ReleaseOptions
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    36
 */
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    37
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    38
import java.nio.file.Path;
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    39
import java.nio.file.Paths;
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    40
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    41
import toolbox.*;
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    42
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    43
public class ReleaseOptions extends ModuleTestBase {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    44
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    45
    public static void main(String... args) throws Exception {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    46
        new ReleaseOptions().runTests();
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    47
    }
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    48
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    49
    @Test
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    50
    public void testReleaseWithPatchModule(Path base) throws Exception {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    51
        Path src = Paths.get(base.toString(), "src");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    52
        Path mpath = Paths.get(src. toString(), "m");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    53
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    54
        tb.writeJavaFiles(mpath,
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    55
                "module m { exports p; }",
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    56
                "package p; public class C { }");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    57
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    58
        Task.Result result = execNegativeTask("--release", "8",
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    59
                "--patch-module", "m=" + mpath.toString(),
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    60
                "p");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    61
        assertMessagePresent(".*No source files for package p.*");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    62
        assertMessageNotPresent(".*Exception*");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    63
        assertMessageNotPresent(".java.lang.AssertionError.*");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    64
    }
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    65
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    66
    @Test
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    67
    public void testReleaseWithSourcepath(Path base) throws Exception {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    68
        Path src = Paths.get(base.toString(), "src");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    69
        Path mpath = Paths.get(src. toString(), "m");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    70
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    71
        tb.writeJavaFiles(mpath,
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    72
                "module m { exports p; }",
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    73
                "package p; public class C { }");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    74
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    75
        Task.Result result = execNegativeTask("--release", "8",
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    76
                "--source-path", mpath.toString(),
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    77
                "--module", "m");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    78
        assertMessagePresent(".*(use -source 9 or higher to enable modules).*");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    79
        assertMessageNotPresent(".*Exception*");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    80
        assertMessageNotPresent(".java.lang.AssertionError.*");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    81
    }
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    82
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    83
//    @Test TBD, JDK-8175277, argument validation should fail on this
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    84
//    public void testReleaseWithModuleSourcepath(Path base) throws Exception {
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    85
//        Path src = Paths.get(base.toString(), "src");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    86
//        Path mpath = Paths.get(src.toString(), "m");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    87
//
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    88
//        tb.writeJavaFiles(mpath,
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    89
//                "module m { exports p; }",
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    90
//                "package p; public class C { }");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    91
//
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    92
//        Task.Result result = execNegativeTask("--release", "8",
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    93
//                "--module-source-path", src.toString(),
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    94
//                "--module", "m");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    95
//        assertMessagePresent(".*(use -source 9 or higher to enable modules).*");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    96
//        assertMessageNotPresent(".*Exception*");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    97
//        assertMessageNotPresent(".java.lang.AssertionError.*");
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    98
//    }
2f97c71f06f4 8175346: javadoc does not handle Locations correctly with --patch-module
ksrini
parents:
diff changeset
    99
}