8215036: Create initial set of tests for jpackage create-installer mode
Submitten-by: almatvee
Reviewed-by: herrick. kcr
--- a/test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -166,7 +166,7 @@
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
testMissingArg();
testMissingArgToolProvider();
}
--- a/test/jdk/tools/jpackage/apps/Hello.java Tue Dec 18 16:57:57 2018 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2018, 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;
-
-public class Hello {
-
- private static final String MSG = "jpackage test application";
- private static final int EXPECTED_NUM_OF_PARAMS = 3; // Starts at 1
-
- public static void main(String[] args) {
- String outputFile = "appOutput.txt";
- File file = new File(outputFile);
-
- try (PrintWriter out =
- new PrintWriter(new BufferedWriter(new FileWriter(file)))) {
- System.out.println(MSG);
- out.println(MSG);
-
- System.out.println("args.length: " + args.length);
- out.println("args.length: " + args.length);
-
- for (String arg : args) {
- System.out.println(arg);
- out.println(arg);
- }
-
- for (int index = 1; index <= EXPECTED_NUM_OF_PARAMS; index++) {
- String value = System.getProperty("param" + index);
- if (value != null) {
- System.out.println("-Dparam" + index + "=" + value);
- out.println("-Dparam" + index + "=" + value);
- }
- }
- } catch (Exception ex) {
- System.err.println(ex.toString());
- }
- }
-
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/apps/image/Hello.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2018, 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;
+
+public class Hello {
+
+ private static final String MSG = "jpackage test application";
+ private static final int EXPECTED_NUM_OF_PARAMS = 3; // Starts at 1
+
+ public static void main(String[] args) {
+ printToStdout(args);
+ printToFile(args);
+ }
+
+ private static void printToStdout(String[] args) {
+ System.out.println(MSG);
+
+ System.out.println("args.length: " + args.length);
+
+ for (String arg : args) {
+ System.out.println(arg);
+ }
+
+ for (int index = 1; index <= EXPECTED_NUM_OF_PARAMS; index++) {
+ String value = System.getProperty("param" + index);
+ if (value != null) {
+ System.out.println("-Dparam" + index + "=" + value);
+ }
+ }
+ }
+
+ private static void printToFile(String[] args) {
+ String outputFile = "appOutput.txt";
+ File file = new File(outputFile);
+
+ try (PrintWriter out
+ = new PrintWriter(new BufferedWriter(new FileWriter(file)))) {
+ out.println(MSG);
+
+ out.println("args.length: " + args.length);
+
+ for (String arg : args) {
+ out.println(arg);
+ }
+
+ for (int index = 1; index <= EXPECTED_NUM_OF_PARAMS; index++) {
+ String value = System.getProperty("param" + index);
+ if (value != null) {
+ out.println("-Dparam" + index + "=" + value);
+ }
+ }
+ } catch (Exception ex) {
+ System.err.println(ex.getMessage());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/apps/installer/Hello.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2018, 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;
+
+public class Hello {
+
+ private static final String MSG = "jpackage test application";
+ private static final int EXPECTED_NUM_OF_PARAMS = 3; // Starts at 1
+
+ public static void main(String[] args) {
+ printToStdout(args);
+ if (args.length == 1) { // Called via file association
+ printToFile(args);
+ }
+ }
+
+ private static void printToStdout(String[] args) {
+ System.out.println(MSG);
+
+ System.out.println("args.length: " + args.length);
+
+ for (String arg : args) {
+ System.out.println(arg);
+ }
+
+ for (int index = 1; index <= EXPECTED_NUM_OF_PARAMS; index++) {
+ String value = System.getProperty("param" + index);
+ if (value != null) {
+ System.out.println("-Dparam" + index + "=" + value);
+ }
+ }
+ }
+
+ private static void printToFile(String[] args) {
+ File inputFile = new File(args[0]);
+ String outputFile = inputFile.getParent() + File.separator + "appOutput.txt";
+ File file = new File(outputFile);
+
+ try (PrintWriter out
+ = new PrintWriter(new BufferedWriter(new FileWriter(file)))) {
+ out.println(MSG);
+
+ out.println("args.length: " + args.length);
+
+ for (String arg : args) {
+ out.println(arg);
+ }
+
+ for (int index = 1; index <= EXPECTED_NUM_OF_PARAMS; index++) {
+ String value = System.getProperty("param" + index);
+ if (value != null) {
+ out.println("-Dparam" + index + "=" + value);
+ }
+ }
+ } catch (Exception ex) {
+ System.err.println(ex.getMessage());
+ }
+ }
+}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -45,7 +45,7 @@
"--arguments", "TBD"};
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
JPackageCreateImageArgumentsBase.testCreateImage(CMD);
JPackageCreateImageArgumentsBase.testCreateImageToolProvider(CMD);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageBuildRootTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageBuildRootTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -102,7 +102,7 @@
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
testBuildRoot();
testBuildRootToolProvider();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageBuildRootTest.java.rej Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,10 @@
+--- JPackageCreateImageBuildRootTest.java
++++ JPackageCreateImageBuildRootTest.java
+@@ -25,6 +25,7 @@
+
+ /*
+ * @test
++ * @requires (os.family == "windows")
+ * @summary jpackage create image to test --build-root
+ * @library ../helpers
+ * @build JPackageHelper
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageForceTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageForceTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -145,7 +145,7 @@
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
testForce();
testForceToolProvider();
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageIconTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageIconTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -111,14 +111,14 @@
ext = ".png";
}
- String path = JPackagePath.getTestSrc() + File.separator + "resources"
+ String path = JPackagePath.getTestSrcRoot() + File.separator + "resources"
+ File.separator + "icon" + ext;
return path;
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
testIcon();
testIconToolProvider();
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageInputFilesTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageInputFilesTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -119,7 +119,7 @@
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
createInputFile();
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageJVMArgsTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageJVMArgsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -58,7 +58,7 @@
"--jvm-args", "TBD"};
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs(CMD);
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgsToolProvider(CMD);
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageMainClassAttributeTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageMainClassAttributeTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -90,7 +90,7 @@
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJarWithMainClass();
+ JPackageHelper.createHelloImageJarWithMainClass();
testMainClassAttribute();
testMainClassAttributeToolProvider();
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageNoNameTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageNoNameTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -90,7 +90,7 @@
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
testMainClassAttribute();
testMainClassAttributeToolProvider();
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -44,7 +44,7 @@
"--files", "hello.jar"};
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
JPackageHelper.createRuntime();
JPackageCreateImageRuntimeBase.testCreateImage(CMD);
JPackageCreateImageRuntimeBase.testCreateImageToolProvider(CMD);
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageSecondaryLauncherTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageSecondaryLauncherTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -44,7 +44,7 @@
"--secondary-launcher", "sl.properties"};
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
JPackageCreateImageSecondaryLauncherBase.createSLProperties();
JPackageCreateImageSecondaryLauncherBase.testCreateImage(CMD);
JPackageCreateImageSecondaryLauncherBase.testCreateImageToolProvider(CMD);
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageStripNativeCommandsTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageStripNativeCommandsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -82,7 +82,7 @@
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
testCreateImage();
testCreateImageToolProvider();
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -43,7 +43,7 @@
"--files", "hello.jar"};
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
JPackageCreateImageBase.testCreateImage(CMD);
JPackageCreateImageBase.testCreateImageToolProvider(CMD);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageVerboseTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageVerboseTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -82,7 +82,7 @@
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
testCreateImage();
testCreateImageToolProvider();
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -94,7 +94,7 @@
}
public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloJar();
+ JPackageHelper.createHelloImageJar();
testVersion();
testVersionToolProvider();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018, 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.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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar"};
+ }
+
+ 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/createinstaller/linux/base/JPackageCreateInstallerBundleNameBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerBundleNameBase {
+
+ 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/linux/base/JPackageCreateInstallerFileAssociationsBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2018, 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.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 {
+ createFileAssociationsTestFile();
+ 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 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 = "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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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();
+ createFileAssociationsProperties();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerInstallDirBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2018, 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 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/linux/base/JPackageCreateInstallerLicenseBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2018, 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.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 [] {
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/linux/base/JPackageCreateInstallerLicenseTypeBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerLicenseTypeBase {
+
+ 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/linux/base/JPackageCreateInstallerMaintainerBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerMaintainerBase {
+
+ 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/linux/base/JPackageCreateInstallerPackageDepsBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerPackageDepsBase {
+
+ 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--linux-package-deps", DEP_NAME.toLowerCase()};
+ CMD_DEP = new String[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", DEP_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar"};
+ }
+
+ 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/createinstaller/linux/deb/JPackageCreateInstallerBundleNameTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerBundleNameBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerBundleNameTest
+ */
+public class JPackageCreateInstallerBundleNameTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerBundleNameTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerBundleNameBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/deb/JPackageCreateInstallerFileAssociationsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 == "linux")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsTest
+ */
+public class JPackageCreateInstallerFileAssociationsTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/deb/JPackageCreateInstallerInstallDirTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerInstallDirBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerInstallDirTest
+ */
+public class JPackageCreateInstallerInstallDirTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerInstallDirTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerInstallDirBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/deb/JPackageCreateInstallerLicenseTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 == "linux")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerLicenseTest
+ */
+public class JPackageCreateInstallerLicenseTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerLicenseTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerLicenseBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/deb/JPackageCreateInstallerMaintainerTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerMaintainerBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerMaintainerTest
+ */
+public class JPackageCreateInstallerMaintainerTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerMaintainerTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerMaintainerBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/deb/JPackageCreateInstallerPackageDepsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerPackageDepsBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm/timeout=240 -Xmx512m JPackageCreateInstallerPackageDepsTest
+ */
+public class JPackageCreateInstallerPackageDepsTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerPackageDepsTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerPackageDepsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/deb/JPackageCreateInstallerTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 == "linux")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerTest
+ */
+public class JPackageCreateInstallerTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerTest";
+ private static final String EXT = "deb";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/deb/install.sh Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,8 @@
+sudo dpkg -i jpackagecreateinstallertest-1.0.deb
+sudo dpkg -i jpackagecreateinstallerfileassociationstest-1.0.deb
+sudo dpkg -i jpackagecreateinstallerlicensetest-1.0.deb
+sudo dpkg -i jpackagecreateinstallerinstalldirtest-1.0.deb
+sudo dpkg -i jpackage-test-bundle-name-1.0.deb
+sudo dpkg -i jpackagecreateinstallermaintainertest-1.0.deb
+sudo dpkg -i jpackagecreateinstallerpackagedepstestdep-1.0.deb
+sudo dpkg -i jpackagecreateinstallerpackagedepstest-1.0.deb
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/deb/uninstall.sh Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,8 @@
+sudo dpkg -r jpackagecreateinstallertest
+sudo dpkg -r jpackagecreateinstallerfileassociationstest
+sudo dpkg -r jpackagecreateinstallerlicensetest
+sudo dpkg -r jpackagecreateinstallerinstalldirtest
+sudo dpkg -r jpackage-test-bundle-name
+sudo dpkg -r jpackagecreateinstallermaintainertest
+sudo dpkg -r jpackagecreateinstallerpackagedepstest
+sudo dpkg -r jpackagecreateinstallerpackagedepstestdep
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPackageCreateInstallerBundleNameTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerBundleNameBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerBundleNameTest
+ */
+public class JPackageCreateInstallerBundleNameTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerBundleNameTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerBundleNameBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPackageCreateInstallerFileAssociationsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsTest
+ */
+public class JPackageCreateInstallerFileAssociationsTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPackageCreateInstallerInstallDirTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerInstallDirBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerInstallDirTest
+ */
+public class JPackageCreateInstallerInstallDirTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerInstallDirTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerInstallDirBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPackageCreateInstallerLicenseTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerLicenseTest
+ */
+public class JPackageCreateInstallerLicenseTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerLicenseTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerLicenseBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPackageCreateInstallerLicenseTypeTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerLicenseTypeBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerLicenseTypeTest
+ */
+public class JPackageCreateInstallerLicenseTypeTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerLicenseTypeTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerLicenseTypeBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPackageCreateInstallerPackageDepsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerPackageDepsBase
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm/timeout=240 -Xmx512m JPackageCreateInstallerPackageDepsTest
+ */
+public class JPackageCreateInstallerPackageDepsTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerPackageDepsTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerPackageDepsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/rpm/JPackageCreateInstallerTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 == "linux")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerTest
+ */
+public class JPackageCreateInstallerTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerTest";
+ private static final String EXT = "rpm";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/linux/rpm/install.sh Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,8 @@
+sudo rpm --install jpackagecreateinstallerfileassociationstest-1.0-1.x86_64.rpm
+sudo rpm --install jpackagecreateinstallerinstalldirtest-1.0-1.x86_64.rpm
+sudo rpm --install jpackagecreateinstallerlicensetest-1.0-1.x86_64.rpm
+sudo rpm --install jpackagecreateinstallerlicensetypetest-1.0-1.x86_64.rpm
+sudo rpm --install jpackagecreateinstallerpackagedepstestdep-1.0-1.x86_64.rpm
+sudo rpm --install jpackagecreateinstallerpackagedepstest-1.0-1.x86_64.rpm
+sudo rpm --install jpackagecreateinstallertest-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/createinstaller/linux/rpm/uninstall.sh Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,8 @@
+sudo rpm -e jpackagecreateinstallerfileassociationstest
+sudo rpm -e jpackagecreateinstallerinstalldirtest
+sudo rpm -e jpackagecreateinstallerlicensetest
+sudo rpm -e jpackagecreateinstallerlicensetypetest
+sudo rpm -e jpackagecreateinstallerpackagedepstest
+sudo rpm -e jpackagecreateinstallerpackagedepstestdep
+sudo rpm -e jpackagecreateinstallertest
+sudo rpm -e jpackage-test-bundle-name
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2018, 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.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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar"};
+ }
+
+ 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/createinstaller/macosx/base/JPackageCreateInstallerFileAssociationsBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2018, 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();
+ }
+
+ 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 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 = "jptest1";
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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();
+ createFileAssociationsProperties();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerInstallDirBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2018, 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 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/macosx/base/JPackageCreateInstallerLicenseBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2018, 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.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 [] {
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/macosx/dmg/JPackageCreateInstallerFileAssociationsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 == "mac")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsTest
+ */
+public class JPackageCreateInstallerFileAssociationsTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsTest";
+ private static final String EXT = "dmg";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/dmg/JPackageCreateInstallerInstallDirTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerInstallDirBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerInstallDirTest
+ */
+public class JPackageCreateInstallerInstallDirTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerInstallDirTest";
+ private static final String EXT = "dmg";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerInstallDirBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/dmg/JPackageCreateInstallerLicenseTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 == "mac")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerLicenseTest
+ */
+public class JPackageCreateInstallerLicenseTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerLicenseTest";
+ private static final String EXT = "dmg";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerLicenseBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/dmg/JPackageCreateInstallerTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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 == "mac")
+ * @modules jdk.jpackage
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerTest
+ */
+public class JPackageCreateInstallerTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerTest";
+ private static final String EXT = "dmg";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/dmg/install.sh Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,21 @@
+echo "Note: This script will install DMG files silently. In order to verify UI, each .dmg needs to launched manually via Finder."
+
+# JPackageCreateInstallerTest
+hdiutil attach JPackageCreateInstallerTest-1.0.dmg
+sudo /usr/sbin/installer -pkg /Volumes/JPackageCreateInstallerTest/JPackageCreateInstallerTest-1.0.pkg -target /
+hdiutil detach /Volumes/JPackageCreateInstallerTest/
+
+# JPackageCreateInstallerLicenseTest
+hdiutil attach JPackageCreateInstallerLicenseTest-1.0.dmg
+sudo /usr/sbin/installer -pkg /Volumes/JPackageCreateInstallerLicenseTest/JPackageCreateInstallerLicenseTest-1.0.pkg -target /
+hdiutil detach /Volumes/JPackageCreateInstallerLicenseTest/
+
+# JPackageCreateInstallerFileAssociationsTest
+hdiutil attach JPackageCreateInstallerFileAssociationsTest-1.0.dmg
+sudo /usr/sbin/installer -pkg /Volumes/JPackageCreateInstallerFileAssociationsTest/JPackageCreateInstallerFileAssociationsTest-1.0.pkg -target /
+hdiutil detach /Volumes/JPackageCreateInstallerFileAssociationsTest/
+
+# JPackageCreateInstallerInstallDirTest
+hdiutil attach JPackageCreateInstallerInstallDirTest-1.0.dmg
+sudo /usr/sbin/installer -pkg /Volumes/JPackageCreateInstallerInstallDirTest/JPackageCreateInstallerInstallDirTest-1.0.pkg -target /
+hdiutil detach /Volumes/JPackageCreateInstallerInstallDirTest/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/dmg/uninstall.sh Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,4 @@
+sudo rm -rf /Applications/JPackageCreateInstallerTest.app
+sudo rm -rf /Applications/JPackageCreateInstallerLicenseTest.app
+sudo rm -rf /Applications/JPackageCreateInstallerFileAssociationsTest.app
+sudo rm -rf /Applications/jpackage/JPackageCreateInstallerInstallDirTest.app
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/pkg/JPackageCreateInstallerFileAssociationsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 == "mac")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsTest
+ */
+public class JPackageCreateInstallerFileAssociationsTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsTest";
+ private static final String EXT = "pkg";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/pkg/JPackageCreateInstallerInstallDirTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 JPackageCreateInstallerInstallDirBase
+ * @requires (os.family == "mac")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerInstallDirTest
+ */
+public class JPackageCreateInstallerInstallDirTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerInstallDirTest";
+ private static final String EXT = "pkg";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerInstallDirBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/pkg/JPackageCreateInstallerLicenseTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 == "mac")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerLicenseTest
+ */
+public class JPackageCreateInstallerLicenseTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerLicenseTest";
+ private static final String EXT = "pkg";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerLicenseBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/pkg/JPackageCreateInstallerTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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 == "mac")
+ * @modules jdk.jpackage
+ * @run main/othervm -Xmx512m JPackageCreateInstallerTest
+ */
+public class JPackageCreateInstallerTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerTest";
+ private static final String EXT = "pkg";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/pkg/install.sh Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,5 @@
+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 JPackageCreateInstallerTest-1.0.pkg -target /
+sudo /usr/sbin/installer -pkg JPackageCreateInstallerLicenseTest-1.0.pkg -target /
+sudo /usr/sbin/installer -pkg JPackageCreateInstallerFileAssociationsTest-1.0.pkg -target /
+sudo /usr/sbin/installer -pkg JPackageCreateInstallerInstallDirTest-1.0.pkg -target /
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/pkg/uninstall.sh Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,4 @@
+sudo rm -rf /Applications/JPackageCreateInstallerTest.app
+sudo rm -rf /Applications/JPackageCreateInstallerLicenseTest.app
+sudo rm -rf /Applications/JPackageCreateInstallerFileAssociationsTest.app
+sudo rm -rf /Applications/jpackage/JPackageCreateInstallerInstallDirTest.app
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2018, 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar"};
+ }
+
+ 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/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2018, 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) {
+ TEST_NAME = name;
+ EXT = ext;
+ TEST_EXT = "jptest1";
+ OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
+ CMD = new String[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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();
+ createFileAssociationsProperties();
+ testCreateInstaller();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerLicenseBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2018, 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 [] {
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/windows/base/JPackageCreateInstallerWinDirChooserBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2018, 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/windows/base/JPackageCreateInstallerWinMenuBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2018, 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/windows/base/JPackageCreateInstallerWinMenuGroupBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018, 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/windows/base/JPackageCreateInstallerWinPerUserInstallBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2018, 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/windows/base/JPackageCreateInstallerWinRegistryNameBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2018, 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/windows/base/JPackageCreateInstallerWinShortcutBase.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2018, 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[]{
+ "create-installer",
+ EXT,
+ "--input", "input",
+ "--output", "output",
+ "--name", TEST_NAME,
+ "--main-jar", "hello.jar",
+ "--class", "Hello",
+ "--force",
+ "--files", "hello.jar",
+ "--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/createinstaller/windows/exe/JPackageCreateInstallerFileAssociationsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsTest
+ */
+public class JPackageCreateInstallerFileAssociationsTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsTest";
+ private static final String EXT = "exe";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerLicenseTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerLicenseBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinDirChooserTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinDirChooserBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinMenuGroupTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinMenuGroupBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinMenuTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinMenuBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinPerUserInstallTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinPerUserInstallBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinRegistryNameTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinRegistryNameBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/JPackageCreateInstallerWinShortcutTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinShortcutBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/install.bat Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,12 @@
+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
+PAUSE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/exe/uninstall.bat Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,10 @@
+"%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"
+PAUSE
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerFileAssociationsTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @run main/othervm -Xmx512m JPackageCreateInstallerFileAssociationsTest
+ */
+public class JPackageCreateInstallerFileAssociationsTest {
+ private static final String TEST_NAME = "JPackageCreateInstallerFileAssociationsTest";
+ private static final String EXT = "msi";
+
+ public static void main(String[] args) throws Exception {
+ JPackageCreateInstallerFileAssociationsBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerLicenseTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerLicenseBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinDirChooserTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinDirChooserBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinMenuGroupTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinMenuGroupBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinMenuTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinMenuBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinPerUserInstallTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinPerUserInstallBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinRegistryNameTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinRegistryNameBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/JPackageCreateInstallerWinShortcutTest.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, 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
+ * @ignore
+ * @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 {
+ JPackageCreateInstallerWinShortcutBase.run(TEST_NAME, EXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/install.bat Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,12 @@
+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
+PAUSE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createinstaller/windows/msi/uninstall.bat Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,10 @@
+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
+PAUSE
\ No newline at end of file
--- a/test/jdk/tools/jpackage/helpers/JPackageHelper.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/helpers/JPackageHelper.java Tue Dec 18 18:23:16 2018 -0500
@@ -37,6 +37,7 @@
private static final boolean VERBOSE = false;
private static final String OS = System.getProperty("os.name").toLowerCase();
private static final String JAVA_HOME = System.getProperty("java.home");
+ public static final String TEST_SRC_ROOT;
public static final String TEST_SRC;
private static final Path BIN_DIR = Path.of(JAVA_HOME, "bin");
private static final Path JPACKAGE;
@@ -61,17 +62,27 @@
File testSrc = new File(System.getProperty("test.src") + File.separator + ".."
+ File.separator + "apps");
if (testSrc.exists()) {
- TEST_SRC = System.getProperty("test.src") + File.separator + "..";
+ TEST_SRC_ROOT = System.getProperty("test.src") + File.separator + "..";
} else {
testSrc = new File(System.getProperty("test.src") + File.separator
+ ".." + File.separator + ".." + File.separator + "apps");
if (testSrc.exists()) {
- TEST_SRC = System.getProperty("test.src") + File.separator + ".."
+ TEST_SRC_ROOT = System.getProperty("test.src") + File.separator + ".."
+ File.separator + "..";
} else {
- TEST_SRC = System.getProperty("test.src");
+ testSrc = new File(System.getProperty("test.src") + File.separator
+ + ".." + File.separator + ".." + File.separator + ".."
+ + File.separator + "apps");
+ if (testSrc.exists()) {
+ TEST_SRC_ROOT = System.getProperty("test.src") + File.separator + ".."
+ + File.separator + ".." + File.separator + "..";
+ } else {
+ TEST_SRC_ROOT = System.getProperty("test.src");
+ }
}
}
+
+ TEST_SRC = System.getProperty("test.src");
}
static final ToolProvider JPACKAGE_TOOL =
@@ -210,15 +221,24 @@
return ((OS.contains("nix") || OS.contains("nux")));
}
- public static void createHelloJar() throws Exception {
- createJar(false);
+ public static void createHelloImageJar() throws Exception {
+ createJar(false, "Hello", "image");
+ }
+
+ public static void createHelloImageJarWithMainClass() throws Exception {
+ createJar(true, "Hello", "image");
}
- public static void createHelloJarWithMainClass() throws Exception {
- createJar(true);
+ public static void createHelloInstallerJar() throws Exception {
+ createJar(false, "Hello", "installer");
}
- private static void createJar(boolean mainClassAttribute) throws Exception {
+ public static void createHelloInstallerJarWithMainClass() throws Exception {
+ createJar(true, "Hello", "installer");
+ }
+
+ private static void createJar(boolean mainClassAttribute, String name,
+ String testType) throws Exception {
int retVal;
File input = new File("input");
@@ -226,12 +246,12 @@
input.mkdir();
}
- Files.copy(Path.of(TEST_SRC + File.separator + "apps" + File.separator
- + "Hello.java"), Path.of("Hello.java"));
+ Files.copy(Path.of(TEST_SRC_ROOT + File.separator + "apps" + File.separator
+ + testType + File.separator + name + ".java"), Path.of(name + ".java"));
File javacLog = new File("javac.log");
try {
- retVal = execute(javacLog, JAVAC.toString(), "Hello.java");
+ retVal = execute(javacLog, JAVAC.toString(), name + ".java");
} catch (Exception ex) {
if (javacLog.exists()) {
System.err.println(Files.readString(javacLog.toPath()));
@@ -253,12 +273,12 @@
args.add("-c");
args.add("-v");
args.add("-f");
- args.add("input" + File.separator + "hello.jar");
+ args.add("input" + File.separator + name.toLowerCase() + ".jar");
if (mainClassAttribute) {
args.add("-e");
- args.add("Hello");
+ args.add(name);
}
- args.add("Hello.class");
+ args.add(name + ".class");
retVal = execute(jarLog, args.stream().toArray(String[]::new));
} catch (Exception ex) {
if (jarLog.exists()) {
@@ -298,9 +318,9 @@
args.add(JAVAC.toString());
args.add("-d");
args.add("module" + File.separator + "com.hello");
- args.add(TEST_SRC + File.separator + "apps" + File.separator + "com.hello"
+ args.add(TEST_SRC_ROOT + File.separator + "apps" + File.separator + "com.hello"
+ File.separator + "module-info.java");
- args.add(TEST_SRC + File.separator + "apps" + File.separator + "com.hello"
+ args.add(TEST_SRC_ROOT + File.separator + "apps" + File.separator + "com.hello"
+ File.separator + "com" + File.separator + "hello" + File.separator
+ javaFile);
retVal = execute(javacLog, args.stream().toArray(String[]::new));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/helpers/JPackageInstallerHelper.java Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2018, 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.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.List;
+
+public class JPackageInstallerHelper {
+ private static final String JPACKAGE_TEST_OUTPUT = "jpackage.test.output";
+ private static final String JPACKAGE_VERIFY_INSTALL = "jpackage.verify.install";
+ private static final String JPACKAGE_VERIFY_UNINSTALL = "jpackage.verify.uninstall";
+ private static String testOutput;
+ private static final boolean isTestOutputSet;
+ private static final boolean isVerifyInstall;
+ private static final boolean isVerifyUnInstall;
+
+ static {
+ String out = System.getProperty(JPACKAGE_TEST_OUTPUT);
+ isTestOutputSet = (out != null);
+ if (isTestOutputSet) {
+ File file = new File(out);
+ if (!file.exists()) {
+ throw new AssertionError(file.getAbsolutePath() + " does not exist");
+ }
+
+ if (!file.isDirectory()) {
+ throw new AssertionError(file.getAbsolutePath() + " is not a directory");
+ }
+
+ if (!file.canWrite()) {
+ throw new AssertionError(file.getAbsolutePath() + " is not writable");
+ }
+
+ if (out.endsWith(File.separator)) {
+ out = out.substring(0, out.length() - 2);
+ }
+
+ testOutput = out;
+ }
+
+ isVerifyInstall = (System.getProperty(JPACKAGE_VERIFY_INSTALL) != null);
+ isVerifyUnInstall = (System.getProperty(JPACKAGE_VERIFY_UNINSTALL) != null);
+ }
+
+ public static boolean isTestOutputSet() {
+ return isTestOutputSet;
+ }
+
+ public static boolean isVerifyInstall() {
+ return isVerifyInstall;
+ }
+
+ public static boolean isVerifyUnInstall() {
+ return isVerifyUnInstall;
+ }
+
+ public static void copyTestResults(List<String> files) throws Exception {
+ if (!isTestOutputSet()) {
+ return;
+ }
+
+ File dest = new File(testOutput);
+ if (!dest.exists()) {
+ dest.mkdirs();
+ }
+
+ if (JPackageHelper.isWindows()) {
+ files.add(JPackagePath.getTestSrc() + File.separator + "install.bat");
+ files.add(JPackagePath.getTestSrc() + File.separator + "uninstall.bat");
+ } else {
+ files.add(JPackagePath.getTestSrc() + File.separator + "install.sh");
+ files.add(JPackagePath.getTestSrc() + File.separator + "uninstall.sh");
+ }
+
+ for (String file : files) {
+ Path source = Path.of(file);
+ Path target = Path.of(dest.toPath() + File.separator + source.getFileName());
+ Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
+ }
+ }
+
+ public static void validateApp(String app) throws Exception {
+ File outFile = new File("appOutput.txt");
+ if (outFile.exists()) {
+ outFile.delete();
+ }
+
+ 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.getAbsolutePath() + " was not created");
+ }
+
+ String output = Files.readString(outFile.toPath());
+ String[] result = output.split("\n");
+ if (result.length != 2) {
+ 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: 0")) {
+ throw new AssertionError("Unexpected result[1]: " + result[1]);
+ }
+ }
+
+ public static void validateOutput(String output) throws Exception {
+ File file = new File(output);
+ if (!file.exists()) {
+ // Try lower case in case of OS is case sensitive
+ file = new File(output.toLowerCase());
+ if (!file.exists()) {
+ throw new AssertionError("Cannot find " + file.getAbsolutePath());
+ }
+ }
+ }
+
+ public static void validateStartMenu(String menuGroup, String menu, boolean exist)
+ throws Exception {
+ String startMenuLink = JPackagePath.getWinStartMenu() +
+ File.separator + menuGroup + File.separator +
+ menu + ".lnk";
+
+ File link = new File(startMenuLink);
+ if (exist) {
+ if (!link.exists()) {
+ throw new AssertionError("Cannot find " + link.getAbsolutePath());
+ }
+ } else {
+ if (link.exists()) {
+ throw new AssertionError("Error: " + link.getAbsolutePath() + " exist");
+ }
+ }
+ }
+
+ public static void validateDesktopShortcut(String name, boolean exist)
+ throws Exception {
+ String shortcutLink = JPackagePath.getWinPublicDesktop() +
+ File.separator + name + ".lnk";
+
+ File link = new File(shortcutLink);
+ if (exist) {
+ if (!link.exists()) {
+ throw new AssertionError("Cannot find " + link.getAbsolutePath());
+ }
+ } else {
+ if (link.exists()) {
+ throw new AssertionError("Error: " + link.getAbsolutePath() + " exist");
+ }
+ }
+ }
+
+ public static void validateUserLocalStartMenu(String menuGroup, String menu, boolean exist)
+ throws Exception {
+ String startMenuLink = JPackagePath.getWinUserLocalStartMenu() +
+ File.separator + menuGroup + File.separator +
+ menu + ".lnk";
+
+ File link = new File(startMenuLink);
+ if (exist) {
+ if (!link.exists()) {
+ throw new AssertionError("Cannot find " + link.getAbsolutePath());
+ }
+ } else {
+ if (link.exists()) {
+ throw new AssertionError("Error: " + link.getAbsolutePath() + " exist");
+ }
+ }
+ }
+
+ public static void validateWinRegistry(String key, String [] values, boolean retValZero)
+ throws Exception {
+ File outFile = new File("regOutput.txt");
+ if (outFile.exists()) {
+ outFile.delete();
+ }
+
+ int retVal = JPackageHelper.execute(outFile, "reg.exe", "query", key);
+ if (retValZero) {
+ if (retVal != 0) {
+ System.out.println("validateWinRegistry() key=" + key);
+ if (outFile.exists()) {
+ System.err.println(Files.readString(outFile.toPath()));
+ }
+ throw new AssertionError(
+ "Reg.exe application exited with error: " + retVal);
+ }
+ } else {
+ if (retVal == 0) {
+ System.out.println("validateWinRegistry() key=" + key);
+ if (outFile.exists()) {
+ System.err.println(Files.readString(outFile.toPath()));
+ }
+ throw new AssertionError(
+ "Reg.exe application exited without error: " + retVal);
+ } else {
+ return; // Done
+ }
+ }
+
+ if (!outFile.exists()) {
+ throw new AssertionError(outFile.getAbsolutePath() + " was not created");
+ }
+
+ String output = Files.readString(outFile.toPath());
+ for (String value : values) {
+ if (!output.contains(value)) {
+ System.err.println(output);
+ throw new AssertionError("Cannot find in registry: " + value);
+ }
+ }
+ }
+}
--- a/test/jdk/tools/jpackage/helpers/JPackagePath.java Tue Dec 18 16:57:57 2018 -0500
+++ b/test/jdk/tools/jpackage/helpers/JPackagePath.java Tue Dec 18 18:23:16 2018 -0500
@@ -28,7 +28,22 @@
*/
public class JPackagePath {
+ // Path to Windows "Program Files" folder
+ // Probably better to figure this out programattically
+ private static final String WIN_PROGRAM_FILES = "C:\\Program Files";
+
+ // Path to Windows Start menu items
+ private static final String WIN_START_MENU = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs";
+
+ // Path to Windows public desktop location
+ private static final String WIN_PUBLIC_DESKTOP = "C:\\Users\\Public\\Desktop";
+
// Return path to test src adjusted to location of caller
+ public static String getTestSrcRoot() {
+ return JPackageHelper.TEST_SRC_ROOT;
+ }
+
+ // Return path to calling test
public static String getTestSrc() {
return JPackageHelper.TEST_SRC;
}
@@ -174,4 +189,90 @@
throw new AssertionError("Cannot detect platform");
}
}
+
+ public static String getWinProgramFiles() {
+ return WIN_PROGRAM_FILES;
+ }
+
+ public static String getWinUserLocal() {
+ return System.getProperty("user.home") + File.separator + "AppData"
+ + File.separator + "Local";
+ }
+
+ public static String getWinStartMenu() {
+ return WIN_START_MENU;
+ }
+
+ public static String getWinPublicDesktop() {
+ return WIN_PUBLIC_DESKTOP;
+ }
+
+ public static String getWinUserLocalStartMenu() {
+ return System.getProperty("user.home") + File.separator + "AppData"
+ + File.separator + "Roaming" + File.separator + "Microsoft"
+ + File.separator + "Windows" + File.separator + "Start Menu"
+ + File.separator + "Programs";
+
+ }
+
+ public static String getWinInstalledApp(String testName) {
+ return getWinProgramFiles() + File.separator + testName + File.separator
+ + testName + ".exe";
+ }
+
+ public static String getOSXInstalledApp(String testName) {
+ return File.separator + "Applications" + File.separator + testName
+ + ".app" + File.separator + "Contents" + File.separator
+ + "MacOS" + File.separator + testName;
+ }
+
+ public static String getLinuxInstalledApp(String testName) {
+ return File.separator + "opt" + File.separator + testName +
+ File.separator + testName;
+ }
+
+ public static String getOSXInstalledApp(String subDir, String testName) {
+ return File.separator + "Applications" + File.separator + subDir
+ + File.separator + testName + ".app" + File.separator
+ + "Contents" + File.separator + "MacOS" + File.separator
+ + testName;
+ }
+
+ public static String getLinuxInstalledApp(String subDir, String testName) {
+ return File.separator + "opt" + File.separator + subDir + File.separator
+ + testName + File.separator + testName;
+ }
+
+ public static String getWinInstallFolder(String testName) {
+ return getWinProgramFiles() + File.separator + testName;
+ }
+
+ public static String getLinuxInstallFolder(String testName) {
+ return File.separator + "opt" + File.separator + testName;
+ }
+
+ public static String getLinuxInstallFolder(String subDir, String testName) {
+ if (testName == null) {
+ return File.separator + "opt" + File.separator + subDir;
+ } else {
+ return File.separator + "opt" + File.separator + subDir
+ + File.separator + testName;
+ }
+ }
+
+ public static String getWinUserLocalInstalledApp(String testName) {
+ return getWinUserLocal() + File.separator + testName + File.separator + testName + ".exe";
+ }
+
+ public static String getWinUserLocalInstallFolder(String testName) {
+ return getWinUserLocal() + File.separator + testName;
+ }
+
+ // Returs path to test license file
+ public static String getLicenseFilePath() {
+ String path = JPackagePath.getTestSrcRoot() + File.separator + "resources"
+ + File.separator + "license.txt";
+
+ return path;
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/resources/license.txt Tue Dec 18 18:23:16 2018 -0500
@@ -0,0 +1,1 @@
+jpackage test lisense file.