--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractImageBundler.java Wed Feb 06 09:14:09 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractImageBundler.java Tue Feb 12 11:54:56 2019 -0500
@@ -144,7 +144,7 @@
if (rootDirectory.exists()) {
if (!(OVERWRITE.fetchFrom(p))) {
- throw new PackagerException("error.root-exists-without-force",
+ throw new PackagerException("error.root-exists-without-overwrite",
rootDirectory.getAbsolutePath());
}
try {
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Wed Feb 06 09:14:09 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Tue Feb 12 11:54:56 2019 -0500
@@ -398,8 +398,8 @@
static final StandardBundlerParam<Boolean> OVERWRITE =
new StandardBundlerParam<>(
- I18N.getString("param.force.name"),
- I18N.getString("param.force.description"),
+ I18N.getString("param.overwrite.name"),
+ I18N.getString("param.overwrite.description"),
Arguments.CLIOptions.OVERWRITE.getId(),
Boolean.class,
params -> false,
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties Wed Feb 06 09:14:09 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources.properties Tue Feb 12 11:54:56 2019 -0500
@@ -46,14 +46,14 @@
\ -c package.ClassName -j MyJar.jar\n\
\ Generate an application installer:\n\
\ jpackage create-installer -i inputdir -o outputdir \\\n\
-\ -n "Installer Name" -c package.ClassName -j MyJar.jar\n\
-\ jpackage create-installer -o outputdir -n "Installer Name" \\\n\
+\ -n <installer-name> -c package.ClassName -j MyJar.jar\n\
+\ jpackage create-installer -o outputdir -n <installer-name>\\\n\
\ --app-image <app image dir>\n\
\ Generate a Java runtime installer:\n\
-\ jpackage create-installer --runtime-installer -name <jre-name>\\\n\
-\ --output outputdir\n\
-\ jpackage create-jre-installer --runtime-installer \\\n\
-\ -n <jre-name> -o outputdir --runtime-image <path>\n\
+\ jpackage create-installer --runtime-installer\\\n\
+\ --name <installer-name> --output outputdir\n\
+\ jpackage create-installer --runtime-installer \\\n\
+\ -n <installer-name> -o outputdir --runtime-image <runtime-path>\n\
\n\
The following options are valid for all platforms:\n\
\ @<filename> \n\
@@ -69,31 +69,30 @@
\ --input -i <input path>\n\
\ Path of the input directory that contains the files to package\n\
\ (absolute path or relative to the current directory)\n\
-\ --files -f <input files>\n\
+\ --files -f <input file>[{0}<input file>...]\n\
\ A {0} separated list of files in the input dir to be packaged\n\
\ If omitted, all files in the input directory will be packaged.\n\
\ --name -n <application name>\n\
\ Name of the application\n\
\ --main-jar -j <main jar file>\n\
-\ The main JAR of the application\n\
+\ The main JAR of the application; containing the main class\n\
\ (specified as a path relative to the input path)\n\
-\ This JAR should contain the main-class.\n\
\ --main-class -c <class name>\n\
\ Qualified name of the application main class to execute\n\
\ --installer-type <type> \n\
-\ Specifies the type of the installer created in create-image mode\n\
+\ The type of the installer created in create-image mode\n\
\ Valid values for "type" are "msi", "exe", "rpm", "deb", "dmg",\n\
\ "pkg", and "pkg-app-store".\n\
\ If this option is not specified (in create-installer mode),\n\
\ all supported types of installable packages for the current\n\
\ platform will be generated.\n\
\ --runtime-installer \n\
-\ Generates a platform-specific installer for Java runtime.\n\
+\ Generates a platform-specific installer for a Java runtime.\n\
\ --app-version <version string>\n\
\ Version of the application\n\
\ --arguments -a <main class arguments>\n\
-\ Command line arguments to pass to the main class if no\n\
-\ arguments are specified by the launcher\n\
+\ Command line arguments to pass to the main class if no command\n\
+\ line arguments are given to the launcher\n\
\ --icon <icon file path>\n\
\ Path of the icon of the application bundle\n\
\ (absolute path or relative to the current directory)\n\
@@ -106,7 +105,7 @@
\ --strip-native-commands\n\
\ Removes native executables from the custom run-time images\n\
\ --jvm-args <java vm arguments>\n\
-\ JVM flags and options to pass to the application\n\
+\ Java arguments to pass to the virtual machine\n\
\ --file-associations <file path>\n\
\ Path to a Properties file that contains list of key, value pairs\n\
\ (absolute path or relative to the current directory)\n\
@@ -115,10 +114,11 @@
\ --secondary-launcher <file path>\n\
\ Path to a Properties file that contains list of key, value pairs\n\
\ (absolute path or relative to the current directory)\n\
-\ The keys "name" (required), "version", "module", "class",\n\
+\ The keys "name" (required), "version", "module", "class",\n\
\ "icon", "arguments", "jvm-args", "win-menu",\n\
-\ "win-shortcut", and "win-console" can be used to describe\n\
-\ the secondary launcher.\n\
+\ "win-shortcut", and "win-console" can be used.\n\
+\ These options are added to, or used to overwrite, the original\n\
+\ command line options when building the secondary launcher.\n\
\ --build-root <file path>\n\
\ Path of a new or empty directory used to create temporary files\n\
\ (absolute path or relative to the current directory)\n\
@@ -164,9 +164,8 @@
\ --module-path -p <module path>\n\
\ Path JLink looks in for modules when packaging the Java Runtime\n\
\ (absolute path or relative to the current directory)\n\
-\ --add-modules <module list>\n\
-\ A comma (",") separated list of modules to add to JImage creation,\n\
-\ including possible services\n\
+\ --add-modules <module name>[,<module name>...]\n\
+\ A comma (",") separated list of modules to add.\n\
MSG_Help_mac=\nThe following options are valid for Mac OS X platforms:\n\
\ --mac-sign\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties Wed Feb 06 09:14:09 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties Tue Feb 12 11:54:56 2019 -0500
@@ -46,14 +46,14 @@
\ -c package.ClassName -j MyJar.jar\n\
\ Generate an application installer:\n\
\ jpackage create-installer -i inputdir -o outputdir \\\n\
-\ -n "Installer Name" -c package.ClassName -j MyJar.jar\n\
-\ jpackage create-installer -o outputdir -n "Installer Name" \\\n\
+\ -n <installer-name> -c package.ClassName -j MyJar.jar\n\
+\ jpackage create-installer -o outputdir -n <installer-name>\\\n\
\ --app-image <app image dir>\n\
\ Generate a Java runtime installer:\n\
-\ jpackage create-installer --runtime-installer -name <jre-name>\\\n\
-\ --output outputdir\n\
-\ jpackage create-jre-installer --runtime-installer \\\n\
-\ -n <jre-name> -o outputdir --runtime-image <path>\n\
+\ jpackage create-installer --runtime-installer\\\n\
+\ --name <installer-name> --output outputdir\n\
+\ jpackage create-installer --runtime-installer \\\n\
+\ -n <installer-name> -o outputdir --runtime-image <runtime-path>\n\
\n\
The following options are valid for all platforms:\n\
\ @<filename> \n\
@@ -69,31 +69,30 @@
\ --input -i <input path>\n\
\ Path of the input directory that contains the files to package\n\
\ (absolute path or relative to the current directory)\n\
-\ --files -f <input files>\n\
+\ --files -f <input file>[{0}<input file>...]\n\
\ A {0} separated list of files in the input dir to be packaged\n\
\ If omitted, all files in the input directory will be packaged.\n\
\ --name -n <application name>\n\
\ Name of the application\n\
\ --main-jar -j <main jar file>\n\
-\ The main JAR of the application\n\
+\ The main JAR of the application; containing the main class\n\
\ (specified as a path relative to the input path)\n\
-\ This JAR should contain the main-class.\n\
\ --main-class -c <class name>\n\
\ Qualified name of the application main class to execute\n\
\ --installer-type <type> \n\
-\ Specifies the type of the installer created in create-image mode\n\
+\ The type of the installer created in create-image mode\n\
\ Valid values for "type" are "msi", "exe", "rpm", "deb", "dmg",\n\
\ "pkg", and "pkg-app-store".\n\
\ If this option is not specified (in create-installer mode),\n\
\ all supported types of installable packages for the current\n\
\ platform will be generated.\n\
\ --runtime-installer \n\
-\ Generates a platform-specific installer for Java runtime.\n\
+\ Generates a platform-specific installer for a Java runtime.\n\
\ --app-version <version string>\n\
\ Version of the application\n\
\ --arguments -a <main class arguments>\n\
-\ Command line arguments to pass to the main class if no\n\
-\ arguments are specified by the launcher\n\
+\ Command line arguments to pass to the main class if no command\n\
+\ line arguments are given to the launcher\n\
\ --icon <icon file path>\n\
\ Path of the icon of the application bundle\n\
\ (absolute path or relative to the current directory)\n\
@@ -106,7 +105,7 @@
\ --strip-native-commands\n\
\ Removes native executables from the custom run-time images\n\
\ --jvm-args <java vm arguments>\n\
-\ JVM flags and options to pass to the application\n\
+\ Java arguments to pass to the virtual machine\n\
\ --file-associations <file path>\n\
\ Path to a Properties file that contains list of key, value pairs\n\
\ (absolute path or relative to the current directory)\n\
@@ -115,10 +114,11 @@
\ --secondary-launcher <file path>\n\
\ Path to a Properties file that contains list of key, value pairs\n\
\ (absolute path or relative to the current directory)\n\
-\ The keys "name" (required), "version", "module", "class",\n\
+\ The keys "name" (required), "version", "module", "class",\n\
\ "icon", "arguments", "jvm-args", "win-menu",\n\
-\ "win-shortcut", and "win-console" can be used to describe\n\
-\ the secondary launcher.\n\
+\ "win-shortcut", and "win-console" can be used.\n\
+\ These options are added to, or used to overwrite, the original\n\
+\ command line options when building the secondary launcher.\n\
\ --build-root <file path>\n\
\ Path of a new or empty directory used to create temporary files\n\
\ (absolute path or relative to the current directory)\n\
@@ -164,9 +164,8 @@
\ --module-path -p <module path>\n\
\ Path JLink looks in for modules when packaging the Java Runtime\n\
\ (absolute path or relative to the current directory)\n\
-\ --add-modules <module list>\n\
-\ A comma (",") separated list of modules to add to JImage creation,\n\
-\ including possible services\n\
+\ --add-modules <module name>[,<module name>...]\n\
+\ A comma (",") separated list of modules to add.\n\
MSG_Help_mac=\nThe following options are valid for Mac OS X platforms:\n\
\ --mac-sign\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties Wed Feb 06 09:14:09 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties Tue Feb 12 11:54:56 2019 -0500
@@ -46,14 +46,14 @@
\ -c package.ClassName -j MyJar.jar\n\
\ Generate an application installer:\n\
\ jpackage create-installer -i inputdir -o outputdir \\\n\
-\ -n "Installer Name" -c package.ClassName -j MyJar.jar\n\
-\ jpackage create-installer -o outputdir -n "Installer Name" \\\n\
+\ -n <installer-name> -c package.ClassName -j MyJar.jar\n\
+\ jpackage create-installer -o outputdir -n <installer-name>\\\n\
\ --app-image <app image dir>\n\
\ Generate a Java runtime installer:\n\
-\ jpackage create-installer --runtime-installer -name <jre-name>\\\n\
-\ --output outputdir\n\
-\ jpackage create-jre-installer --runtime-installer \\\n\
-\ -n <jre-name> -o outputdir --runtime-image <path>\n\
+\ jpackage create-installer --runtime-installer\\\n\
+\ --name <installer-name> --output outputdir\n\
+\ jpackage create-installer --runtime-installer \\\n\
+\ -n <installer-name> -o outputdir --runtime-image <runtime-path>\n\
\n\
The following options are valid for all platforms:\n\
\ @<filename> \n\
@@ -69,31 +69,30 @@
\ --input -i <input path>\n\
\ Path of the input directory that contains the files to package\n\
\ (absolute path or relative to the current directory)\n\
-\ --files -f <input files>\n\
+\ --files -f <input file>[{0}<input file>...]\n\
\ A {0} separated list of files in the input dir to be packaged\n\
\ If omitted, all files in the input directory will be packaged.\n\
\ --name -n <application name>\n\
\ Name of the application\n\
\ --main-jar -j <main jar file>\n\
-\ The main JAR of the application\n\
+\ The main JAR of the application; containing the main class\n\
\ (specified as a path relative to the input path)\n\
-\ This JAR should contain the main-class.\n\
\ --main-class -c <class name>\n\
\ Qualified name of the application main class to execute\n\
\ --installer-type <type> \n\
-\ Specifies the type of the installer created in create-image mode\n\
+\ The type of the installer created in create-image mode\n\
\ Valid values for "type" are "msi", "exe", "rpm", "deb", "dmg",\n\
\ "pkg", and "pkg-app-store".\n\
\ If this option is not specified (in create-installer mode),\n\
\ all supported types of installable packages for the current\n\
\ platform will be generated.\n\
\ --runtime-installer \n\
-\ Generates a platform-specific installer for Java runtime.\n\
+\ Generates a platform-specific installer for a Java runtime.\n\
\ --app-version <version string>\n\
\ Version of the application\n\
\ --arguments -a <main class arguments>\n\
-\ Command line arguments to pass to the main class if no\n\
-\ arguments are specified by the launcher\n\
+\ Command line arguments to pass to the main class if no command\n\
+\ line arguments are given to the launcher\n\
\ --icon <icon file path>\n\
\ Path of the icon of the application bundle\n\
\ (absolute path or relative to the current directory)\n\
@@ -106,7 +105,7 @@
\ --strip-native-commands\n\
\ Removes native executables from the custom run-time images\n\
\ --jvm-args <java vm arguments>\n\
-\ JVM flags and options to pass to the application\n\
+\ Java arguments to pass to the virtual machine\n\
\ --file-associations <file path>\n\
\ Path to a Properties file that contains list of key, value pairs\n\
\ (absolute path or relative to the current directory)\n\
@@ -115,10 +114,11 @@
\ --secondary-launcher <file path>\n\
\ Path to a Properties file that contains list of key, value pairs\n\
\ (absolute path or relative to the current directory)\n\
-\ The keys "name" (required), "version", "module", "class",\n\
+\ The keys "name" (required), "version", "module", "class",\n\
\ "icon", "arguments", "jvm-args", "win-menu",\n\
-\ "win-shortcut", and "win-console" can be used to describe\n\
-\ the secondary launcher.\n\
+\ "win-shortcut", and "win-console" can be used.\n\
+\ These options are added to, or used to overwrite, the original\n\
+\ command line options when building the secondary launcher.\n\
\ --build-root <file path>\n\
\ Path of a new or empty directory used to create temporary files\n\
\ (absolute path or relative to the current directory)\n\
@@ -164,9 +164,8 @@
\ --module-path -p <module path>\n\
\ Path JLink looks in for modules when packaging the Java Runtime\n\
\ (absolute path or relative to the current directory)\n\
-\ --add-modules <module list>\n\
-\ A comma (",") separated list of modules to add to JImage creation,\n\
-\ including possible services\n\
+\ --add-modules <module name>[,<module name>...]\n\
+\ A comma (",") separated list of modules to add.\n\
MSG_Help_mac=\nThe following options are valid for Mac OS X platforms:\n\
\ --mac-sign\n\
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Wed Feb 06 09:14:09 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Tue Feb 12 11:54:56 2019 -0500
@@ -91,8 +91,8 @@
param.version.default=1.0
param.verbose.name=Verbose
param.verbose.description=Flag to print out more information and saves configuration files for bundlers.
-param.force.name=Overwrite
-param.force.description=Flag to allow removal of existing application output directory
+param.overwrite.name=Overwrite
+param.overwrite.description=Flag to allow removal of existing application output directory
param.resource-dir.name=Resource Dir
param.resource-dir.description=The directory to look for bundler specific resources.
param.secondary-launchers.name=Secondary Launchers
@@ -137,7 +137,7 @@
error.cannot-create-output-dir=Output directory {0} cannot be created.
error.cannot-write-to-output-dir=Output directory {0} is not writable.
-error.root-exists-without-force=Error: Application output directory {0} already exists and --overwrite is not specified"
+error.root-exists-without-overwrite=Error: Application output directory {0} already exists and --overwrite is not specified
error.no-application-class=Main application class is missing.
error.no-application-class.advice=Please specify main application class.
error.no-main-module=Main application module is missing.
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Wed Feb 06 09:14:09 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Tue Feb 12 11:54:56 2019 -0500
@@ -91,8 +91,8 @@
param.version.default=1.0
param.verbose.name=Verbose
param.verbose.description=Flag to print out more information and saves configuration files for bundlers.
-param.force.name=Overwrite
-param.force.description=Flag to allow removal of existing application output directory
+param.overwrite.name=Overwrite
+param.overwrite.description=Flag to allow removal of existing application output directory
param.resource-dir.name=Resource Dir
param.resource-dir.description=The directory to look for bundler specific resources.
param.secondary-launchers.name=Secondary Launchers
@@ -137,7 +137,7 @@
error.cannot-create-output-dir=Output directory {0} cannot be created.
error.cannot-write-to-output-dir=Output directory {0} is not writable.
-error.root-exists-without-force=Error: Application output directory {0} already exists and --overwrite is not specified"
+error.root-exists-without-overwrite=Error: Application output directory {0} already exists and --overwrite is not specified
error.no-application-class=Main application class is missing.
error.no-application-class.advice=Please specify main application class.
error.no-main-module=Main application module is missing.
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Wed Feb 06 09:14:09 2019 -0500
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Tue Feb 12 11:54:56 2019 -0500
@@ -91,8 +91,8 @@
param.version.default=1.0
param.verbose.name=Verbose
param.verbose.description=Flag to print out more information and saves configuration files for bundlers.
-param.force.name=Overwrite
-param.force.description=Flag to allow removal of existing application output directory
+param.overwrite.name=Overwrite
+param.overwrite.description=Flag to allow removal of existing application output directory
param.resource-dir.name=Resource Dir
param.resource-dir.description=The directory to look for bundler specific resources.
param.secondary-launchers.name=Secondary Launchers
@@ -137,7 +137,7 @@
error.cannot-create-output-dir=Output directory {0} cannot be created.
error.cannot-write-to-output-dir=Output directory {0} is not writable.
-error.root-exists-without-force=Error: Application output directory {0} already exists and --overwrite is not specified"
+error.root-exists-without-overwrite=Error: Application output directory {0} already exists and --overwrite is not specified
error.no-application-class=Main application class is missing.
error.no-application-class.advice=Please specify main application class.
error.no-main-module=Main application module is missing.
--- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageForceTest.java Wed Feb 06 09:14:09 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 JPackageCreateImageForceTest
- */
-public class JPackageCreateImageForceTest {
- 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_FORCE = {
- "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 validateForce() 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 testForce() throws Exception {
- CMD[CMD.length - 1] = "output";
- CMD_FORCE[CMD_FORCE.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_FORCE);
- validateForce();
- }
-
- private static void testForceToolProvider() throws Exception {
- CMD[CMD.length - 1] = "outputToolProvider";
- CMD_FORCE[CMD_FORCE.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_FORCE);
- validateForce();
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testForce();
- testForceToolProvider();
- }
-
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/createimage/JPackageCreateImageOverwriteTest.java Tue Feb 12 11:54:56 2019 -0500
@@ -0,0 +1,153 @@
+/*
+ * 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/createinstaller/linux/base/JPackageCreateInstallerBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -67,8 +67,7 @@
}
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBundleNameBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBundleNameBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -69,8 +69,7 @@
}
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerFileAssociationsBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerFileAssociationsBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -131,8 +131,7 @@
}
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerInstallDirBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerInstallDirBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -73,8 +73,7 @@
}
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -68,8 +68,7 @@
}
CMD = new String [] {
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseTypeBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseTypeBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -90,8 +90,7 @@
}
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerPackageDepsBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerPackageDepsBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -114,8 +114,7 @@
}
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
@@ -126,8 +125,7 @@
"--linux-package-deps", DEP_NAME.toLowerCase()};
CMD_DEP = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", DEP_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -61,8 +61,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerFileAssociationsBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerFileAssociationsBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -125,8 +125,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerInstallDirBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerInstallDirBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -61,8 +61,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerLicenseBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerLicenseBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -62,8 +62,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String [] {
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -69,8 +69,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -143,8 +143,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerLicenseBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerLicenseBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -69,8 +69,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String [] {
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinDirChooserBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinDirChooserBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -69,8 +69,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -69,8 +69,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuGroupBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuGroupBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -69,8 +69,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinPerUserInstallBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinPerUserInstallBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -69,8 +69,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinRegistryNameBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinRegistryNameBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -145,8 +145,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,
--- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinShortcutBase.java Wed Feb 06 09:14:09 2019 -0500
+++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinShortcutBase.java Tue Feb 12 11:54:56 2019 -0500
@@ -75,8 +75,7 @@
OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
CMD = new String[]{
"create-installer",
- "--installer-type",
- EXT,
+ "--installer-type", EXT,
"--input", "input",
"--output", "output",
"--name", TEST_NAME,