test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java
branchJDK-8200758-branch
changeset 57241 e11f3bf34083
parent 57150 fa68c2ab636d
equal deleted inserted replaced
57220:6a80fd1912ef 57241:e11f3bf34083
    33  * @build JPackagePath
    33  * @build JPackagePath
    34  * @modules jdk.jpackage
    34  * @modules jdk.jpackage
    35  * @run main/othervm -Xmx512m JPackageCreateImageVersionTest
    35  * @run main/othervm -Xmx512m JPackageCreateImageVersionTest
    36  */
    36  */
    37 public class JPackageCreateImageVersionTest {
    37 public class JPackageCreateImageVersionTest {
       
    38     private static final String OUTPUT = "output";
    38     private static final String appCfg = JPackagePath.getAppCfg();
    39     private static final String appCfg = JPackagePath.getAppCfg();
    39     private static final String VERSION = "2.3";
    40     private static final String VERSION = "2.3";
    40     private static final String VERSION_DEFAULT = "1.0";
    41     private static final String VERSION_DEFAULT = "1.0";
    41 
    42 
    42     private static final String[] CMD = {
    43     private static final String[] CMD = {
    43         "create-image",
    44         "create-image",
    44         "--input", "input",
    45         "--input", "input",
    45         "--output", "output",
    46         "--output", OUTPUT,
    46         "--name", "test",
    47         "--name", "test",
    47         "--main-jar", "hello.jar",
    48         "--main-jar", "hello.jar",
    48         "--main-class", "Hello",
    49         "--main-class", "Hello",
    49         "--overwrite",
       
    50         "--files", "hello.jar"};
    50         "--files", "hello.jar"};
    51 
    51 
    52     private static final String[] CMD_VERSION = {
    52     private static final String[] CMD_VERSION = {
    53         "create-image",
    53         "create-image",
    54         "--input", "input",
    54         "--input", "input",
    55         "--output", "output",
    55         "--output", OUTPUT,
    56         "--name", "test",
    56         "--name", "test",
    57         "--main-jar", "hello.jar",
    57         "--main-jar", "hello.jar",
    58         "--main-class", "Hello",
    58         "--main-class", "Hello",
    59         "--files", "hello.jar",
    59         "--files", "hello.jar",
    60         "--overwrite",
       
    61         "--app-version", VERSION};
    60         "--app-version", VERSION};
    62 
    61 
    63     private static void validate(String version)
    62     private static void validate(String version)
    64             throws Exception {
    63             throws Exception {
    65         File outfile = new File(appCfg);
    64         File outfile = new File(appCfg);
    80     }
    79     }
    81 
    80 
    82     private static void testVersion() throws Exception {
    81     private static void testVersion() throws Exception {
    83         JPackageHelper.executeCLI(true, CMD);
    82         JPackageHelper.executeCLI(true, CMD);
    84         validate(null);
    83         validate(null);
       
    84         JPackageHelper.deleteOutputFolder(OUTPUT);
    85         JPackageHelper.executeCLI(true, CMD_VERSION);
    85         JPackageHelper.executeCLI(true, CMD_VERSION);
    86         validate(VERSION);
    86         validate(VERSION);
    87     }
    87     }
    88 
    88 
    89     private static void testVersionToolProvider() throws Exception {
    89     private static void testVersionToolProvider() throws Exception {
       
    90         JPackageHelper.deleteOutputFolder(OUTPUT);
    90         JPackageHelper.executeToolProvider(true, CMD);
    91         JPackageHelper.executeToolProvider(true, CMD);
    91         validate(null);
    92         validate(null);
       
    93         JPackageHelper.deleteOutputFolder(OUTPUT);
    92         JPackageHelper.executeToolProvider(true, CMD_VERSION);
    94         JPackageHelper.executeToolProvider(true, CMD_VERSION);
    93         validate(VERSION);
    95         validate(VERSION);
    94     }
    96     }
    95 
    97 
    96     public static void main(String[] args) throws Exception {
    98     public static void main(String[] args) throws Exception {