test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModuleTest.java
branchJDK-8200758-branch
changeset 57395 521c02b9eed0
parent 57307 4948a1944cf9
child 57414 6eda749d3117
equal deleted inserted replaced
57394:17c43babfc2f 57395:521c02b9eed0
     1 /*
     1 /*
     2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24  /*
    24  /*
    25  * @test
    25  * @test
    26  * @summary jpackage create image module test
    26  * @summary jpackage create image modular jar test
    27  * @library ../helpers
    27  * @library ../helpers
    28  * @build JPackageHelper
    28  * @build JPackageHelper
    29  * @build JPackagePath
    29  * @build JPackagePath
    30  * @build JPackageCreateAppImageBase
    30  * @build JPackageCreateAppImageBase
    31  * @modules jdk.jpackage
    31  * @modules jdk.jpackage
    32  * @run main/othervm -Xmx512m JPackageCreateAppImageModuleTest
    32  * @run main/othervm -Xmx512m JPackageCreateAppImageModuleTest
    33  */
    33  */
    34 public class JPackageCreateAppImageModuleTest {
    34 public class JPackageCreateAppImageModuleTest {
    35     private static final String OUTPUT = "output";
    35     private static final String OUTPUT = "output";
    36 
    36 
    37     private static final String [] CMD = {
    37     private static final String [] CMD1 = {
    38         "create-app-image",
    38         "create-app-image",
       
    39         "--module-path", "module",
       
    40         "--module", "com.other/com.other.Other",
    39         "--output", OUTPUT,
    41         "--output", OUTPUT,
    40         "--name", "test",
    42         "--name", "test",
    41         "--module", "com.hello/com.hello.Hello",
    43     };
    42         "--module-path", "input"};
    44 
       
    45     private static String [] commands = {
       
    46         "create-app-image",
       
    47         "--module-path", "module",
       
    48         "--module", "com.other/com.other.Other",
       
    49         "--output", OUTPUT,
       
    50         "--name", "test",
       
    51         "--add-modules", "TBD",
       
    52     };
       
    53 
       
    54     private final static String [] paths = {
       
    55         "ALL-MODULES",
       
    56         "ALL_MODULE_PATH",
       
    57         "ALL-SYSTEM",
       
    58         "ALL-DEFAULT",
       
    59     };
    43 
    60 
    44     public static void main(String[] args) throws Exception {
    61     public static void main(String[] args) throws Exception {
    45         JPackageHelper.createHelloModule();
    62         JPackageHelper.createOtherModule();
    46         JPackageCreateAppImageBase.testCreateAppImage(CMD);
    63 
    47         JPackageHelper.deleteOutputFolder(OUTPUT);
    64         JPackageHelper.deleteOutputFolder(OUTPUT);
    48         JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD);
    65         JPackageCreateAppImageBase.testCreateAppImage(CMD1);
       
    66 
       
    67         for (String path : paths) {
       
    68             commands[commands.length - 1] = path;
       
    69             System.out.println("using --add-modules " + path);
       
    70             JPackageHelper.deleteOutputFolder(OUTPUT);
       
    71             JPackageCreateAppImageBase.testCreateAppImageToolProvider(commands);
       
    72             System.out.println("succeeded");
       
    73         }
    49     }
    74     }
    50 
    75 
    51 }
    76 }