test/jdk/tools/jpackage/share/ModuleTest.java
branchJDK-8200758-branch
changeset 57446 5a5b85f00a63
parent 57414 6eda749d3117
child 58114 42df7de58e39
equal deleted inserted replaced
57445:405ddd80496e 57446:5a5b85f00a63
       
     1 /*
       
     2  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24  /*
       
    25  * @test
       
    26  * @summary jpackage create image modular jar test
       
    27  * @library ../helpers
       
    28  * @build JPackageHelper
       
    29  * @build JPackagePath
       
    30  * @build Base
       
    31  * @modules jdk.jpackage
       
    32  * @run main/othervm -Xmx512m ModuleTest
       
    33  */
       
    34 public class ModuleTest {
       
    35     private static final String OUTPUT = "output";
       
    36 
       
    37     private static final String [] CMD1 = {
       
    38         "--module-path", "module",
       
    39         "--module", "com.other/com.other.Other",
       
    40         "--output", OUTPUT,
       
    41         "--name", "test",
       
    42     };
       
    43 
       
    44     private static String [] commands = {
       
    45         "--module-path", "module",
       
    46         "--module", "com.other/com.other.Other",
       
    47         "--output", OUTPUT,
       
    48         "--name", "test",
       
    49         "--add-modules", "TBD",
       
    50     };
       
    51 
       
    52     private final static String [] paths = {
       
    53         "ALL-MODULES",
       
    54         "ALL_MODULE_PATH",
       
    55         "ALL-SYSTEM",
       
    56         "ALL-DEFAULT",
       
    57     };
       
    58 
       
    59     public static void main(String[] args) throws Exception {
       
    60         JPackageHelper.createOtherModule();
       
    61 
       
    62         JPackageHelper.deleteOutputFolder(OUTPUT);
       
    63         Base.testCreateAppImage(CMD1);
       
    64 
       
    65         for (String path : paths) {
       
    66             commands[commands.length - 1] = path;
       
    67             System.out.println("using --add-modules " + path);
       
    68             JPackageHelper.deleteOutputFolder(OUTPUT);
       
    69             Base.testCreateAppImageToolProvider(commands);
       
    70             System.out.println("succeeded");
       
    71         }
       
    72     }
       
    73 
       
    74 }