< prev index next >

test/jdk/tools/jpackage/share/jdk/jpackage/tests/BasicTest.java

Print this page




  48  * @summary jpackage basic testing
  49  * @library ../../../../helpers
  50  * @build jdk.jpackage.test.*
  51  * @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal
  52  * @compile BasicTest.java
  53  * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
  54  *  --jpt-run=jdk.jpackage.tests.BasicTest
  55  */
  56 
  57 public final class BasicTest {
  58     @Test
  59     public void testNoArgs() {
  60         List<String> output =
  61                 getJPackageToolProvider().executeAndGetOutput();
  62         TKit.assertStringListEquals(List.of("Usage: jpackage <options>",
  63                 "Use jpackage --help (or -h) for a list of possible options"),
  64                 output, "Check jpackage output");
  65     }
  66 
  67     @Test






















  68     public void testVersion() {
  69         List<String> output =
  70                 getJPackageToolProvider()
  71                         .addArgument("--version")
  72                         .executeAndGetOutput();
  73         TKit.assertStringListEquals(List.of(System.getProperty("java.version")),
  74                 output, "Check jpackage output");
  75     }
  76 
  77     @Test
  78     public void testHelp() {
  79         List<String> hOutput = getJPackageToolProvider()
  80                 .addArgument("-h").executeAndGetOutput();
  81         List<String> helpOutput = getJPackageToolProvider()
  82                 .addArgument("--help").executeAndGetOutput();
  83 
  84         TKit.assertStringListEquals(hOutput, helpOutput,
  85                 "Check -h and --help parameters produce the same output");
  86 
  87         final String windowsPrefix = "--win-";




  48  * @summary jpackage basic testing
  49  * @library ../../../../helpers
  50  * @build jdk.jpackage.test.*
  51  * @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal
  52  * @compile BasicTest.java
  53  * @run main/othervm/timeout=720 -Xmx512m jdk.jpackage.test.Main
  54  *  --jpt-run=jdk.jpackage.tests.BasicTest
  55  */
  56 
  57 public final class BasicTest {
  58     @Test
  59     public void testNoArgs() {
  60         List<String> output =
  61                 getJPackageToolProvider().executeAndGetOutput();
  62         TKit.assertStringListEquals(List.of("Usage: jpackage <options>",
  63                 "Use jpackage --help (or -h) for a list of possible options"),
  64                 output, "Check jpackage output");
  65     }
  66 
  67     @Test
  68     public void testJpackageProps() {
  69         String appVersion = "3.0";
  70         JPackageCommand cmd = JPackageCommand.helloAppImage(
  71                 JavaAppDesc.parse("Hello"))
  72                 // Disable default logic adding `--verbose` option
  73                 // to jpackage command line.
  74                 .ignoreDefaultVerbose(true)
  75                 .saveConsoleOutput(true)
  76                 .addArguments("--app-version", appVersion, "--arguments",
  77                     "jpackage.app-version jpackage.app-path")
  78                 .ignoreDefaultRuntime(true);
  79 
  80         cmd.executeAndAssertImageCreated();
  81         Path launcherPath = cmd.appLauncherPath();
  82 
  83         List<String> output = HelloApp.executeLauncher(cmd).getOutput();
  84 
  85         TKit.assertTextStream("jpackage.app-version=" + appVersion).apply(output.stream());
  86         TKit.assertTextStream("jpackage.app-path=").apply(output.stream());
  87     }
  88 
  89     @Test
  90     public void testVersion() {
  91         List<String> output =
  92                 getJPackageToolProvider()
  93                         .addArgument("--version")
  94                         .executeAndGetOutput();
  95         TKit.assertStringListEquals(List.of(System.getProperty("java.version")),
  96                 output, "Check jpackage output");
  97     }
  98 
  99     @Test
 100     public void testHelp() {
 101         List<String> hOutput = getJPackageToolProvider()
 102                 .addArgument("-h").executeAndGetOutput();
 103         List<String> helpOutput = getJPackageToolProvider()
 104                 .addArgument("--help").executeAndGetOutput();
 105 
 106         TKit.assertStringListEquals(hOutput, helpOutput,
 107                 "Check -h and --help parameters produce the same output");
 108 
 109         final String windowsPrefix = "--win-";


< prev index next >