< 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("com.hello/com.hello.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 
  79         cmd.executeAndAssertImageCreated();
  80 
  81         Path launcherPath = cmd.appLauncherPath();
  82         if (!cmd.isFakeRuntime(String.format(
  83                 "Not running [%s] launcher", launcherPath))) {
  84             List<String> output = HelloApp.executeLauncher(cmd).getOutput();
  85 
  86             TKit.assertTextStream("jpackage.app-version=" + appVersion)
  87                     .apply(output.stream());
  88             TKit.assertTextStream("jpackage.app-path=")
  89                     .apply(output.stream());
  90         }
  91     }
  92 
  93     @Test
  94     public void testVersion() {
  95         List<String> output =
  96                 getJPackageToolProvider()
  97                         .addArgument("--version")
  98                         .executeAndGetOutput();
  99         TKit.assertStringListEquals(List.of(System.getProperty("java.version")),
 100                 output, "Check jpackage output");
 101     }
 102 
 103     @Test
 104     public void testHelp() {
 105         List<String> hOutput = getJPackageToolProvider()
 106                 .addArgument("-h").executeAndGetOutput();
 107         List<String> helpOutput = getJPackageToolProvider()
 108                 .addArgument("--help").executeAndGetOutput();
 109 
 110         TKit.assertStringListEquals(hOutput, helpOutput,
 111                 "Check -h and --help parameters produce the same output");
 112 
 113         final String windowsPrefix = "--win-";


< prev index next >