--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java Sat Jun 29 09:11:19 2019 -0400
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java Mon Jul 01 18:31:16 2019 -0400
@@ -57,6 +57,7 @@
private final Path root;
private final Path appDir;
private final Path appModsDir;
+ private final String relativeModsDir;
private final Path runtimeDir;
private final Path binDir;
private final Path mdir;
@@ -88,6 +89,7 @@
this.root = imageOutDir.resolve(APP_NAME.fetchFrom(config));
this.appDir = root.resolve("app");
this.appModsDir = appDir.resolve("mods");
+ this.relativeModsDir = "app/mods";
this.runtimeDir = root.resolve("runtime");
this.binDir = root.resolve("bin");
this.mdir = runtimeDir.resolve("lib");
@@ -107,6 +109,7 @@
this.root = imageOutDir.resolve(appName);
this.appDir = null;
this.appModsDir = null;
+ this.relativeModsDir = null;
this.runtimeDir = null;
this.binDir = null;
this.mdir = null;
@@ -150,6 +153,11 @@
}
@Override
+ public String getRelativeModsDir() {
+ return relativeModsDir;
+ }
+
+ @Override
public void prepareApplicationFiles() throws IOException {
Map<String, ? super Object> originalParams = new HashMap<>(params);
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java Sat Jun 29 09:11:19 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacAppImageBuilder.java Mon Jul 01 18:31:16 2019 -0400
@@ -76,6 +76,7 @@
private final Path contentsDir;
private final Path javaDir;
private final Path javaModsDir;
+ private final String relativeModsDir;
private final Path resourcesDir;
private final Path macOSDir;
private final Path runtimeDir;
@@ -175,6 +176,7 @@
this.contentsDir = root.resolve("Contents");
this.javaDir = contentsDir.resolve("Java");
this.javaModsDir = javaDir.resolve("mods");
+ this.relativeModsDir = "Java/mods";
this.resourcesDir = contentsDir.resolve("Resources");
this.macOSDir = contentsDir.resolve("MacOS");
this.runtimeDir = contentsDir.resolve("runtime");
@@ -197,6 +199,7 @@
this.contentsDir = root.resolve("Contents");
this.javaDir = null;
this.javaModsDir = null;
+ this.relativeModsDir = null;
this.resourcesDir = null;
this.macOSDir = null;
this.runtimeDir = this.root;
@@ -275,6 +278,11 @@
}
@Override
+ public String getRelativeModsDir() {
+ return relativeModsDir;
+ }
+
+ @Override
public void prepareApplicationFiles() throws IOException {
Map<String, ? super Object> originalParams = new HashMap<>(params);
// Generate PkgInfo
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Sat Jun 29 09:11:19 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractAppImageBuilder.java Mon Jul 01 18:31:16 2019 -0400
@@ -68,6 +68,7 @@
public abstract void prepareJreFiles() throws IOException;
public abstract Path getAppDir();
public abstract Path getAppModsDir();
+ public abstract String getRelativeModsDir();
public Path getRoot() {
return this.root;
@@ -219,9 +220,10 @@
out.println(arg);
}
Path modsDir = getAppModsDir();
+
if (modsDir != null && modsDir.toFile().exists()) {
out.println("--module-path");
- out.println("$APPDIR/app/" + getAppDir().relativize(modsDir));
+ out.println("$APPDIR/" + getRelativeModsDir());
}
out.println();
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java Sat Jun 29 09:11:19 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java Mon Jul 01 18:31:16 2019 -0400
@@ -191,12 +191,14 @@
InputStreamReader isr = new InputStreamReader(p.getInputStream());
BufferedReader br = new BufferedReader(isr);
String lineRead;
+ String output = "";
while ((lineRead = br.readLine()) != null) {
if (consumer != null) {
consumer.print(lineRead + '\n');
} else {
Log.verbose(lineRead);
}
+ output += lineRead;
}
try {
int ret = p.waitFor();
@@ -206,7 +208,8 @@
+ Arrays.toString(pb.command().toArray(new String[0]))
+ " in " + (pb.directory() != null ?
pb.directory().getAbsolutePath() :
- "unspecified directory"));
+ "unspecified directory")
+ + " output: " + output);
}
} catch (InterruptedException ex) {
}
--- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java Sat Jun 29 09:11:19 2019 -0400
+++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java Mon Jul 01 18:31:16 2019 -0400
@@ -74,6 +74,7 @@
private final Path root;
private final Path appDir;
private final Path appModsDir;
+ private final String relativeModsDir;
private final Path runtimeDir;
private final Path mdir;
private final Path binDir;
@@ -124,6 +125,7 @@
this.root = imageOutDir.resolve(APP_NAME.fetchFrom(params));
this.appDir = root.resolve("app");
this.appModsDir = appDir.resolve("mods");
+ this.relativeModsDir = "app/mods";
this.runtimeDir = root.resolve("runtime");
this.mdir = runtimeDir.resolve("lib");
this.binDir = root.resolve("bin");
@@ -141,6 +143,7 @@
this.root = imageOutDir.resolve(jreName);
this.appDir = null;
this.appModsDir = null;
+ this.relativeModsDir = null;
this.runtimeDir = root;
this.mdir = runtimeDir.resolve("lib");
this.binDir = null;
@@ -197,6 +200,11 @@
}
@Override
+ public String getRelativeModsDir() {
+ return relativeModsDir;
+ }
+
+ @Override
public void prepareApplicationFiles() throws IOException {
Map<String, ? super Object> originalParams = new HashMap<>(params);
--- a/test/jdk/tools/jpackage/JPackageHelpTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage help test
- * @library helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageHelpTest
- */
-public class JPackageHelpTest {
-
- // Platform specific help messages.
- private static final String WINDOWS_HELP =
- "--win-dir-chooser";
- private static final String OSX_HELP =
- "--mac-bundle-identifier";
- private static final String LINUX_HELP =
- "--linux-bundle-name";
-
- private static void validate(String output1, String output2)
- throws Exception {
- if (output1.split("\n").length < 25) {
- throw new AssertionError("jpacakger --help failed");
- }
-
- if (output2.split("\n").length < 25) {
- throw new AssertionError("jpacakger -h failed");
- }
-
- // Make sure output matches for --help and -h
- if (!output1.equals(output2)) {
- System.err.println("================= --help =================");
- System.err.println(output1);
-
- System.err.println("=================== -h ===================");
- System.err.println(output2);
-
- throw new AssertionError(
- "jpacakger help text does not match between --help and -h");
- }
-
- if (JPackageHelper.isWindows()) {
- if (!output1.contains(WINDOWS_HELP)) {
- throw new AssertionError(
- "jpacakger help text missing Windows specific help");
- }
-
- if (output1.contains(OSX_HELP) || output1.contains(LINUX_HELP)) {
- throw new AssertionError(
- "jpacakger help text contains other platforms specific help");
-
- }
- } else if (JPackageHelper.isOSX()) {
- if (!output1.contains(OSX_HELP)) {
- throw new AssertionError(
- "jpacakger help text missing OS X specific help");
- }
-
- if (output1.contains(WINDOWS_HELP) ||
- output1.contains(LINUX_HELP)) {
- throw new AssertionError(
- "jpacakger help text contains other platforms specific help");
- }
- } else if (JPackageHelper.isLinux()) {
- if (!output1.contains(LINUX_HELP)) {
- throw new AssertionError(
- "jpacakger help text missing Linux specific help");
- }
-
- if (output1.contains(OSX_HELP) || output1.contains(WINDOWS_HELP)) {
- throw new AssertionError(
- "jpacakger help text contains other platforms specific help");
- }
- }
- }
-
- private static void testHelp() throws Exception {
- String output1 = JPackageHelper.executeCLI(true, "--help");
- String output2 = JPackageHelper.executeCLI(true, "-h");
- validate(output1, output2);
- }
-
- private static void testHelpToolProvider() throws Exception {
- String output1 = JPackageHelper.executeToolProvider(true, "--help");
- String output2 = JPackageHelper.executeToolProvider(true, "-h");
- validate(output1, output2);
- }
-
- public static void main(String[] args) throws Exception {
- testHelp();
- testHelpToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/JPackageInvalidArgTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage invalid argument test
- * @library helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageInvalidArgTest
- */
-public class JPackageInvalidArgTest {
-
- private static final String ARG1 = "--no-such-argument";
- private static final String ARG2 = "--output";
- private static final String RESULT1 =
- "Invalid Option: [--no-such-argument]";
- private static final String RESULT2 = "--main-jar or --module";
-
- private static void validate(String arg, String output) throws Exception {
- String[] result = JPackageHelper.splitAndFilter(output);
- if (result.length != 1) {
- System.err.println(output);
- throw new AssertionError("Invalid number of lines in output: "
- + result.length);
- }
-
- if (arg.equals(ARG1)) {
- if (!result[0].trim().contains(RESULT1)) {
- System.err.println("Expected: " + RESULT1);
- System.err.println("Actual: " + result[0]);
- throw new AssertionError("Unexpected output: " + result[0]);
- }
- } else if (arg.equals(ARG2)) {
- if (!result[0].trim().contains(RESULT2)) {
- System.err.println("Expected: " + RESULT2);
- System.err.println("Actual: " + result[0]);
- throw new AssertionError("Unexpected output: " + result[0]);
- }
- }
- }
-
- private static void testInvalidArg() throws Exception {
- String output = JPackageHelper.executeCLI(false, ARG1);
- validate(ARG1, output);
- output = JPackageHelper.executeCLI(false, ARG2);
- validate(ARG2, output);
- }
-
- private static void testInvalidArgToolProvider() throws Exception {
- String output = JPackageHelper.executeToolProvider(false, ARG1);
- validate(ARG1, output);
- output = JPackageHelper.executeToolProvider(false, ARG2);
- validate(ARG2, output);
- }
-
- public static void main(String[] args) throws Exception {
- testInvalidArg();
- testInvalidArgToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image missing arguments test
- * @library helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageMissingArgumentsTest
- */
-
-public class JPackageMissingArgumentsTest {
- private static final String [] RESULT_1 = {"--output"};
- private static final String [] CMD_1 = {
- "--input", "input",
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- private static final String [] RESULT_2 = {"--input"};
- private static final String [] CMD_2 = {
- "--output", "output",
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- private static final String [] RESULT_3 = {"--input", "--app-image"};
- private static final String [] CMD_3 = {
- "--package-type", "invalid-package-type",
- "--output", "output",
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- private static final String [] RESULT_4 = {"main class was not specified"};
- private static final String [] CMD_4 = {
- "--input", "input",
- "--output", "output",
- "--name", "test",
- "--main-jar", "hello.jar",
- };
-
- private static final String [] RESULT_5 = {"--main-jar"};
- private static final String [] CMD_5 = {
- "--input", "input",
- "--output", "output",
- "--name", "test",
- "--main-class", "Hello",
- };
-
- private static final String [] RESULT_6 = {"--module-path", "--runtime-image"};
- private static final String [] CMD_6 = {
- "--output", "output",
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- };
-
- private static final String [] RESULT_7 = {"--module-path", "--runtime-image",
- "--app-image"};
- private static final String [] CMD_7 = {
- "--package-type", "invalid-package-type",
- "--output", "output",
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- };
-
- private static void validate(String output, String [] expected,
- boolean single) throws Exception {
- String[] result = JPackageHelper.splitAndFilter(output);
- if (single && result.length != 1) {
- System.err.println(output);
- throw new AssertionError("Invalid number of lines in output: "
- + result.length);
- }
-
- for (String s : expected) {
- if (!result[0].contains(s)) {
- System.err.println("Expected to contain: " + s);
- System.err.println("Actual: " + result[0]);
- throw new AssertionError("Unexpected error message");
- }
- }
- }
-
- private static void testMissingArg() throws Exception {
- String output = JPackageHelper.executeCLI(false, CMD_1);
- validate(output, RESULT_1, true);
-
- output = JPackageHelper.executeCLI(false, CMD_2);
- validate(output, RESULT_2, true);
-
- output = JPackageHelper.executeCLI(false, CMD_3);
- validate(output, RESULT_3, true);
-
- output = JPackageHelper.executeCLI(false, CMD_4);
- validate(output, RESULT_4, false);
-
- output = JPackageHelper.executeCLI(false, CMD_5);
- validate(output, RESULT_5, true);
-
- output = JPackageHelper.executeCLI(false, CMD_6);
- validate(output, RESULT_6, true);
-
- output = JPackageHelper.executeCLI(false, CMD_7);
- validate(output, RESULT_7, true);
-
- }
-
- private static void testMissingArgToolProvider() throws Exception {
- String output = JPackageHelper.executeToolProvider(false, CMD_1);
- validate(output, RESULT_1, true);
-
- output = JPackageHelper.executeToolProvider(false, CMD_2);
- validate(output, RESULT_2, true);
-
- output = JPackageHelper.executeToolProvider(false, CMD_3);
- validate(output, RESULT_3, true);
-
- output = JPackageHelper.executeToolProvider(false, CMD_4);
- validate(output, RESULT_4, false);
-
- output = JPackageHelper.executeToolProvider(false, CMD_5);
- validate(output, RESULT_5, true);
-
- output = JPackageHelper.executeToolProvider(false, CMD_6);
- validate(output, RESULT_6, true);
-
- output = JPackageHelper.executeToolProvider(false, CMD_7);
- validate(output, RESULT_7, true);
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testMissingArg();
- testMissingArgToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/JPackageNoArgTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage no argument test
- * @library helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageNoArgTest
- */
-public class JPackageNoArgTest {
-
- private static final String RESULT1 = "Usage: jpackage <mode> <options>";
- private static final String[] EXPECTED =
- {"--help", "list of possible options"};
-
- private static void validate(String output) throws Exception {
- String[] result = JPackageHelper.splitAndFilter(output);
- if (result.length != 2) {
- System.err.println(output);
- throw new AssertionError(
- "Invalid number of lines in output: " + result.length);
- }
-
- if (!result[0].trim().equals(RESULT1)) {
- System.err.println("Expected: " + RESULT1);
- System.err.println("Actual: " + result[0]);
- throw new AssertionError("Unexpected line 1");
- }
-
- for (String expected : EXPECTED) {
- if (!result[1].contains(expected)) {
- System.err.println("Expected to contain: " + expected);
- System.err.println("Actual: " + result[1]);
- throw new AssertionError("Unexpected line 2");
- }
- }
- }
-
- private static void testNoArg() throws Exception {
- String output = JPackageHelper.executeCLI(true, new String[0]);
- validate(output);
- }
-
- private static void testNoArgToolProvider() throws Exception {
- String output =
- JPackageHelper.executeToolProvider(true, new String[0]);
- validate(output);
- }
-
- public static void main(String[] args) throws Exception {
- testNoArg();
- testNoArgToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/JPackageVersionTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage version test
- * @library helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageVersionTest
- */
-public class JPackageVersionTest {
-
- private static final String ARG = "--version";
- private static final String RESULT = System.getProperty("java.version");
-
- private static void validate(String output) throws Exception {
- String[] result = JPackageHelper.splitAndFilter(output);
- if (result.length != 1) {
- System.err.println(output);
- throw new AssertionError("Invalid number of lines in output: " + result.length);
- }
-
- if (!result[0].trim().equals(RESULT)) {
- System.err.println("Expected: " + RESULT);
- System.err.println("Actual: " + result[0]);
- throw new AssertionError("Unexpected line 1");
- }
- }
-
- private static void testVersion() throws Exception {
- String output = JPackageHelper.executeCLI(true, ARG);
- validate(output);
- }
-
- private static void testVersionToolProvider() throws Exception {
- String output = JPackageHelper.executeToolProvider(true, ARG);
- validate(output);
- }
-
- public static void main(String[] args) throws Exception {
- testVersion();
- testVersionToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateAppImageAddLauncherBase {
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- // Note: quotes in argument for add launcher is not support by test
- private static final String ARGUMENT1 = "argument 1";
- private static final String ARGUMENT2 = "argument 2";
- private static final String ARGUMENT3 = "argument 3";
-
- private static final List<String> arguments = new ArrayList<>();
-
- private static final String PARAM1 = "-Dparam1=Some Param 1";
- private static final String PARAM2 = "-Dparam2=Some Param 2";
- private static final String PARAM3 = "-Dparam3=Some Param 3";
-
- private static final List<String> vmArguments = new ArrayList<>();
- private static final List<String> empty = new ArrayList<>();
-
- private static void validateResult(List<String> args, List<String> vmArgs)
- throws Exception {
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
-
- int expected = 2 + args.size() + vmArgs.size();
-
- if (result.length != expected) {
- throw new AssertionError("Unexpected number of lines: "
- + result.length + " expected: " + expected + " - results: " + output);
- }
-
- if (!result[0].trim().endsWith("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: " + args.size())) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- int index = 2;
- for (String arg : args) {
- if (!result[index].trim().equals(arg)) {
- throw new AssertionError("Unexpected result["
- + index + "]: " + result[index]);
- }
- index++;
- }
-
- for (String vmArg : vmArgs) {
- if (!result[index].trim().equals(vmArg)) {
- throw new AssertionError("Unexpected result["
- + index + "]: " + result[index]);
- }
- index++;
- }
- }
-
- private static void validate(boolean includeArgs, String name)
- throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError("Test application " + app
- + " exited with error: " + retVal);
- }
- validateResult(new ArrayList<>(), new ArrayList<>());
-
- String app2 = JPackagePath.getAppSL(name);
- retVal = JPackageHelper.execute(null, app2);
- if (retVal != 0) {
- throw new AssertionError("Test application " + app2
- + " exited with error: " + retVal);
- }
- if (includeArgs) {
- validateResult(arguments, vmArguments);
- } else {
- validateResult(empty, empty);
- }
- }
-
- public static void testCreateAppImage(String [] cmd) throws Exception {
- testCreateAppImage(cmd, true, "test2");
- }
-
- public static void testCreateAppImage(String [] cmd,
- boolean includeArgs, String name) throws Exception {
- JPackageHelper.executeCLI(true, cmd);
- validate(includeArgs, name);
- }
-
- public static void testCreateAppImageToolProvider(String [] cmd)
- throws Exception {
- testCreateAppImageToolProvider(cmd, true, "test2");
- }
-
- public static void testCreateAppImageToolProvider(String [] cmd,
- boolean includeArgs, String name) throws Exception {
- JPackageHelper.executeToolProvider(true, cmd);
- validate(includeArgs, name);
- }
-
- public static void createSLProperties() throws Exception {
- arguments.add(ARGUMENT1);
- arguments.add(ARGUMENT2);
- arguments.add(ARGUMENT3);
-
- String argumentsMap =
- JPackageHelper.listToArgumentsMap(arguments, true);
-
- vmArguments.add(PARAM1);
- vmArguments.add(PARAM2);
- vmArguments.add(PARAM3);
-
- String vmArgumentsMap =
- JPackageHelper.listToArgumentsMap(vmArguments, true);
-
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter("sl.properties")))) {
- out.println("arguments=" + argumentsMap);
- out.println("java-options=" + vmArgumentsMap);
- }
-
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter("m1.properties")))) {
- out.println("module=com.hello/com.hello.Hello");
- out.println("main-jar=");
- }
-
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter("j1.properties")))) {
- out.println("main-jar hello.jar");
- out.println("main-class Hello");
- }
-
-
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherModuleTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image with additional launcher test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageAddLauncherBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageAddLauncherModuleTest
- */
-public class JPackageCreateAppImageAddLauncherModuleTest {
- private static final String OUTPUT = "output";
- private static final String [] CMD = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--add-launcher", "test2=sl.properties"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloModule();
- JPackageCreateAppImageAddLauncherBase.createSLProperties();
- JPackageCreateAppImageAddLauncherBase.testCreateAppImageToolProvider(
- CMD);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image with additional launcher test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageAddLauncherBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageAddLauncherTest
- */
-public class JPackageCreateAppImageAddLauncherTest {
- private static final String OUTPUT = "output";
- private static final String [] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--add-launcher", "test2=sl.properties"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- JPackageCreateAppImageAddLauncherBase.createSLProperties();
- JPackageCreateAppImageAddLauncherBase.testCreateAppImage(CMD);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLaunchersTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image with additional launcher test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageAddLauncherBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageAddLaunchersTest
- */
-public class JPackageCreateAppImageAddLaunchersTest {
- private static final String OUTPUT = "output";
- private static final String [] CMD1 = {
- "--description", "Test non modular app with multiple add-launchers where one is modular app and other is non modular app",
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--module-path", "module",
- "--add-modules", "com.hello",
- "--add-launcher", "test3=j1.properties",
- "--add-launcher", "test4=m1.properties"};
-
- private static final String [] CMD2 = {
- "--description", "Test modular app with multiple add-launchers where one is modular app and other is non modular app",
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "module",
- "--add-launcher", "test5=jl.properties",
- "--add-launcher", "test6=m1.properties"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- JPackageHelper.createHelloModule();
- JPackageCreateAppImageAddLauncherBase.createSLProperties();
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageAddLauncherBase.testCreateAppImageToolProvider(
- CMD1, false, "test3");
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageAddLauncherBase.testCreateAppImage(
- CMD1, false, "test4");
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageAddLauncherBase.testCreateAppImage(
- CMD2, false, "test5");
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageAddLauncherBase.testCreateAppImageToolProvider(
- CMD2, false, "test6");
-
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddModulesTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image module test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageAddModulesTest
- */
-public class JPackageCreateAppImageAddModulesTest {
- private static final String OUTPUT = "output";
-
- private static final String [] CMD1 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--add-modules", "java.desktop",
- };
-
- private static final String [] CMD2 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--add-modules", "java.desktop,java.xml",
- };
-
- private static final String [] CMD3 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--add-modules", "java.desktop",
- "--add-modules", "java.xml",
- };
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloModule();
- JPackageCreateAppImageBase.testCreateAppImage(CMD1);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD1);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD2);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD3);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageArgumentsBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateAppImageArgumentsBase {
-
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- private static final String ARGUMENT1 = "argument";
- private static final String ARGUMENT2 = "Some Arguments";
- private static final String ARGUMENT3 = "Value \"with\" quotes";
-
- private static final String ARGUMENT_CMD1 = "test";
-
- private static final List<String> arguments = new ArrayList<>();
- private static final List<String> argumentsCmd = new ArrayList<>();
-
- public static void initArguments(boolean toolProvider, String[] cmd) {
- if (arguments.isEmpty()) {
- arguments.add(ARGUMENT1);
- arguments.add(ARGUMENT2);
- arguments.add(ARGUMENT3);
- }
-
- if (argumentsCmd.isEmpty()) {
- argumentsCmd.add(ARGUMENT_CMD1);
- }
-
- String argumentsMap
- = JPackageHelper.listToArgumentsMap(arguments, toolProvider);
- cmd[cmd.length - 1] = argumentsMap;
- }
-
- private static void validateResult(String[] result, List<String> args)
- throws Exception {
- if (result.length != (args.size() + 2)) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: " + args.size())) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- int index = 2;
- for (String arg : args) {
- if (!result[index].trim().equals(arg)) {
- throw new AssertionError(
- "Unexpected result[" + index + "]: " + result[index]);
- }
- index++;
- }
- }
-
- private static void validate(String arg, List<String> expectedArgs)
- throws Exception {
- int retVal;
-
- if (arg == null) {
- retVal = JPackageHelper.execute(null, app);
- } else {
- retVal = JPackageHelper.execute(null, app, arg);
- }
- if (retVal != 0) {
- throw new AssertionError("Test application exited with error: "
- + retVal);
- }
-
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
- validateResult(result, expectedArgs);
- }
-
- public static void testCreateAppImage(String[] cmd) throws Exception {
- initArguments(false, cmd);
- JPackageHelper.executeCLI(true, cmd);
- validate(null, arguments);
- validate(ARGUMENT_CMD1, argumentsCmd);
- }
-
- public static void testCreateAppImageToolProvider(String[] cmd) throws Exception {
- initArguments(true, cmd);
- JPackageHelper.executeToolProvider(true, cmd);
- validate(null, arguments);
- validate(ARGUMENT_CMD1, argumentsCmd);
- }
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageArgumentsModuleTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create image with --arguments test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageArgumentsBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageArgumentsModuleTest
- */
-public class JPackageCreateAppImageArgumentsModuleTest {
- private static final String OUTPUT = "output";
-
- private static final String[] CMD = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--arguments", "TBD"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloModule();
- JPackageCreateAppImageArgumentsBase.testCreateAppImage(CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageArgumentsBase.testCreateAppImageToolProvider(CMD);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageArgumentsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create image with --arguments test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageArgumentsBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageArgumentsTest
- */
-public class JPackageCreateAppImageArgumentsTest {
- private static final String OUTPUT = "output";
-
- private static final String[] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--arguments", "TBD"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- JPackageCreateAppImageArgumentsBase.testCreateAppImage(CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageArgumentsBase.testCreateAppImageToolProvider(CMD);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAtFilenameTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageAtFilenameTest
- */
-public class JPackageCreateAppImageAtFilenameTest {
- private static final String OUTPUT = "output";
-
- private static final String [] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
-
- doTest(0, 1); // replace just the mode
- doTest(0, 11); // replace everything
- doTest(1, 10); // replace everything except mode
- doTest(4, 2); // replace the name and --main-jar without jar name
-
- }
-
- private static void doTest(int index, int len) throws Exception {
- String[] cmdWithAtFilename =
- JPackageHelper.cmdWithAtFilename(CMD, index, len);
-
- JPackageCreateAppImageBase.
- testCreateAppImageToolProvider(cmdWithAtFilename);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-public abstract class JPackageCreateAppImageBase {
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- private static void validateResult(String[] result) throws Exception {
- if (result.length != 2) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().endsWith("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- public static void validate(String app) throws Exception {
- Path outPath = Path.of(appOutput);
- int retVal = JPackageHelper.execute(null, app);
-
- if (outPath.toFile().exists()) {
- System.out.println("output contents: ");
- System.out.println(Files.readString(outPath) + "\n");
- } else {
- System.out.println("no output file: " + outPath
- + " from command: " + app);
- }
-
- if (retVal != 0) {
- throw new AssertionError(
- "Test application (" + app + ") exited with error: " + retVal);
- }
-
- if (!outPath.toFile().exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outPath);
- String[] result = JPackageHelper.splitAndFilter(output);
- validateResult(result);
- }
-
- public static void testCreateAppImage(String [] cmd) throws Exception {
- JPackageHelper.executeCLI(true, cmd);
- validate(JPackagePath.getApp());
- }
-
- public static void testCreateAppImageToolProvider(String [] cmd) throws Exception {
- JPackageHelper.executeToolProvider(true, cmd);
- validate(JPackagePath.getApp());
- }
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageErrorTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create app image error test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageErrorTest
- */
-import java.util.*;
-import java.io.*;
-import java.nio.*;
-import java.nio.file.*;
-import java.nio.file.attribute.*;
-
-public class JPackageCreateAppImageErrorTest {
-
- private static final String OUTPUT = "output";
-
- private static final String ARG1 = "--no-such-argument";
- private static final String EXPECTED1 =
- "Invalid Option: [--no-such-argument]";
- private static final String ARG2 = "--output";
- private static final String EXPECTED2 = "--main-jar or --module";
-
- private static final String [] CMD1 = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "non-existant.jar",
- };
- private static final String EXP1 = "main jar does not exist";
-
- private static final String [] CMD2 = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- };
- private static final String EXP2 = "class was not specified nor was";
-
- private static void validate(String output, String expected, boolean single)
- throws Exception {
- String[] result = output.split("\n");
- if (single && result.length != 1) {
- System.err.println(output);
- throw new AssertionError("Unexpected multiple lines of output: "
- + output);
- }
-
- if (!result[0].trim().contains(expected)) {
- throw new AssertionError("Unexpected output: " + result[0]
- + " - expected output to contain: " + expected);
- }
- }
-
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
-
- validate(JPackageHelper.executeToolProvider(false, ARG1), EXPECTED1, true);
- validate(JPackageHelper.executeToolProvider(false, ARG2), EXPECTED2, true);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- validate(JPackageHelper.executeToolProvider(false, CMD1), EXP1, false);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- validate(JPackageHelper.executeToolProvider(false, CMD2), EXP2, false);
-
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageIconTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
-/*
- * @test
- * @summary jpackage create image to verify --icon
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageIconTest
- */
-public class JPackageCreateAppImageIconTest {
- private static final String OUTPUT = "output";
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- private static final String[] CMD = {
- "--input", "input",
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--icon", getIconPath(),
- "--output", OUTPUT};
-
- private static void validateResult(String[] result) throws Exception {
- if (result.length != 2) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- private static void validate() throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError(
- "Test application exited with error: " + retVal);
- }
-
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
- validateResult(result);
- }
-
- private static void validateIcon() throws Exception {
- File origIcon = new File(getIconPath());
- File icon = new File(JPackagePath.getAppIcon());
- if (origIcon.length() != icon.length()) {
- System.err.println("origIcon.length(): " + origIcon.length());
- System.err.println("icon.length(): " + icon.length());
- throw new AssertionError("Icons size does not match");
- }
- }
-
- private static void testIcon() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- validate();
- validateIcon();
- }
-
- private static void testIconToolProvider() throws Exception {
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeToolProvider(true, CMD);
- validate();
- validateIcon();
- }
-
- private static String getIconPath() {
- String ext = ".ico";
- if (JPackageHelper.isOSX()) {
- ext = ".icns";
- } else if (JPackageHelper.isLinux()) {
- ext = ".png";
- }
-
- String path = JPackagePath.getTestSrcRoot() + File.separator + "resources"
- + File.separator + "icon" + ext;
-
- return path;
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testIcon();
- testIconToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJLinkModuleTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.util.ArrayList;
-
- /*
- * @test
- * @summary jpackage create image modular jar test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageJLinkModuleTest
- */
-public class JPackageCreateAppImageJLinkModuleTest {
- private static final String OUTPUT = "output";
- private static final String RUNTIME = "runtime";
-
- private static final String [] CMD = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.other/com.other.Other",
- "--runtime-image", RUNTIME,
- };
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createOtherModule();
-
- ArrayList<String> jlargs = new ArrayList<>();
- jlargs.add("--add-modules");
- jlargs.add("com.other");
- jlargs.add("--module-path");
- jlargs.add("module");
- jlargs.add("--strip-debug");
- jlargs.add("--no-header-files");
- jlargs.add("--no-man-pages");
- jlargs.add("--strip-native-commands");
- JPackageHelper.createRuntime(jlargs);
-
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImage(CMD);
-
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateAppImageJavaOptionsBase {
-
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- private static final String ARGUMENT1 = "-Dparam1=Some Param 1";
- private static final String ARGUMENT2 = "-Dparam2=Some \"Param\" 2";
- private static final String ARGUMENT3 =
- "-Dparam3=Some \"Param\" with \" 3";
-
- private static final List<String> arguments = new ArrayList<>();
-
- private static void initArguments(boolean toolProvider, String [] cmd) {
- if (arguments.isEmpty()) {
- arguments.add(ARGUMENT1);
- arguments.add(ARGUMENT2);
- arguments.add(ARGUMENT3);
- }
-
- String argumentsMap = JPackageHelper.listToArgumentsMap(arguments,
- toolProvider);
- cmd[cmd.length - 1] = argumentsMap;
- }
-
- private static void initArguments2(boolean toolProvider, String [] cmd) {
- int index = cmd.length - 6;
-
- cmd[index++] = "--java-options";
- arguments.clear();
- arguments.add(ARGUMENT1);
- cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
- toolProvider);
-
- cmd[index++] = "--java-options";
- arguments.clear();
- arguments.add(ARGUMENT2);
- cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
- toolProvider);
-
- cmd[index++] = "--java-options";
- arguments.clear();
- arguments.add(ARGUMENT3);
- cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
- toolProvider);
-
- arguments.clear();
- arguments.add(ARGUMENT1);
- arguments.add(ARGUMENT2);
- arguments.add(ARGUMENT3);
- }
-
- private static void validateResult(String[] result, List<String> args)
- throws Exception {
- if (result.length != (args.size() + 2)) {
- for (String r : result) {
- System.err.println(r.trim());
- }
- throw new AssertionError("Unexpected number of lines: "
- + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- int index = 2;
- for (String arg : args) {
- if (!result[index].trim().equals(arg)) {
- throw new AssertionError("Unexpected result[" + index + "]: "
- + result[index]);
- }
- index++;
- }
- }
-
- private static void validate(List<String> expectedArgs) throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError("Test application exited with error: "
- + retVal);
- }
-
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = JPackageHelper.splitAndFilter(output);
- validateResult(result, expectedArgs);
- }
-
- public static void testCreateAppImageJavaOptions(String [] cmd) throws Exception {
- initArguments(false, cmd);
- JPackageHelper.executeCLI(true, cmd);
- validate(arguments);
- }
-
- public static void testCreateAppImageJavaOptionsToolProvider(String [] cmd) throws Exception {
- initArguments(true, cmd);
- JPackageHelper.executeToolProvider(true, cmd);
- validate(arguments);
- }
-
- public static void testCreateAppImageJavaOptions2(String [] cmd) throws Exception {
- initArguments2(false, cmd);
- JPackageHelper.executeCLI(true, cmd);
- validate(arguments);
- }
-
- public static void testCreateAppImageJavaOptions2ToolProvider(String [] cmd) throws Exception {
- initArguments2(true, cmd);
- JPackageHelper.executeToolProvider(true, cmd);
- validate(arguments);
- }
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsEqualsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
-/*
- * @test
- * @summary jpackage create image with --java-options test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageJavaOptionsBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageJavaOptionsEqualsTest
- */
-public class JPackageCreateAppImageJavaOptionsEqualsTest {
-
- private static final String app = JPackagePath.getApp();
-
- private static final String OUTPUT = "output";
-
- private static final String[] CMD = {
- "--input", "input",
- "--description", "the two options below should cause two app execution "
- + "Warnings with two lines output saying: "
- + "WARNING: Unknown module: <module-name>",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--java-options",
- "--add-exports=java.base/sun.util=me.mymodule.foo,ALL-UNNAMED",
- "--java-options",
- "--add-exports=java.base/sun.security.util=other.mod.bar,ALL-UNNAMED",
- };
-
- private static void validate() throws Exception {
- File outfile = new File("app.out");
-
- int retVal = JPackageHelper.execute(outfile, app);
- if (retVal != 0) {
- throw new AssertionError(
- "Test application exited with error: " + retVal);
- }
-
- if (!outfile.exists()) {
- throw new AssertionError(
- "outfile: " + outfile + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = JPackageHelper.splitAndFilter(output);
- if (result.length != 4) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length
- + " - output: " + output);
- }
-
- if (!result[0].startsWith("WARNING: Unknown module: me.mymodule.foo")){
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (result[1].equals(result[0])) {
- System.err.println("--- This is known bug JDK-8224486, remove this "
- + "if/else block when JDK-8224486 is fixed");
- } else
-
- if (!result[1].startsWith("WARNING: Unknown module: other.mod.bar")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- if (!result[2].trim().endsWith("jpackage test application")) {
- throw new AssertionError("Unexpected result[2]: " + result[2]);
- }
-
- if (!result[3].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[3]: " + result[3]);
- }
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- String output = JPackageHelper.executeCLI(true, CMD);
- validate();
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- output = JPackageHelper.executeToolProvider(true, CMD);
- validate();
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsModuleTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create image with --java-options test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageJavaOptionsBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageJavaOptionsModuleTest
- */
-public class JPackageCreateAppImageJavaOptionsModuleTest {
- private static final String OUTPUT = "output";
-
- private static final String[] CMD = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--java-options", "TBD"};
-
- private static final String[] CMD2 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--java-options", "TBD",
- "--java-options", "TBD",
- "--java-options", "TBD"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloModule();
-
- JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions(CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptionsToolProvider(CMD);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions2(CMD2);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions2ToolProvider(CMD2);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create image with --java-options test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageJavaOptionsBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageJavaOptionsTest
- */
-public class JPackageCreateAppImageJavaOptionsTest {
- private static final String OUTPUT = "output";
-
- private static final String[] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--java-options", "TBD"};
-
- private static final String[] CMD2 = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--java-options", "TBD",
- "--java-options", "TBD",
- "--java-options", "TBD"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions(CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptionsToolProvider(CMD);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions2(CMD2);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions2ToolProvider(CMD2);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageMainClassAttributeTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
-/*
- * @test
- * @summary jpackage create image with no main class arguments and with main-class attribute
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageMainClassAttributeTest
- */
-public class JPackageCreateAppImageMainClassAttributeTest {
- private static final String OUTPUT = "output";
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- private static final String[] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar"};
-
- private static void validateResult(String[] result) throws Exception {
- if (result.length != 2) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- private static void validate() throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError(
- "Test application exited with error: " + retVal);
- }
-
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
- validateResult(result);
- }
-
- private static void testMainClassAttribute() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- validate();
- }
-
- private static void testMainClassAttributeToolProvider() throws Exception {
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeToolProvider(true, CMD);
- validate();
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJarWithMainClass();
- testMainClassAttribute();
- testMainClassAttributeToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageMainClassErrorTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
-/*
- * @test
- * @summary jpackage create image with no main class arguments and with main-class attribute
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageMainClassErrorTest
- */
-public class JPackageCreateAppImageMainClassErrorTest {
- private static final String OUTPUT = "output";
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- private static final String[] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar"};
-
- private static void validate(String output) throws Exception {
- String[] result = JPackageHelper.splitAndFilter(output);
- if (result.length != 2) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().contains("main class was not specified")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().startsWith("Advice to fix: ")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- validate(JPackageHelper.executeCLI(false, CMD));
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- validate(JPackageHelper.executeToolProvider(false, CMD));
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModularJarTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image modular jar test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageModularJarTest
- */
-public class JPackageCreateAppImageModularJarTest {
- private static final String OUTPUT = "output";
-
- private static final String [] CMD1 = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "com.hello.jar",
- "--main-class", "com.hello.Hello",
- };
-
- private static final String [] CMD2 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input/com.hello.jar",
- };
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloModule();
-
- JPackageCreateAppImageBase.testCreateAppImage(CMD1);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD1);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImage(CMD2);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD2);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModuleMainClassErrorTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
-/*
- * @test
- * @summary jpackage create image with no main class arguments and with main-class attribute
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageModuleMainClassErrorTest
- */
-public class JPackageCreateAppImageModuleMainClassErrorTest {
- private static final String OUTPUT = "output";
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- private static final String [] CMD1 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello",
- "--module-path", "input"};
-
- private static final String [] CMD2 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input"};
-
- private static void validate(String buildOutput) throws Exception {
-
- File outfile = new File(appOutput);
- int retVal = JPackageHelper.execute(outfile, app);
- if (retVal != 0) {
- throw new AssertionError(
- "Test application exited with error: ");
- }
-
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloModule();
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeCLI(false, CMD1);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeToolProvider(false, CMD1);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- validate(JPackageHelper.executeCLI(true, CMD2));
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- validate(JPackageHelper.executeToolProvider(true, CMD2));
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModulePathTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image module test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageModulePathTest
- */
-
-import java.io.File;
-
-public class JPackageCreateAppImageModulePathTest {
- private static final String OUTPUT = "output";
-
- private static final String [] CMD1 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- };
-
- private static final String [] CMD2 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input" + File.pathSeparator + "input-other",
- };
-
- private static final String [] CMD3 = {
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input",
- "--module-path", "input-other",
- };
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloModule();
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD1);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD2);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD3);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModuleTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image modular jar test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageModuleTest
- */
-public class JPackageCreateAppImageModuleTest {
- private static final String OUTPUT = "output";
-
- private static final String [] CMD1 = {
- "--module-path", "module",
- "--module", "com.other/com.other.Other",
- "--output", OUTPUT,
- "--name", "test",
- };
-
- private static String [] commands = {
- "--module-path", "module",
- "--module", "com.other/com.other.Other",
- "--output", OUTPUT,
- "--name", "test",
- "--add-modules", "TBD",
- };
-
- private final static String [] paths = {
- "ALL-MODULES",
- "ALL_MODULE_PATH",
- "ALL-SYSTEM",
- "ALL-DEFAULT",
- };
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createOtherModule();
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImage(CMD1);
-
- for (String path : paths) {
- commands[commands.length - 1] = path;
- System.out.println("using --add-modules " + path);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(commands);
- System.out.println("succeeded");
- }
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageNoNameTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
-/*
- * @test
- * @summary jpackage create image with no --name
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageNoNameTest
- */
-public class JPackageCreateAppImageNoNameTest {
- private static final String OUTPUT = "output";
- private static final String app = JPackagePath.getApp("Hello");
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- private static final String[] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- private static void validateResult(String[] result) throws Exception {
- if (result.length != 2) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- private static void validate() throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError(
- "Test application exited with error: " + retVal);
- }
-
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
- validateResult(result);
- }
-
- private static void testMainClassAttribute() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- validate();
- }
-
- private static void testMainClassAttributeToolProvider() throws Exception {
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeToolProvider(true, CMD);
- validate();
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testMainClassAttribute();
- testMainClassAttributeToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageResourceTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
-/*
- * @test
- * @summary jpackage create image to verify --icon
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @requires ((os.family == "windows") | (os.family == "mac"))
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageResourceTest
- */
-public class JPackageCreateAppImageResourceTest {
- private static final String OUTPUT = "output";
- private static final String app = JPackagePath.getApp("icon");
- private static final String appOutput = JPackagePath.getAppOutputFile();
- private static final String resourceDir =
- JPackagePath.getTestSrcRoot() + File.separator + "resources";
-
- private static final String[] CMD = {
- "--input", "input",
- "--name", "icon",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--resource-dir", resourceDir,
- "--output", OUTPUT};
-
- private static void validateResult(String[] result) throws Exception {
- if (result.length != 2) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- private static void validate() throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError(
- "Test application exited with error: " + retVal);
- }
-
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
- validateResult(result);
- }
-
- private static void validateIcon() throws Exception {
- File origIcon = new File(getIconPath());
- File icon = new File(JPackagePath.getAppIcon("icon"));
- if (origIcon.length() != icon.length()) {
- System.err.println("file: " + origIcon + " - origIcon.length(): "
- + origIcon.length());
- System.err.println("file: " + icon + " - icon.length(): "
- + icon.length());
- throw new AssertionError("Icons size does not match");
- }
- }
-
- private static void testIcon() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- validate();
- validateIcon();
- }
-
- private static void testIconToolProvider() throws Exception {
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeToolProvider(true, CMD);
- validate();
- validateIcon();
- }
-
- private static String getResourcenPath() {
- return JPackagePath.getTestSrcRoot() + File.separator + "resources";
- }
-
- private static String getIconPath() {
- String ext = ".ico";
- if (JPackageHelper.isOSX()) {
- ext = ".icns";
- } else if (JPackageHelper.isLinux()) {
- ext = ".png";
- }
- return resourceDir + File.separator + "icon" + ext;
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testIcon();
- testIconToolProvider();
- }
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
- public class JPackageCreateAppImageRuntimeBase {
- private static final String app = JPackagePath.getApp();
- private static final String runtimeJava = JPackagePath.getRuntimeJava();
- private static final String runtimeJavaOutput = "javaOutput.txt";
- private static final String appOutput = JPackagePath.getAppOutputFile();
-
- private static void validateResult(String[] result) throws Exception {
- if (result.length != 2) {
- throw new AssertionError("Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- private static void validate() throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError("Test application exited with error: " + retVal);
- }
-
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = JPackageHelper.splitAndFilter(output);
- validateResult(result);
- }
-
- private static void validateRuntime() throws Exception {
- int retVal = JPackageHelper.execute(new File(runtimeJavaOutput), runtimeJava, "--list-modules");
- if (retVal != 0) {
- throw new AssertionError("Test application exited with error: " + retVal);
- }
-
- File outfile = new File(runtimeJavaOutput);
- if (!outfile.exists()) {
- throw new AssertionError(runtimeJavaOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = JPackageHelper.splitAndFilter(output);
- if (result.length != 1) {
- throw new AssertionError("Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].startsWith("java.base")) {
- throw new AssertionError("Unexpected result: " + result[0]);
- }
- }
-
- public static void testCreateAppImage(String [] cmd) throws Exception {
-System.out.println("----- current dir = " + System.getProperty("user.dir"));
- JPackageHelper.executeCLI(true, cmd);
-System.out.println("----- current dir = " + System.getProperty("user.dir"));
- validate();
- validateRuntime();
- }
-
- public static void testCreateAppImageToolProvider(String [] cmd) throws Exception {
-System.out.println("----- ToolProvider current dir = " + System.getProperty("user.dir"));
- JPackageHelper.executeToolProvider(true, cmd);
-System.out.println("----- ToolProvider current dir = " + System.getProperty("user.dir"));
- validate();
- validateRuntime();
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeModuleTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image runtime test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageRuntimeBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageRuntimeModuleTest
- */
-public class JPackageCreateAppImageRuntimeModuleTest {
- private static final String OUTPUT = "output";
- private static final String [] CMD = {
- "--runtime-image", "runtime",
- "--output", OUTPUT,
- "--name", "test",
- "--module", "com.hello/com.hello.Hello",
- "--module-path", "input"};
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloModule();
- JPackageHelper.createRuntime();
- JPackageCreateAppImageRuntimeBase.testCreateAppImage(CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageRuntimeBase.testCreateAppImageToolProvider(CMD);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image runtime test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageRuntimeBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageRuntimeTest
- */
-public class JPackageCreateAppImageRuntimeTest {
- private static final String OUTPUT = "output";
- private static final String [] CMD = {
- "--runtime-image", "runtime",
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- JPackageHelper.createRuntime();
- JPackageCreateAppImageRuntimeBase.testCreateAppImage(CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageRuntimeBase.testCreateAppImageToolProvider(CMD);
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageTempRootTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-
- /*
- * @test
- * @requires (os.family == "windows")
- * @summary jpackage create image to test --temp-root
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageTempRootTest
- */
-public class JPackageCreateAppImageTempRootTest {
- private static final String OUTPUT = "output";
- private static String buildRoot = null;
- private static final String BUILD_ROOT = "buildRoot";
- private static final String BUILD_ROOT_TB = "buildRootToolProvider";
-
- private static final String [] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- private static final String [] CMD_BUILD_ROOT = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--temp-root", "TBD"};
-
- private static void validate(boolean retain) throws Exception {
- File br = new File(buildRoot);
- if (retain) {
- if (!br.exists()) {
- throw new AssertionError(br.getAbsolutePath() + " does not exist");
- }
- } else {
- if (br.exists()) {
- throw new AssertionError(br.getAbsolutePath() + " exist");
- }
- }
- }
-
- private static void init(boolean toolProvider) {
- if (toolProvider) {
- buildRoot = BUILD_ROOT_TB;
- } else {
- buildRoot = BUILD_ROOT;
- }
-
- CMD_BUILD_ROOT[CMD_BUILD_ROOT.length - 1] = buildRoot;
- }
-
- private static void testTempRoot() throws Exception {
- init(false);
- JPackageHelper.executeCLI(true, CMD);
- validate(false);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeCLI(true, CMD_BUILD_ROOT);
- validate(true);
- }
-
- private static void testTempRootToolProvider() throws Exception {
- init(true);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeToolProvider(true, CMD);
- validate(false);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeToolProvider(true, CMD_BUILD_ROOT);
- validate(true);
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testTempRoot();
- testTempRootToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
- /*
- * @test
- * @summary jpackage create image test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageTest
- */
-public class JPackageCreateAppImageTest {
- private static final String OUTPUT = "output";
-
- private static final String [] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- JPackageCreateAppImageBase.testCreateAppImage(CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD);
- }
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageVerboseTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create image verbose test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageVerboseTest
- */
-public class JPackageCreateAppImageVerboseTest {
- private static final String OUTPUT = "output";
- private static final String[] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- private static final String[] CMD_VERBOSE = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--verbose"};
-
- private static void validate(String result, String resultVerbose)
- throws Exception {
- String[] r = result.split("\n");
- String[] rv = resultVerbose.split("\n");
-
- if (r.length >= rv.length) {
- System.err.println("r.length: " + r.length);
- System.err.println(result);
- System.err.println("rv.length: " + rv.length);
- System.err.println(resultVerbose);
- throw new AssertionError(
- "non-verbose output is less or equal to verbose output");
- }
- }
-
- private static void testCreateAppImage() throws Exception {
- String result = JPackageHelper.executeCLI(true, CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- String resultVerbose = JPackageHelper.executeCLI(true, CMD_VERBOSE);
- validate(result, resultVerbose);
- }
-
- private static void testCreateAppImageToolProvider() throws Exception {
- JPackageHelper.deleteOutputFolder(OUTPUT);
- String result = JPackageHelper.executeToolProvider(true, CMD);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- String resultVerbose =
- JPackageHelper.executeToolProvider(true, CMD_VERBOSE);
- validate(result, resultVerbose);
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testCreateAppImage();
- testCreateAppImageToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageVersionTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
-/*
- * @test
- * @summary jpackage create image --app-version test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageVersionTest
- */
-public class JPackageCreateAppImageVersionTest {
- private static final String OUTPUT = "output";
- private static final String appCfg = JPackagePath.getAppCfg();
- private static final String VERSION = "2.3";
- private static final String VERSION_DEFAULT = "1.0";
-
- private static final String[] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- private static final String[] CMD_VERSION = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--app-version", VERSION};
-
- private static void validate(String version)
- throws Exception {
- File outfile = new File(appCfg);
- if (!outfile.exists()) {
- throw new AssertionError(appCfg + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- if (version == null) {
- version = VERSION_DEFAULT;
- }
-
- String expected = "app.version=" + version;
- if (!output.contains(expected)) {
- System.err.println("Expected: " + expected);
- throw new AssertionError("Cannot find expected entry in config file");
- }
- }
-
- private static void testVersion() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- validate(null);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeCLI(true, CMD_VERSION);
- validate(VERSION);
- }
-
- private static void testVersionToolProvider() throws Exception {
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeToolProvider(true, CMD);
- validate(null);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.executeToolProvider(true, CMD_VERSION);
- validate(VERSION);
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testVersion();
- testVersionToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageWithSpaceTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-
- /*
- * @test
- * @summary jpackage create image test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageWithSpaceTest
- */
-public class JPackageCreateAppImageWithSpaceTest {
- private static final String OUTPUT = "output";
-
- private static final String [] CMD1 = {
- "--input", "input dir",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- private static final String [] CMD2 = {
- "--input", "input dir2",
- "--output", OUTPUT,
- "--name", "test",
- "--main-jar", "sub dir/hello.jar",
- "--main-class", "Hello",
- };
-
- public static void main(String[] args) throws Exception {
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.createHelloImageJar("input dir");
- JPackageCreateAppImageBase.testCreateAppImage(CMD1);
-
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.createHelloImageJar(
- "input dir2" + File.separator + "sub dir");
-
- JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD2);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- }
-}
--- a/test/jdk/tools/jpackage/createappimage/macosx/JPackageCreateAppImageBundleIdentifierTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.nio.file.Files;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathFactory;
-
-/*
- * @test
- * @summary jpackage create image bundle identifier test
- * @library ../../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @requires (os.family == "mac")
- * @run main/othervm -Xmx512m JPackageCreateAppImageBundleIdentifierTest
- */
-public class JPackageCreateAppImageBundleIdentifierTest {
- private static final String OUTPUT = "output";
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
- private static final String MAC_BUNDLE_IDENTIFIER = "TestBundleIdentifier";
- private static final String APP_NAME = "test";
- private static final String MAIN_CLASS = "Hello";
-
- private static final String [] CMD_1 = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", APP_NAME,
- "--main-jar", "hello.jar",
- "--main-class", MAIN_CLASS
- };
-
- private static final String [] CMD_2 = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", APP_NAME,
- "--main-jar", "hello.jar",
- "--main-class", MAIN_CLASS,
- "--mac-bundle-identifier", MAC_BUNDLE_IDENTIFIER
- };
-
- private static void validateResult(String[] result) throws Exception {
- if (result.length != 2) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- private static void validate() throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError(
- "Test application exited with error: " + retVal);
- }
-
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
- validateResult(result);
- }
-
- private static void validateBundleIdentifier(String bundleIdentifier)
- throws Exception {
- System.out.println("Validating bundleIdentifier: " + bundleIdentifier);
-
- File infoPList = new File(OUTPUT + File.separator + APP_NAME + ".app" +
- File.separator + "Contents" + File.separator + "Info.plist");
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newDefaultInstance();
- dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
- DocumentBuilder b = dbf.newDocumentBuilder();
- org.w3c.dom.Document doc = b.parse(new FileInputStream(
- infoPList.getAbsolutePath()));
-
- XPath xPath = XPathFactory.newInstance().newXPath();
- // Query for the value of <string> element preceding <key> element
- // with value equal to CFBundleIdentifier
- String v = (String)xPath.evaluate(
- "//string[preceding-sibling::key = \"CFBundleIdentifier\"][1]",
- doc, XPathConstants.STRING);
-
- if (!v.equals(bundleIdentifier)) {
- throw new AssertionError("Unexpected value of CFBundleIdentifier key: ["
- + v + "]. Expected value: [" + bundleIdentifier + "]");
- }
- }
-
- private static void testCreateAppImage(String [] cmd,
- String bundleIdentifier,
- boolean validateApp) throws Exception {
- JPackageHelper.executeCLI(true, cmd);
- if (validateApp) {
- validate();
- }
- validateBundleIdentifier(bundleIdentifier);
- }
-
- private static void testCreateAppImageToolProvider(String [] cmd,
- String bundleIdentifier,
- boolean validateApp) throws Exception {
- JPackageHelper.executeToolProvider(true, cmd);
- if (validateApp) {
- validate();
- }
- validateBundleIdentifier(bundleIdentifier);
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testCreateAppImage(CMD_1, MAIN_CLASS, false);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- testCreateAppImageToolProvider(CMD_1, MAIN_CLASS, false);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- testCreateAppImage(CMD_2, MAC_BUNDLE_IDENTIFIER, true);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- testCreateAppImageToolProvider(CMD_2, MAC_BUNDLE_IDENTIFIER, true);
- }
-}
--- a/test/jdk/tools/jpackage/createappimage/macosx/JPackageCreateAppImageBundleNameTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.nio.file.Files;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathFactory;
-
-/*
- * @test
- * @summary jpackage create image bundle name test
- * @library ../../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @requires (os.family == "mac")
- * @run main/othervm -Xmx512m JPackageCreateAppImageBundleNameTest
- */
-public class JPackageCreateAppImageBundleNameTest {
- private static final String OUTPUT = "output";
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
- private static final String MAC_BUNDLE_NAME = "TestBundleName";
- private static final String APP_NAME = "test";
-
- private static final String [] CMD_1 = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", APP_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello"
- };
-
- private static final String [] CMD_2 = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", APP_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--mac-bundle-name", MAC_BUNDLE_NAME
- };
-
- private static void validateResult(String[] result) throws Exception {
- if (result.length != 2) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- private static void validate() throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError(
- "Test application exited with error: " + retVal);
- }
-
- File outfile = new File(appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
- validateResult(result);
- }
-
- private static void validateBundleName(String bundleName) throws Exception {
- System.out.println("Validating bundleName: " + bundleName);
-
- File infoPList = new File(OUTPUT + File.separator + APP_NAME + ".app" +
- File.separator + "Contents" + File.separator + "Info.plist");
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newDefaultInstance();
- dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
- DocumentBuilder b = dbf.newDocumentBuilder();
- org.w3c.dom.Document doc = b.parse(new FileInputStream(
- infoPList.getAbsolutePath()));
-
- XPath xPath = XPathFactory.newInstance().newXPath();
- // Query for the value of <string> element preceding <key> element
- // with value equal to CFBundleName
- String v = (String)xPath.evaluate(
- "//string[preceding-sibling::key = \"CFBundleName\"][1]",
- doc, XPathConstants.STRING);
-
- if (!v.equals(bundleName)) {
- throw new AssertionError("Unexpected value of CFBundleName key: ["
- + v + "]. Expected value: [" + bundleName + "]");
- }
- }
-
- private static void testCreateAppImage(String [] cmd,
- String bundleName,
- boolean validateApp) throws Exception {
- JPackageHelper.executeCLI(true, cmd);
- if (validateApp) {
- validate();
- }
- validateBundleName(bundleName);
- }
-
- private static void testCreateAppImageToolProvider(String [] cmd,
- String bundleName,
- boolean validateApp) throws Exception {
- JPackageHelper.executeToolProvider(true, cmd);
- if (validateApp) {
- validate();
- }
- validateBundleName(bundleName);
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testCreateAppImage(CMD_1, APP_NAME, false);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- testCreateAppImageToolProvider(CMD_1, APP_NAME, false);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- testCreateAppImage(CMD_2, MAC_BUNDLE_NAME, true);
- JPackageHelper.deleteOutputFolder(OUTPUT);
- testCreateAppImageToolProvider(CMD_2, MAC_BUNDLE_NAME, true);
- }
-}
--- a/test/jdk/tools/jpackage/createappimage/windows/JPackageCreateAppImageWinConsoleTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.io.InputStream;
-import java.io.FileInputStream;
-
-/*
- * @test
- * @summary jpackage create image win console test
- * @library ../../helpers
- * @library ../
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageCreateAppImageBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateAppImageWinConsoleTest
- */
-
-public class JPackageCreateAppImageWinConsoleTest {
- private static final String NAME = "test";
- private static final String OUTPUT = "output";
- private static final String OUTPUT_WIN_CONSOLE = "outputWinConsole";
- private static final int BUFFER_SIZE = 512;
- private static final int GUI_SUBSYSTEM = 2;
- private static final int CONSOLE_SUBSYSTEM = 3;
-
- private static final String [] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
-
- private static final String [] CMD_WIN_CONSOLE = {
- "--input", "input",
- "--output", OUTPUT_WIN_CONSOLE,
- "--name", NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-console"
- };
-
- private static void checkSubsystem(boolean console) throws Exception {
- Path path = Path.of(console ? OUTPUT_WIN_CONSOLE : OUTPUT,
- NAME, "bin", NAME + ".exe");
-
- System.out.println("validate path: " + path.toString());
- JPackageCreateAppImageBase.validate(path.toString());
-
- try (InputStream inputStream = new FileInputStream(path.toString())) {
- byte [] bytes = new byte[BUFFER_SIZE];
- if (inputStream.read(bytes) != BUFFER_SIZE) {
- throw new AssertionError("Wrong number of bytes read");
- }
-
- // Check PE header for console or Win GUI app.
- // https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_image_nt_headers
- for (int i = 0; i < (bytes.length - 4); i++) {
- if (bytes[i] == 0x50 && bytes[i + 1] == 0x45 &&
- bytes[i + 2] == 0x0 && bytes[i + 3] == 0x0) {
-
- // Signature, File Header and subsystem offset.
- i = i + 4 + 20 + 68;
- byte subsystem = bytes[i];
- if (console) {
- if (subsystem != CONSOLE_SUBSYSTEM) {
- throw new AssertionError("Unexpected subsystem: "
- + subsystem);
- } else {
- return;
- }
- } else {
- if (subsystem != GUI_SUBSYSTEM) {
- throw new AssertionError("Unexpected subsystem: "
- + subsystem);
- } else {
- return;
- }
- }
- }
- }
- }
-
- throw new AssertionError("Unable to verify PE header");
- }
-
- private static void validate() throws Exception {
- checkSubsystem(false);
- checkSubsystem(true);
- }
-
- private static void testCreateAppImage(String [] cmd) throws Exception {
- JPackageHelper.executeCLI(true, cmd);
- }
-
- private static void testCreateAppImageToolProvider(String [] cmd)
- throws Exception {
- JPackageHelper.executeToolProvider(true, cmd);
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testCreateAppImage(CMD);
- testCreateAppImage(CMD_WIN_CONSOLE);
- validate();
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.deleteOutputFolder(OUTPUT_WIN_CONSOLE);
- testCreateAppImageToolProvider(CMD);
- testCreateAppImageToolProvider(CMD_WIN_CONSOLE);
- validate();
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPLinuxAssociationsBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.Desktop;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPLinuxAssociationsBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String TEST_EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void validateAppOutput() throws Exception {
- File outFile = new File("appOutput.txt");
- int count = 10;
- boolean bOutputCreated = false;
- while (count > 0) {
- if (!outFile.exists()) {
- Thread.sleep(3000);
- count--;
- } else {
- bOutputCreated = true;
- break;
- }
- }
-
- if (!bOutputCreated) {
- throw new AssertionError(outFile.getAbsolutePath() + " was not created");
- }
-
- String output = Files.readString(outFile.toPath());
- String[] result = output.split("\n");
- if (result.length != 3) {
- System.err.println(output);
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 1")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- File faFile = new File(TEST_NAME + "." + TEST_EXT);
- if (!result[2].trim().equals(faFile.getAbsolutePath())) {
- throw new AssertionError("Unexpected result[2]: " + result[2]);
- }
- }
-
- private static void verifyInstall() throws Exception {
- createAssociationsTestFile();
- Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
- validateAppOutput();
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void createAssociationsTestFile() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
- out.println(TEST_NAME);
- }
- }
-
- private static void createAssociationsProperties() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter("fa.properties")))) {
- out.println("extension=" + TEST_EXT);
- out.println("mime-type=application/" + TEST_EXT);
- out.println("description=jpackage test extention");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- TEST_EXT = "jptest1";
- if (EXT.equals("rpm")) {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
- } else {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- }
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--file-associations", "fa.properties"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- createAssociationsProperties();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPLinuxBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPLinuxBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- if (EXT.equals("rpm")) {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
- } else {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- }
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello" };
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPLinuxBundleNameBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPLinuxBundleNameBase {
-
- private static String TEST_NAME;
- private static String BUNDLE_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- BUNDLE_NAME = "jpackage-test-bundle-name";
- EXT = ext;
- if (EXT.equals("rpm")) {
- OUTPUT = "output" + File.separator + BUNDLE_NAME + "-1.0-1.x86_64." + EXT;
- } else {
- OUTPUT = "output" + File.separator + BUNDLE_NAME + "-1.0." + EXT;
- }
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--linux-bundle-name", BUNDLE_NAME};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPLinuxInstallDirBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPLinuxInstallDirBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp("jpackage", TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder("jpackage", TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- folderPath = JPackagePath.getLinuxInstallFolder("jpackage", null);
- folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- if (EXT.equals("rpm")) {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
- } else {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- }
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--install-dir", "/opt/jpackage"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPLinuxLicenseBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPLinuxLicenseBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- if (EXT.equals("rpm")) {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
- } else {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- }
- CMD = new String [] {
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--license-file", JPackagePath.getLicenseFilePath()};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPLinuxLicenseTypeBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPLinuxLicenseTypeBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String JP_LICENSE_TYPE;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static final String infoResult = "infoResult.txt";
- private static void validatePackage() throws Exception {
- int retVal = JPackageHelper.execute(new File(infoResult),"rpm",
- "--query", "--package", "--info", OUTPUT.toLowerCase());
- if (retVal != 0) {
- throw new AssertionError("rpm exited with error: " + retVal);
- }
-
- File outfile = new File(infoResult);
- if (!outfile.exists()) {
- throw new AssertionError(infoResult + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- if (!output.contains(JP_LICENSE_TYPE)) {
- throw new AssertionError("Unexpected result: " + output);
- }
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- validatePackage();
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- JP_LICENSE_TYPE = "JP_LICENSE_TYPE";
- if (EXT.equals("rpm")) {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
- } else {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- }
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--linux-rpm-license-type", JP_LICENSE_TYPE};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPLinuxMaintainerBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPLinuxMaintainerBase {
-
- private static String TEST_NAME;
- private static String EMAIL;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static final String infoResult = "infoResult.txt";
- private static void validatePackage() throws Exception {
- int retVal = JPackageHelper.execute(new File(infoResult), "dpkg",
- "--info", OUTPUT.toLowerCase());
- if (retVal != 0) {
- throw new AssertionError("dpkg exited with error: " + retVal);
- }
-
- File outfile = new File(infoResult);
- if (!outfile.exists()) {
- throw new AssertionError(infoResult + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- if (!output.contains("Maintainer: " + EMAIL)) {
- throw new AssertionError("Unexpected result: " + output);
- }
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- validatePackage();
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EMAIL = "jpackage-test@java.com";
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--linux-deb-maintainer", EMAIL};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPLinuxPackageDepsBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPLinuxPackageDepsBase {
-
- private static String TEST_NAME;
- private static String DEP_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String OUTPUT_DEP;
- private static String[] CMD;
- private static String[] CMD_DEP;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- files.add(OUTPUT_DEP.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static final String infoResult = "infoResult.txt";
- private static void validatePackage() throws Exception {
- if (EXT.equals("rpm")) {
- int retVal = JPackageHelper.execute(new File(infoResult),"rpm",
- "--query", "--package", "--requires", OUTPUT.toLowerCase());
- if (retVal != 0) {
- throw new AssertionError("rpm exited with error: " + retVal);
- }
- } else {
- int retVal = JPackageHelper.execute(new File(infoResult), "dpkg",
- "--info", OUTPUT.toLowerCase());
- if (retVal != 0) {
- throw new AssertionError("dpkg exited with error: " + retVal);
- }
- }
-
- File outfile = new File(infoResult);
- if (!outfile.exists()) {
- throw new AssertionError(infoResult + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- if (!output.contains(DEP_NAME.toLowerCase())) {
- throw new AssertionError("Unexpected result: " + output);
- }
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageHelper.executeCLI(true, CMD_DEP);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- JPackageInstallerHelper.validateOutput(OUTPUT_DEP);
- validatePackage();
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- app = JPackagePath.getLinuxInstalledApp(DEP_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- folderPath = JPackagePath.getLinuxInstallFolder(DEP_NAME);
- folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- DEP_NAME = name + "Dep";
- EXT = ext;
- if (EXT.equals("rpm")) {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
- OUTPUT_DEP = "output" + File.separator + DEP_NAME + "-1.0-1.x86_64." + EXT;
- } else {
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- OUTPUT_DEP = "output" + File.separator + DEP_NAME + "-1.0." + EXT;
- }
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--linux-package-deps", DEP_NAME.toLowerCase()};
- CMD_DEP = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", DEP_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/deb/JPLinuxDebAssociationsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxAssociationsBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPLinuxDebAssociationsTest
- */
-public class JPLinuxDebAssociationsTest {
- private static final String TEST_NAME = "JPLinuxDebAssociationsTest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- JPLinuxAssociationsBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/deb/JPLinuxDebBundleNameTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxBundleNameBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPLinuxDebBundleNameTest
- */
-public class JPLinuxDebBundleNameTest {
- private static final String TEST_NAME = "JPLinuxDebBundleNameTest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- JPLinuxBundleNameBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/deb/JPLinuxDebInstallDirTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxInstallDirBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPLinuxDebInstallDirTest
- */
-public class JPLinuxDebInstallDirTest {
- private static final String TEST_NAME = "JPLinuxDebInstallDirTest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- JPLinuxInstallDirBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/deb/JPLinuxDebLicenseTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxLicenseBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPLinuxDebLicenseTest
- */
-public class JPLinuxDebLicenseTest {
- private static final String TEST_NAME = "JPLinuxDebLicenseTest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- JPLinuxLicenseBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/deb/JPLinuxDebMaintainerTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxMaintainerBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPLinuxDebMaintainerTest
- */
-public class JPLinuxDebMaintainerTest {
- private static final String TEST_NAME = "JPLinuxDebMaintainerTest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- JPLinuxMaintainerBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/deb/JPLinuxDebPackageDepsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxPackageDepsBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=240 -Xmx512m JPLinuxDebPackageDepsTest
- */
-public class JPLinuxDebPackageDepsTest {
- private static final String TEST_NAME = "JPLinuxDebPackageDepsTest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- JPLinuxPackageDepsBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/deb/JPLinuxDebTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPLinuxDebTest
- */
-public class JPLinuxDebTest {
- private static final String TEST_NAME = "JPLinuxDebTest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- JPLinuxBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/deb/install.sh Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-sudo dpkg -i jplinuxdebtest-1.0.deb
-sudo dpkg -i jplinuxdebassociationstest-1.0.deb
-sudo dpkg -i jplinuxdeblicensetest-1.0.deb
-sudo dpkg -i jplinuxdebinstalldirtest-1.0.deb
-sudo dpkg -i jpackage-test-bundle-name-1.0.deb
-sudo dpkg -i jplinuxdebmaintainertest-1.0.deb
-sudo dpkg -i jplinuxdebpackagedepstestdep-1.0.deb
-sudo dpkg -i jplinuxdebpackagedepstest-1.0.deb
--- a/test/jdk/tools/jpackage/createinstaller/linux/deb/uninstall.sh Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-sudo dpkg -r jplinuxdebtest
-sudo dpkg -r jplinuxdebassociationstest
-sudo dpkg -r jplinuxdeblicensetest
-sudo dpkg -r jplinuxdebinstalldirtest
-sudo dpkg -r jpackage-test-bundle-name
-sudo dpkg -r jplinuxdebmaintainertest
-sudo dpkg -r jplinuxdebpackagedepstest
-sudo dpkg -r jplinuxdebpackagedepstestdep
--- a/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPLinuxRpmAssociationsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxAssociationsBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPLinuxRpmAssociationsTest
- */
-public class JPLinuxRpmAssociationsTest {
- private static final String TEST_NAME = "JPLinuxRpmAssociationsTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- JPLinuxAssociationsBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPLinuxRpmBundleNameTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxBundleNameBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPLinuxRpmBundleNameTest
- */
-public class JPLinuxRpmBundleNameTest {
- private static final String TEST_NAME = "JPLinuxRpmBundleNameTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- JPLinuxBundleNameBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPLinuxRpmInstallDirTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxInstallDirBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPLinuxRpmInstallDirTest
- */
-public class JPLinuxRpmInstallDirTest {
- private static final String TEST_NAME = "JPLinuxRpmInstallDirTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- JPLinuxInstallDirBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPLinuxRpmLicenseTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxLicenseBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPLinuxRpmLicenseTest
- */
-public class JPLinuxRpmLicenseTest {
- private static final String TEST_NAME = "JPLinuxRpmLicenseTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- JPLinuxLicenseBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPLinuxRpmLicenseTypeTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxLicenseTypeBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPLinuxRpmLicenseTypeTest
- */
-public class JPLinuxRpmLicenseTypeTest {
- private static final String TEST_NAME = "JPLinuxRpmLicenseTypeTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- JPLinuxLicenseTypeBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPLinuxRpmPackageDepsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxPackageDepsBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm/timeout=240 -Xmx512m JPLinuxRpmPackageDepsTest
- */
-public class JPLinuxRpmPackageDepsTest {
- private static final String TEST_NAME = "JPLinuxRpmPackageDepsTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- JPLinuxPackageDepsBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPLinuxRpmTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPLinuxBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPLinuxRpmTest
- */
-public class JPLinuxRpmTest {
- private static final String TEST_NAME = "JPLinuxRpmTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- JPLinuxBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/linux/rpm/install.sh Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-sudo rpm --install jplinuxrpmassociationstest-1.0-1.x86_64.rpm
-sudo rpm --install jplinuxrpminstalldirtest-1.0-1.x86_64.rpm
-sudo rpm --install jplinuxrpmlicensetest-1.0-1.x86_64.rpm
-sudo rpm --install jplinuxrpmlicensetypetest-1.0-1.x86_64.rpm
-sudo rpm --install jplinuxrpmpackagedepstestdep-1.0-1.x86_64.rpm
-sudo rpm --install jplinuxrpmpackagedepstest-1.0-1.x86_64.rpm
-sudo rpm --install jplinuxrpmtest-1.0-1.x86_64.rpm
-sudo rpm --install jpackage-test-bundle-name-1.0-1.x86_64.rpm
--- a/test/jdk/tools/jpackage/createinstaller/linux/rpm/uninstall.sh Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-sudo rpm -e jplinuxrpmassociationstest
-sudo rpm -e jplinuxrpminstalldirtest
-sudo rpm -e jplinuxrpmlicensetest
-sudo rpm -e jplinuxrpmlicensetypetest
-sudo rpm -e jplinuxrpmpackagedepstest
-sudo rpm -e jplinuxrpmpackagedepstestdep
-sudo rpm -e jplinuxrpmtest
-sudo rpm -e jpackage-test-bundle-name
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPMacAssociationsBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.Desktop;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPMacAssociationsBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String TEST_EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void validateAppOutput() throws Exception {
- File outFile = new File("appOutput.txt");
- int count = 10;
- boolean bOutputCreated = false;
- while (count > 0) {
- if (!outFile.exists()) {
- Thread.sleep(3000);
- count--;
- } else {
- bOutputCreated = true;
- break;
- }
- }
-
- if (!bOutputCreated) {
- throw new AssertionError(outFile.getAbsolutePath() + " was not created");
- }
-
- String output = Files.readString(outFile.toPath());
- String[] result = output.split("\n");
- if (result.length != 3) {
- System.err.println(output);
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 1")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- File faFile = new File(TEST_NAME + "." + TEST_EXT);
- if (!result[2].trim().equals(faFile.getAbsolutePath())) {
- throw new AssertionError("Unexpected result[2]: " + result[2]);
- }
- }
-
- private static void verifyInstall() throws Exception {
- createAssociationsTestFile();
- Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
- validateAppOutput();
- }
-
- private static void verifyUnInstall() throws Exception {
- // Not needed on OS X, since we just deleting installed application
- // without using generated installer. We keeping this for consistnency
- // between platforms.
- }
-
- private static void createAssociationsTestFile() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
- out.println(TEST_NAME);
- }
- }
-
- private static void createAssociationsProperties() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter("fa.properties")))) {
- out.println("extension=" + TEST_EXT);
- out.println("mime-type=application/" + TEST_EXT);
- out.println("description=jpackage test extention");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- TEST_EXT = "jptest1";
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--file-associations", "fa.properties"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- createAssociationsProperties();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPMacBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPMacBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getOSXInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- // Not needed on OS X, since we just deleting installed application
- // without using generated installer. We keeping this for consistnency
- // between platforms.
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPMacInstallDirBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPMacInstallDirBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getOSXInstalledApp("jpackage", TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- // Not needed on OS X, since we just deleting installed application
- // without using generated installer. We keeping this for consistnency
- // between platforms.
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--install-dir", "/Applications/jpackage"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPMacLicenseBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPMacLicenseBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getOSXInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- }
-
- private static void verifyUnInstall() throws Exception {
- // Not needed on OS X, since we just deleting installed application
- // without using generated installer. We keeping this for consistnency
- // between platforms.
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String [] {
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--license-file", JPackagePath.getLicenseFilePath()};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPMacOptionsBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-
-public class JPMacOptionsBase {
-
- static final String TEST_BUNDLE_NAME = "TestBundleName";
- static final String TEST_BUNDLE_IDENTIFIER = "net.java.openjdk.packagerTest";
- static final String TEST_CATECORY = "public.app-category.test";
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
-
- if (EXT.equals("dmg")) {
- String disk = null;
- try {
- var log = new File("hdiutil.log");
- JPackageHelper.execute(log, "/usr/bin/hdiutil",
- "attach", OUTPUT);
- try(var br = new BufferedReader(new FileReader(log))) {
- var line = br.lines().reduce((a, b) -> b).orElse(null)
- .split("\t");
- disk = line[0].trim();
- testPkg(line[2].trim() + File.separator + TEST_NAME +
- "-1.0.pkg");
- }
- } finally {
- if (disk != null) {
- JPackageHelper.execute(null,
- "/usr/bin/hdiutil", "detach", disk);
- }
- }
- } else {
- testPkg(OUTPUT);
- }
- }
-
- private static void testPkg(String path) throws Exception {
- JPackageHelper.execute(null, "/usr/sbin/pkgutil",
- "--expand-full", path, "expand");
- var info = new File("expand/" + TEST_NAME + "-app.pkg/Payload/"
- + TEST_NAME + ".app/Contents/Info.plist");
- if (!info.exists()) {
- throw new AssertionError("Info.plist not found");
- }
-
- String bundleName = null;
- String bundleIdentifier = null;
- String categoryType = null;
- try (FileInputStream fis = new FileInputStream(info)) {
- var xmlInFact = XMLInputFactory.newInstance();
- xmlInFact.setProperty(XMLInputFactory.SUPPORT_DTD, false);
- xmlInFact.setProperty(
- XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
- var reader = xmlInFact.createXMLStreamReader(fis);
- while (reader.hasNext()) {
- if (reader.next() == XMLStreamConstants.CHARACTERS) {
- switch (reader.getText()) {
- case "CFBundleName": {
- bundleName = readValue(reader);
- break;
- }
- case "CFBundleIdentifier" : {
- bundleIdentifier = readValue(reader);
- break;
- }
- case "LSApplicationCategoryType" : {
- categoryType = readValue(reader);
- break;
- }
- }
- }
- }
- }
- boolean passed = true;
- if (!TEST_BUNDLE_NAME.equals(bundleName)) {
- passed = false;
- System.err.println("Wrong bundle name [" + bundleName +
- "] expected [" + TEST_BUNDLE_NAME + "]" );
- }
- if (!TEST_BUNDLE_IDENTIFIER.equals(bundleIdentifier)) {
- passed = false;
- System.err.println("Wrong bundle identifier [" +
- bundleIdentifier + "] expected [" + TEST_BUNDLE_IDENTIFIER
- + "]" );
- }
- if (!TEST_CATECORY.equals(categoryType)) {
- passed = false;
- System.err.println("Wrong appstore category [" + categoryType +
- "] expected [" + TEST_CATECORY + "]" );
- }
-
- if (!passed) {
- throw new AssertionError("Test failed");
- }
- }
-
- static private String readValue(XMLStreamReader reader) throws Exception {
- while (reader.hasNext() && reader.next() != XMLStreamConstants.START_ELEMENT);
- return reader.hasNext() ? reader.getElementText() : null;
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getOSXInstalledApp("jpackage", TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- // Not needed on OS X, since we just deleting installed application
- // without using generated installer. We keeping this for consistnency
- // between platforms.
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[] {
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--mac-bundle-name", TEST_BUNDLE_NAME,
- "--mac-bundle-identifier", TEST_BUNDLE_IDENTIFIER,
- "--mac-app-store-category", TEST_CATECORY
- };
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/dmg/JPMacDmgAssociationsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacAssociationsBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPMacDmgAssociationsTest
- */
-public class JPMacDmgAssociationsTest {
- private static final String TEST_NAME = "JPMacDmgAssociationsTest";
- private static final String EXT = "dmg";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
- JPMacAssociationsBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/dmg/JPMacDmgInstallDirTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacInstallDirBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPMacDmgInstallDirTest
- */
-public class JPMacDmgInstallDirTest {
- private static final String TEST_NAME = "JPMacDmgInstallDirTest";
- private static final String EXT = "dmg";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
- JPMacInstallDirBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/dmg/JPMacDmgLicenseTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacLicenseBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPMacDmgLicenseTest
- */
-public class JPMacDmgLicenseTest {
- private static final String TEST_NAME = "JPMacDmgLicenseTest";
- private static final String EXT = "dmg";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
- JPMacLicenseBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/dmg/JPMacDmgOptionsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacOptionsBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPMacDmgOptionsTest
- */
-public class JPMacDmgOptionsTest {
- private static final String TEST_NAME = "JPMacDmgOptionsTest";
- private static final String EXT = "dmg";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
- JPMacOptionsBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/dmg/JPMacDmgTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPMacDmgTest
- */
-public class JPMacDmgTest {
- private static final String TEST_NAME = "JPMacDmgTest";
- private static final String EXT = "dmg";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
- JPMacBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/dmg/install.sh Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-echo "Note: This script will install DMG files silently. In order to verify UI, each .dmg needs to launched manually via Finder."
-
-# JPMacDmgTest
-hdiutil attach JPMacDmgTest-1.0.dmg
-sudo /usr/sbin/installer -pkg /Volumes/JPMacDmgTest/JPMacDmgTest-1.0.pkg -target /
-hdiutil detach /Volumes/JPMacDmgTest/
-
-# JPMacDmgLicenseTest
-hdiutil attach JPMacDmgLicenseTest-1.0.dmg
-sudo /usr/sbin/installer -pkg /Volumes/JPMacDmgLicenseTest/JPMacDmgLicenseTest-1.0.pkg -target /
-hdiutil detach /Volumes/JPMacDmgLicenseTest/
-
-# JPMacDmgAssociationsTest
-hdiutil attach JPMacDmgAssociationsTest-1.0.dmg
-sudo /usr/sbin/installer -pkg /Volumes/JPMacDmgAssociationsTest/JPMacDmgAssociationsTest-1.0.pkg -target /
-hdiutil detach /Volumes/JPMacDmgAssociationsTest/
-
-# JPMacDmgOptionsTest
-hdiutil attach JPMacDmgOptionsTest-1.0.dmg
-sudo /usr/sbin/installer -pkg /Volumes/JPMacDmgOptionsTest/JPMacDmgOptionsTest-1.0.pkg -target /
-hdiutil detach /Volumes/JPMacDmgOptionsTest/
-
-# JPMacDmgInstallDirTest
-hdiutil attach JPMacDmgInstallDirTest-1.0.dmg
-sudo /usr/sbin/installer -pkg /Volumes/JPMacDmgInstallDirTest/JPMacDmgInstallDirTest-1.0.pkg -target /
-hdiutil detach /Volumes/JPMacDmgInstallDirTest/
--- a/test/jdk/tools/jpackage/createinstaller/macosx/dmg/uninstall.sh Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-sudo rm -rf /Applications/JPMacDmgTest.app
-sudo rm -rf /Applications/JPMacDmgLicenseTest.app
-sudo rm -rf /Applications/JPMacDmgAssociationsTest.app
-sudo rm -rf /Applications/JPMacDmgOptionsTest.app
-sudo rm -rf /Applications/jpackage/JPMacDmgInstallDirTest.app
--- a/test/jdk/tools/jpackage/createinstaller/macosx/pkg/JPMacPkgAssociationsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacAssociationsBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPMacPkgAssociationsTest
- */
-public class JPMacPkgAssociationsTest {
- private static final String TEST_NAME = "JPMacPkgAssociationsTest";
- private static final String EXT = "pkg";
-
- public static void main(String[] args) throws Exception {
- JPMacAssociationsBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/pkg/JPMacPkgInstallDirTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacInstallDirBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPMacPkgInstallDirTest
- */
-public class JPMacPkgInstallDirTest {
- private static final String TEST_NAME = "JPMacPkgInstallDirTest";
- private static final String EXT = "pkg";
-
- public static void main(String[] args) throws Exception {
- JPMacInstallDirBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/pkg/JPMacPkgLicenseTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacLicenseBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPMacPkgLicenseTest
- */
-public class JPMacPkgLicenseTest {
- private static final String TEST_NAME = "JPMacPkgLicenseTest";
- private static final String EXT = "pkg";
-
- public static void main(String[] args) throws Exception {
- JPMacLicenseBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/pkg/JPMacPkgOptionsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacOptionsBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPMacPkgOptionsTest
- */
-public class JPMacPkgOptionsTest {
- private static final String TEST_NAME = "JPMacPkgOptionsTest";
- private static final String EXT = "pkg";
-
- public static void main(String[] args) throws Exception {
- JPMacOptionsBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/pkg/JPMacPkgTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPMacBase
- * @requires (os.family == "mac")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPMacPkgTest
- */
-public class JPMacPkgTest {
- private static final String TEST_NAME = "JPMacPkgTest";
- private static final String EXT = "pkg";
-
- public static void main(String[] args) throws Exception {
- JPMacBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/pkg/install.sh Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-echo Note: This script will install packages silently. In order to verify UI, each .pkg needs to launched manually via Finder.
-sudo /usr/sbin/installer -pkg JPMacPkgTest-1.0.pkg -target /
-sudo /usr/sbin/installer -pkg JPMacPkgLicenseTest-1.0.pkg -target /
-sudo /usr/sbin/installer -pkg JPMacPkgAssociationsTest-1.0.pkg -target /
-sudo /usr/sbin/installer -pkg JPMacOptionsTest-1.0.pkg -target /
-sudo /usr/sbin/installer -pkg JPMacPkgInstallDirTest-1.0.pkg -target /
--- a/test/jdk/tools/jpackage/createinstaller/macosx/pkg/uninstall.sh Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-sudo rm -rf /Applications/JPMacPkgTest.app
-sudo rm -rf /Applications/JPMacPkgLicenseTest.app
-sudo rm -rf /Applications/JPMacPkgAssociationsTest.app
-sudo rm -rf /Applications/JPMacPkgOptionsDirTest.app
-sudo rm -rf /Applications/jpackage/JPMacPkgInstallDirTest.app
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.Desktop;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerFileAssociationsBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String TEST_EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void validateAppOutput() throws Exception {
- File outFile = new File("appOutput.txt");
- int count = 10;
- boolean bOutputCreated = false;
- while (count > 0) {
- if (!outFile.exists()) {
- Thread.sleep(3000);
- count--;
- } else {
- bOutputCreated = true;
- break;
- }
- }
-
- if (!bOutputCreated) {
- throw new AssertionError(outFile.getAbsolutePath() + " was not created");
- }
-
- String output = Files.readString(outFile.toPath());
- String[] result = output.split("\n");
- if (result.length != 3) {
- System.err.println(output);
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 1")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- File faFile = new File(TEST_NAME + "." + TEST_EXT);
- if (!result[2].trim().equals(faFile.getAbsolutePath())) {
- throw new AssertionError("Unexpected result[2]: " + result[2]);
- }
- }
-
- private static void verifyInstall() throws Exception {
- createFileAssociationsTestFile();
- Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
- validateAppOutput();
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
-
- // Validate registry
- String[] values1 = {TEST_NAME};
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, values1, true);
- String[] values2 = {TEST_EXT};
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, values2, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate registry
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, null, false);
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, null, false);
- }
-
- private static void createFileAssociationsTestFile() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
- out.println(TEST_NAME);
- }
- }
-
- private static void createFileAssociationsProperties() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter("fa.properties")))) {
- out.println("extension=" + TEST_EXT);
- out.println("mime-type=application/" + TEST_EXT);
- out.println("description=jpackage test extention");
- }
- }
-
- private static void init(String name, String ext, String installDir, String testExt) {
- TEST_NAME = name;
- EXT = ext;
- TEST_EXT = testExt;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- if (installDir == null) {
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--file-associations", "fa.properties"};
- } else {
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--file-associations", "fa.properties",
- "--install-dir", installDir};
- }
- }
-
- public static void run(String name, String ext, String installDir, String testExt) throws Exception {
- init(name, ext, installDir, testExt);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- createFileAssociationsProperties();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerInstallDirBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerInstallDirBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
- private static String INSTALL_DIR;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(INSTALL_DIR, TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate desktop shortcut
- JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(INSTALL_DIR);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate desktop shortcut
- JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- INSTALL_DIR = "TestVendor\\JPackageCreateInstallerInstallDirTestDir";
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--install-dir", INSTALL_DIR,
- "--win-shortcut"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerLicenseBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerLicenseBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String [] {
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--license-file", JPackagePath.getLicenseFilePath()};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerRuntimeBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerRuntimeBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- // NOP by design.
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--output", "output",
- "--name", TEST_NAME,
- "--runtime-image", System.getProperty("java.home")};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinDirChooserBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerWinDirChooserBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-dir-chooser"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerWinMenuBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-menu"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuGroupBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerWinMenuGroupBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu(TEST_NAME, TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu(TEST_NAME, TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-menu",
- "--win-menu-group", TEST_NAME};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinPerUserInstallBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerWinPerUserInstallBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinUserLocalInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateUserLocalStartMenu(TEST_NAME, TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinUserLocalInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateUserLocalStartMenu(TEST_NAME, TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-per-user-install",
- "--win-menu",
- "--win-menu-group", TEST_NAME};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinRegistryNameBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.Desktop;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerWinRegistryNameBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String TEST_EXT;
- private static String WIN_REGISTRY_NAME;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void validateAppOutput() throws Exception {
- File outFile = new File("appOutput.txt");
- int count = 10;
- boolean bOutputCreated = false;
- while (count > 0) {
- if (!outFile.exists()) {
- Thread.sleep(3000);
- count--;
- } else {
- bOutputCreated = true;
- break;
- }
- }
-
- if (!bOutputCreated) {
- throw new AssertionError(outFile.getAbsolutePath() + " was not created");
- }
-
- String output = Files.readString(outFile.toPath());
- String[] result = output.split("\n");
- if (result.length != 3) {
- System.err.println(output);
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 1")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- File faFile = new File(TEST_NAME + "." + TEST_EXT);
- if (!result[2].trim().equals(faFile.getAbsolutePath())) {
- throw new AssertionError("Unexpected result[2]: " + result[2]);
- }
- }
-
- private static void verifyInstall() throws Exception {
- createFileAssociationsTestFile();
- Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
- validateAppOutput();
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
-
- // Validate registry
- String[] values1 = {WIN_REGISTRY_NAME};
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, values1, true);
- String[] values2 = {TEST_EXT};
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, values2, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate registry
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, null, false);
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, null, false);
- }
-
- private static void createFileAssociationsTestFile() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
- out.println(TEST_NAME);
- }
- }
-
- private static void createFileAssociationsProperties() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter("fa.properties")))) {
- out.println("extension=" + TEST_EXT);
- out.println("mime-type=application/" + TEST_EXT);
- out.println("description=jpackage test extention");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- TEST_EXT = "jptest2";
- WIN_REGISTRY_NAME = "JPWINTESTREGISTRYNAME";
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--file-associations", "fa.properties",
- "--win-registry-name", WIN_REGISTRY_NAME};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- createFileAssociationsProperties();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinShortcutBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerWinShortcutBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate desktop shortcut
- JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate desktop shortcut
- JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-shortcut"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinUpgradeUUIDBase.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JPackageCreateInstallerWinUpgradeUUIDBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT_1;
- private static String[] CMD_1;
- private static String OUTPUT_2;
- private static String[] CMD_2;
- private static final String FILE_1 = "file1.txt";
- private static final String FILE_2 = "file2.txt";
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT_1);
- files.add(OUTPUT_2);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD_1);
- JPackageInstallerHelper.validateOutput(OUTPUT_1);
- JPackageHelper.executeCLI(true, CMD_2);
- JPackageInstallerHelper.validateOutput(OUTPUT_2);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- String file1Path = JPackagePath.getWinInstalledAppFolder(TEST_NAME) + File.separator + FILE_1;
- File file1 = new File(file1Path);
- if (EXT.equals("msi")) {
- if (file1.exists()) {
- throw new AssertionError("Unexpected file does exist: "
- + file1.getAbsolutePath());
- }
- } else if (EXT.equals("exe")) {
- if (!file1.exists()) {
- throw new AssertionError("Unexpected file does not exist: "
- + file1.getAbsolutePath());
- }
- } else {
- throw new AssertionError("Unknown installer type: " + EXT);
- }
-
- String file2Path = JPackagePath.getWinInstalledAppFolder(TEST_NAME) + File.separator + FILE_2;
- File file2 = new File(file2Path);
- if (!file2.exists()) {
- throw new AssertionError("Unexpected file does not exist: "
- + file2.getAbsolutePath());
- }
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT_1 = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD_1 = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--app-version", "1.0",
- "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"};
- OUTPUT_2 = "output" + File.separator + TEST_NAME + "-2.0." + EXT;
- CMD_2 = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--app-version", "2.0",
- "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"};
- }
-
- private static void createInputFile(String name, String context) throws Exception {
- try (PrintWriter out = new PrintWriter(
- new BufferedWriter(new FileWriter("input" + File.separator + name)))) {
- out.println(context);
- }
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- createInputFile(FILE_1, FILE_1);
- createInputFile(FILE_2, FILE_2);
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerFileAssociationsInstallDirTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerFileAssociationsBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsInstallDirTest
- */
-public class JPackageCreateInstallerFileAssociationsInstallDirTest {
- private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsInstallDirTest";
- private static final String EXT = "exe";
- private static final String INSTALL_DIR
- = "TestVendor\\JPackageCreateInstallerFileAssociationsInstallDirTestDir";
- private static final String TEST_EXT = "jptest3";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME, EXT, INSTALL_DIR, TEST_EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerFileAssociationsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerFileAssociationsBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsTest
- */
-public class JPackageCreateInstallerFileAssociationsTest {
- private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsTest";
- private static final String EXT = "exe";
- private static final String TEST_EXT = "jptest1";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME, EXT, null, TEST_EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerInstallDirTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer install dir test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerInstallDirBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerInstallDirTest
- */
-public class JPackageCreateInstallerInstallDirTest {
- private static final String TEST_NAME = "JPackageCreateInstallerInstallDirTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerInstallDirBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerLicenseTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerLicenseBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerLicenseTest
- */
-public class JPackageCreateInstallerLicenseTest {
- private static final String TEST_NAME = "JPackageCreateInstallerLicenseTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerLicenseBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerRuntimeTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.lang.invoke.MethodHandles;
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerRuntimeBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerRuntimeTest
- */
-public class JPackageCreateInstallerRuntimeTest {
-
- private static final String TEST_NAME = MethodHandles.lookup().lookupClass().getName();
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerRuntimeBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerTest
- */
-public class JPackageCreateInstallerTest {
- private static final String TEST_NAME = "JPackageCreateInstallerTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinDirChooserTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinDirChooserBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinDirChooserTest
- */
-public class JPackageCreateInstallerWinDirChooserTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinDirChooserTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinDirChooserBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinMenuGroupTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinMenuGroupBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinMenuGroupTest
- */
-public class JPackageCreateInstallerWinMenuGroupTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinMenuGroupTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinMenuGroupBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinMenuTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinMenuBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinMenuTest
- */
-public class JPackageCreateInstallerWinMenuTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinMenuTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinMenuBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinPerUserInstallTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinPerUserInstallBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinPerUserInstallTest
- */
-public class JPackageCreateInstallerWinPerUserInstallTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinPerUserInstallTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinPerUserInstallBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinRegistryNameTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinRegistryNameBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinRegistryNameTest
- */
-public class JPackageCreateInstallerWinRegistryNameTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinRegistryNameTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinRegistryNameBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinShortcutTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinShortcutBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinShortcutTest
- */
-public class JPackageCreateInstallerWinShortcutTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinShortcutTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinShortcutBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinUpgradeUUIDTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinUpgradeUUIDBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinUpgradeUUIDTest
- */
-public class JPackageCreateInstallerWinUpgradeUUIDTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinUpgradeUUIDTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinUpgradeUUIDBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/install.bat Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-JPackageCreateInstallerTest-1.0.exe
-JPackageCreateInstallerWinMenuTest-1.0.exe
-JPackageCreateInstallerWinMenuGroupTest-1.0.exe
-JPackageCreateInstallerWinPerUserInstallTest-1.0.exe
-JPackageCreateInstallerFileAssociationsTest-1.0.exe
-ECHO Make sure that installer asks to select installation location. Install to default one.
-JPackageCreateInstallerWinDirChooserTest-1.0.exe
-JPackageCreateInstallerWinRegistryNameTest-1.0.exe
-JPackageCreateInstallerWinShortcutTest-1.0.exe
-ECHO Make sure that installer shows license
-JPackageCreateInstallerLicenseTest-1.0.exe
-JPackageCreateInstallerWinUpgradeUUIDTest-1.0.exe
-JPackageCreateInstallerWinUpgradeUUIDTest-2.0.exe
-JPackageCreateInstallerInstallDirTest-1.0.exe
-JPackageCreateInstallerFileAssociationsInstallDirTest-1.0.exe
-JPackageCreateInstallerRuntimeTest-1.0.exe
-PAUSE
--- a/test/jdk/tools/jpackage/createinstaller/windows/exe/uninstall.bat Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-"%ProgramFiles%\JPackageCreateInstallerTest\unins000.exe"
-"%ProgramFiles%\JPackageCreateInstallerWinMenuTest\unins000.exe"
-"%ProgramFiles%\JPackageCreateInstallerWinMenuGroupTest\unins000.exe"
-"%localappdata%\JPackageCreateInstallerWinPerUserInstallTest\unins000.exe"
-"%ProgramFiles%\JPackageCreateInstallerFileAssociationsTest\unins000.exe"
-"%ProgramFiles%\JPackageCreateInstallerWinDirChooserTest\unins000.exe"
-"%ProgramFiles%\JPackageCreateInstallerWinRegistryNameTest\unins000.exe"
-"%ProgramFiles%\JPackageCreateInstallerWinShortcutTest\unins000.exe"
-"%ProgramFiles%\JPackageCreateInstallerLicenseTest\unins000.exe"
-"%ProgramFiles%\JPackageCreateInstallerWinUpgradeUUIDTest\unins000.exe"
-"%ProgramFiles%\TestVendor\JPackageCreateInstallerInstallDirTestDir\unins000.exe"
-"%ProgramFiles%\TestVendor\JPackageCreateInstallerFileAssociationsInstallDirTestDir\unins000.exe"
-"%ProgramFiles%\JPackageCreateInstallerRuntimeTest\unins000.exe"
-PAUSE
\ No newline at end of file
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerFileAssociationsInstallDirTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerFileAssociationsBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsInstallDirTest
- */
-public class JPackageCreateInstallerFileAssociationsInstallDirTest {
- private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsInstallDirTest";
- private static final String EXT = "msi";
- private static final String INSTALL_DIR
- = "TestVendor\\JPackageCreateInstallerFileAssociationsInstallDirTestDir";
- private static final String TEST_EXT = "jptest3";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME,
- EXT, INSTALL_DIR, TEST_EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerFileAssociationsTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerFileAssociationsBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsTest
- */
-public class JPackageCreateInstallerFileAssociationsTest {
- private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsTest";
- private static final String EXT = "msi";
- private static final String TEST_EXT = "jptest1";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME,
- EXT, null, TEST_EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerInstallDirTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer install dir test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerInstallDirBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerInstallDirTest
- */
-public class JPackageCreateInstallerInstallDirTest {
- private static final String TEST_NAME = "JPackageCreateInstallerInstallDirTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerInstallDirBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerLicenseTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerLicenseBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerLicenseTest
- */
-public class JPackageCreateInstallerLicenseTest {
- private static final String TEST_NAME = "JPackageCreateInstallerLicenseTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerLicenseBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerRuntimeTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.lang.invoke.MethodHandles;
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerRuntimeBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerRuntimeTest
- */
-public class JPackageCreateInstallerRuntimeTest {
-
- private static final String TEST_NAME = MethodHandles.lookup().lookupClass().getName();
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerRuntimeBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerTest
- */
-public class JPackageCreateInstallerTest {
- private static final String TEST_NAME = "JPackageCreateInstallerTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinDirChooserTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinDirChooserBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinDirChooserTest
- */
-public class JPackageCreateInstallerWinDirChooserTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinDirChooserTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinDirChooserBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinMenuGroupTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinMenuGroupBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinMenuGroupTest
- */
-public class JPackageCreateInstallerWinMenuGroupTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinMenuGroupTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinMenuGroupBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinMenuTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinMenuBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinMenuTest
- */
-public class JPackageCreateInstallerWinMenuTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinMenuTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinMenuBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinPerUserInstallTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinPerUserInstallBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinPerUserInstallTest
- */
-public class JPackageCreateInstallerWinPerUserInstallTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinPerUserInstallTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinPerUserInstallBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinRegistryNameTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinRegistryNameBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinRegistryNameTest
- */
-public class JPackageCreateInstallerWinRegistryNameTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinRegistryNameTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinRegistryNameBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinShortcutTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinShortcutBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinShortcutTest
- */
-public class JPackageCreateInstallerWinShortcutTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinShortcutTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinShortcutBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinUpgradeUUIDTest.java Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build JPackageCreateInstallerWinUpgradeUUIDBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m JPackageCreateInstallerWinUpgradeUUIDTest
- */
-public class JPackageCreateInstallerWinUpgradeUUIDTest {
- private static final String TEST_NAME = "JPackageCreateInstallerWinUpgradeUUIDTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- JPackageCreateInstallerWinUpgradeUUIDBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/install.bat Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-JPackageCreateInstallerTest-1.0.msi
-JPackageCreateInstallerWinMenuTest-1.0.msi
-JPackageCreateInstallerWinMenuGroupTest-1.0.msi
-JPackageCreateInstallerWinPerUserInstallTest-1.0.msi
-JPackageCreateInstallerFileAssociationsTest-1.0.msi
-ECHO Make sure that installer asks to select installation location. Install to default one.
-JPackageCreateInstallerWinDirChooserTest-1.0.msi
-JPackageCreateInstallerWinRegistryNameTest-1.0.msi
-JPackageCreateInstallerWinShortcutTest-1.0.msi
-ECHO Make sure that installer shows license
-JPackageCreateInstallerLicenseTest-1.0.msi
-JPackageCreateInstallerWinUpgradeUUIDTest-1.0.msi
-JPackageCreateInstallerWinUpgradeUUIDTest-2.0.msi
-JPackageCreateInstallerInstallDirTest-1.0.msi
-JPackageCreateInstallerFileAssociationsInstallDirTest-1.0.msi
-JPackageCreateInstallerRuntimeTest-1.0.msi
-PAUSE
--- a/test/jdk/tools/jpackage/createinstaller/windows/msi/uninstall.bat Sat Jun 29 09:11:19 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-MSIEXEC /uninstall JPackageCreateInstallerTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerWinMenuTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerWinMenuGroupTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerWinPerUserInstallTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerFileAssociationsTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerWinDirChooserTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerWinRegistryNameTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerWinShortcutTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerLicenseTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerWinUpgradeUUIDTest-2.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerInstallDirTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerFileAssociationsInstallDirTest-1.0.msi
-MSIEXEC /uninstall JPackageCreateInstallerRuntimeTest-1.0.msi
-PAUSE
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/base/Base.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Base {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT.toLowerCase());
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ if (EXT.equals("rpm")) {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
+ } else {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ }
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello" };
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/base/BundleNameBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class BundleNameBase {
+
+ private static String TEST_NAME;
+ private static String BUNDLE_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT.toLowerCase());
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ BUNDLE_NAME = "jpackage-test-bundle-name";
+ EXT = ext;
+ if (EXT.equals("rpm")) {
+ OUTPUT = "output" + File.separator + BUNDLE_NAME + "-1.0-1.x86_64." + EXT;
+ } else {
+ OUTPUT = "output" + File.separator + BUNDLE_NAME + "-1.0." + EXT;
+ }
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--linux-bundle-name", BUNDLE_NAME};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/base/FileAssociationsBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Desktop;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FileAssociationsBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String TEST_EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT.toLowerCase());
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void validateAppOutput() throws Exception {
+ File outFile = new File("appOutput.txt");
+ int count = 10;
+ boolean bOutputCreated = false;
+ while (count > 0) {
+ if (!outFile.exists()) {
+ Thread.sleep(3000);
+ count--;
+ } else {
+ bOutputCreated = true;
+ break;
+ }
+ }
+
+ if (!bOutputCreated) {
+ throw new AssertionError(outFile.getAbsolutePath() + " was not created");
+ }
+
+ String output = Files.readString(outFile.toPath());
+ String[] result = output.split("\n");
+ if (result.length != 3) {
+ System.err.println(output);
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 1")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+
+ File faFile = new File(TEST_NAME + "." + TEST_EXT);
+ if (!result[2].trim().equals(faFile.getAbsolutePath())) {
+ throw new AssertionError("Unexpected result[2]: " + result[2]);
+ }
+ }
+
+ private static void verifyInstall() throws Exception {
+ createAssociationsTestFile();
+ Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
+ validateAppOutput();
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void createAssociationsTestFile() throws Exception {
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
+ out.println(TEST_NAME);
+ }
+ }
+
+ private static void createAssociationsProperties() throws Exception {
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter("fa.properties")))) {
+ out.println("extension=" + TEST_EXT);
+ out.println("mime-type=application/" + TEST_EXT);
+ out.println("description=jpackage test extention");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ TEST_EXT = "jptest1";
+ if (EXT.equals("rpm")) {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
+ } else {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ }
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--file-associations", "fa.properties"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ createAssociationsProperties();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/base/InstallDirBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class InstallDirBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT.toLowerCase());
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getLinuxInstalledApp("jpackage", TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getLinuxInstallFolder("jpackage", TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ folderPath = JPackagePath.getLinuxInstallFolder("jpackage", null);
+ folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ if (EXT.equals("rpm")) {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
+ } else {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ }
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--install-dir", "/opt/jpackage"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/base/LicenseBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class LicenseBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT.toLowerCase());
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ if (EXT.equals("rpm")) {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
+ } else {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ }
+ CMD = new String [] {
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--license-file", JPackagePath.getLicenseFilePath()};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/base/LicenseTypeBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class LicenseTypeBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String JP_LICENSE_TYPE;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT.toLowerCase());
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static final String infoResult = "infoResult.txt";
+ private static void validatePackage() throws Exception {
+ int retVal = JPackageHelper.execute(new File(infoResult),"rpm",
+ "--query", "--package", "--info", OUTPUT.toLowerCase());
+ if (retVal != 0) {
+ throw new AssertionError("rpm exited with error: " + retVal);
+ }
+
+ File outfile = new File(infoResult);
+ if (!outfile.exists()) {
+ throw new AssertionError(infoResult + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ if (!output.contains(JP_LICENSE_TYPE)) {
+ throw new AssertionError("Unexpected result: " + output);
+ }
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ validatePackage();
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ JP_LICENSE_TYPE = "JP_LICENSE_TYPE";
+ if (EXT.equals("rpm")) {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
+ } else {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ }
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--linux-rpm-license-type", JP_LICENSE_TYPE};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/base/MaintainerBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MaintainerBase {
+
+ private static String TEST_NAME;
+ private static String EMAIL;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT.toLowerCase());
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static final String infoResult = "infoResult.txt";
+ private static void validatePackage() throws Exception {
+ int retVal = JPackageHelper.execute(new File(infoResult), "dpkg",
+ "--info", OUTPUT.toLowerCase());
+ if (retVal != 0) {
+ throw new AssertionError("dpkg exited with error: " + retVal);
+ }
+
+ File outfile = new File(infoResult);
+ if (!outfile.exists()) {
+ throw new AssertionError(infoResult + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ if (!output.contains("Maintainer: " + EMAIL)) {
+ throw new AssertionError("Unexpected result: " + output);
+ }
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ validatePackage();
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EMAIL = "jpackage-test@java.com";
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--linux-deb-maintainer", EMAIL};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/base/PackageDepsBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PackageDepsBase {
+
+ private static String TEST_NAME;
+ private static String DEP_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String OUTPUT_DEP;
+ private static String[] CMD;
+ private static String[] CMD_DEP;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT.toLowerCase());
+ files.add(OUTPUT_DEP.toLowerCase());
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static final String infoResult = "infoResult.txt";
+ private static void validatePackage() throws Exception {
+ if (EXT.equals("rpm")) {
+ int retVal = JPackageHelper.execute(new File(infoResult),"rpm",
+ "--query", "--package", "--requires", OUTPUT.toLowerCase());
+ if (retVal != 0) {
+ throw new AssertionError("rpm exited with error: " + retVal);
+ }
+ } else {
+ int retVal = JPackageHelper.execute(new File(infoResult), "dpkg",
+ "--info", OUTPUT.toLowerCase());
+ if (retVal != 0) {
+ throw new AssertionError("dpkg exited with error: " + retVal);
+ }
+ }
+
+ File outfile = new File(infoResult);
+ if (!outfile.exists()) {
+ throw new AssertionError(infoResult + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ if (!output.contains(DEP_NAME.toLowerCase())) {
+ throw new AssertionError("Unexpected result: " + output);
+ }
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageHelper.executeCLI(true, CMD_DEP);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ JPackageInstallerHelper.validateOutput(OUTPUT_DEP);
+ validatePackage();
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ app = JPackagePath.getLinuxInstalledApp(DEP_NAME);
+ JPackageInstallerHelper.validateApp(app);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ folderPath = JPackagePath.getLinuxInstallFolder(DEP_NAME);
+ folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ DEP_NAME = name + "Dep";
+ EXT = ext;
+ if (EXT.equals("rpm")) {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
+ OUTPUT_DEP = "output" + File.separator + DEP_NAME + "-1.0-1.x86_64." + EXT;
+ } else {
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ OUTPUT_DEP = "output" + File.separator + DEP_NAME + "-1.0." + EXT;
+ }
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--linux-package-deps", DEP_NAME.toLowerCase()};
+ CMD_DEP = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", DEP_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/deb/BundleNameTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build BundleNameBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m BundleNameTest
+ */
+public class BundleNameTest {
+ private static final String TEST_NAME = "BundleNameTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
+ BundleNameBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/deb/FileAssociationsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build FileAssociationsBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m FileAssociationsTest
+ */
+public class FileAssociationsTest {
+ private static final String TEST_NAME = "FileAssociationsTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
+ FileAssociationsBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/deb/InstallDirTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build InstallDirBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m InstallDirTest
+ */
+public class InstallDirTest {
+ private static final String TEST_NAME = "InstallDirTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
+ InstallDirBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/deb/LicenseTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build LicenseBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m LicenseTest
+ */
+public class LicenseTest {
+ private static final String TEST_NAME = "LicenseTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
+ LicenseBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/deb/MaintainerTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build MaintainerBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m MaintainerTest
+ */
+public class MaintainerTest {
+ private static final String TEST_NAME = "MaintainerTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
+ MaintainerBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/deb/PackageDepsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build PackageDepsBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=240 -Xmx512m PackageDepsTest
+ */
+public class PackageDepsTest {
+ private static final String TEST_NAME = "PackageDepsTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
+ PackageDepsBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/deb/Test.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build Base
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m Test
+ */
+public class Test {
+ private static final String TEST_NAME = "Test";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
+ Base.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/deb/install.sh Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,8 @@
+sudo dpkg -i test-1.0.deb
+sudo dpkg -i fileassociationstest-1.0.deb
+sudo dpkg -i licensetest-1.0.deb
+sudo dpkg -i installdirtest-1.0.deb
+sudo dpkg -i jpackage-test-bundle-name-1.0.deb
+sudo dpkg -i maintainertest-1.0.deb
+sudo dpkg -i packagedepstestdep-1.0.deb
+sudo dpkg -i packagedepstest-1.0.deb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/deb/uninstall.sh Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,8 @@
+sudo dpkg -r test
+sudo dpkg -r fileassociationstest
+sudo dpkg -r licensetest
+sudo dpkg -r installdirtest
+sudo dpkg -r jpackage-test-bundle-name
+sudo dpkg -r maintainertest
+sudo dpkg -r packagedepstest
+sudo dpkg -r packagedepstestdep
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/rpm/BundleNameTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build BundleNameBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m BundleNameTest
+ */
+public class BundleNameTest {
+ private static final String TEST_NAME = "BundleNameTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ BundleNameBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/rpm/FileAssociationsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build FileAssociationsBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m FileAssociationsTest
+ */
+public class FileAssociationsTest {
+ private static final String TEST_NAME = "FileAssociationsTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ FileAssociationsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/rpm/InstallDirTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build InstallDirBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m InstallDirTest
+ */
+public class InstallDirTest {
+ private static final String TEST_NAME = "InstallDirTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ InstallDirBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/rpm/LicenseTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build LicenseBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m LicenseTest
+ */
+public class LicenseTest {
+ private static final String TEST_NAME = "LicenseTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ LicenseBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/rpm/LicenseTypeTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build LicenseTypeBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m LicenseTypeTest
+ */
+public class LicenseTypeTest {
+ private static final String TEST_NAME = "LicenseTypeTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ LicenseTypeBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/rpm/PackageDepsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build PackageDepsBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm/timeout=240 -Xmx512m PackageDepsTest
+ */
+public class PackageDepsTest {
+ private static final String TEST_NAME = "PackageDepsTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ PackageDepsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/rpm/Test.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build Base
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m Test
+ */
+public class Test {
+ private static final String TEST_NAME = "Test";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ Base.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/rpm/install.sh Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,8 @@
+sudo rpm --install fileassociationstest-1.0-1.x86_64.rpm
+sudo rpm --install installdirtest-1.0-1.x86_64.rpm
+sudo rpm --install licensetest-1.0-1.x86_64.rpm
+sudo rpm --install licensetypetest-1.0-1.x86_64.rpm
+sudo rpm --install packagedepstestdep-1.0-1.x86_64.rpm
+sudo rpm --install packagedepstest-1.0-1.x86_64.rpm
+sudo rpm --install test-1.0-1.x86_64.rpm
+sudo rpm --install jpackage-test-bundle-name-1.0-1.x86_64.rpm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/rpm/uninstall.sh Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,8 @@
+sudo rpm -e fileassociationstest
+sudo rpm -e installdirtest
+sudo rpm -e licensetest
+sudo rpm -e licensetypetest
+sudo rpm -e packagedepstest
+sudo rpm -e packagedepstestdep
+sudo rpm -e test
+sudo rpm -e jpackage-test-bundle-name
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/BundleIdentifierTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.nio.file.Files;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
+/*
+ * @test
+ * @summary jpackage create image bundle identifier test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @requires (os.family == "mac")
+ * @run main/othervm -Xmx512m BundleIdentifierTest
+ */
+public class BundleIdentifierTest {
+ private static final String OUTPUT = "output";
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+ private static final String MAC_BUNDLE_IDENTIFIER = "TestBundleIdentifier";
+ private static final String APP_NAME = "test";
+ private static final String MAIN_CLASS = "Hello";
+
+ private static final String [] CMD_1 = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", APP_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", MAIN_CLASS
+ };
+
+ private static final String [] CMD_2 = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", APP_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", MAIN_CLASS,
+ "--mac-bundle-identifier", MAC_BUNDLE_IDENTIFIER
+ };
+
+ private static void validateResult(String[] result) throws Exception {
+ if (result.length != 2) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ private static void validate() throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError(
+ "Test application exited with error: " + retVal);
+ }
+
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+ validateResult(result);
+ }
+
+ private static void validateBundleIdentifier(String bundleIdentifier)
+ throws Exception {
+ System.out.println("Validating bundleIdentifier: " + bundleIdentifier);
+
+ File infoPList = new File(OUTPUT + File.separator + APP_NAME + ".app" +
+ File.separator + "Contents" + File.separator + "Info.plist");
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newDefaultInstance();
+ dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ DocumentBuilder b = dbf.newDocumentBuilder();
+ org.w3c.dom.Document doc = b.parse(new FileInputStream(
+ infoPList.getAbsolutePath()));
+
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ // Query for the value of <string> element preceding <key> element
+ // with value equal to CFBundleIdentifier
+ String v = (String)xPath.evaluate(
+ "//string[preceding-sibling::key = \"CFBundleIdentifier\"][1]",
+ doc, XPathConstants.STRING);
+
+ if (!v.equals(bundleIdentifier)) {
+ throw new AssertionError("Unexpected value of CFBundleIdentifier key: ["
+ + v + "]. Expected value: [" + bundleIdentifier + "]");
+ }
+ }
+
+ private static void testCreateAppImage(String [] cmd,
+ String bundleIdentifier,
+ boolean validateApp) throws Exception {
+ JPackageHelper.executeCLI(true, cmd);
+ if (validateApp) {
+ validate();
+ }
+ validateBundleIdentifier(bundleIdentifier);
+ }
+
+ private static void testCreateAppImageToolProvider(String [] cmd,
+ String bundleIdentifier,
+ boolean validateApp) throws Exception {
+ JPackageHelper.executeToolProvider(true, cmd);
+ if (validateApp) {
+ validate();
+ }
+ validateBundleIdentifier(bundleIdentifier);
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testCreateAppImage(CMD_1, MAIN_CLASS, false);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ testCreateAppImageToolProvider(CMD_1, MAIN_CLASS, false);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ testCreateAppImage(CMD_2, MAC_BUNDLE_IDENTIFIER, true);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ testCreateAppImageToolProvider(CMD_2, MAC_BUNDLE_IDENTIFIER, true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/BundleNameTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.nio.file.Files;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
+/*
+ * @test
+ * @summary jpackage create image bundle name test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @requires (os.family == "mac")
+ * @run main/othervm -Xmx512m BundleNameTest
+ */
+public class BundleNameTest {
+ private static final String OUTPUT = "output";
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+ private static final String MAC_BUNDLE_NAME = "TestBundleName";
+ private static final String APP_NAME = "test";
+
+ private static final String [] CMD_1 = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", APP_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello"
+ };
+
+ private static final String [] CMD_2 = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", APP_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--mac-bundle-name", MAC_BUNDLE_NAME
+ };
+
+ private static void validateResult(String[] result) throws Exception {
+ if (result.length != 2) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ private static void validate() throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError(
+ "Test application exited with error: " + retVal);
+ }
+
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+ validateResult(result);
+ }
+
+ private static void validateBundleName(String bundleName) throws Exception {
+ System.out.println("Validating bundleName: " + bundleName);
+
+ File infoPList = new File(OUTPUT + File.separator + APP_NAME + ".app" +
+ File.separator + "Contents" + File.separator + "Info.plist");
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newDefaultInstance();
+ dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ DocumentBuilder b = dbf.newDocumentBuilder();
+ org.w3c.dom.Document doc = b.parse(new FileInputStream(
+ infoPList.getAbsolutePath()));
+
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ // Query for the value of <string> element preceding <key> element
+ // with value equal to CFBundleName
+ String v = (String)xPath.evaluate(
+ "//string[preceding-sibling::key = \"CFBundleName\"][1]",
+ doc, XPathConstants.STRING);
+
+ if (!v.equals(bundleName)) {
+ throw new AssertionError("Unexpected value of CFBundleName key: ["
+ + v + "]. Expected value: [" + bundleName + "]");
+ }
+ }
+
+ private static void testCreateAppImage(String [] cmd,
+ String bundleName,
+ boolean validateApp) throws Exception {
+ JPackageHelper.executeCLI(true, cmd);
+ if (validateApp) {
+ validate();
+ }
+ validateBundleName(bundleName);
+ }
+
+ private static void testCreateAppImageToolProvider(String [] cmd,
+ String bundleName,
+ boolean validateApp) throws Exception {
+ JPackageHelper.executeToolProvider(true, cmd);
+ if (validateApp) {
+ validate();
+ }
+ validateBundleName(bundleName);
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testCreateAppImage(CMD_1, APP_NAME, false);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ testCreateAppImageToolProvider(CMD_1, APP_NAME, false);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ testCreateAppImage(CMD_2, MAC_BUNDLE_NAME, true);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ testCreateAppImageToolProvider(CMD_2, MAC_BUNDLE_NAME, true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/base/Base.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Base {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getOSXInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ // Not needed on OS X, since we just deleting installed application
+ // without using generated installer. We keeping this for consistnency
+ // between platforms.
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/base/FileAssociationsBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Desktop;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FileAssociationsBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String TEST_EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void validateAppOutput() throws Exception {
+ File outFile = new File("appOutput.txt");
+ int count = 10;
+ boolean bOutputCreated = false;
+ while (count > 0) {
+ if (!outFile.exists()) {
+ Thread.sleep(3000);
+ count--;
+ } else {
+ bOutputCreated = true;
+ break;
+ }
+ }
+
+ if (!bOutputCreated) {
+ throw new AssertionError(outFile.getAbsolutePath() + " was not created");
+ }
+
+ String output = Files.readString(outFile.toPath());
+ String[] result = output.split("\n");
+ if (result.length != 3) {
+ System.err.println(output);
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 1")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+
+ File faFile = new File(TEST_NAME + "." + TEST_EXT);
+ if (!result[2].trim().equals(faFile.getAbsolutePath())) {
+ throw new AssertionError("Unexpected result[2]: " + result[2]);
+ }
+ }
+
+ private static void verifyInstall() throws Exception {
+ createAssociationsTestFile();
+ Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
+ validateAppOutput();
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ // Not needed on OS X, since we just deleting installed application
+ // without using generated installer. We keeping this for consistnency
+ // between platforms.
+ }
+
+ private static void createAssociationsTestFile() throws Exception {
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
+ out.println(TEST_NAME);
+ }
+ }
+
+ private static void createAssociationsProperties() throws Exception {
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter("fa.properties")))) {
+ out.println("extension=" + TEST_EXT);
+ out.println("mime-type=application/" + TEST_EXT);
+ out.println("description=jpackage test extention");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ TEST_EXT = "jptest1";
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--file-associations", "fa.properties"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ createAssociationsProperties();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/base/InstallDirBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class InstallDirBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getOSXInstalledApp("jpackage", TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ // Not needed on OS X, since we just deleting installed application
+ // without using generated installer. We keeping this for consistnency
+ // between platforms.
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--install-dir", "/Applications/jpackage"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/base/LicenseBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class LicenseBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getOSXInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ // Not needed on OS X, since we just deleting installed application
+ // without using generated installer. We keeping this for consistnency
+ // between platforms.
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String [] {
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--license-file", JPackagePath.getLicenseFilePath()};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/base/OptionsBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+
+public class OptionsBase {
+
+ static final String TEST_BUNDLE_NAME = "TestBundleName";
+ static final String TEST_BUNDLE_IDENTIFIER = "net.java.openjdk.packagerTest";
+ static final String TEST_CATECORY = "public.app-category.test";
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+
+ if (EXT.equals("dmg")) {
+ String disk = null;
+ try {
+ var log = new File("hdiutil.log");
+ JPackageHelper.execute(log, "/usr/bin/hdiutil",
+ "attach", OUTPUT);
+ try(var br = new BufferedReader(new FileReader(log))) {
+ var line = br.lines().reduce((a, b) -> b).orElse(null)
+ .split("\t");
+ disk = line[0].trim();
+ testPkg(line[2].trim() + File.separator + TEST_NAME +
+ "-1.0.pkg");
+ }
+ } finally {
+ if (disk != null) {
+ JPackageHelper.execute(null,
+ "/usr/bin/hdiutil", "detach", disk);
+ }
+ }
+ } else {
+ testPkg(OUTPUT);
+ }
+ }
+
+ private static void testPkg(String path) throws Exception {
+ JPackageHelper.execute(null, "/usr/sbin/pkgutil",
+ "--expand-full", path, "expand");
+ var info = new File("expand/" + TEST_NAME + "-app.pkg/Payload/"
+ + TEST_NAME + ".app/Contents/Info.plist");
+ if (!info.exists()) {
+ throw new AssertionError("Info.plist not found");
+ }
+
+ String bundleName = null;
+ String bundleIdentifier = null;
+ String categoryType = null;
+ try (FileInputStream fis = new FileInputStream(info)) {
+ var xmlInFact = XMLInputFactory.newInstance();
+ xmlInFact.setProperty(XMLInputFactory.SUPPORT_DTD, false);
+ xmlInFact.setProperty(
+ XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
+ var reader = xmlInFact.createXMLStreamReader(fis);
+ while (reader.hasNext()) {
+ if (reader.next() == XMLStreamConstants.CHARACTERS) {
+ switch (reader.getText()) {
+ case "CFBundleName": {
+ bundleName = readValue(reader);
+ break;
+ }
+ case "CFBundleIdentifier" : {
+ bundleIdentifier = readValue(reader);
+ break;
+ }
+ case "LSApplicationCategoryType" : {
+ categoryType = readValue(reader);
+ break;
+ }
+ }
+ }
+ }
+ }
+ boolean passed = true;
+ if (!TEST_BUNDLE_NAME.equals(bundleName)) {
+ passed = false;
+ System.err.println("Wrong bundle name [" + bundleName +
+ "] expected [" + TEST_BUNDLE_NAME + "]" );
+ }
+ if (!TEST_BUNDLE_IDENTIFIER.equals(bundleIdentifier)) {
+ passed = false;
+ System.err.println("Wrong bundle identifier [" +
+ bundleIdentifier + "] expected [" + TEST_BUNDLE_IDENTIFIER
+ + "]" );
+ }
+ if (!TEST_CATECORY.equals(categoryType)) {
+ passed = false;
+ System.err.println("Wrong appstore category [" + categoryType +
+ "] expected [" + TEST_CATECORY + "]" );
+ }
+
+ if (!passed) {
+ throw new AssertionError("Test failed");
+ }
+ }
+
+ static private String readValue(XMLStreamReader reader) throws Exception {
+ while (reader.hasNext() && reader.next() != XMLStreamConstants.START_ELEMENT);
+ return reader.hasNext() ? reader.getElementText() : null;
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getOSXInstalledApp("jpackage", TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ // Not needed on OS X, since we just deleting installed application
+ // without using generated installer. We keeping this for consistnency
+ // between platforms.
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[] {
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--mac-bundle-name", TEST_BUNDLE_NAME,
+ "--mac-bundle-identifier", TEST_BUNDLE_IDENTIFIER,
+ "--mac-app-store-category", TEST_CATECORY
+ };
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/dmg/FileAssociationsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build FileAssociationsBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m FileAssociationsTest
+ */
+public class FileAssociationsTest {
+ private static final String TEST_NAME = "FileAssociationsTest";
+ private static final String EXT = "dmg";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
+ FileAssociationsBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/dmg/InstallDirTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build InstallDirBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m InstallDirTest
+ */
+public class InstallDirTest {
+ private static final String TEST_NAME = "InstallDirTest";
+ private static final String EXT = "dmg";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
+ InstallDirBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/dmg/LicenseTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build LicenseBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m LicenseTest
+ */
+public class LicenseTest {
+ private static final String TEST_NAME = "LicenseTest";
+ private static final String EXT = "dmg";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
+ LicenseBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/dmg/OptionsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build OptionsBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m OptionsTest
+ */
+public class OptionsTest {
+ private static final String TEST_NAME = "OptionsTest";
+ private static final String EXT = "dmg";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
+ OptionsBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/dmg/Test.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build Base
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m Test
+ */
+public class Test {
+ private static final String TEST_NAME = "Test";
+ private static final String EXT = "dmg";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.MacDmgBundler.isSupported()) {
+ Base.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/dmg/install.sh Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,26 @@
+echo "Note: This script will install DMG files silently. In order to verify UI, each .dmg needs to launched manually via Finder."
+
+# Test
+hdiutil attach Test-1.0.dmg
+sudo /usr/sbin/installer -pkg /Volumes/Test/Test-1.0.pkg -target /
+hdiutil detach /Volumes/Test/
+
+# LicenseTest
+hdiutil attach LicenseTest-1.0.dmg
+sudo /usr/sbin/installer -pkg /Volumes/LicenseTest/LicenseTest-1.0.pkg -target /
+hdiutil detach /Volumes/LicenseTest/
+
+# AssociationsTest
+hdiutil attach AssociationsTest-1.0.dmg
+sudo /usr/sbin/installer -pkg /Volumes/AssociationsTest/AssociationsTest-1.0.pkg -target /
+hdiutil detach /Volumes/AssociationsTest/
+
+# OptionsTest
+hdiutil attach OptionsTest-1.0.dmg
+sudo /usr/sbin/installer -pkg /Volumes/OptionsTest/OptionsTest-1.0.pkg -target /
+hdiutil detach /Volumes/OptionsTest/
+
+# InstallDirTest
+hdiutil attach InstallDirTest-1.0.dmg
+sudo /usr/sbin/installer -pkg /Volumes/InstallDirTest/InstallDirTest-1.0.pkg -target /
+hdiutil detach /Volumes/InstallDirTest/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/dmg/uninstall.sh Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,5 @@
+sudo rm -rf /Applications/Test.app
+sudo rm -rf /Applications/LicenseTest.app
+sudo rm -rf /Applications/FileAssociationsTest.app
+sudo rm -rf /Applications/OptionsTest.app
+sudo rm -rf /Applications/jpackage/InstallDirTest.app
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/pkg/FileAssociationsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build FileAssociationsBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m FileAssociationsTest
+ */
+public class FileAssociationsTest {
+ private static final String TEST_NAME = "FileAssociationsTest";
+ private static final String EXT = "pkg";
+
+ public static void main(String[] args) throws Exception {
+ FileAssociationsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/pkg/InstallDirTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build InstallDirBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m InstallDirTest
+ */
+public class InstallDirTest {
+ private static final String TEST_NAME = "InstallDirTest";
+ private static final String EXT = "pkg";
+
+ public static void main(String[] args) throws Exception {
+ InstallDirBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/pkg/LicenseTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build LicenseBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m LicenseTest
+ */
+public class LicenseTest {
+ private static final String TEST_NAME = "LicenseTest";
+ private static final String EXT = "pkg";
+
+ public static void main(String[] args) throws Exception {
+ LicenseBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/pkg/OptionsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build OptionsBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m OptionsTest
+ */
+public class OptionsTest {
+ private static final String TEST_NAME = "OptionsTest";
+ private static final String EXT = "pkg";
+
+ public static void main(String[] args) throws Exception {
+ OptionsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/pkg/Test.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build Base
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m Test
+ */
+public class Test {
+ private static final String TEST_NAME = "Test";
+ private static final String EXT = "pkg";
+
+ public static void main(String[] args) throws Exception {
+ Base.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/pkg/install.sh Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,6 @@
+echo Note: This script will install packages silently. In order to verify UI, each .pkg needs to launched manually via Finder.
+sudo /usr/sbin/installer -pkg Test-1.0.pkg -target /
+sudo /usr/sbin/installer -pkg LicenseTest-1.0.pkg -target /
+sudo /usr/sbin/installer -pkg FileAssociationsTest-1.0.pkg -target /
+sudo /usr/sbin/installer -pkg OptionsTest-1.0.pkg -target /
+sudo /usr/sbin/installer -pkg InstallDirTest-1.0.pkg -target /
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/macosx/pkg/uninstall.sh Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,5 @@
+sudo rm -rf /Applications/Test.app
+sudo rm -rf /Applications/LicenseTest.app
+sudo rm -rf /Applications/FileAssociationsTest.app
+sudo rm -rf /Applications/OptionsDirTest.app
+sudo rm -rf /Applications/jpackage/InstallDirTest.app
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/AddLauncherBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AddLauncherBase {
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ // Note: quotes in argument for add launcher is not support by test
+ private static final String ARGUMENT1 = "argument 1";
+ private static final String ARGUMENT2 = "argument 2";
+ private static final String ARGUMENT3 = "argument 3";
+
+ private static final List<String> arguments = new ArrayList<>();
+
+ private static final String PARAM1 = "-Dparam1=Some Param 1";
+ private static final String PARAM2 = "-Dparam2=Some Param 2";
+ private static final String PARAM3 = "-Dparam3=Some Param 3";
+
+ private static final List<String> vmArguments = new ArrayList<>();
+ private static final List<String> empty = new ArrayList<>();
+
+ private static void validateResult(List<String> args, List<String> vmArgs)
+ throws Exception {
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+
+ int expected = 2 + args.size() + vmArgs.size();
+
+ if (result.length != expected) {
+ throw new AssertionError("Unexpected number of lines: "
+ + result.length + " expected: " + expected + " - results: " + output);
+ }
+
+ if (!result[0].trim().endsWith("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: " + args.size())) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+
+ int index = 2;
+ for (String arg : args) {
+ if (!result[index].trim().equals(arg)) {
+ throw new AssertionError("Unexpected result["
+ + index + "]: " + result[index]);
+ }
+ index++;
+ }
+
+ for (String vmArg : vmArgs) {
+ if (!result[index].trim().equals(vmArg)) {
+ throw new AssertionError("Unexpected result["
+ + index + "]: " + result[index]);
+ }
+ index++;
+ }
+ }
+
+ private static void validate(boolean includeArgs, String name)
+ throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError("Test application " + app
+ + " exited with error: " + retVal);
+ }
+ validateResult(new ArrayList<>(), new ArrayList<>());
+
+ String app2 = JPackagePath.getAppSL(name);
+ retVal = JPackageHelper.execute(null, app2);
+ if (retVal != 0) {
+ throw new AssertionError("Test application " + app2
+ + " exited with error: " + retVal);
+ }
+ if (includeArgs) {
+ validateResult(arguments, vmArguments);
+ } else {
+ validateResult(empty, empty);
+ }
+ }
+
+ public static void testCreateAppImage(String [] cmd) throws Exception {
+ testCreateAppImage(cmd, true, "test2");
+ }
+
+ public static void testCreateAppImage(String [] cmd,
+ boolean includeArgs, String name) throws Exception {
+ JPackageHelper.executeCLI(true, cmd);
+ validate(includeArgs, name);
+ }
+
+ public static void testCreateAppImageToolProvider(String [] cmd)
+ throws Exception {
+ testCreateAppImageToolProvider(cmd, true, "test2");
+ }
+
+ public static void testCreateAppImageToolProvider(String [] cmd,
+ boolean includeArgs, String name) throws Exception {
+ JPackageHelper.executeToolProvider(true, cmd);
+ validate(includeArgs, name);
+ }
+
+ public static void createSLProperties() throws Exception {
+ arguments.add(ARGUMENT1);
+ arguments.add(ARGUMENT2);
+ arguments.add(ARGUMENT3);
+
+ String argumentsMap =
+ JPackageHelper.listToArgumentsMap(arguments, true);
+
+ vmArguments.add(PARAM1);
+ vmArguments.add(PARAM2);
+ vmArguments.add(PARAM3);
+
+ String vmArgumentsMap =
+ JPackageHelper.listToArgumentsMap(vmArguments, true);
+
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter("sl.properties")))) {
+ out.println("arguments=" + argumentsMap);
+ out.println("java-options=" + vmArgumentsMap);
+ }
+
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter("m1.properties")))) {
+ out.println("module=com.hello/com.hello.Hello");
+ out.println("main-jar=");
+ }
+
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter("j1.properties")))) {
+ out.println("main-jar hello.jar");
+ out.println("main-class Hello");
+ }
+
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/AddLauncherModuleTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image with additional launcher test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build AddLauncherBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m AddLauncherModuleTest
+ */
+public class AddLauncherModuleTest {
+ private static final String OUTPUT = "output";
+ private static final String [] CMD = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--add-launcher", "test2=sl.properties"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloModule();
+ AddLauncherBase.createSLProperties();
+ AddLauncherBase.testCreateAppImageToolProvider(
+ CMD);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/AddLauncherTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image with additional launcher test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build AddLauncherBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m AddLauncherTest
+ */
+public class AddLauncherTest {
+ private static final String OUTPUT = "output";
+ private static final String [] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--add-launcher", "test2=sl.properties"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ AddLauncherBase.createSLProperties();
+ AddLauncherBase.testCreateAppImage(CMD);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/AddLaunchersTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image with additional launcher test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build AddLauncherBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m AddLaunchersTest
+ */
+public class AddLaunchersTest {
+ private static final String OUTPUT = "output";
+ private static final String [] CMD1 = {
+ "--description", "Test non modular app with multiple add-launchers where one is modular app and other is non modular app",
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--module-path", "module",
+ "--add-modules", "com.hello",
+ "--add-launcher", "test3=j1.properties",
+ "--add-launcher", "test4=m1.properties"};
+
+ private static final String [] CMD2 = {
+ "--description", "Test modular app with multiple add-launchers where one is modular app and other is non modular app",
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "module",
+ "--add-launcher", "test5=jl.properties",
+ "--add-launcher", "test6=m1.properties"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ JPackageHelper.createHelloModule();
+ AddLauncherBase.createSLProperties();
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ AddLauncherBase.testCreateAppImageToolProvider(
+ CMD1, false, "test3");
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ AddLauncherBase.testCreateAppImage(
+ CMD1, false, "test4");
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ AddLauncherBase.testCreateAppImage(
+ CMD2, false, "test5");
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ AddLauncherBase.testCreateAppImageToolProvider(
+ CMD2, false, "test6");
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/AddModulesTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image module test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m AddModulesTest
+ */
+public class AddModulesTest {
+ private static final String OUTPUT = "output";
+
+ private static final String [] CMD1 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--add-modules", "java.desktop",
+ };
+
+ private static final String [] CMD2 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--add-modules", "java.desktop,java.xml",
+ };
+
+ private static final String [] CMD3 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--add-modules", "java.desktop",
+ "--add-modules", "java.xml",
+ };
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloModule();
+ Base.testCreateAppImage(CMD1);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImageToolProvider(CMD1);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImageToolProvider(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImageToolProvider(CMD3);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/AppVersionTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+
+/*
+ * @test
+ * @summary jpackage create image --app-version test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m AppVersionTest
+ */
+public class AppVersionTest {
+ private static final String OUTPUT = "output";
+ private static final String appCfg = JPackagePath.getAppCfg();
+ private static final String VERSION = "2.3";
+ private static final String VERSION_DEFAULT = "1.0";
+
+ private static final String[] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ private static final String[] CMD_VERSION = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--app-version", VERSION};
+
+ private static void validate(String version)
+ throws Exception {
+ File outfile = new File(appCfg);
+ if (!outfile.exists()) {
+ throw new AssertionError(appCfg + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ if (version == null) {
+ version = VERSION_DEFAULT;
+ }
+
+ String expected = "app.version=" + version;
+ if (!output.contains(expected)) {
+ System.err.println("Expected: " + expected);
+ throw new AssertionError("Cannot find expected entry in config file");
+ }
+ }
+
+ private static void testVersion() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ validate(null);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeCLI(true, CMD_VERSION);
+ validate(VERSION);
+ }
+
+ private static void testVersionToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeToolProvider(true, CMD);
+ validate(null);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeToolProvider(true, CMD_VERSION);
+ validate(VERSION);
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testVersion();
+ testVersionToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/ArgumentsBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ArgumentsBase {
+
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ private static final String ARGUMENT1 = "argument";
+ private static final String ARGUMENT2 = "Some Arguments";
+ private static final String ARGUMENT3 = "Value \"with\" quotes";
+
+ private static final String ARGUMENT_CMD1 = "test";
+
+ private static final List<String> arguments = new ArrayList<>();
+ private static final List<String> argumentsCmd = new ArrayList<>();
+
+ public static void initArguments(boolean toolProvider, String[] cmd) {
+ if (arguments.isEmpty()) {
+ arguments.add(ARGUMENT1);
+ arguments.add(ARGUMENT2);
+ arguments.add(ARGUMENT3);
+ }
+
+ if (argumentsCmd.isEmpty()) {
+ argumentsCmd.add(ARGUMENT_CMD1);
+ }
+
+ String argumentsMap
+ = JPackageHelper.listToArgumentsMap(arguments, toolProvider);
+ cmd[cmd.length - 1] = argumentsMap;
+ }
+
+ private static void validateResult(String[] result, List<String> args)
+ throws Exception {
+ if (result.length != (args.size() + 2)) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: " + args.size())) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+
+ int index = 2;
+ for (String arg : args) {
+ if (!result[index].trim().equals(arg)) {
+ throw new AssertionError(
+ "Unexpected result[" + index + "]: " + result[index]);
+ }
+ index++;
+ }
+ }
+
+ private static void validate(String arg, List<String> expectedArgs)
+ throws Exception {
+ int retVal;
+
+ if (arg == null) {
+ retVal = JPackageHelper.execute(null, app);
+ } else {
+ retVal = JPackageHelper.execute(null, app, arg);
+ }
+ if (retVal != 0) {
+ throw new AssertionError("Test application exited with error: "
+ + retVal);
+ }
+
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+ validateResult(result, expectedArgs);
+ }
+
+ public static void testCreateAppImage(String[] cmd) throws Exception {
+ initArguments(false, cmd);
+ JPackageHelper.executeCLI(true, cmd);
+ validate(null, arguments);
+ validate(ARGUMENT_CMD1, argumentsCmd);
+ }
+
+ public static void testCreateAppImageToolProvider(String[] cmd) throws Exception {
+ initArguments(true, cmd);
+ JPackageHelper.executeToolProvider(true, cmd);
+ validate(null, arguments);
+ validate(ARGUMENT_CMD1, argumentsCmd);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/ArgumentsModuleTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create image with --arguments test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build ArgumentsBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m ArgumentsModuleTest
+ */
+public class ArgumentsModuleTest {
+ private static final String OUTPUT = "output";
+
+ private static final String[] CMD = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--arguments", "TBD"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloModule();
+ ArgumentsBase.testCreateAppImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ ArgumentsBase.testCreateAppImageToolProvider(CMD);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/ArgumentsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create image with --arguments test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build ArgumentsBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m ArgumentsTest
+ */
+public class ArgumentsTest {
+ private static final String OUTPUT = "output";
+
+ private static final String[] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--arguments", "TBD"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ ArgumentsBase.testCreateAppImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ ArgumentsBase.testCreateAppImageToolProvider(CMD);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/AtFilenameTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m AtFilenameTest
+ */
+public class AtFilenameTest {
+ private static final String OUTPUT = "output";
+
+ private static final String [] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+
+ doTest(0, 1); // replace just the mode
+ doTest(0, 11); // replace everything
+ doTest(1, 10); // replace everything except mode
+ doTest(4, 2); // replace the name and --main-jar without jar name
+
+ }
+
+ private static void doTest(int index, int len) throws Exception {
+ String[] cmdWithAtFilename =
+ JPackageHelper.cmdWithAtFilename(CMD, index, len);
+
+ Base.testCreateAppImageToolProvider(cmdWithAtFilename);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/Base.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+public abstract class Base {
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ private static void validateResult(String[] result) throws Exception {
+ if (result.length != 2) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().endsWith("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ public static void validate(String app) throws Exception {
+ Path outPath = Path.of(appOutput);
+ int retVal = JPackageHelper.execute(null, app);
+
+ if (outPath.toFile().exists()) {
+ System.out.println("output contents: ");
+ System.out.println(Files.readString(outPath) + "\n");
+ } else {
+ System.out.println("no output file: " + outPath
+ + " from command: " + app);
+ }
+
+ if (retVal != 0) {
+ throw new AssertionError(
+ "Test application (" + app + ") exited with error: " + retVal);
+ }
+
+ if (!outPath.toFile().exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outPath);
+ String[] result = JPackageHelper.splitAndFilter(output);
+ validateResult(result);
+ }
+
+ public static void testCreateAppImage(String [] cmd) throws Exception {
+ JPackageHelper.executeCLI(true, cmd);
+ validate(JPackagePath.getApp());
+ }
+
+ public static void testCreateAppImageToolProvider(String [] cmd) throws Exception {
+ JPackageHelper.executeToolProvider(true, cmd);
+ validate(JPackagePath.getApp());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/ErrorTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create app image error test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m ErrorTest
+ */
+import java.util.*;
+import java.io.*;
+import java.nio.*;
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+
+public class ErrorTest {
+
+ private static final String OUTPUT = "output";
+
+ private static final String ARG1 = "--no-such-argument";
+ private static final String EXPECTED1 =
+ "Invalid Option: [--no-such-argument]";
+ private static final String ARG2 = "--output";
+ private static final String EXPECTED2 = "--main-jar or --module";
+
+ private static final String [] CMD1 = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "non-existant.jar",
+ };
+ private static final String EXP1 = "main jar does not exist";
+
+ private static final String [] CMD2 = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ };
+ private static final String EXP2 = "class was not specified nor was";
+
+ private static void validate(String output, String expected, boolean single)
+ throws Exception {
+ String[] result = output.split("\n");
+ if (single && result.length != 1) {
+ System.err.println(output);
+ throw new AssertionError("Unexpected multiple lines of output: "
+ + output);
+ }
+
+ if (!result[0].trim().contains(expected)) {
+ throw new AssertionError("Unexpected output: " + result[0]
+ + " - expected output to contain: " + expected);
+ }
+ }
+
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+
+ validate(JPackageHelper.executeToolProvider(false, ARG1), EXPECTED1, true);
+ validate(JPackageHelper.executeToolProvider(false, ARG2), EXPECTED2, true);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ validate(JPackageHelper.executeToolProvider(false, CMD1), EXP1, false);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ validate(JPackageHelper.executeToolProvider(false, CMD2), EXP2, false);
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/HelpTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage help test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m HelpTest
+ */
+public class HelpTest {
+
+ // Platform specific help messages.
+ private static final String WINDOWS_HELP =
+ "--win-dir-chooser";
+ private static final String OSX_HELP =
+ "--mac-bundle-identifier";
+ private static final String LINUX_HELP =
+ "--linux-bundle-name";
+
+ private static void validate(String output1, String output2)
+ throws Exception {
+ if (output1.split("\n").length < 25) {
+ throw new AssertionError("jpacakger --help failed");
+ }
+
+ if (output2.split("\n").length < 25) {
+ throw new AssertionError("jpacakger -h failed");
+ }
+
+ // Make sure output matches for --help and -h
+ if (!output1.equals(output2)) {
+ System.err.println("================= --help =================");
+ System.err.println(output1);
+
+ System.err.println("=================== -h ===================");
+ System.err.println(output2);
+
+ throw new AssertionError(
+ "jpacakger help text does not match between --help and -h");
+ }
+
+ if (JPackageHelper.isWindows()) {
+ if (!output1.contains(WINDOWS_HELP)) {
+ throw new AssertionError(
+ "jpacakger help text missing Windows specific help");
+ }
+
+ if (output1.contains(OSX_HELP) || output1.contains(LINUX_HELP)) {
+ throw new AssertionError(
+ "jpacakger help text contains other platforms specific help");
+
+ }
+ } else if (JPackageHelper.isOSX()) {
+ if (!output1.contains(OSX_HELP)) {
+ throw new AssertionError(
+ "jpacakger help text missing OS X specific help");
+ }
+
+ if (output1.contains(WINDOWS_HELP) ||
+ output1.contains(LINUX_HELP)) {
+ throw new AssertionError(
+ "jpacakger help text contains other platforms specific help");
+ }
+ } else if (JPackageHelper.isLinux()) {
+ if (!output1.contains(LINUX_HELP)) {
+ throw new AssertionError(
+ "jpacakger help text missing Linux specific help");
+ }
+
+ if (output1.contains(OSX_HELP) || output1.contains(WINDOWS_HELP)) {
+ throw new AssertionError(
+ "jpacakger help text contains other platforms specific help");
+ }
+ }
+ }
+
+ private static void testHelp() throws Exception {
+ String output1 = JPackageHelper.executeCLI(true, "--help");
+ String output2 = JPackageHelper.executeCLI(true, "-h");
+ validate(output1, output2);
+ }
+
+ private static void testHelpToolProvider() throws Exception {
+ String output1 = JPackageHelper.executeToolProvider(true, "--help");
+ String output2 = JPackageHelper.executeToolProvider(true, "-h");
+ validate(output1, output2);
+ }
+
+ public static void main(String[] args) throws Exception {
+ testHelp();
+ testHelpToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/IconTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+
+/*
+ * @test
+ * @summary jpackage create image to verify --icon
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m IconTest
+ */
+public class IconTest {
+ private static final String OUTPUT = "output";
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ private static final String[] CMD = {
+ "--input", "input",
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--icon", getIconPath(),
+ "--output", OUTPUT};
+
+ private static void validateResult(String[] result) throws Exception {
+ if (result.length != 2) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ private static void validate() throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError(
+ "Test application exited with error: " + retVal);
+ }
+
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+ validateResult(result);
+ }
+
+ private static void validateIcon() throws Exception {
+ File origIcon = new File(getIconPath());
+ File icon = new File(JPackagePath.getAppIcon());
+ if (origIcon.length() != icon.length()) {
+ System.err.println("origIcon.length(): " + origIcon.length());
+ System.err.println("icon.length(): " + icon.length());
+ throw new AssertionError("Icons size does not match");
+ }
+ }
+
+ private static void testIcon() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ validate();
+ validateIcon();
+ }
+
+ private static void testIconToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeToolProvider(true, CMD);
+ validate();
+ validateIcon();
+ }
+
+ private static String getIconPath() {
+ String ext = ".ico";
+ if (JPackageHelper.isOSX()) {
+ ext = ".icns";
+ } else if (JPackageHelper.isLinux()) {
+ ext = ".png";
+ }
+
+ String path = JPackagePath.getTestSrcRoot() + File.separator + "resources"
+ + File.separator + "icon" + ext;
+
+ return path;
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testIcon();
+ testIconToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/InvalidArgTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage invalid argument test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m InvalidArgTest
+ */
+public class InvalidArgTest {
+
+ private static final String ARG1 = "--no-such-argument";
+ private static final String ARG2 = "--output";
+ private static final String RESULT1 =
+ "Invalid Option: [--no-such-argument]";
+ private static final String RESULT2 = "--main-jar or --module";
+
+ private static void validate(String arg, String output) throws Exception {
+ String[] result = JPackageHelper.splitAndFilter(output);
+ if (result.length != 1) {
+ System.err.println(output);
+ throw new AssertionError("Invalid number of lines in output: "
+ + result.length);
+ }
+
+ if (arg.equals(ARG1)) {
+ if (!result[0].trim().contains(RESULT1)) {
+ System.err.println("Expected: " + RESULT1);
+ System.err.println("Actual: " + result[0]);
+ throw new AssertionError("Unexpected output: " + result[0]);
+ }
+ } else if (arg.equals(ARG2)) {
+ if (!result[0].trim().contains(RESULT2)) {
+ System.err.println("Expected: " + RESULT2);
+ System.err.println("Actual: " + result[0]);
+ throw new AssertionError("Unexpected output: " + result[0]);
+ }
+ }
+ }
+
+ private static void testInvalidArg() throws Exception {
+ String output = JPackageHelper.executeCLI(false, ARG1);
+ validate(ARG1, output);
+ output = JPackageHelper.executeCLI(false, ARG2);
+ validate(ARG2, output);
+ }
+
+ private static void testInvalidArgToolProvider() throws Exception {
+ String output = JPackageHelper.executeToolProvider(false, ARG1);
+ validate(ARG1, output);
+ output = JPackageHelper.executeToolProvider(false, ARG2);
+ validate(ARG2, output);
+ }
+
+ public static void main(String[] args) throws Exception {
+ testInvalidArg();
+ testInvalidArgToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/JLinkModuleTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.ArrayList;
+
+ /*
+ * @test
+ * @summary jpackage create image modular jar test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JLinkModuleTest
+ */
+public class JLinkModuleTest {
+ private static final String OUTPUT = "output";
+ private static final String RUNTIME = "runtime";
+
+ private static final String [] CMD = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.other/com.other.Other",
+ "--runtime-image", RUNTIME,
+ };
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createOtherModule();
+
+ ArrayList<String> jlargs = new ArrayList<>();
+ jlargs.add("--add-modules");
+ jlargs.add("com.other");
+ jlargs.add("--module-path");
+ jlargs.add("module");
+ jlargs.add("--strip-debug");
+ jlargs.add("--no-header-files");
+ jlargs.add("--no-man-pages");
+ jlargs.add("--strip-native-commands");
+ JPackageHelper.createRuntime(jlargs);
+
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImage(CMD);
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/JavaOptionsBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class JavaOptionsBase {
+
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ private static final String ARGUMENT1 = "-Dparam1=Some Param 1";
+ private static final String ARGUMENT2 = "-Dparam2=Some \"Param\" 2";
+ private static final String ARGUMENT3 =
+ "-Dparam3=Some \"Param\" with \" 3";
+
+ private static final List<String> arguments = new ArrayList<>();
+
+ private static void initArguments(boolean toolProvider, String [] cmd) {
+ if (arguments.isEmpty()) {
+ arguments.add(ARGUMENT1);
+ arguments.add(ARGUMENT2);
+ arguments.add(ARGUMENT3);
+ }
+
+ String argumentsMap = JPackageHelper.listToArgumentsMap(arguments,
+ toolProvider);
+ cmd[cmd.length - 1] = argumentsMap;
+ }
+
+ private static void initArguments2(boolean toolProvider, String [] cmd) {
+ int index = cmd.length - 6;
+
+ cmd[index++] = "--java-options";
+ arguments.clear();
+ arguments.add(ARGUMENT1);
+ cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
+ toolProvider);
+
+ cmd[index++] = "--java-options";
+ arguments.clear();
+ arguments.add(ARGUMENT2);
+ cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
+ toolProvider);
+
+ cmd[index++] = "--java-options";
+ arguments.clear();
+ arguments.add(ARGUMENT3);
+ cmd[index++] = JPackageHelper.listToArgumentsMap(arguments,
+ toolProvider);
+
+ arguments.clear();
+ arguments.add(ARGUMENT1);
+ arguments.add(ARGUMENT2);
+ arguments.add(ARGUMENT3);
+ }
+
+ private static void validateResult(String[] result, List<String> args)
+ throws Exception {
+ if (result.length != (args.size() + 2)) {
+ for (String r : result) {
+ System.err.println(r.trim());
+ }
+ throw new AssertionError("Unexpected number of lines: "
+ + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+
+ int index = 2;
+ for (String arg : args) {
+ if (!result[index].trim().equals(arg)) {
+ throw new AssertionError("Unexpected result[" + index + "]: "
+ + result[index]);
+ }
+ index++;
+ }
+ }
+
+ private static void validate(List<String> expectedArgs) throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError("Test application exited with error: "
+ + retVal);
+ }
+
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = JPackageHelper.splitAndFilter(output);
+ validateResult(result, expectedArgs);
+ }
+
+ public static void testCreateAppImageJavaOptions(String [] cmd) throws Exception {
+ initArguments(false, cmd);
+ JPackageHelper.executeCLI(true, cmd);
+ validate(arguments);
+ }
+
+ public static void testCreateAppImageJavaOptionsToolProvider(String [] cmd) throws Exception {
+ initArguments(true, cmd);
+ JPackageHelper.executeToolProvider(true, cmd);
+ validate(arguments);
+ }
+
+ public static void testCreateAppImageJavaOptions2(String [] cmd) throws Exception {
+ initArguments2(false, cmd);
+ JPackageHelper.executeCLI(true, cmd);
+ validate(arguments);
+ }
+
+ public static void testCreateAppImageJavaOptions2ToolProvider(String [] cmd) throws Exception {
+ initArguments2(true, cmd);
+ JPackageHelper.executeToolProvider(true, cmd);
+ validate(arguments);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/JavaOptionsEqualsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+
+/*
+ * @test
+ * @summary jpackage create image with --java-options test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JavaOptionsBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JavaOptionsEqualsTest
+ */
+public class JavaOptionsEqualsTest {
+
+ private static final String app = JPackagePath.getApp();
+
+ private static final String OUTPUT = "output";
+
+ private static final String[] CMD = {
+ "--input", "input",
+ "--description", "the two options below should cause two app execution "
+ + "Warnings with two lines output saying: "
+ + "WARNING: Unknown module: <module-name>",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--java-options",
+ "--add-exports=java.base/sun.util=me.mymodule.foo,ALL-UNNAMED",
+ "--java-options",
+ "--add-exports=java.base/sun.security.util=other.mod.bar,ALL-UNNAMED",
+ };
+
+ private static void validate() throws Exception {
+ File outfile = new File("app.out");
+
+ int retVal = JPackageHelper.execute(outfile, app);
+ if (retVal != 0) {
+ throw new AssertionError(
+ "Test application exited with error: " + retVal);
+ }
+
+ if (!outfile.exists()) {
+ throw new AssertionError(
+ "outfile: " + outfile + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = JPackageHelper.splitAndFilter(output);
+ if (result.length != 4) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length
+ + " - output: " + output);
+ }
+
+ if (!result[0].startsWith("WARNING: Unknown module: me.mymodule.foo")){
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (result[1].equals(result[0])) {
+ System.err.println("--- This is known bug JDK-8224486, remove this "
+ + "if/else block when JDK-8224486 is fixed");
+ } else
+
+ if (!result[1].startsWith("WARNING: Unknown module: other.mod.bar")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+
+ if (!result[2].trim().endsWith("jpackage test application")) {
+ throw new AssertionError("Unexpected result[2]: " + result[2]);
+ }
+
+ if (!result[3].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[3]: " + result[3]);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ String output = JPackageHelper.executeCLI(true, CMD);
+ validate();
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ output = JPackageHelper.executeToolProvider(true, CMD);
+ validate();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/JavaOptionsModuleTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create image with --java-options test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JavaOptionsBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JavaOptionsModuleTest
+ */
+public class JavaOptionsModuleTest {
+ private static final String OUTPUT = "output";
+
+ private static final String[] CMD = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--java-options", "TBD"};
+
+ private static final String[] CMD2 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--java-options", "TBD",
+ "--java-options", "TBD",
+ "--java-options", "TBD"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloModule();
+
+ JavaOptionsBase.testCreateAppImageJavaOptions(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JavaOptionsBase.testCreateAppImageJavaOptionsToolProvider(CMD);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JavaOptionsBase.testCreateAppImageJavaOptions2(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JavaOptionsBase.testCreateAppImageJavaOptions2ToolProvider(CMD2);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/JavaOptionsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create image with --java-options test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JavaOptionsBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JavaOptionsTest
+ */
+public class JavaOptionsTest {
+ private static final String OUTPUT = "output";
+
+ private static final String[] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--java-options", "TBD"};
+
+ private static final String[] CMD2 = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--java-options", "TBD",
+ "--java-options", "TBD",
+ "--java-options", "TBD"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ JavaOptionsBase.testCreateAppImageJavaOptions(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JavaOptionsBase.testCreateAppImageJavaOptionsToolProvider(CMD);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JavaOptionsBase.testCreateAppImageJavaOptions2(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JavaOptionsBase.testCreateAppImageJavaOptions2ToolProvider(CMD2);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/MainClassAttributeTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+
+/*
+ * @test
+ * @summary jpackage create image with no main class arguments and with main-class attribute
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m MainClassAttributeTest
+ */
+public class MainClassAttributeTest {
+ private static final String OUTPUT = "output";
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ private static final String[] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar"};
+
+ private static void validateResult(String[] result) throws Exception {
+ if (result.length != 2) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ private static void validate() throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError(
+ "Test application exited with error: " + retVal);
+ }
+
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+ validateResult(result);
+ }
+
+ private static void testMainClassAttribute() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ validate();
+ }
+
+ private static void testMainClassAttributeToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeToolProvider(true, CMD);
+ validate();
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJarWithMainClass();
+ testMainClassAttribute();
+ testMainClassAttributeToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/MainClassErrorTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+
+/*
+ * @test
+ * @summary jpackage create image with no main class arguments and with main-class attribute
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m MainClassErrorTest
+ */
+public class MainClassErrorTest {
+ private static final String OUTPUT = "output";
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ private static final String[] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar"};
+
+ private static void validate(String output) throws Exception {
+ String[] result = JPackageHelper.splitAndFilter(output);
+ if (result.length != 2) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().contains("main class was not specified")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().startsWith("Advice to fix: ")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ validate(JPackageHelper.executeCLI(false, CMD));
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ validate(JPackageHelper.executeToolProvider(false, CMD));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/MissingArgumentsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image missing arguments test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m MissingArgumentsTest
+ */
+
+public class MissingArgumentsTest {
+ private static final String [] RESULT_1 = {"--output"};
+ private static final String [] CMD_1 = {
+ "--input", "input",
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ private static final String [] RESULT_2 = {"--input"};
+ private static final String [] CMD_2 = {
+ "--output", "output",
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ private static final String [] RESULT_3 = {"--input", "--app-image"};
+ private static final String [] CMD_3 = {
+ "--package-type", "invalid-package-type",
+ "--output", "output",
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ private static final String [] RESULT_4 = {"main class was not specified"};
+ private static final String [] CMD_4 = {
+ "--input", "input",
+ "--output", "output",
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ };
+
+ private static final String [] RESULT_5 = {"--main-jar"};
+ private static final String [] CMD_5 = {
+ "--input", "input",
+ "--output", "output",
+ "--name", "test",
+ "--main-class", "Hello",
+ };
+
+ private static final String [] RESULT_6 = {"--module-path", "--runtime-image"};
+ private static final String [] CMD_6 = {
+ "--output", "output",
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ };
+
+ private static final String [] RESULT_7 = {"--module-path", "--runtime-image",
+ "--app-image"};
+ private static final String [] CMD_7 = {
+ "--package-type", "invalid-package-type",
+ "--output", "output",
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ };
+
+ private static void validate(String output, String [] expected,
+ boolean single) throws Exception {
+ String[] result = JPackageHelper.splitAndFilter(output);
+ if (single && result.length != 1) {
+ System.err.println(output);
+ throw new AssertionError("Invalid number of lines in output: "
+ + result.length);
+ }
+
+ for (String s : expected) {
+ if (!result[0].contains(s)) {
+ System.err.println("Expected to contain: " + s);
+ System.err.println("Actual: " + result[0]);
+ throw new AssertionError("Unexpected error message");
+ }
+ }
+ }
+
+ private static void testMissingArg() throws Exception {
+ String output = JPackageHelper.executeCLI(false, CMD_1);
+ validate(output, RESULT_1, true);
+
+ output = JPackageHelper.executeCLI(false, CMD_2);
+ validate(output, RESULT_2, true);
+
+ output = JPackageHelper.executeCLI(false, CMD_3);
+ validate(output, RESULT_3, true);
+
+ output = JPackageHelper.executeCLI(false, CMD_4);
+ validate(output, RESULT_4, false);
+
+ output = JPackageHelper.executeCLI(false, CMD_5);
+ validate(output, RESULT_5, true);
+
+ output = JPackageHelper.executeCLI(false, CMD_6);
+ validate(output, RESULT_6, true);
+
+ output = JPackageHelper.executeCLI(false, CMD_7);
+ validate(output, RESULT_7, true);
+
+ }
+
+ private static void testMissingArgToolProvider() throws Exception {
+ String output = JPackageHelper.executeToolProvider(false, CMD_1);
+ validate(output, RESULT_1, true);
+
+ output = JPackageHelper.executeToolProvider(false, CMD_2);
+ validate(output, RESULT_2, true);
+
+ output = JPackageHelper.executeToolProvider(false, CMD_3);
+ validate(output, RESULT_3, true);
+
+ output = JPackageHelper.executeToolProvider(false, CMD_4);
+ validate(output, RESULT_4, false);
+
+ output = JPackageHelper.executeToolProvider(false, CMD_5);
+ validate(output, RESULT_5, true);
+
+ output = JPackageHelper.executeToolProvider(false, CMD_6);
+ validate(output, RESULT_6, true);
+
+ output = JPackageHelper.executeToolProvider(false, CMD_7);
+ validate(output, RESULT_7, true);
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testMissingArg();
+ testMissingArgToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/ModularJarTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image modular jar test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m ModularJarTest
+ */
+public class ModularJarTest {
+ private static final String OUTPUT = "output";
+
+ private static final String [] CMD1 = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "com.hello.jar",
+ "--main-class", "com.hello.Hello",
+ };
+
+ private static final String [] CMD2 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input/com.hello.jar",
+ };
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloModule();
+
+ Base.testCreateAppImage(CMD1);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImageToolProvider(CMD1);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImage(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImageToolProvider(CMD2);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/ModuleMainClassErrorTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+
+/*
+ * @test
+ * @summary jpackage create image with no main class arguments and with main-class attribute
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m ModuleMainClassErrorTest
+ */
+public class ModuleMainClassErrorTest {
+ private static final String OUTPUT = "output";
+ private static final String app = JPackagePath.getApp();
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ private static final String [] CMD1 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello",
+ "--module-path", "input"};
+
+ private static final String [] CMD2 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input"};
+
+ private static void validate(String buildOutput) throws Exception {
+
+ File outfile = new File(appOutput);
+ int retVal = JPackageHelper.execute(outfile, app);
+ if (retVal != 0) {
+ throw new AssertionError(
+ "Test application exited with error: ");
+ }
+
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloModule();
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeCLI(false, CMD1);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeToolProvider(false, CMD1);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ validate(JPackageHelper.executeCLI(true, CMD2));
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ validate(JPackageHelper.executeToolProvider(true, CMD2));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/ModulePathTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image module test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m ModulePathTest
+ */
+
+import java.io.File;
+
+public class ModulePathTest {
+ private static final String OUTPUT = "output";
+
+ private static final String [] CMD1 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ };
+
+ private static final String [] CMD2 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input" + File.pathSeparator + "input-other",
+ };
+
+ private static final String [] CMD3 = {
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input",
+ "--module-path", "input-other",
+ };
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloModule();
+ Base.testCreateAppImageToolProvider(CMD1);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImageToolProvider(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImageToolProvider(CMD3);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/ModuleTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image modular jar test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m ModuleTest
+ */
+public class ModuleTest {
+ private static final String OUTPUT = "output";
+
+ private static final String [] CMD1 = {
+ "--module-path", "module",
+ "--module", "com.other/com.other.Other",
+ "--output", OUTPUT,
+ "--name", "test",
+ };
+
+ private static String [] commands = {
+ "--module-path", "module",
+ "--module", "com.other/com.other.Other",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--add-modules", "TBD",
+ };
+
+ private final static String [] paths = {
+ "ALL-MODULES",
+ "ALL_MODULE_PATH",
+ "ALL-SYSTEM",
+ "ALL-DEFAULT",
+ };
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createOtherModule();
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImage(CMD1);
+
+ for (String path : paths) {
+ commands[commands.length - 1] = path;
+ System.out.println("using --add-modules " + path);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImageToolProvider(commands);
+ System.out.println("succeeded");
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/NoArgTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage no argument test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m NoArgTest
+ */
+public class NoArgTest {
+
+ private static final String RESULT1 = "Usage: jpackage <mode> <options>";
+ private static final String[] EXPECTED =
+ {"--help", "list of possible options"};
+
+ private static void validate(String output) throws Exception {
+ String[] result = JPackageHelper.splitAndFilter(output);
+ if (result.length != 2) {
+ System.err.println(output);
+ throw new AssertionError(
+ "Invalid number of lines in output: " + result.length);
+ }
+
+ if (!result[0].trim().equals(RESULT1)) {
+ System.err.println("Expected: " + RESULT1);
+ System.err.println("Actual: " + result[0]);
+ throw new AssertionError("Unexpected line 1");
+ }
+
+ for (String expected : EXPECTED) {
+ if (!result[1].contains(expected)) {
+ System.err.println("Expected to contain: " + expected);
+ System.err.println("Actual: " + result[1]);
+ throw new AssertionError("Unexpected line 2");
+ }
+ }
+ }
+
+ private static void testNoArg() throws Exception {
+ String output = JPackageHelper.executeCLI(true, new String[0]);
+ validate(output);
+ }
+
+ private static void testNoArgToolProvider() throws Exception {
+ String output =
+ JPackageHelper.executeToolProvider(true, new String[0]);
+ validate(output);
+ }
+
+ public static void main(String[] args) throws Exception {
+ testNoArg();
+ testNoArgToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/NoNameTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+
+/*
+ * @test
+ * @summary jpackage create image with no --name
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m NoNameTest
+ */
+public class NoNameTest {
+ private static final String OUTPUT = "output";
+ private static final String app = JPackagePath.getApp("Hello");
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ private static final String[] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ private static void validateResult(String[] result) throws Exception {
+ if (result.length != 2) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ private static void validate() throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError(
+ "Test application exited with error: " + retVal);
+ }
+
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+ validateResult(result);
+ }
+
+ private static void testMainClassAttribute() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ validate();
+ }
+
+ private static void testMainClassAttributeToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeToolProvider(true, CMD);
+ validate();
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testMainClassAttribute();
+ testMainClassAttributeToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/ResourceTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+
+/*
+ * @test
+ * @summary jpackage create image to verify --icon
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @requires ((os.family == "windows") | (os.family == "mac"))
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m ResourceTest
+ */
+public class ResourceTest {
+ private static final String OUTPUT = "output";
+ private static final String app = JPackagePath.getApp("icon");
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+ private static final String resourceDir =
+ JPackagePath.getTestSrcRoot() + File.separator + "resources";
+
+ private static final String[] CMD = {
+ "--input", "input",
+ "--name", "icon",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--resource-dir", resourceDir,
+ "--output", OUTPUT};
+
+ private static void validateResult(String[] result) throws Exception {
+ if (result.length != 2) {
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ private static void validate() throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError(
+ "Test application exited with error: " + retVal);
+ }
+
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = output.split("\n");
+ validateResult(result);
+ }
+
+ private static void validateIcon() throws Exception {
+ File origIcon = new File(getIconPath());
+ File icon = new File(JPackagePath.getAppIcon("icon"));
+ if (origIcon.length() != icon.length()) {
+ System.err.println("file: " + origIcon + " - origIcon.length(): "
+ + origIcon.length());
+ System.err.println("file: " + icon + " - icon.length(): "
+ + icon.length());
+ throw new AssertionError("Icons size does not match");
+ }
+ }
+
+ private static void testIcon() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ validate();
+ validateIcon();
+ }
+
+ private static void testIconToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeToolProvider(true, CMD);
+ validate();
+ validateIcon();
+ }
+
+ private static String getResourcenPath() {
+ return JPackagePath.getTestSrcRoot() + File.separator + "resources";
+ }
+
+ private static String getIconPath() {
+ String ext = ".ico";
+ if (JPackageHelper.isOSX()) {
+ ext = ".icns";
+ } else if (JPackageHelper.isLinux()) {
+ ext = ".png";
+ }
+ return resourceDir + File.separator + "icon" + ext;
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testIcon();
+ testIconToolProvider();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/RuntimeBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+
+ public class RuntimeBase {
+ private static final String app = JPackagePath.getApp();
+ private static final String runtimeJava = JPackagePath.getRuntimeJava();
+ private static final String runtimeJavaOutput = "javaOutput.txt";
+ private static final String appOutput = JPackagePath.getAppOutputFile();
+
+ private static void validateResult(String[] result) throws Exception {
+ if (result.length != 2) {
+ throw new AssertionError("Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ private static void validate() throws Exception {
+ int retVal = JPackageHelper.execute(null, app);
+ if (retVal != 0) {
+ throw new AssertionError("Test application exited with error: " + retVal);
+ }
+
+ File outfile = new File(appOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(appOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = JPackageHelper.splitAndFilter(output);
+ validateResult(result);
+ }
+
+ private static void validateRuntime() throws Exception {
+ int retVal = JPackageHelper.execute(new File(runtimeJavaOutput), runtimeJava, "--list-modules");
+ if (retVal != 0) {
+ throw new AssertionError("Test application exited with error: " + retVal);
+ }
+
+ File outfile = new File(runtimeJavaOutput);
+ if (!outfile.exists()) {
+ throw new AssertionError(runtimeJavaOutput + " was not created");
+ }
+
+ String output = Files.readString(outfile.toPath());
+ String[] result = JPackageHelper.splitAndFilter(output);
+ if (result.length != 1) {
+ throw new AssertionError("Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].startsWith("java.base")) {
+ throw new AssertionError("Unexpected result: " + result[0]);
+ }
+ }
+
+ public static void testCreateAppImage(String [] cmd) throws Exception {
+ JPackageHelper.executeCLI(true, cmd);
+ validate();
+ validateRuntime();
+ }
+
+ public static void testCreateAppImageToolProvider(String [] cmd) throws Exception {
+ JPackageHelper.executeToolProvider(true, cmd);
+ validate();
+ validateRuntime();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/RuntimeModuleTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image runtime test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build RuntimeBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m RuntimeModuleTest
+ */
+public class RuntimeModuleTest {
+ private static final String OUTPUT = "output";
+ private static final String [] CMD = {
+ "--runtime-image", "runtime",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--module", "com.hello/com.hello.Hello",
+ "--module-path", "input"};
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloModule();
+ JPackageHelper.createRuntime();
+ RuntimeBase.testCreateAppImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ RuntimeBase.testCreateAppImageToolProvider(CMD);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/RuntimeTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image runtime test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build RuntimeBase
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m RuntimeTest
+ */
+public class RuntimeTest {
+ private static final String OUTPUT = "output";
+ private static final String [] CMD = {
+ "--runtime-image", "runtime",
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ JPackageHelper.createRuntime();
+ RuntimeBase.testCreateAppImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ RuntimeBase.testCreateAppImageToolProvider(CMD);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/TempRootTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+
+ /*
+ * @test
+ * @requires (os.family == "windows")
+ * @summary jpackage create image to test --temp-root
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m TempRootTest
+ */
+public class TempRootTest {
+ private static final String OUTPUT = "output";
+ private static String buildRoot = null;
+ private static final String BUILD_ROOT = "buildRoot";
+ private static final String BUILD_ROOT_TB = "buildRootToolProvider";
+
+ private static final String [] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ private static final String [] CMD_BUILD_ROOT = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--temp-root", "TBD"};
+
+ private static void validate(boolean retain) throws Exception {
+ File br = new File(buildRoot);
+ if (retain) {
+ if (!br.exists()) {
+ throw new AssertionError(br.getAbsolutePath() + " does not exist");
+ }
+ } else {
+ if (br.exists()) {
+ throw new AssertionError(br.getAbsolutePath() + " exist");
+ }
+ }
+ }
+
+ private static void init(boolean toolProvider) {
+ if (toolProvider) {
+ buildRoot = BUILD_ROOT_TB;
+ } else {
+ buildRoot = BUILD_ROOT;
+ }
+
+ CMD_BUILD_ROOT[CMD_BUILD_ROOT.length - 1] = buildRoot;
+ }
+
+ private static void testTempRoot() throws Exception {
+ init(false);
+ JPackageHelper.executeCLI(true, CMD);
+ validate(false);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeCLI(true, CMD_BUILD_ROOT);
+ validate(true);
+ }
+
+ private static void testTempRootToolProvider() throws Exception {
+ init(true);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeToolProvider(true, CMD);
+ validate(false);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.executeToolProvider(true, CMD_BUILD_ROOT);
+ validate(true);
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testTempRoot();
+ testTempRootToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/Test.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage create image test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m Test
+ */
+public class Test {
+ private static final String OUTPUT = "output";
+
+ private static final String [] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ Base.testCreateAppImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ Base.testCreateAppImageToolProvider(CMD);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/VerboseTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create image verbose test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m VerboseTest
+ */
+public class VerboseTest {
+ private static final String OUTPUT = "output";
+ private static final String[] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ private static final String[] CMD_VERBOSE = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--verbose"};
+
+ private static void validate(String result, String resultVerbose)
+ throws Exception {
+ String[] r = result.split("\n");
+ String[] rv = resultVerbose.split("\n");
+
+ if (r.length >= rv.length) {
+ System.err.println("r.length: " + r.length);
+ System.err.println(result);
+ System.err.println("rv.length: " + rv.length);
+ System.err.println(resultVerbose);
+ throw new AssertionError(
+ "non-verbose output is less or equal to verbose output");
+ }
+ }
+
+ private static void testCreateAppImage() throws Exception {
+ String result = JPackageHelper.executeCLI(true, CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ String resultVerbose = JPackageHelper.executeCLI(true, CMD_VERBOSE);
+ validate(result, resultVerbose);
+ }
+
+ private static void testCreateAppImageToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ String result = JPackageHelper.executeToolProvider(true, CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ String resultVerbose =
+ JPackageHelper.executeToolProvider(true, CMD_VERBOSE);
+ validate(result, resultVerbose);
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testCreateAppImage();
+ testCreateAppImageToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/VersionTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @summary jpackage version test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m VersionTest
+ */
+public class VersionTest {
+
+ private static final String ARG = "--version";
+ private static final String RESULT = System.getProperty("java.version");
+
+ private static void validate(String output) throws Exception {
+ String[] result = JPackageHelper.splitAndFilter(output);
+ if (result.length != 1) {
+ System.err.println(output);
+ throw new AssertionError("Invalid number of lines in output: " + result.length);
+ }
+
+ if (!result[0].trim().equals(RESULT)) {
+ System.err.println("Expected: " + RESULT);
+ System.err.println("Actual: " + result[0]);
+ throw new AssertionError("Unexpected line 1");
+ }
+ }
+
+ private static void testVersion() throws Exception {
+ String output = JPackageHelper.executeCLI(true, ARG);
+ validate(output);
+ }
+
+ private static void testVersionToolProvider() throws Exception {
+ String output = JPackageHelper.executeToolProvider(true, ARG);
+ validate(output);
+ }
+
+ public static void main(String[] args) throws Exception {
+ testVersion();
+ testVersionToolProvider();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/WithSpaceTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+
+ /*
+ * @test
+ * @summary jpackage create image test
+ * @library ../helpers
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m WithSpaceTest
+ */
+public class WithSpaceTest {
+ private static final String OUTPUT = "output";
+
+ private static final String [] CMD1 = {
+ "--input", "input dir",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ private static final String [] CMD2 = {
+ "--input", "input dir2",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "sub dir/hello.jar",
+ "--main-class", "Hello",
+ };
+
+ public static void main(String[] args) throws Exception {
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.createHelloImageJar("input dir");
+ Base.testCreateAppImage(CMD1);
+
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.createHelloImageJar(
+ "input dir2" + File.separator + "sub dir");
+
+ Base.testCreateAppImageToolProvider(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/WinConsoleTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.io.InputStream;
+import java.io.FileInputStream;
+
+/*
+ * @test
+ * @summary jpackage create image win console test
+ * @library ../helpers
+ * @library ../share
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build Base
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m WinConsoleTest
+ */
+
+public class WinConsoleTest {
+ private static final String NAME = "test";
+ private static final String OUTPUT = "output";
+ private static final String OUTPUT_WIN_CONSOLE = "outputWinConsole";
+ private static final int BUFFER_SIZE = 512;
+ private static final int GUI_SUBSYSTEM = 2;
+ private static final int CONSOLE_SUBSYSTEM = 3;
+
+ private static final String [] CMD = {
+ "--input", "input",
+ "--output", OUTPUT,
+ "--name", NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ };
+
+ private static final String [] CMD_WIN_CONSOLE = {
+ "--input", "input",
+ "--output", OUTPUT_WIN_CONSOLE,
+ "--name", NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--win-console"
+ };
+
+ private static void checkSubsystem(boolean console) throws Exception {
+ Path path = Path.of(console ? OUTPUT_WIN_CONSOLE : OUTPUT,
+ NAME, "bin", NAME + ".exe");
+
+ System.out.println("validate path: " + path.toString());
+ Base.validate(path.toString());
+
+ try (InputStream inputStream = new FileInputStream(path.toString())) {
+ byte [] bytes = new byte[BUFFER_SIZE];
+ if (inputStream.read(bytes) != BUFFER_SIZE) {
+ throw new AssertionError("Wrong number of bytes read");
+ }
+
+ // Check PE header for console or Win GUI app.
+ // https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_image_nt_headers
+ for (int i = 0; i < (bytes.length - 4); i++) {
+ if (bytes[i] == 0x50 && bytes[i + 1] == 0x45 &&
+ bytes[i + 2] == 0x0 && bytes[i + 3] == 0x0) {
+
+ // Signature, File Header and subsystem offset.
+ i = i + 4 + 20 + 68;
+ byte subsystem = bytes[i];
+ if (console) {
+ if (subsystem != CONSOLE_SUBSYSTEM) {
+ throw new AssertionError("Unexpected subsystem: "
+ + subsystem);
+ } else {
+ return;
+ }
+ } else {
+ if (subsystem != GUI_SUBSYSTEM) {
+ throw new AssertionError("Unexpected subsystem: "
+ + subsystem);
+ } else {
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ throw new AssertionError("Unable to verify PE header");
+ }
+
+ private static void validate() throws Exception {
+ checkSubsystem(false);
+ checkSubsystem(true);
+ }
+
+ private static void testCreateAppImage(String [] cmd) throws Exception {
+ JPackageHelper.executeCLI(true, cmd);
+ }
+
+ private static void testCreateAppImageToolProvider(String [] cmd)
+ throws Exception {
+ JPackageHelper.executeToolProvider(true, cmd);
+ }
+
+ public static void main(String[] args) throws Exception {
+ JPackageHelper.createHelloImageJar();
+ testCreateAppImage(CMD);
+ testCreateAppImage(CMD_WIN_CONSOLE);
+ validate();
+ JPackageHelper.deleteOutputFolder(OUTPUT);
+ JPackageHelper.deleteOutputFolder(OUTPUT_WIN_CONSOLE);
+ testCreateAppImageToolProvider(CMD);
+ testCreateAppImageToolProvider(CMD_WIN_CONSOLE);
+ validate();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/Base.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Base {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getWinInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/FileAssociationsBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Desktop;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FileAssociationsBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String TEST_EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void validateAppOutput() throws Exception {
+ File outFile = new File("appOutput.txt");
+ int count = 10;
+ boolean bOutputCreated = false;
+ while (count > 0) {
+ if (!outFile.exists()) {
+ Thread.sleep(3000);
+ count--;
+ } else {
+ bOutputCreated = true;
+ break;
+ }
+ }
+
+ if (!bOutputCreated) {
+ throw new AssertionError(outFile.getAbsolutePath() + " was not created");
+ }
+
+ String output = Files.readString(outFile.toPath());
+ String[] result = output.split("\n");
+ if (result.length != 3) {
+ System.err.println(output);
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 1")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+
+ File faFile = new File(TEST_NAME + "." + TEST_EXT);
+ if (!result[2].trim().equals(faFile.getAbsolutePath())) {
+ throw new AssertionError("Unexpected result[2]: " + result[2]);
+ }
+ }
+
+ private static void verifyInstall() throws Exception {
+ createFileAssociationsTestFile();
+ Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
+ validateAppOutput();
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
+
+ // Validate registry
+ String[] values1 = {TEST_NAME};
+ JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, values1, true);
+ String[] values2 = {TEST_EXT};
+ JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, values2, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+
+ // Validate registry
+ JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, null, false);
+ JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, null, false);
+ }
+
+ private static void createFileAssociationsTestFile() throws Exception {
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
+ out.println(TEST_NAME);
+ }
+ }
+
+ private static void createFileAssociationsProperties() throws Exception {
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter("fa.properties")))) {
+ out.println("extension=" + TEST_EXT);
+ out.println("mime-type=application/" + TEST_EXT);
+ out.println("description=jpackage test extention");
+ }
+ }
+
+ private static void init(String name, String ext, String installDir, String testExt) {
+ TEST_NAME = name;
+ EXT = ext;
+ TEST_EXT = testExt;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ if (installDir == null) {
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--file-associations", "fa.properties"};
+ } else {
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--file-associations", "fa.properties",
+ "--install-dir", installDir};
+ }
+ }
+
+ public static void run(String name, String ext, String installDir, String testExt) throws Exception {
+ init(name, ext, installDir, testExt);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ createFileAssociationsProperties();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/InstallDirBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class InstallDirBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+ private static String INSTALL_DIR;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getWinInstalledApp(INSTALL_DIR, TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+
+ // Validate desktop shortcut
+ JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(INSTALL_DIR);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+
+ // Validate desktop shortcut
+ JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, false);
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ INSTALL_DIR = "TestVendor\\JPackageCreateInstallerInstallDirTestDir";
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--install-dir", INSTALL_DIR,
+ "--win-shortcut"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/LicenseBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class LicenseBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getWinInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String [] {
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--license-file", JPackagePath.getLicenseFilePath()};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/RuntimeBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class RuntimeBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ // NOP by design.
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--runtime-image", System.getProperty("java.home")};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/WinDirChooserBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WinDirChooserBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getWinInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--win-dir-chooser"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/WinMenuBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WinMenuBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getWinInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--win-menu"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/WinMenuGroupBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WinMenuGroupBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getWinInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu(TEST_NAME, TEST_NAME, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu(TEST_NAME, TEST_NAME, false);
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--win-menu",
+ "--win-menu-group", TEST_NAME};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/WinPerUserInstallBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WinPerUserInstallBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getWinUserLocalInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ // Validate start menu
+ JPackageInstallerHelper.validateUserLocalStartMenu(TEST_NAME, TEST_NAME, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinUserLocalInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateUserLocalStartMenu(TEST_NAME, TEST_NAME, false);
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--win-per-user-install",
+ "--win-menu",
+ "--win-menu-group", TEST_NAME};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/WinRegistryNameBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Desktop;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WinRegistryNameBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String TEST_EXT;
+ private static String WIN_REGISTRY_NAME;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void validateAppOutput() throws Exception {
+ File outFile = new File("appOutput.txt");
+ int count = 10;
+ boolean bOutputCreated = false;
+ while (count > 0) {
+ if (!outFile.exists()) {
+ Thread.sleep(3000);
+ count--;
+ } else {
+ bOutputCreated = true;
+ break;
+ }
+ }
+
+ if (!bOutputCreated) {
+ throw new AssertionError(outFile.getAbsolutePath() + " was not created");
+ }
+
+ String output = Files.readString(outFile.toPath());
+ String[] result = output.split("\n");
+ if (result.length != 3) {
+ System.err.println(output);
+ throw new AssertionError(
+ "Unexpected number of lines: " + result.length);
+ }
+
+ if (!result[0].trim().equals("jpackage test application")) {
+ throw new AssertionError("Unexpected result[0]: " + result[0]);
+ }
+
+ if (!result[1].trim().equals("args.length: 1")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+
+ File faFile = new File(TEST_NAME + "." + TEST_EXT);
+ if (!result[2].trim().equals(faFile.getAbsolutePath())) {
+ throw new AssertionError("Unexpected result[2]: " + result[2]);
+ }
+ }
+
+ private static void verifyInstall() throws Exception {
+ createFileAssociationsTestFile();
+ Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
+ validateAppOutput();
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
+
+ // Validate registry
+ String[] values1 = {WIN_REGISTRY_NAME};
+ JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, values1, true);
+ String[] values2 = {TEST_EXT};
+ JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, values2, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+
+ // Validate registry
+ JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, null, false);
+ JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, null, false);
+ }
+
+ private static void createFileAssociationsTestFile() throws Exception {
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
+ out.println(TEST_NAME);
+ }
+ }
+
+ private static void createFileAssociationsProperties() throws Exception {
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(
+ new FileWriter("fa.properties")))) {
+ out.println("extension=" + TEST_EXT);
+ out.println("mime-type=application/" + TEST_EXT);
+ out.println("description=jpackage test extention");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ TEST_EXT = "jptest2";
+ WIN_REGISTRY_NAME = "JPWINTESTREGISTRYNAME";
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--file-associations", "fa.properties",
+ "--win-registry-name", WIN_REGISTRY_NAME};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ createFileAssociationsProperties();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/WinShortcutBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WinShortcutBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT;
+ private static String[] CMD;
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD);
+ JPackageInstallerHelper.validateOutput(OUTPUT);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getWinInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+
+ // Validate desktop shortcut
+ JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, true);
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+
+ // Validate start menu
+ JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
+
+ // Validate desktop shortcut
+ JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, false);
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--win-shortcut"};
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/base/WinUpgradeUUIDBase.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WinUpgradeUUIDBase {
+
+ private static String TEST_NAME;
+ private static String EXT;
+ private static String OUTPUT_1;
+ private static String[] CMD_1;
+ private static String OUTPUT_2;
+ private static String[] CMD_2;
+ private static final String FILE_1 = "file1.txt";
+ private static final String FILE_2 = "file2.txt";
+
+ private static void copyResults() throws Exception {
+ List<String> files = new ArrayList<>();
+ files.add(OUTPUT_1);
+ files.add(OUTPUT_2);
+ JPackageInstallerHelper.copyTestResults(files);
+ }
+
+ private static void testCreateInstaller() throws Exception {
+ JPackageHelper.executeCLI(true, CMD_1);
+ JPackageInstallerHelper.validateOutput(OUTPUT_1);
+ JPackageHelper.executeCLI(true, CMD_2);
+ JPackageInstallerHelper.validateOutput(OUTPUT_2);
+ copyResults();
+ }
+
+ private static void verifyInstall() throws Exception {
+ String app = JPackagePath.getWinInstalledApp(TEST_NAME);
+ JPackageInstallerHelper.validateApp(app);
+
+ String file1Path = JPackagePath.getWinInstalledAppFolder(TEST_NAME) + File.separator + FILE_1;
+ File file1 = new File(file1Path);
+ if (EXT.equals("msi")) {
+ if (file1.exists()) {
+ throw new AssertionError("Unexpected file does exist: "
+ + file1.getAbsolutePath());
+ }
+ } else if (EXT.equals("exe")) {
+ if (!file1.exists()) {
+ throw new AssertionError("Unexpected file does not exist: "
+ + file1.getAbsolutePath());
+ }
+ } else {
+ throw new AssertionError("Unknown installer type: " + EXT);
+ }
+
+ String file2Path = JPackagePath.getWinInstalledAppFolder(TEST_NAME) + File.separator + FILE_2;
+ File file2 = new File(file2Path);
+ if (!file2.exists()) {
+ throw new AssertionError("Unexpected file does not exist: "
+ + file2.getAbsolutePath());
+ }
+ }
+
+ private static void verifyUnInstall() throws Exception {
+ String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
+ File folder = new File(folderPath);
+ if (folder.exists()) {
+ throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
+ }
+ }
+
+ private static void init(String name, String ext) {
+ TEST_NAME = name;
+ EXT = ext;
+ OUTPUT_1 = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD_1 = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--app-version", "1.0",
+ "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"};
+ OUTPUT_2 = "output" + File.separator + TEST_NAME + "-2.0." + EXT;
+ CMD_2 = new String[]{
+ "--package-type", EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--app-version", "2.0",
+ "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"};
+ }
+
+ private static void createInputFile(String name, String context) throws Exception {
+ try (PrintWriter out = new PrintWriter(
+ new BufferedWriter(new FileWriter("input" + File.separator + name)))) {
+ out.println(context);
+ }
+ }
+
+ public static void run(String name, String ext) throws Exception {
+ init(name, ext);
+
+ if (JPackageInstallerHelper.isVerifyInstall()) {
+ verifyInstall();
+ } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
+ verifyUnInstall();
+ } else {
+ JPackageHelper.createHelloInstallerJar();
+ createInputFile(FILE_1, FILE_1);
+ createInputFile(FILE_2, FILE_2);
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/FileAssociationsInstallDirTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build FileAssociationsBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m FileAssociationsInstallDirTest
+ */
+public class FileAssociationsInstallDirTest {
+ private static final String TEST_NAME = "FileAssociationsInstallDirTest";
+ private static final String EXT = "exe";
+ private static final String INSTALL_DIR
+ = "TestVendor\\FileAssociationsInstallDirTestDir";
+ private static final String TEST_EXT = "jptest3";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ FileAssociationsBase.run(TEST_NAME, EXT, INSTALL_DIR, TEST_EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/FileAssociationsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build FileAssociationsBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m FileAssociationsTest
+ */
+public class FileAssociationsTest {
+ private static final String TEST_NAME = "FileAssociationsTest";
+ private static final String EXT = "exe";
+ private static final String TEST_EXT = "jptest1";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ FileAssociationsBase.run(TEST_NAME, EXT, null, TEST_EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/InstallDirTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer install dir test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build InstallDirBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m InstallDirTest
+ */
+public class InstallDirTest {
+ private static final String TEST_NAME = "InstallDirTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ InstallDirBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/LicenseTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build LicenseBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m LicenseTest
+ */
+public class LicenseTest {
+ private static final String TEST_NAME = "LicenseTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ LicenseBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/RuntimeTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.invoke.MethodHandles;
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build RuntimeBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m RuntimeTest
+ */
+public class RuntimeTest {
+
+ private static final String TEST_NAME = MethodHandles.lookup().lookupClass().getName();
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ RuntimeBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/Test.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build Base
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m Test
+ */
+public class Test {
+ private static final String TEST_NAME = "Test";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ Base.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/WinDirChooserTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinDirChooserBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinDirChooserTest
+ */
+public class WinDirChooserTest {
+ private static final String TEST_NAME = "WinDirChooserTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinDirChooserBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/WinMenuGroupTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinMenuGroupBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinMenuGroupTest
+ */
+public class WinMenuGroupTest {
+ private static final String TEST_NAME = "WinMenuGroupTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinMenuGroupBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/WinMenuTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinMenuBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinMenuTest
+ */
+public class WinMenuTest {
+ private static final String TEST_NAME = "WinMenuTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinMenuBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/WinPerUserInstallTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinPerUserInstallBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinPerUserInstallTest
+ */
+public class WinPerUserInstallTest {
+ private static final String TEST_NAME = "WinPerUserInstallTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinPerUserInstallBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/WinRegistryNameTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinRegistryNameBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinRegistryNameTest
+ */
+public class WinRegistryNameTest {
+ private static final String TEST_NAME = "WinRegistryNameTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinRegistryNameBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/WinShortcutTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinShortcutBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinShortcutTest
+ */
+public class WinShortcutTest {
+ private static final String TEST_NAME = "WinShortcutTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinShortcutBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/WinUpgradeUUIDTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinUpgradeUUIDBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinUpgradeUUIDTest
+ */
+public class WinUpgradeUUIDTest {
+ private static final String TEST_NAME = "WinUpgradeUUIDTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinUpgradeUUIDBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/install.bat Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,17 @@
+Test-1.0.exe
+WinMenuTest-1.0.exe
+WinMenuGroupTest-1.0.exe
+WinPerUserInstallTest-1.0.exe
+FileAssociationsTest-1.0.exe
+ECHO Make sure that installer asks to select installation location. Install to default one.
+WinDirChooserTest-1.0.exe
+WinRegistryNameTest-1.0.exe
+WinShortcutTest-1.0.exe
+ECHO Make sure that installer shows license
+LicenseTest-1.0.exe
+WinUpgradeUUIDTest-1.0.exe
+WinUpgradeUUIDTest-2.0.exe
+InstallDirTest-1.0.exe
+FileAssociationsInstallDirTest-1.0.exe
+RuntimeTest-1.0.exe
+PAUSE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/exe/uninstall.bat Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,14 @@
+"%ProgramFiles%\Test\unins000.exe"
+"%ProgramFiles%\WinMenuTest\unins000.exe"
+"%ProgramFiles%\WinMenuGroupTest\unins000.exe"
+"%localappdata%\WinPerUserInstallTest\unins000.exe"
+"%ProgramFiles%\FileAssociationsTest\unins000.exe"
+"%ProgramFiles%\WinDirChooserTest\unins000.exe"
+"%ProgramFiles%\WinRegistryNameTest\unins000.exe"
+"%ProgramFiles%\WinShortcutTest\unins000.exe"
+"%ProgramFiles%\LicenseTest\unins000.exe"
+"%ProgramFiles%\WinUpgradeUUIDTest\unins000.exe"
+"%ProgramFiles%\TestVendor\InstallDirTestDir\unins000.exe"
+"%ProgramFiles%\TestVendor\FileAssociationsInstallDirTestDir\unins000.exe"
+"%ProgramFiles%\RuntimeTest\unins000.exe"
+PAUSE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/FileAssociationsInstallDirTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build FileAssociationsBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m FileAssociationsInstallDirTest
+ */
+public class FileAssociationsInstallDirTest {
+ private static final String TEST_NAME = "FileAssociationsInstallDirTest";
+ private static final String EXT = "msi";
+ private static final String INSTALL_DIR
+ = "TestVendor\\FileAssociationsInstallDirTestDir";
+ private static final String TEST_EXT = "jptest3";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ FileAssociationsBase.run(TEST_NAME,
+ EXT, INSTALL_DIR, TEST_EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/FileAssociationsTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build FileAssociationsBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m FileAssociationsTest
+ */
+public class FileAssociationsTest {
+ private static final String TEST_NAME = "FileAssociationsTest";
+ private static final String EXT = "msi";
+ private static final String TEST_EXT = "jptest1";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ FileAssociationsBase.run(TEST_NAME,
+ EXT, null, TEST_EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/InstallDirTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer install dir test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build InstallDirBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m InstallDirTest
+ */
+public class InstallDirTest {
+ private static final String TEST_NAME = "InstallDirTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ InstallDirBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/LicenseTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build LicenseBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m LicenseTest
+ */
+public class LicenseTest {
+ private static final String TEST_NAME = "LicenseTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ LicenseBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/RuntimeTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.invoke.MethodHandles;
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build RuntimeBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m RuntimeTest
+ */
+public class RuntimeTest {
+
+ private static final String TEST_NAME = MethodHandles.lookup().lookupClass().getName();
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ RuntimeBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/Test.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build Base
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m Test
+ */
+public class Test {
+ private static final String TEST_NAME = "Test";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ Base.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/WinDirChooserTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinDirChooserBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinDirChooserTest
+ */
+public class WinDirChooserTest {
+ private static final String TEST_NAME = "WinDirChooserTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinDirChooserBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/WinMenuGroupTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinMenuGroupBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinMenuGroupTest
+ */
+public class WinMenuGroupTest {
+ private static final String TEST_NAME = "WinMenuGroupTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinMenuGroupBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/WinMenuTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinMenuBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinMenuTest
+ */
+public class WinMenuTest {
+ private static final String TEST_NAME = "WinMenuTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinMenuBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/WinPerUserInstallTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinPerUserInstallBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinPerUserInstallTest
+ */
+public class WinPerUserInstallTest {
+ private static final String TEST_NAME = "WinPerUserInstallTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinPerUserInstallBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/WinRegistryNameTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinRegistryNameBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinRegistryNameTest
+ */
+public class WinRegistryNameTest {
+ private static final String TEST_NAME = "WinRegistryNameTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinRegistryNameBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/WinShortcutTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinShortcutBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinShortcutTest
+ */
+public class WinShortcutTest {
+ private static final String TEST_NAME = "WinShortcutTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinShortcutBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/WinUpgradeUUIDTest.java Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary jpackage create installer test
+ * @library ../../helpers
+ * @library ../base
+ * @build JPackageHelper
+ * @build JPackagePath
+ * @build JPackageInstallerHelper
+ * @build WinUpgradeUUIDBase
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinUpgradeUUIDTest
+ */
+public class WinUpgradeUUIDTest {
+ private static final String TEST_NAME = "WinUpgradeUUIDTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
+ WinUpgradeUUIDBase.run(TEST_NAME, EXT);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/install.bat Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,17 @@
+Test-1.0.msi
+WinMenuTest-1.0.msi
+WinMenuGroupTest-1.0.msi
+WinPerUserInstallTest-1.0.msi
+FileAssociationsTest-1.0.msi
+ECHO Make sure that installer asks to select installation location. Install to default one.
+WinDirChooserTest-1.0.msi
+WinRegistryNameTest-1.0.msi
+WinShortcutTest-1.0.msi
+ECHO Make sure that installer shows license
+LicenseTest-1.0.msi
+WinUpgradeUUIDTest-1.0.msi
+WinUpgradeUUIDTest-2.0.msi
+InstallDirTest-1.0.msi
+FileAssociationsInstallDirTest-1.0.msi
+RuntimeTest-1.0.msi
+PAUSE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/msi/uninstall.bat Mon Jul 01 18:31:16 2019 -0400
@@ -0,0 +1,14 @@
+MSIEXEC /uninstall Test-1.0.msi
+MSIEXEC /uninstall WinMenuTest-1.0.msi
+MSIEXEC /uninstall WinMenuGroupTest-1.0.msi
+MSIEXEC /uninstall WinPerUserInstallTest-1.0.msi
+MSIEXEC /uninstall FileAssociationsTest-1.0.msi
+MSIEXEC /uninstall WinDirChooserTest-1.0.msi
+MSIEXEC /uninstall WinRegistryNameTest-1.0.msi
+MSIEXEC /uninstall WinShortcutTest-1.0.msi
+MSIEXEC /uninstall LicenseTest-1.0.msi
+MSIEXEC /uninstall WinUpgradeUUIDTest-2.0.msi
+MSIEXEC /uninstall InstallDirTest-1.0.msi
+MSIEXEC /uninstall FileAssociationsInstallDirTest-1.0.msi
+MSIEXEC /uninstall RuntimeTest-1.0.msi
+PAUSE