test/jdk/tools/jpackage/createimage/JPackageCreateImageInputFilesTest.java
branchJDK-8200758-branch
changeset 57241 e11f3bf34083
parent 57150 fa68c2ab636d
equal deleted inserted replaced
57220:6a80fd1912ef 57241:e11f3bf34083
    34  * @build JPackagePath
    34  * @build JPackagePath
    35  * @modules jdk.jpackage
    35  * @modules jdk.jpackage
    36  * @run main/othervm -Xmx512m JPackageCreateImageInputFilesTest
    36  * @run main/othervm -Xmx512m JPackageCreateImageInputFilesTest
    37  */
    37  */
    38 public class JPackageCreateImageInputFilesTest {
    38 public class JPackageCreateImageInputFilesTest {
       
    39     private static final String OUTPUT = "output";
    39     private static final String inputFile =
    40     private static final String inputFile =
    40             "input" + File.separator + "input.txt";
    41             "input" + File.separator + "input.txt";
    41     private static final String jarFile =
    42     private static final String jarFile =
    42             "input" + File.separator + "hello.jar";
    43             "input" + File.separator + "hello.jar";
    43     private static final String appInputFilePath;
    44     private static final String appInputFilePath;
    49     }
    50     }
    50 
    51 
    51     private static final String [] CMD_1 = {
    52     private static final String [] CMD_1 = {
    52         "create-image",
    53         "create-image",
    53         "--input", "input",
    54         "--input", "input",
    54         "--output", "output",
    55         "--output", OUTPUT,
    55         "--name", "test",
    56         "--name", "test",
    56         "--main-jar", "hello.jar",
    57         "--main-jar", "hello.jar",
    57         "--overwrite",
       
    58         "--main-class", "Hello"};
    58         "--main-class", "Hello"};
    59 
    59 
    60     private static final String [] CMD_2 = {
    60     private static final String [] CMD_2 = {
    61         "create-image",
    61         "create-image",
    62         "--input", "input",
    62         "--input", "input",
    63         "--output", "output",
    63         "--output", OUTPUT,
    64         "--name", "test",
    64         "--name", "test",
    65         "--main-jar", "hello.jar",
    65         "--main-jar", "hello.jar",
    66         "--main-class", "Hello",
    66         "--main-class", "Hello",
    67         "--overwrite",
       
    68         "--files", "hello.jar"};
    67         "--files", "hello.jar"};
    69 
    68 
    70     private static void validate1() throws Exception {
    69     private static void validate1() throws Exception {
    71         File input = new File(appInputFilePath);
    70         File input = new File(appInputFilePath);
    72         if (!input.exists()) {
    71         if (!input.exists()) {
    97 
    96 
    98     private static void testCreateImage() throws Exception {
    97     private static void testCreateImage() throws Exception {
    99         JPackageHelper.executeCLI(true, CMD_1);
    98         JPackageHelper.executeCLI(true, CMD_1);
   100         validate1();
    99         validate1();
   101 
   100 
       
   101         JPackageHelper.deleteOutputFolder(OUTPUT);
   102         JPackageHelper.executeCLI(true, CMD_2);
   102         JPackageHelper.executeCLI(true, CMD_2);
   103         validate2();
   103         validate2();
   104     }
   104     }
   105 
   105 
   106     private static void testCreateImageToolProvider() throws Exception {
   106     private static void testCreateImageToolProvider() throws Exception {
       
   107         JPackageHelper.deleteOutputFolder(OUTPUT);
   107         JPackageHelper.executeToolProvider(true, CMD_1);
   108         JPackageHelper.executeToolProvider(true, CMD_1);
   108         validate1();
   109         validate1();
   109 
   110 
       
   111         JPackageHelper.deleteOutputFolder(OUTPUT);
   110         JPackageHelper.executeToolProvider(true, CMD_2);
   112         JPackageHelper.executeToolProvider(true, CMD_2);
   111         validate2();
   113         validate2();
   112     }
   114     }
   113 
   115 
   114     private static void createInputFile() throws Exception {
   116     private static void createInputFile() throws Exception {