20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.io.File;
25 import java.nio.file.Files;
26
27 /*
28 * @test
29 * @summary jpackage create image with --java-options test
30 * @library ../helpers
31 * @build JPackageHelper
32 * @build JPackagePath
33 * @build JPackageCreateAppImageJavaOptionsBase
34 * @modules jdk.jpackage
35 * @run main/othervm -Xmx512m JPackageCreateAppImageJavaOptionsEqualsTest
36 */
37 public class JPackageCreateAppImageJavaOptionsEqualsTest {
38
39 private static final String app = JPackagePath.getApp();
40 private static final String appWorkingDir = JPackagePath.getAppWorkingDir();
41
42 private static final String OUTPUT = "output";
43
44 private static final String[] CMD = {
45 "--input", "input",
46 "--description", "the two options below should cause two app execution "
47 + "Warnings with two lines output saying: "
48 + "WARNING: Unknown module: <module-name>",
49 "--output", OUTPUT,
50 "--name", "test",
51 "--main-jar", "hello.jar",
52 "--main-class", "Hello",
53 "--java-options",
54 "--add-exports=java.base/sun.util=me.mymodule.foo,ALL-UNNAMED",
55 "--java-options",
56 "--add-exports=java.base/sun.security.util=other.mod.bar,ALL-UNNAMED",
57 };
58
59 private static void validate() throws Exception {
60 File outfile = new File(appWorkingDir + File.separator + "app.out");
61
62 int retVal = JPackageHelper.execute(outfile, app);
63 if (retVal != 0) {
64 throw new AssertionError(
65 "Test application exited with error: " + retVal);
66 }
67
68 if (!outfile.exists()) {
69 throw new AssertionError(
70 "outfile: " + outfile + " was not created");
71 }
72
73 String output = Files.readString(outfile.toPath());
74 String[] result = JPackageHelper.splitAndFilter(output);
75 if (result.length != 4) {
76 throw new AssertionError(
77 "Unexpected number of lines: " + result.length
78 + " - output: " + output);
79 }
80
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.io.File;
25 import java.nio.file.Files;
26
27 /*
28 * @test
29 * @summary jpackage create image with --java-options test
30 * @library ../helpers
31 * @build JPackageHelper
32 * @build JPackagePath
33 * @build JPackageCreateAppImageJavaOptionsBase
34 * @modules jdk.jpackage
35 * @run main/othervm -Xmx512m JPackageCreateAppImageJavaOptionsEqualsTest
36 */
37 public class JPackageCreateAppImageJavaOptionsEqualsTest {
38
39 private static final String app = JPackagePath.getApp();
40
41 private static final String OUTPUT = "output";
42
43 private static final String[] CMD = {
44 "--input", "input",
45 "--description", "the two options below should cause two app execution "
46 + "Warnings with two lines output saying: "
47 + "WARNING: Unknown module: <module-name>",
48 "--output", OUTPUT,
49 "--name", "test",
50 "--main-jar", "hello.jar",
51 "--main-class", "Hello",
52 "--java-options",
53 "--add-exports=java.base/sun.util=me.mymodule.foo,ALL-UNNAMED",
54 "--java-options",
55 "--add-exports=java.base/sun.security.util=other.mod.bar,ALL-UNNAMED",
56 };
57
58 private static void validate() throws Exception {
59 File outfile = new File("app.out");
60
61 int retVal = JPackageHelper.execute(outfile, app);
62 if (retVal != 0) {
63 throw new AssertionError(
64 "Test application exited with error: " + retVal);
65 }
66
67 if (!outfile.exists()) {
68 throw new AssertionError(
69 "outfile: " + outfile + " was not created");
70 }
71
72 String output = Files.readString(outfile.toPath());
73 String[] result = JPackageHelper.splitAndFilter(output);
74 if (result.length != 4) {
75 throw new AssertionError(
76 "Unexpected number of lines: " + result.length
77 + " - output: " + output);
78 }
79
|