8219889: Update jpackage tests for JDK-8219678 changes
Submitten-by: almatvee
Reviewed-by: kbr, herrick
--- a/test/jdk/tools/jpackage/JPackageInvalidArgTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/JPackageInvalidArgTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -33,7 +33,7 @@
public class JPackageInvalidArgTest {
private static final String ARG1 = "--no-such-argument";
- private static final String ARG2 = "--overwrite";
+ private static final String ARG2 = "--output";
private static final String RESULT1 =
"Invalid Option: [--no-such-argument]";
private static final String RESULT2 = "Mode is not specified";
--- a/test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -39,7 +39,6 @@
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
private static final String [] RESULT_2 = {"--input"};
@@ -49,7 +48,6 @@
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
private static final String [] RESULT_3 = {"--input", "--app-image"};
@@ -59,7 +57,6 @@
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
private static final String [] RESULT_4 = {"--main-class"};
@@ -69,7 +66,6 @@
"--output", "output",
"--name", "test",
"--main-jar", "hello.jar",
- "--overwrite",
"--files", "hello.jar"};
private static final String [] RESULT_5 = {"--main-jar"};
@@ -79,7 +75,6 @@
"--output", "output",
"--name", "test",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
private static final String [] RESULT_6 = {"--module-path", "--runtime-image"};
@@ -88,7 +83,6 @@
"--output", "output",
"--name", "test",
"--module", "com.hello/com.hello.Hello",
- "--overwrite",
"--files", "hello.jar"};
private static final String [] RESULT_7 = {"--module-path", "--runtime-image",
@@ -98,7 +92,6 @@
"--output", "output",
"--name", "test",
"--module", "com.hello/com.hello.Hello",
- "--overwrite",
"--files", "hello.jar"};
private static void validate(String output, String [] expected)
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsModuleTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsModuleTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,12 +32,12 @@
* @run main/othervm -Xmx512m JPackageCreateImageArgumentsModuleTest
*/
public class JPackageCreateImageArgumentsModuleTest {
+ private static final String OUTPUT = "output";
private static final String[] CMD = {
"create-image",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
- "--overwrite",
"--module", "com.hello/com.hello.Hello",
"--module-path", "input",
"--arguments", "TBD"};
@@ -45,6 +45,7 @@
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloModule();
JPackageCreateImageArgumentsBase.testCreateImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageArgumentsBase.testCreateImageToolProvider(CMD);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,21 +32,22 @@
* @run main/othervm -Xmx512m JPackageCreateImageArgumentsTest
*/
public class JPackageCreateImageArgumentsTest {
+ private static final String OUTPUT = "output";
private static final String[] CMD = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
"--files", "hello.jar",
- "--overwrite",
"--arguments", "TBD"};
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloImageJar();
JPackageCreateImageArgumentsBase.testCreateImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageArgumentsBase.testCreateImageToolProvider(CMD);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageBuildRootTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageBuildRootTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -34,6 +34,7 @@
* @run main/othervm -Xmx512m JPackageCreateImageBuildRootTest
*/
public class JPackageCreateImageBuildRootTest {
+ private static final String OUTPUT = "output";
private static String buildRoot = null;
private static final String BUILD_ROOT = "buildRoot";
private static final String BUILD_ROOT_TB = "buildRootToolProvider";
@@ -41,22 +42,20 @@
private static final String [] CMD = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
+ "--name", "test",
+ "--main-jar", "hello.jar",
+ "--main-class", "Hello",
+ "--files", "hello.jar" };
+
+ private static final String [] CMD_BUILD_ROOT = {
+ "create-image",
+ "--input", "input",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
"--files", "hello.jar",
- "--overwrite" };
-
- private static final String [] CMD_BUILD_ROOT = {
- "create-image",
- "--input", "input",
- "--output", "output",
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--files", "hello.jar",
- "--overwrite",
"--build-root", "TBD"};
private static void validate(boolean retain) throws Exception {
@@ -86,14 +85,17 @@
init(false);
JPackageHelper.executeCLI(true, CMD);
validate(false);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeCLI(true, CMD_BUILD_ROOT);
validate(true);
}
private static void testBuildRootToolProvider() throws Exception {
init(true);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeToolProvider(true, CMD);
validate(false);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeToolProvider(true, CMD_BUILD_ROOT);
validate(true);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageIconTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageIconTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -34,6 +34,7 @@
* @run main/othervm -Xmx512m JPackageCreateImageIconTest
*/
public class JPackageCreateImageIconTest {
+ private static final String OUTPUT = "output";
private static final String app = JPackagePath.getApp();
private static final String appOutput = JPackagePath.getAppOutputFile();
private static final String appWorkingDir = JPackagePath.getAppWorkingDir();
@@ -44,10 +45,9 @@
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--icon", getIconPath(),
- "--output", "output"};
+ "--output", OUTPUT};
private static void validateResult(String[] result) throws Exception {
if (result.length != 2) {
@@ -98,6 +98,7 @@
}
private static void testIconToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeToolProvider(true, CMD);
validate();
validateIcon();
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageInputFilesTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageInputFilesTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -36,6 +36,7 @@
* @run main/othervm -Xmx512m JPackageCreateImageInputFilesTest
*/
public class JPackageCreateImageInputFilesTest {
+ private static final String OUTPUT = "output";
private static final String inputFile =
"input" + File.separator + "input.txt";
private static final String jarFile =
@@ -51,20 +52,18 @@
private static final String [] CMD_1 = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
- "--overwrite",
"--main-class", "Hello"};
private static final String [] CMD_2 = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
private static void validate1() throws Exception {
@@ -99,14 +98,17 @@
JPackageHelper.executeCLI(true, CMD_1);
validate1();
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeCLI(true, CMD_2);
validate2();
}
private static void testCreateImageToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeToolProvider(true, CMD_1);
validate1();
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeToolProvider(true, CMD_2);
validate2();
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageJVMArgsModuleTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageJVMArgsModuleTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,21 +32,20 @@
* @run main/othervm -Xmx512m JPackageCreateImageJVMArgsModuleTest
*/
public class JPackageCreateImageJVMArgsModuleTest {
+ private static final String OUTPUT = "output";
private static final String[] CMD = {
"create-image",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
- "--overwrite",
"--module", "com.hello/com.hello.Hello",
"--module-path", "input",
"--jvm-args", "TBD"};
private static final String[] CMD2 = {
"create-image",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
- "--overwrite",
"--module", "com.hello/com.hello.Hello",
"--module-path", "input",
"--jvm-args", "TBD",
@@ -57,9 +56,12 @@
JPackageHelper.createHelloModule();
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgsToolProvider(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs2(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs2ToolProvider(CMD2);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageJVMArgsTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageJVMArgsTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,27 +32,26 @@
* @run main/othervm -Xmx512m JPackageCreateImageJVMArgsTest
*/
public class JPackageCreateImageJVMArgsTest {
+ private static final String OUTPUT = "output";
private static final String[] CMD = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
"--files", "hello.jar",
- "--overwrite",
"--jvm-args", "TBD"};
private static final String[] CMD2 = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
"--files", "hello.jar",
- "--overwrite",
"--jvm-args", "TBD",
"--jvm-args", "TBD",
"--jvm-args", "TBD"};
@@ -60,9 +59,12 @@
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloImageJar();
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgsToolProvider(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs2(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageJVMArgsBase.testCreateImageJVMArgs2ToolProvider(CMD2);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageMainClassAttributeTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageMainClassAttributeTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -34,6 +34,7 @@
* @run main/othervm -Xmx512m JPackageCreateImageMainClassAttributeTest
*/
public class JPackageCreateImageMainClassAttributeTest {
+ private static final String OUTPUT = "output";
private static final String app = JPackagePath.getApp();
private static final String appOutput = JPackagePath.getAppOutputFile();
private static final String appWorkingDir = JPackagePath.getAppWorkingDir();
@@ -41,10 +42,9 @@
private static final String[] CMD = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
- "--overwrite",
"--files", "hello.jar"};
private static void validateResult(String[] result) throws Exception {
@@ -85,6 +85,7 @@
}
private static void testMainClassAttributeToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeToolProvider(true, CMD);
validate();
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageModularJarTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageModularJarTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,34 +32,36 @@
* @run main/othervm -Xmx512m JPackageCreateImageModularJarTest
*/
public class JPackageCreateImageModularJarTest {
+ private static final String OUTPUT = "output";
private static final String [] CMD1 = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "com.hello.jar",
"--main-class", "com.hello.Hello",
"--files", "com.hello.jar",
- "--overwrite"
};
private static final String [] CMD2 = {
"create-image",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--module", "com.hello/com.hello.Hello",
"--module-path", "input/com.hello.jar",
- "--overwrite"
};
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloModule();
JPackageCreateImageBase.testCreateImage(CMD1);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageBase.testCreateImageToolProvider(CMD1);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageBase.testCreateImage(CMD2);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageBase.testCreateImageToolProvider(CMD2);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageModuleTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageModuleTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,17 +32,19 @@
* @run main/othervm -Xmx512m JPackageCreateImageModuleTest
*/
public class JPackageCreateImageModuleTest {
+ private static final String OUTPUT = "output";
+
private static final String [] CMD = {
"create-image",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
- "--overwrite",
"--module", "com.hello/com.hello.Hello",
"--module-path", "input"};
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloModule();
JPackageCreateImageBase.testCreateImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageBase.testCreateImageToolProvider(CMD);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageNoNameTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageNoNameTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -34,6 +34,7 @@
* @run main/othervm -Xmx512m JPackageCreateImageNoNameTest
*/
public class JPackageCreateImageNoNameTest {
+ private static final String OUTPUT = "output";
private static final String app = JPackagePath.getAppNoName();
private static final String appOutput = JPackagePath.getAppOutputFile();
private static final String appWorkingDir = JPackagePath.getAppWorkingDirNoName();
@@ -41,10 +42,9 @@
private static final String[] CMD = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
private static void validateResult(String[] result) throws Exception {
@@ -85,6 +85,7 @@
}
private static void testMainClassAttributeToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeToolProvider(true, CMD);
validate();
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageOverwriteTest.java Wed Feb 27 20:45:51 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-
-/*
- * @test
- * @summary jpackage create image to verify --overwrite
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateImageOverwriteTest
- */
-public class JPackageCreateImageOverwriteTest {
- private static final String app = JPackagePath.getApp();
- private static final String appOutput = JPackagePath.getAppOutputFile();
- private static final String appWorkingDir = JPackagePath.getAppWorkingDir();
-
- private static final String[] CMD = {
- "create-image",
- "--input", "input",
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--files", "hello.jar",
- "--output", "TBD"};
-
- private static final String[] CMD_OVERWRITE = {
- "create-image",
- "--input", "input",
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--overwrite",
- "--files", "hello.jar",
- "--output", "TBD"};
-
- private static void validateResult(String[] result) throws Exception {
- if (result.length != 2) {
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 0")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
- }
-
- private static void validate(String result) throws Exception {
- if (!result.contains("java.io.IOException") &&
- !result.contains("already exists") &&
- !result.contains("--overwrite is not specified")) {
- System.err.println(result);
- throw new AssertionError("Unexpected error message");
- }
- }
-
- private static void validateOverwrite() throws Exception {
- int retVal = JPackageHelper.execute(null, app);
- if (retVal != 0) {
- throw new AssertionError(
- "Test application exited with error: " + retVal);
- }
-
- File outfile = new File(appWorkingDir + File.separator + appOutput);
- if (!outfile.exists()) {
- throw new AssertionError(appOutput + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- String[] result = output.split("\n");
- validateResult(result);
- }
-
- private static void testOverwrite() throws Exception {
- CMD[CMD.length - 1] = "output";
- CMD_OVERWRITE[CMD_OVERWRITE.length - 1] = "output";
-
- String appFolder = "test";
- if (JPackageHelper.isOSX()) {
- appFolder = "test.app";
- }
-
- File output = new File("output" + File.separator + appFolder);
- if (output.exists()) {
- throw new AssertionError(
- "Output folder already exist");
- }
- output.mkdirs();
-
- String result = JPackageHelper.executeCLI(false, CMD);
- validate(result);
-
- JPackageHelper.executeCLI(true, CMD_OVERWRITE);
- validateOverwrite();
- }
-
- private static void testOverwriteToolProvider() throws Exception {
- CMD[CMD.length - 1] = "outputToolProvider";
- CMD_OVERWRITE[CMD_OVERWRITE.length - 1] = "outputToolProvider";
-
- String appFolder = "test";
- if (JPackageHelper.isOSX()) {
- appFolder = "test.app";
- }
-
- File output = new File("outputToolProvider" + File.separator + appFolder);
- if (output.exists()) {
- throw new AssertionError(
- "Output folder already exist");
- }
- output.mkdirs();
-
- String result = JPackageHelper.executeToolProvider(false, CMD);
- validate(result);
-
- JPackageHelper.executeToolProvider(true, CMD_OVERWRITE);
- validateOverwrite();
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testOverwrite();
- testOverwriteToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeModuleTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeModuleTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,12 +32,12 @@
* @run main/othervm -Xmx512m JPackageCreateImageRuntimeModuleTest
*/
public class JPackageCreateImageRuntimeModuleTest {
+ private static final String OUTPUT = "output";
private static final String [] CMD = {
"create-image",
"--runtime-image", "runtime",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
- "--overwrite",
"--win-console",
"--module", "com.hello/com.hello.Hello",
"--module-path", "input"};
@@ -46,6 +46,7 @@
JPackageHelper.createHelloModule();
JPackageHelper.createRuntime();
JPackageCreateImageRuntimeBase.testCreateImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageRuntimeBase.testCreateImageToolProvider(CMD);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,21 +32,22 @@
* @run main/othervm -Xmx512m JPackageCreateImageRuntimeTest
*/
public class JPackageCreateImageRuntimeTest {
+ private static final String OUTPUT = "output";
private static final String [] CMD = {
"create-image",
"--runtime-image", "runtime",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloImageJar();
JPackageHelper.createRuntime();
JPackageCreateImageRuntimeBase.testCreateImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageRuntimeBase.testCreateImageToolProvider(CMD);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageSecondaryLauncherModuleTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageSecondaryLauncherModuleTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,11 +32,11 @@
* @run main/othervm -Xmx512m JPackageCreateImageSecondaryLauncherModuleTest
*/
public class JPackageCreateImageSecondaryLauncherModuleTest {
+ private static final String OUTPUT = "output";
private static final String [] CMD = {
"create-image",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
- "--overwrite",
"--module", "com.hello/com.hello.Hello",
"--module-path", "input",
"--secondary-launcher", "sl.properties"};
@@ -45,6 +45,7 @@
JPackageHelper.createHelloModule();
JPackageCreateImageSecondaryLauncherBase.createSLProperties();
JPackageCreateImageSecondaryLauncherBase.testCreateImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageSecondaryLauncherBase.testCreateImageToolProvider(CMD);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageSecondaryLauncherTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageSecondaryLauncherTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,21 +32,22 @@
* @run main/othervm -Xmx512m JPackageCreateImageSecondaryLauncherTest
*/
public class JPackageCreateImageSecondaryLauncherTest {
+ private static final String OUTPUT = "output";
private static final String [] CMD = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
"--files", "hello.jar",
- "--overwrite",
"--secondary-launcher", "sl.properties"};
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloImageJar();
JPackageCreateImageSecondaryLauncherBase.createSLProperties();
JPackageCreateImageSecondaryLauncherBase.testCreateImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageSecondaryLauncherBase.testCreateImageToolProvider(CMD);
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageStripNativeCommandsTest.java Wed Feb 27 20:45:51 2019 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.stream.Collectors;
-
- /*
- * @test
- * @summary jpackage create image with --strip-native-commands test
- * @library ../helpers
- * @build JPackageHelper
- * @build JPackagePath
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m JPackageCreateImageStripNativeCommandsTest
- */
-public class JPackageCreateImageStripNativeCommandsTest {
- private static final String runtimeBinPath = JPackagePath.getRuntimeBin();
-
- private static final String [] CMD = {
- "create-image",
- "--input", "input",
- "--output", "output",
- "--name", "test",
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--files", "hello.jar",
- "--overwrite",
- "--strip-native-commands"};
-
- private static void validate() throws Exception {
- if (JPackageHelper.isWindows()) {
- Path binPath = Paths.get(runtimeBinPath).toAbsolutePath();
- List<Path> files = Files.walk(binPath).collect(Collectors.toList());
- files.forEach((f) -> {
- if (f.toString().endsWith(".exe")) {
- throw new AssertionError(
- "Found executable file in runtime bin folder: "
- + f.toString());
- }
- });
- } else {
- File binFolder = new File(runtimeBinPath);
- if (binFolder.exists()) {
- throw new AssertionError("Found bin folder in runtime: "
- + binFolder.toString());
- }
- }
- }
-
- private static void testCreateImage() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- validate();
- }
-
- private static void testCreateImageToolProvider() throws Exception {
- JPackageHelper.executeToolProvider(true, CMD);
- validate();
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testCreateImage();
- testCreateImageToolProvider();
- }
-
-}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -32,19 +32,21 @@
* @run main/othervm -Xmx512m JPackageCreateImageTest
*/
public class JPackageCreateImageTest {
+ private static final String OUTPUT = "output";
+
private static final String [] CMD = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
public static void main(String[] args) throws Exception {
JPackageHelper.createHelloImageJar();
JPackageCreateImageBase.testCreateImage(CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageCreateImageBase.testCreateImageToolProvider(CMD);
}
}
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageVerboseTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageVerboseTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -31,26 +31,24 @@
* @run main/othervm -Xmx512m JPackageCreateImageVerboseTest
*/
public class JPackageCreateImageVerboseTest {
-
+ private static final String OUTPUT = "output";
private static final String[] CMD = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
private static final String[] CMD_VERBOSE = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
"--files", "hello.jar",
- "--overwrite",
"--verbose"};
private static void validate(String result, String resultVerbose)
@@ -70,12 +68,15 @@
private static void testCreateImage() throws Exception {
String result = JPackageHelper.executeCLI(true, CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
String resultVerbose = JPackageHelper.executeCLI(true, CMD_VERBOSE);
validate(result, resultVerbose);
}
private static void testCreateImageToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
String result = JPackageHelper.executeToolProvider(true, CMD);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
String resultVerbose =
JPackageHelper.executeToolProvider(true, CMD_VERBOSE);
validate(result, resultVerbose);
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java Fri Mar 01 08:27:51 2019 -0500
@@ -35,6 +35,7 @@
* @run main/othervm -Xmx512m JPackageCreateImageVersionTest
*/
public class JPackageCreateImageVersionTest {
+ private static final String OUTPUT = "output";
private static final String appCfg = JPackagePath.getAppCfg();
private static final String VERSION = "2.3";
private static final String VERSION_DEFAULT = "1.0";
@@ -42,22 +43,20 @@
private static final String[] CMD = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
private static final String[] CMD_VERSION = {
"create-image",
"--input", "input",
- "--output", "output",
+ "--output", OUTPUT,
"--name", "test",
"--main-jar", "hello.jar",
"--main-class", "Hello",
"--files", "hello.jar",
- "--overwrite",
"--app-version", VERSION};
private static void validate(String version)
@@ -82,13 +81,16 @@
private static void testVersion() throws Exception {
JPackageHelper.executeCLI(true, CMD);
validate(null);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeCLI(true, CMD_VERSION);
validate(VERSION);
}
private static void testVersionToolProvider() throws Exception {
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeToolProvider(true, CMD);
validate(null);
+ JPackageHelper.deleteOutputFolder(OUTPUT);
JPackageHelper.executeToolProvider(true, CMD_VERSION);
validate(VERSION);
}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -73,7 +73,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBundleNameBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBundleNameBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -75,7 +75,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--linux-bundle-name", BUNDLE_NAME};
}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerFileAssociationsBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerFileAssociationsBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -137,7 +137,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--file-associations", "fa.properties"};
}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerInstallDirBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerInstallDirBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -79,7 +79,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--install-dir", "/opt/jpackage"};
}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -74,7 +74,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--license-file", JPackagePath.getLicenseFilePath()};
}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseTypeBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseTypeBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -96,7 +96,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--linux-rpm-license-type", JP_LICENSE_TYPE};
}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerMaintainerBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerMaintainerBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -86,13 +86,12 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--linux-deb-maintainer", EMAIL};
}
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerPackageDepsBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerPackageDepsBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -120,7 +120,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--linux-package-deps", DEP_NAME.toLowerCase()};
CMD_DEP = new String[]{
@@ -131,7 +130,6 @@
"--name", DEP_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -67,7 +67,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerFileAssociationsBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerFileAssociationsBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -131,7 +131,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--file-associations", "fa.properties"};
}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerInstallDirBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerInstallDirBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -67,7 +67,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--install-dir", "/Applications/jpackage"};
}
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerLicenseBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerLicenseBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -68,7 +68,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--license-file", JPackagePath.getLicenseFilePath()};
}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -75,7 +75,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar"};
}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -149,7 +149,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--file-associations", "fa.properties"};
}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerLicenseBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerLicenseBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -75,7 +75,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--license-file", JPackagePath.getLicenseFilePath()};
}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinDirChooserBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinDirChooserBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -75,7 +75,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--win-dir-chooser"};
}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -75,7 +75,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--win-menu"};
}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuGroupBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuGroupBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -75,7 +75,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--win-menu",
"--win-menu-group", TEST_NAME};
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinPerUserInstallBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinPerUserInstallBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -75,7 +75,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--win-per-user-install",
"--win-menu",
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinRegistryNameBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinRegistryNameBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -151,7 +151,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--file-associations", "fa.properties",
"--win-registry-name", WIN_REGISTRY_NAME};
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinShortcutBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinShortcutBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -81,7 +81,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar",
"--win-shortcut"};
}
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinUpgradeUUIDBase.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinUpgradeUUIDBase.java Fri Mar 01 08:27:51 2019 -0500
@@ -102,7 +102,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar" + File.pathSeparator + FILE_1,
"--app-version", "1.0",
"--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"};
@@ -115,7 +114,6 @@
"--name", TEST_NAME,
"--main-jar", "hello.jar",
"--main-class", "Hello",
- "--overwrite",
"--files", "hello.jar" + File.pathSeparator + FILE_2,
"--app-version", "2.0",
"--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"};
--- a/test/jdk/tools/jpackage/helpers/JPackageHelper.java Wed Feb 27 20:45:51 2019 -0500
+++ b/test/jdk/tools/jpackage/helpers/JPackageHelper.java Fri Mar 01 08:27:51 2019 -0500
@@ -22,11 +22,15 @@
*/
import java.io.File;
+import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.List;
@@ -149,6 +153,47 @@
return command;
}
+ private static void deleteRecursive(File path) throws IOException {
+ if (!path.exists()) {
+ return;
+ }
+
+ Path directory = path.toPath();
+ Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult visitFile(Path file,
+ BasicFileAttributes attr) throws IOException {
+ if (OS.startsWith("win")) {
+ Files.setAttribute(file, "dos:readonly", false);
+ }
+ Files.delete(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir,
+ BasicFileAttributes attr) throws IOException {
+ if (OS.startsWith("win")) {
+ Files.setAttribute(dir, "dos:readonly", false);
+ }
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException e)
+ throws IOException {
+ Files.delete(dir);
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ }
+
+ public static void deleteOutputFolder(String output) throws IOException {
+ File outputFolder = new File(output);
+ System.out.println("AMDEBUG output: " + outputFolder.getAbsolutePath());
+ deleteRecursive(outputFolder);
+ }
+
public static String executeCLI(boolean retValZero, String... args) throws Exception {
int retVal;
File outfile = new File("output.log");