< prev index next >

test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java

Print this page




  22  */
  23 
  24  /*
  25  * @test
  26  * @summary jpackage create image missing arguments test
  27  * @library helpers
  28  * @build JPackageHelper
  29  * @build JPackagePath
  30  * @modules jdk.jpackage
  31  * @run main/othervm -Xmx512m JPackageMissingArgumentsTest
  32  */
  33 
  34 public class JPackageMissingArgumentsTest {
  35     private static final String [] RESULT_1 = {"--output"};
  36     private static final String [] CMD_1 = {
  37         "create-image",
  38         "--input", "input",
  39         "--name", "test",
  40         "--main-jar", "hello.jar",
  41         "--main-class", "Hello",
  42         "--overwrite",
  43         "--files", "hello.jar"};
  44 
  45     private static final String [] RESULT_2 = {"--input"};
  46     private static final String [] CMD_2 = {
  47         "create-image",
  48         "--output", "output",
  49         "--name", "test",
  50         "--main-jar", "hello.jar",
  51         "--main-class", "Hello",
  52         "--overwrite",
  53         "--files", "hello.jar"};
  54 
  55     private static final String [] RESULT_3 = {"--input", "--app-image"};
  56     private static final String [] CMD_3 = {
  57         "create-installer",
  58         "--output", "output",
  59         "--name", "test",
  60         "--main-jar", "hello.jar",
  61         "--main-class", "Hello",
  62         "--overwrite",
  63         "--files", "hello.jar"};
  64 
  65     private static final String [] RESULT_4 = {"--main-class"};
  66     private static final String [] CMD_4 = {
  67         "create-image",
  68         "--input", "input",
  69         "--output", "output",
  70         "--name", "test",
  71         "--main-jar", "hello.jar",
  72         "--overwrite",
  73         "--files", "hello.jar"};
  74 
  75     private static final String [] RESULT_5 = {"--main-jar"};
  76     private static final String [] CMD_5 = {
  77         "create-image",
  78         "--input", "input",
  79         "--output", "output",
  80         "--name", "test",
  81         "--main-class", "Hello",
  82         "--overwrite",
  83         "--files", "hello.jar"};
  84 
  85     private static final String [] RESULT_6 = {"--module-path", "--runtime-image"};
  86     private static final String [] CMD_6 = {
  87         "create-image",
  88         "--output", "output",
  89         "--name", "test",
  90         "--module", "com.hello/com.hello.Hello",
  91         "--overwrite",
  92         "--files", "hello.jar"};
  93 
  94     private static final String [] RESULT_7 = {"--module-path", "--runtime-image",
  95                                                "--app-image"};
  96     private static final String [] CMD_7 = {
  97         "create-installer",
  98         "--output", "output",
  99         "--name", "test",
 100         "--module", "com.hello/com.hello.Hello",
 101         "--overwrite",
 102         "--files", "hello.jar"};
 103 
 104     private static void validate(String output, String [] expected)
 105            throws Exception {
 106         String[] result = output.split("\n");
 107         if (result.length != 1) {
 108             System.err.println(output);
 109             throw new AssertionError("Invalid number of lines in output: "
 110                     + result.length);
 111         }
 112 
 113         for (String s : expected) {
 114             if (!result[0].contains(s)) {
 115                 System.err.println("Expected to contain: " + s);
 116                 System.err.println("Actual: " + result[0]);
 117                 throw new AssertionError("Unexpected error message");
 118             }
 119         }
 120     }
 121 




  22  */
  23 
  24  /*
  25  * @test
  26  * @summary jpackage create image missing arguments test
  27  * @library helpers
  28  * @build JPackageHelper
  29  * @build JPackagePath
  30  * @modules jdk.jpackage
  31  * @run main/othervm -Xmx512m JPackageMissingArgumentsTest
  32  */
  33 
  34 public class JPackageMissingArgumentsTest {
  35     private static final String [] RESULT_1 = {"--output"};
  36     private static final String [] CMD_1 = {
  37         "create-image",
  38         "--input", "input",
  39         "--name", "test",
  40         "--main-jar", "hello.jar",
  41         "--main-class", "Hello",

  42         "--files", "hello.jar"};
  43 
  44     private static final String [] RESULT_2 = {"--input"};
  45     private static final String [] CMD_2 = {
  46         "create-image",
  47         "--output", "output",
  48         "--name", "test",
  49         "--main-jar", "hello.jar",
  50         "--main-class", "Hello",

  51         "--files", "hello.jar"};
  52 
  53     private static final String [] RESULT_3 = {"--input", "--app-image"};
  54     private static final String [] CMD_3 = {
  55         "create-installer",
  56         "--output", "output",
  57         "--name", "test",
  58         "--main-jar", "hello.jar",
  59         "--main-class", "Hello",

  60         "--files", "hello.jar"};
  61 
  62     private static final String [] RESULT_4 = {"--main-class"};
  63     private static final String [] CMD_4 = {
  64         "create-image",
  65         "--input", "input",
  66         "--output", "output",
  67         "--name", "test",
  68         "--main-jar", "hello.jar",

  69         "--files", "hello.jar"};
  70 
  71     private static final String [] RESULT_5 = {"--main-jar"};
  72     private static final String [] CMD_5 = {
  73         "create-image",
  74         "--input", "input",
  75         "--output", "output",
  76         "--name", "test",
  77         "--main-class", "Hello",

  78         "--files", "hello.jar"};
  79 
  80     private static final String [] RESULT_6 = {"--module-path", "--runtime-image"};
  81     private static final String [] CMD_6 = {
  82         "create-image",
  83         "--output", "output",
  84         "--name", "test",
  85         "--module", "com.hello/com.hello.Hello",

  86         "--files", "hello.jar"};
  87 
  88     private static final String [] RESULT_7 = {"--module-path", "--runtime-image",
  89                                                "--app-image"};
  90     private static final String [] CMD_7 = {
  91         "create-installer",
  92         "--output", "output",
  93         "--name", "test",
  94         "--module", "com.hello/com.hello.Hello",

  95         "--files", "hello.jar"};
  96 
  97     private static void validate(String output, String [] expected)
  98            throws Exception {
  99         String[] result = output.split("\n");
 100         if (result.length != 1) {
 101             System.err.println(output);
 102             throw new AssertionError("Invalid number of lines in output: "
 103                     + result.length);
 104         }
 105 
 106         for (String s : expected) {
 107             if (!result[0].contains(s)) {
 108                 System.err.println("Expected to contain: " + s);
 109                 System.err.println("Actual: " + result[0]);
 110                 throw new AssertionError("Unexpected error message");
 111             }
 112         }
 113     }
 114 


< prev index next >