test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java
branchJDK-8200758-branch
changeset 57414 6eda749d3117
parent 57314 23da9e6f446f
child 57419 44c2481650ce
equal deleted inserted replaced
57413:45c74e654794 57414:6eda749d3117
    32  */
    32  */
    33 
    33 
    34 public class JPackageMissingArgumentsTest {
    34 public class JPackageMissingArgumentsTest {
    35     private static final String [] RESULT_1 = {"--output"};
    35     private static final String [] RESULT_1 = {"--output"};
    36     private static final String [] CMD_1 = {
    36     private static final String [] CMD_1 = {
    37         "create-app-image",
       
    38         "--input", "input",
    37         "--input", "input",
    39         "--name", "test",
    38         "--name", "test",
    40         "--main-jar", "hello.jar",
    39         "--main-jar", "hello.jar",
    41         "--main-class", "Hello",
    40         "--main-class", "Hello",
    42     };
    41     };
    43 
    42 
    44     private static final String [] RESULT_2 = {"--input"};
    43     private static final String [] RESULT_2 = {"--input"};
    45     private static final String [] CMD_2 = {
    44     private static final String [] CMD_2 = {
    46         "create-app-image",
       
    47         "--output", "output",
    45         "--output", "output",
    48         "--name", "test",
    46         "--name", "test",
    49         "--main-jar", "hello.jar",
    47         "--main-jar", "hello.jar",
    50         "--main-class", "Hello",
    48         "--main-class", "Hello",
    51     };
    49     };
    52 
    50 
    53     private static final String [] RESULT_3 = {"--input", "--app-image"};
    51     private static final String [] RESULT_3 = {"--input", "--app-image"};
    54     private static final String [] CMD_3 = {
    52     private static final String [] CMD_3 = {
    55         "create-installer",
    53         "--package-type", "invalid-package-type",
    56         "--output", "output",
    54         "--output", "output",
    57         "--name", "test",
    55         "--name", "test",
    58         "--main-jar", "hello.jar",
    56         "--main-jar", "hello.jar",
    59         "--main-class", "Hello",
    57         "--main-class", "Hello",
    60     };
    58     };
    61 
    59 
    62     private static final String [] RESULT_4 = {"main class was not specified"};
    60     private static final String [] RESULT_4 = {"main class was not specified"};
    63     private static final String [] CMD_4 = {
    61     private static final String [] CMD_4 = {
    64         "create-app-image",
       
    65         "--input", "input",
    62         "--input", "input",
    66         "--output", "output",
    63         "--output", "output",
    67         "--name", "test",
    64         "--name", "test",
    68         "--main-jar", "hello.jar",
    65         "--main-jar", "hello.jar",
    69     };
    66     };
    70 
    67 
    71     private static final String [] RESULT_5 = {"--main-jar"};
    68     private static final String [] RESULT_5 = {"--main-jar"};
    72     private static final String [] CMD_5 = {
    69     private static final String [] CMD_5 = {
    73         "create-app-image",
       
    74         "--input", "input",
    70         "--input", "input",
    75         "--output", "output",
    71         "--output", "output",
    76         "--name", "test",
    72         "--name", "test",
    77         "--main-class", "Hello",
    73         "--main-class", "Hello",
    78     };
    74     };
    79 
    75 
    80     private static final String [] RESULT_6 = {"--module-path", "--runtime-image"};
    76     private static final String [] RESULT_6 = {"--module-path", "--runtime-image"};
    81     private static final String [] CMD_6 = {
    77     private static final String [] CMD_6 = {
    82         "create-app-image",
       
    83         "--output", "output",
    78         "--output", "output",
    84         "--name", "test",
    79         "--name", "test",
    85         "--module", "com.hello/com.hello.Hello",
    80         "--module", "com.hello/com.hello.Hello",
    86     };
    81     };
    87 
    82 
    88     private static final String [] RESULT_7 = {"--module-path", "--runtime-image",
    83     private static final String [] RESULT_7 = {"--module-path", "--runtime-image",
    89                                                "--app-image"};
    84                                                "--app-image"};
    90     private static final String [] CMD_7 = {
    85     private static final String [] CMD_7 = {
    91         "create-installer",
    86         "--package-type", "invalid-package-type",
    92         "--output", "output",
    87         "--output", "output",
    93         "--name", "test",
    88         "--name", "test",
    94         "--module", "com.hello/com.hello.Hello",
    89         "--module", "com.hello/com.hello.Hello",
    95     };
    90     };
    96 
    91 
   131         output = JPackageHelper.executeCLI(false, CMD_6);
   126         output = JPackageHelper.executeCLI(false, CMD_6);
   132         validate(output, RESULT_6, true);
   127         validate(output, RESULT_6, true);
   133 
   128 
   134         output = JPackageHelper.executeCLI(false, CMD_7);
   129         output = JPackageHelper.executeCLI(false, CMD_7);
   135         validate(output, RESULT_7, true);
   130         validate(output, RESULT_7, true);
       
   131 
   136     }
   132     }
   137 
   133 
   138     private static void testMissingArgToolProvider() throws Exception {
   134     private static void testMissingArgToolProvider() throws Exception {
   139         String output = JPackageHelper.executeToolProvider(false, CMD_1);
   135         String output = JPackageHelper.executeToolProvider(false, CMD_1);
   140         validate(output, RESULT_1, true);
   136         validate(output, RESULT_1, true);