test/jdk/tools/jpackage/share/RuntimePackageTest.java
branchJDK-8200758-branch
changeset 58301 e0efb29609bd
parent 58113 885b0543f6e4
child 58416 f09bf58c1f17
equal deleted inserted replaced
58172:bf06a1d3aef6 58301:e0efb29609bd
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
       
    24 import java.nio.file.Path;
       
    25 import java.util.Optional;
       
    26 import jdk.jpackage.test.Test;
    24 import jdk.jpackage.test.PackageTest;
    27 import jdk.jpackage.test.PackageTest;
       
    28 import jdk.jpackage.test.JPackageCommand;
    25 
    29 
    26 /**
    30 /**
    27  * Test --runtime-image parameter.
    31  * Test --runtime-image parameter.
    28  * Output of the test should be RuntimePackageTest*.* installer.
    32  * Output of the test should be RuntimePackageTest*.* installer.
    29  * The installer should install Java Runtime without an application.
    33  * The installer should install Java Runtime without an application.
    39 /*
    43 /*
    40  * @test
    44  * @test
    41  * @summary jpackage with --runtime-image
    45  * @summary jpackage with --runtime-image
    42  * @library ../helpers
    46  * @library ../helpers
    43  * @comment Temporary disable for Linux and OSX until functionality implemented
    47  * @comment Temporary disable for Linux and OSX until functionality implemented
    44  * @requires (os.family == "windows")
    48  * @requires (os.family != "mac")
    45  * @modules jdk.jpackage/jdk.jpackage.internal
    49  * @modules jdk.jpackage/jdk.jpackage.internal
    46  * @run main/othervm -Xmx512m RuntimePackageTest
    50  * @run main/othervm/timeout=360 -Xmx512m RuntimePackageTest
    47  */
    51  */
    48 public class RuntimePackageTest {
    52 public class RuntimePackageTest {
    49 
    53 
    50     public static void main(String[] args) {
    54     public static void main(String[] args) {
    51         new PackageTest()
    55         Test.run(args, () -> {
    52         .addInitializer(cmd -> {
    56             new PackageTest()
    53             cmd.addArguments("--runtime-image", System.getProperty("java.home"));
    57             .addInitializer(cmd -> {
    54             // Remove --input parameter from jpackage command line as we don't
    58                 cmd.addArguments("--runtime-image", Optional.ofNullable(
    55             // create input directory in the test and jpackage fails
    59                         JPackageCommand.DEFAULT_RUNTIME_IMAGE).orElse(Path.of(
    56             // if --input references non existant directory.
    60                                 System.getProperty("java.home"))));
    57             cmd.setArgumentValue("--input", null);
    61                 // Remove --input parameter from jpackage command line as we don't
    58         })
    62                 // create input directory in the test and jpackage fails
    59         .run();
    63                 // if --input references non existant directory.
       
    64                 cmd.removeArgument("--input");
       
    65             })
       
    66             .run();
       
    67         });
    60     }
    68     }
    61 }
    69 }