# HG changeset patch # User herrick # Date 1554477884 14400 # Node ID 4948a1944cf9558d70ed905e85f7d64ed02bdc77 # Parent b3b59183df78f3b0a588e7842c8663be789ae832 8221777: CLI changes from jpackage EA5 feedback Reviewed-by: kbr, almatvee diff -r b3b59183df78 -r 4948a1944cf9 src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractImageBundler.java --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractImageBundler.java Fri Apr 05 10:55:51 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AbstractImageBundler.java Fri Apr 05 11:24:44 2019 -0400 @@ -42,7 +42,7 @@ * * It contains methods and parameters common to all Image Bundlers. * - * Application Image Bundlers are created in "create-image" mode, + * Application Image Bundlers are created in "create-app-image" mode, * or as an intermeadiate step in "create-installer" mode. * * The concrete implementations are in the platform specific Bundlers. diff -r b3b59183df78 -r 4948a1944cf9 src/jdk.jpackage/share/classes/jdk/jpackage/internal/AddLauncherArguments.java --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AddLauncherArguments.java Fri Apr 05 10:55:51 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AddLauncherArguments.java Fri Apr 05 11:24:44 2019 -0400 @@ -40,7 +40,7 @@ * BundlerParams p = (new AddLauncherArguments(file)).getLauncherMap(); * * A add-launcher is another executable program generated by either the - * create-image mode or the create-installer mode. + * create-app-image mode or the create-installer mode. * The add-launcher may be the same program with different configuration, * or a completely different program created from the same files. * diff -r b3b59183df78 -r 4948a1944cf9 src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Fri Apr 05 10:55:51 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Fri Apr 05 11:24:44 2019 -0400 @@ -64,17 +64,17 @@ private static final ResourceBundle I18N = ResourceBundle.getBundle( "jdk.jpackage.internal.resources.MainResources"); - private static final String IMAGE_MODE = "image"; - private static final String INSTALLER_MODE = "installer"; + private static final String APPIMAGE_MODE = "create-app-image"; + private static final String INSTALLER_MODE = "create-installer"; private static final String FA_EXTENSIONS = "extension"; private static final String FA_CONTENT_TYPE = "mime-type"; private static final String FA_DESCRIPTION = "description"; private static final String FA_ICON = "icon"; - public static final BundlerParamInfo CREATE_IMAGE = + public static final BundlerParamInfo CREATE_APP_IMAGE = new StandardBundlerParam<>( - IMAGE_MODE, + APPIMAGE_MODE, Boolean.class, p -> Boolean.FALSE, (s, p) -> (s == null || "null".equalsIgnoreCase(s)) ? @@ -100,8 +100,6 @@ private List allOptions = null; - private ArrayList files = null; - private String input = null; private String output = null; @@ -152,10 +150,10 @@ // CLIOptions is public for DeployParamsTest public enum CLIOptions { - CREATE_IMAGE(IMAGE_MODE, OptionCategories.MODE, () -> { + CREATE_APP_IMAGE(APPIMAGE_MODE, OptionCategories.MODE, () -> { context().bundleType = BundlerType.IMAGE; context().deployParams.setTargetFormat("image"); - setOptionValue(IMAGE_MODE, true); + setOptionValue(APPIMAGE_MODE, true); }), CREATE_INSTALLER(INSTALLER_MODE, OptionCategories.MODE, () -> { @@ -208,13 +206,6 @@ setOptionValue("resource-dir", resourceDir); }), - FILES ("files", "f", OptionCategories.PROPERTY, () -> { - context().files = new ArrayList<>(); - String files = popArg(); - context().files.addAll( - Arrays.asList(files.split(File.pathSeparator))); - }), - ARGUMENTS ("arguments", OptionCategories.PROPERTY, () -> { List arguments = getArgumentList(popArg()); setOptionValue("arguments", arguments); @@ -419,7 +410,7 @@ } String getIdWithPrefix() { - String prefix = isMode() ? "create-" : "--"; + String prefix = isMode() ? "" : "--"; return prefix + this.id; } @@ -523,7 +514,7 @@ validateArguments(); - addResources(deployParams, input, files); + addResources(deployParams, input); deployParams.setBundleType(bundleType); @@ -588,7 +579,7 @@ private void validateArguments() throws PackagerException { CLIOptions mode = allOptions.get(0); - boolean imageOnly = (mode == CLIOptions.CREATE_IMAGE); + boolean imageOnly = (mode == CLIOptions.CREATE_APP_IMAGE); boolean hasAppImage = allOptions.contains( CLIOptions.PREDEFINED_APP_IMAGE); boolean hasRuntime = allOptions.contains( @@ -728,7 +719,7 @@ } private void addResources(DeployParams deployParams, - String inputdir, List inputfiles) { + String inputdir) { if (inputdir == null || inputdir.isEmpty()) { return; @@ -743,18 +734,12 @@ } List fileNames; - if (inputfiles != null) { - fileNames = inputfiles; - } else { - // "-files" is omitted, all files in input cdir (which - // is a mandatory argument in this case) will be packaged. - fileNames = new ArrayList<>(); - try (Stream files = Files.list(baseDir.toPath())) { - files.forEach(file -> fileNames.add( - file.getFileName().toString())); - } catch (IOException e) { - Log.error("Unable to add resources: " + e.getMessage()); - } + fileNames = new ArrayList<>(); + try (Stream files = Files.list(baseDir.toPath())) { + files.forEach(file -> fileNames.add( + file.getFileName().toString())); + } catch (IOException e) { + Log.error("Unable to add resources: " + e.getMessage()); } fileNames.forEach(file -> deployParams.addResource(baseDir, file)); diff -r b3b59183df78 -r 4948a1944cf9 src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java Fri Apr 05 10:55:51 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ValidOptions.java Fri Apr 05 11:24:44 2019 -0400 @@ -58,7 +58,7 @@ // initializing list of mandatory arguments static { - options.put(CLIOptions.CREATE_IMAGE.getId(), USE.ALL); + options.put(CLIOptions.CREATE_APP_IMAGE.getId(), USE.ALL); options.put(CLIOptions.CREATE_INSTALLER.getId(), USE.ALL); options.put(CLIOptions.NAME.getId(), USE.ALL); options.put(CLIOptions.VERSION.getId(), USE.ALL); @@ -73,7 +73,6 @@ options.put(CLIOptions.COPYRIGHT.getId(), USE.ALL); options.put(CLIOptions.INPUT.getId(), USE.LAUNCHER); - options.put(CLIOptions.FILES.getId(), USE.LAUNCHER); options.put(CLIOptions.MODULE.getId(), USE.LAUNCHER); options.put(CLIOptions.MODULE_PATH.getId(), USE.LAUNCHER); options.put(CLIOptions.ADD_MODULES.getId(), USE.LAUNCHER); diff -r b3b59183df78 -r 4948a1944cf9 src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Fri Apr 05 10:55:51 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Fri Apr 05 11:24:44 2019 -0400 @@ -74,7 +74,7 @@ ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform. -ERR_NotImageOption=Error: Option [{0}] is not valid in create-image mode. +ERR_NotImageOption=Error: Option [{0}] is not valid in create-app-image mode. ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option. @@ -94,4 +94,4 @@ ERR_VersionComparison=Error: Failed to compare version {0} with {1}. ERR_InvalidInstallerType=Error: Invalid or Unsupported Installer type: [{0}]. ERR_BothMainJarAndModule="Error: Cannot have both --main-jar and --module Options" -ERR_NoEntryPoint="Error: create-image requires --main-jar or --module Option" +ERR_NoEntryPoint="Error: create-app-image requires --main-jar or --module Option" diff -r b3b59183df78 -r 4948a1944cf9 src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Fri Apr 05 10:55:51 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Fri Apr 05 11:24:44 2019 -0400 @@ -74,7 +74,7 @@ ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform. -ERR_NotImageOption=Error: Option [{0}] is not valid in create-image mode. +ERR_NotImageOption=Error: Option [{0}] is not valid in create-app-image mode. ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option. @@ -94,4 +94,4 @@ ERR_VersionComparison=Error: Failed to compare version {0} with {1}. ERR_InvalidInstallerType=Error: Invalid or Unsupported Installer type: [{0}]. ERR_BothMainJarAndModule="Error: Cannot have both --main-jar and --module Options" -ERR_NoEntryPoint="Error: create-image requires --main-jar or --module Option" +ERR_NoEntryPoint="Error: create-app-image requires --main-jar or --module Option" diff -r b3b59183df78 -r 4948a1944cf9 src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Fri Apr 05 10:55:51 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Fri Apr 05 11:24:44 2019 -0400 @@ -74,7 +74,7 @@ ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform. -ERR_NotImageOption=Error: Option [{0}] is not valid in create-image mode. +ERR_NotImageOption=Error: Option [{0}] is not valid in create-app-image mode. ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option. @@ -94,4 +94,4 @@ ERR_VersionComparison=Error: Failed to compare version {0} with {1}. ERR_InvalidInstallerType=Error: Invalid or Unsupported Installer type: [{0}]. ERR_BothMainJarAndModule="Error: Cannot have both --main-jar and --module Options" -ERR_NoEntryPoint="Error: create-image requires --main-jar or --module Option" +ERR_NoEntryPoint="Error: create-app-image requires --main-jar or --module Option" diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java --- a/test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -34,21 +34,21 @@ public class JPackageMissingArgumentsTest { private static final String [] RESULT_1 = {"--output"}; private static final String [] CMD_1 = { - "create-image", + "create-app-image", "--input", "input", "--name", "test", "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar"}; + }; private static final String [] RESULT_2 = {"--input"}; private static final String [] CMD_2 = { - "create-image", + "create-app-image", "--output", "output", "--name", "test", "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar"}; + }; private static final String [] RESULT_3 = {"--input", "--app-image"}; private static final String [] CMD_3 = { @@ -57,33 +57,33 @@ "--name", "test", "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar"}; + }; private static final String [] RESULT_4 = {"--main-class"}; private static final String [] CMD_4 = { - "create-image", + "create-app-image", "--input", "input", "--output", "output", "--name", "test", "--main-jar", "hello.jar", - "--files", "hello.jar"}; + }; private static final String [] RESULT_5 = {"--main-jar"}; private static final String [] CMD_5 = { - "create-image", + "create-app-image", "--input", "input", "--output", "output", "--name", "test", "--main-class", "Hello", - "--files", "hello.jar"}; + }; private static final String [] RESULT_6 = {"--module-path", "--runtime-image"}; private static final String [] CMD_6 = { - "create-image", + "create-app-image", "--output", "output", "--name", "test", "--module", "com.hello/com.hello.Hello", - "--files", "hello.jar"}; + }; private static final String [] RESULT_7 = {"--module-path", "--runtime-image", "--app-image"}; @@ -92,7 +92,7 @@ "--output", "output", "--name", "test", "--module", "com.hello/com.hello.Hello", - "--files", "hello.jar"}; + }; private static void validate(String output, String [] expected) throws Exception { diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherBase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; + +public class JPackageCreateAppImageAddLauncherBase { + private static final String app = JPackagePath.getApp(); + private static final String app2 = JPackagePath.getAppSL(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + + // Note: quotes in argument for add launcher is not support by test + private static final String ARGUMENT1 = "argument 1"; + private static final String ARGUMENT2 = "argument 2"; + private static final String ARGUMENT3 = "argument 3"; + + private static final List arguments = new ArrayList<>(); + + private static final String PARAM1 = "-Dparam1=Some Param 1"; + private static final String PARAM2 = "-Dparam2=Some Param 2"; + private static final String PARAM3 = "-Dparam3=Some Param 3"; + + private static final List vmArguments = new ArrayList<>(); + + private static void validateResult(List args, List vmArgs) + throws Exception { + 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"); + + if (result.length != (args.size() + vmArgs.size() + 2)) { + throw new AssertionError("Unexpected number of lines: " + + result.length); + } + + if (!result[0].trim().equals("jpackage test application")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().equals("args.length: " + args.size())) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + + int index = 2; + for (String arg : args) { + if (!result[index].trim().equals(arg)) { + throw new AssertionError("Unexpected result[" + index + "]: " + + result[index]); + } + index++; + } + + for (String vmArg : vmArgs) { + if (!result[index].trim().equals(vmArg)) { + throw new AssertionError("Unexpected result[" + index + "]: " + + result[index]); + } + index++; + } + } + + private static void validate() throws Exception { + int retVal = JPackageHelper.execute(null, app); + if (retVal != 0) { + throw new AssertionError("Test application exited with error: " + + retVal); + } + validateResult(new ArrayList<>(), new ArrayList<>()); + + retVal = JPackageHelper.execute(null, app2); + if (retVal != 0) { + throw new AssertionError("Test application exited with error: " + + retVal); + } + validateResult(arguments, vmArguments); + } + + public static void testCreateAppImage(String [] cmd) throws Exception { + JPackageHelper.executeCLI(true, cmd); + validate(); + } + + public static void testCreateAppImageToolProvider(String [] cmd) throws Exception { + JPackageHelper.executeToolProvider(true, cmd); + validate(); + } + + public static void createSLProperties() throws Exception { + arguments.add(ARGUMENT1); + arguments.add(ARGUMENT2); + arguments.add(ARGUMENT3); + + String argumentsMap = + JPackageHelper.listToArgumentsMap(arguments, true); + + vmArguments.add(PARAM1); + vmArguments.add(PARAM2); + vmArguments.add(PARAM3); + + String vmArgumentsMap = + JPackageHelper.listToArgumentsMap(vmArguments, true); + + try (PrintWriter out = new PrintWriter(new BufferedWriter( + new FileWriter("sl.properties")))) { + out.println("name=test2"); + out.println("arguments=" + argumentsMap); + out.println("java-options=" + vmArgumentsMap); + } + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherModuleTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherModuleTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @summary jpackage create image with additional launcher test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageAddLauncherBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageAddLauncherModuleTest + */ +public class JPackageCreateAppImageAddLauncherModuleTest { + private static final String OUTPUT = "output"; + private static final String [] CMD = { + "create-app-image", + "--output", OUTPUT, + "--name", "test", + "--module", "com.hello/com.hello.Hello", + "--module-path", "input", + "--add-launcher", "sl.properties"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloModule(); + JPackageCreateAppImageAddLauncherBase.createSLProperties(); + JPackageCreateAppImageAddLauncherBase.testCreateAppImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageAddLauncherBase.testCreateAppImageToolProvider(CMD); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageAddLauncherTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @summary jpackage create image with additional launcher test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageAddLauncherBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageAddLauncherTest + */ +public class JPackageCreateAppImageAddLauncherTest { + private static final String OUTPUT = "output"; + private static final String [] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--add-launcher", "sl.properties"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + JPackageCreateAppImageAddLauncherBase.createSLProperties(); + JPackageCreateAppImageAddLauncherBase.testCreateAppImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageAddLauncherBase.testCreateAppImageToolProvider(CMD); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageArgumentsBase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageArgumentsBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; + +public class JPackageCreateAppImageArgumentsBase { + + private static final String app = JPackagePath.getApp(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + + private static final String ARGUMENT1 = "argument"; + private static final String ARGUMENT2 = "Some Arguments"; + private static final String ARGUMENT3 = "Value \"with\" quotes"; + + private static final String ARGUMENT_CMD1 = "test"; + + private static final List arguments = new ArrayList<>(); + private static final List argumentsCmd = new ArrayList<>(); + + public static void initArguments(boolean toolProvider, String[] cmd) { + if (arguments.isEmpty()) { + arguments.add(ARGUMENT1); + arguments.add(ARGUMENT2); + arguments.add(ARGUMENT3); + } + + if (argumentsCmd.isEmpty()) { + argumentsCmd.add(ARGUMENT_CMD1); + } + + String argumentsMap + = JPackageHelper.listToArgumentsMap(arguments, toolProvider); + cmd[cmd.length - 1] = argumentsMap; + } + + private static void validateResult(String[] result, List args) + throws Exception { + if (result.length != (args.size() + 2)) { + throw new AssertionError( + "Unexpected number of lines: " + result.length); + } + + if (!result[0].trim().equals("jpackage test application")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().equals("args.length: " + args.size())) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + + int index = 2; + for (String arg : args) { + if (!result[index].trim().equals(arg)) { + throw new AssertionError( + "Unexpected result[" + index + "]: " + result[index]); + } + index++; + } + } + + private static void validate(String arg, List expectedArgs) + throws Exception { + int retVal; + + if (arg == null) { + retVal = JPackageHelper.execute(null, app); + } else { + retVal = JPackageHelper.execute(null, app, arg); + } + if (retVal != 0) { + throw new AssertionError("Test application exited with error: " + + retVal); + } + + File outfile = new File(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, expectedArgs); + } + + public static void testCreateAppImage(String[] cmd) throws Exception { + initArguments(false, cmd); + JPackageHelper.executeCLI(true, cmd); + validate(null, arguments); + validate(ARGUMENT_CMD1, argumentsCmd); + } + + public static void testCreateAppImageToolProvider(String[] cmd) throws Exception { + initArguments(true, cmd); + JPackageHelper.executeToolProvider(true, cmd); + validate(null, arguments); + validate(ARGUMENT_CMD1, argumentsCmd); + } +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageArgumentsModuleTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageArgumentsModuleTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary jpackage create image with --arguments test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageArgumentsBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageArgumentsModuleTest + */ +public class JPackageCreateAppImageArgumentsModuleTest { + private static final String OUTPUT = "output"; + + private static final String[] CMD = { + "create-app-image", + "--output", OUTPUT, + "--name", "test", + "--module", "com.hello/com.hello.Hello", + "--module-path", "input", + "--arguments", "TBD"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloModule(); + JPackageCreateAppImageArgumentsBase.testCreateAppImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageArgumentsBase.testCreateAppImageToolProvider(CMD); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageArgumentsTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageArgumentsTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary jpackage create image with --arguments test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageArgumentsBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageArgumentsTest + */ +public class JPackageCreateAppImageArgumentsTest { + private static final String OUTPUT = "output"; + + private static final String[] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--arguments", "TBD"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + JPackageCreateAppImageArgumentsBase.testCreateAppImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageArgumentsBase.testCreateAppImageToolProvider(CMD); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageBase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.nio.file.Files; + +public abstract class JPackageCreateAppImageBase { + private static final String app = JPackagePath.getApp(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + + private static void validateResult(String[] result) throws Exception { + if (result.length != 2) { + throw new AssertionError( + "Unexpected number of lines: " + result.length); + } + + if (!result[0].trim().equals("jpackage test application")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().equals("args.length: 0")) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + } + + private static void validate() throws Exception { + int retVal = JPackageHelper.execute(null, app); + if (retVal != 0) { + throw new AssertionError( + "Test application exited with error: " + retVal); + } + + File outfile = new File(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); + } + + public static void testCreateAppImage(String [] cmd) throws Exception { + JPackageHelper.executeCLI(true, cmd); + validate(); + } + + public static void testCreateAppImageToolProvider(String [] cmd) throws Exception { + JPackageHelper.executeToolProvider(true, cmd); + validate(); + } +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageIconTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageIconTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.nio.file.Files; + +/* + * @test + * @summary jpackage create image to verify --icon + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageIconTest + */ +public class JPackageCreateAppImageIconTest { + private static final String OUTPUT = "output"; + private static final String app = JPackagePath.getApp(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + + private static final String[] CMD = { + "create-app-image", + "--input", "input", + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--icon", getIconPath(), + "--output", OUTPUT}; + + private static void validateResult(String[] result) throws Exception { + if (result.length != 2) { + throw new AssertionError( + "Unexpected number of lines: " + result.length); + } + + if (!result[0].trim().equals("jpackage test application")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().equals("args.length: 0")) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + } + + private static void validate() throws Exception { + int retVal = JPackageHelper.execute(null, app); + if (retVal != 0) { + throw new AssertionError( + "Test application exited with error: " + retVal); + } + + File outfile = new File(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 validateIcon() throws Exception { + File origIcon = new File(getIconPath()); + File icon = new File(JPackagePath.getAppIcon()); + if (origIcon.length() != icon.length()) { + System.err.println("origIcon.length(): " + origIcon.length()); + System.err.println("icon.length(): " + icon.length()); + throw new AssertionError("Icons size does not match"); + } + } + + private static void testIcon() throws Exception { + JPackageHelper.executeCLI(true, CMD); + validate(); + validateIcon(); + } + + private static void testIconToolProvider() throws Exception { + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeToolProvider(true, CMD); + validate(); + validateIcon(); + } + + private static String getIconPath() { + String ext = ".ico"; + if (JPackageHelper.isOSX()) { + ext = ".icns"; + } else if (JPackageHelper.isLinux()) { + ext = ".png"; + } + + String path = JPackagePath.getTestSrcRoot() + File.separator + "resources" + + File.separator + "icon" + ext; + + return path; + } + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + testIcon(); + testIconToolProvider(); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsBase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; + +public class JPackageCreateAppImageJavaOptionsBase { + + private static final String app = JPackagePath.getApp(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + + private static final String ARGUMENT1 = "-Dparam1=Some Param 1"; + private static final String ARGUMENT2 = "-Dparam2=Some \"Param\" 2"; + private static final String ARGUMENT3 = + "-Dparam3=Some \"Param\" with \" 3"; + + private static final List arguments = new ArrayList<>(); + + private static void initArguments(boolean toolProvider, String [] cmd) { + if (arguments.isEmpty()) { + arguments.add(ARGUMENT1); + arguments.add(ARGUMENT2); + arguments.add(ARGUMENT3); + } + + String argumentsMap = JPackageHelper.listToArgumentsMap(arguments, + toolProvider); + cmd[cmd.length - 1] = argumentsMap; + } + + private static void initArguments2(boolean toolProvider, String [] cmd) { + int index = cmd.length - 6; + + cmd[index++] = "--java-options"; + arguments.clear(); + arguments.add(ARGUMENT1); + cmd[index++] = JPackageHelper.listToArgumentsMap(arguments, + toolProvider); + + cmd[index++] = "--java-options"; + arguments.clear(); + arguments.add(ARGUMENT2); + cmd[index++] = JPackageHelper.listToArgumentsMap(arguments, + toolProvider); + + cmd[index++] = "--java-options"; + arguments.clear(); + arguments.add(ARGUMENT3); + cmd[index++] = JPackageHelper.listToArgumentsMap(arguments, + toolProvider); + + arguments.clear(); + arguments.add(ARGUMENT1); + arguments.add(ARGUMENT2); + arguments.add(ARGUMENT3); + } + + private static void validateResult(String[] result, List args) + throws Exception { + if (result.length != (args.size() + 2)) { + for (String r : result) { + System.err.println(r.trim()); + } + throw new AssertionError("Unexpected number of lines: " + + result.length); + } + + if (!result[0].trim().equals("jpackage test application")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().equals("args.length: 0")) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + + int index = 2; + for (String arg : args) { + if (!result[index].trim().equals(arg)) { + throw new AssertionError("Unexpected result[" + index + "]: " + + result[index]); + } + index++; + } + } + + private static void validate(List expectedArgs) throws Exception { + int retVal = JPackageHelper.execute(null, app); + if (retVal != 0) { + throw new AssertionError("Test application exited with error: " + + retVal); + } + + File outfile = new File(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, expectedArgs); + } + + public static void testCreateAppImageJavaOptions(String [] cmd) throws Exception { + initArguments(false, cmd); + JPackageHelper.executeCLI(true, cmd); + validate(arguments); + } + + public static void testCreateAppImageJavaOptionsToolProvider(String [] cmd) throws Exception { + initArguments(true, cmd); + JPackageHelper.executeToolProvider(true, cmd); + validate(arguments); + } + + public static void testCreateAppImageJavaOptions2(String [] cmd) throws Exception { + initArguments2(false, cmd); + JPackageHelper.executeCLI(true, cmd); + validate(arguments); + } + + public static void testCreateAppImageJavaOptions2ToolProvider(String [] cmd) throws Exception { + initArguments2(true, cmd); + JPackageHelper.executeToolProvider(true, cmd); + validate(arguments); + } +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsModuleTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsModuleTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary jpackage create image with --java-options test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageJavaOptionsBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageJavaOptionsModuleTest + */ +public class JPackageCreateAppImageJavaOptionsModuleTest { + private static final String OUTPUT = "output"; + + private static final String[] CMD = { + "create-app-image", + "--output", OUTPUT, + "--name", "test", + "--module", "com.hello/com.hello.Hello", + "--module-path", "input", + "--java-options", "TBD"}; + + private static final String[] CMD2 = { + "create-app-image", + "--output", OUTPUT, + "--name", "test", + "--module", "com.hello/com.hello.Hello", + "--module-path", "input", + "--java-options", "TBD", + "--java-options", "TBD", + "--java-options", "TBD"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloModule(); + + JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptionsToolProvider(CMD); + + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions2(CMD2); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions2ToolProvider(CMD2); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageJavaOptionsTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary jpackage create image with --java-options test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageJavaOptionsBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageJavaOptionsTest + */ +public class JPackageCreateAppImageJavaOptionsTest { + private static final String OUTPUT = "output"; + + private static final String[] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--java-options", "TBD"}; + + private static final String[] CMD2 = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--java-options", "TBD", + "--java-options", "TBD", + "--java-options", "TBD"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptionsToolProvider(CMD); + + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions2(CMD2); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageJavaOptionsBase.testCreateAppImageJavaOptions2ToolProvider(CMD2); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageMainClassAttributeTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageMainClassAttributeTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.nio.file.Files; + +/* + * @test + * @summary jpackage create image with no main class arguments and with main-class attribute + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageMainClassAttributeTest + */ +public class JPackageCreateAppImageMainClassAttributeTest { + private static final String OUTPUT = "output"; + private static final String app = JPackagePath.getApp(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + + private static final String[] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar"}; + + private static void validateResult(String[] result) throws Exception { + if (result.length != 2) { + throw new AssertionError( + "Unexpected number of lines: " + result.length); + } + + if (!result[0].trim().equals("jpackage test application")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().equals("args.length: 0")) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + } + + private static void validate() throws Exception { + int retVal = JPackageHelper.execute(null, app); + if (retVal != 0) { + throw new AssertionError( + "Test application exited with error: " + retVal); + } + + File outfile = new File(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 testMainClassAttribute() throws Exception { + JPackageHelper.executeCLI(true, CMD); + validate(); + } + + private static void testMainClassAttributeToolProvider() throws Exception { + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeToolProvider(true, CMD); + validate(); + } + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJarWithMainClass(); + testMainClassAttribute(); + testMainClassAttributeToolProvider(); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModularJarTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModularJarTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @summary jpackage create image modular jar test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageModularJarTest + */ +public class JPackageCreateAppImageModularJarTest { + private static final String OUTPUT = "output"; + + private static final String [] CMD1 = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "com.hello.jar", + "--main-class", "com.hello.Hello", + }; + + private static final String [] CMD2 = { + "create-app-image", + "--output", OUTPUT, + "--name", "test", + "--module", "com.hello/com.hello.Hello", + "--module-path", "input/com.hello.jar", + }; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloModule(); + + JPackageCreateAppImageBase.testCreateAppImage(CMD1); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD1); + + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageBase.testCreateAppImage(CMD2); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD2); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModuleTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModuleTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @summary jpackage create image module test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageModuleTest + */ +public class JPackageCreateAppImageModuleTest { + private static final String OUTPUT = "output"; + + private static final String [] CMD = { + "create-app-image", + "--output", OUTPUT, + "--name", "test", + "--module", "com.hello/com.hello.Hello", + "--module-path", "input"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloModule(); + JPackageCreateAppImageBase.testCreateAppImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageNoNameTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageNoNameTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.nio.file.Files; + +/* + * @test + * @summary jpackage create image with no --name + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageNoNameTest + */ +public class JPackageCreateAppImageNoNameTest { + private static final String OUTPUT = "output"; + private static final String app = JPackagePath.getAppNoName(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDirNoName(); + + private static final String[] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--main-jar", "hello.jar", + "--main-class", "Hello", + }; + + private static void validateResult(String[] result) throws Exception { + if (result.length != 2) { + throw new AssertionError( + "Unexpected number of lines: " + result.length); + } + + if (!result[0].trim().equals("jpackage test application")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().equals("args.length: 0")) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + } + + private static void validate() throws Exception { + int retVal = JPackageHelper.execute(null, app); + if (retVal != 0) { + throw new AssertionError( + "Test application exited with error: " + retVal); + } + + File outfile = new File(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 testMainClassAttribute() throws Exception { + JPackageHelper.executeCLI(true, CMD); + validate(); + } + + private static void testMainClassAttributeToolProvider() throws Exception { + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeToolProvider(true, CMD); + validate(); + } + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + testMainClassAttribute(); + testMainClassAttributeToolProvider(); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeBase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.nio.file.Files; + + public class JPackageCreateAppImageRuntimeBase { + private static final String app = JPackagePath.getApp(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + private static final String runtimeJava = JPackagePath.getRuntimeJava(); + private static final String runtimeJavaOutput = "javaOutput.txt"; + private static final String appOutput = JPackagePath.getAppOutputFile(); + + private static void validateResult(String[] result) throws Exception { + if (result.length != 2) { + throw new AssertionError("Unexpected number of lines: " + result.length); + } + + if (!result[0].trim().equals("jpackage test application")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().equals("args.length: 0")) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + } + + private static void validate() throws Exception { + int retVal = JPackageHelper.execute(null, app); + if (retVal != 0) { + throw new AssertionError("Test application exited with error: " + retVal); + } + + File outfile = new File(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 validateRuntime() throws Exception { + int retVal = JPackageHelper.execute(new File(runtimeJavaOutput), runtimeJava, "--list-modules"); + if (retVal != 0) { + throw new AssertionError("Test application exited with error: " + retVal); + } + + File outfile = new File(runtimeJavaOutput); + if (!outfile.exists()) { + throw new AssertionError(runtimeJavaOutput + " was not created"); + } + + String output = Files.readString(outfile.toPath()); + String[] result = output.split("\n"); + if (result.length != 1) { + throw new AssertionError("Unexpected number of lines: " + result.length); + } + + if (!result[0].startsWith("java.base")) { + throw new AssertionError("Unexpected result: " + result[0]); + } + } + + public static void testCreateAppImage(String [] cmd) throws Exception { + JPackageHelper.executeCLI(true, cmd); + validate(); + validateRuntime(); + } + + public static void testCreateAppImageToolProvider(String [] cmd) throws Exception { + JPackageHelper.executeToolProvider(true, cmd); + validate(); + validateRuntime(); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeModuleTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeModuleTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @summary jpackage create image runtime test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageRuntimeBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageRuntimeModuleTest + */ +public class JPackageCreateAppImageRuntimeModuleTest { + private static final String OUTPUT = "output"; + private static final String [] CMD = { + "create-app-image", + "--runtime-image", "runtime", + "--output", OUTPUT, + "--name", "test", + "--module", "com.hello/com.hello.Hello", + "--module-path", "input"}; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloModule(); + JPackageHelper.createRuntime(); + JPackageCreateAppImageRuntimeBase.testCreateAppImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageRuntimeBase.testCreateAppImageToolProvider(CMD); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @summary jpackage create image runtime test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageRuntimeBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageRuntimeTest + */ +public class JPackageCreateAppImageRuntimeTest { + private static final String OUTPUT = "output"; + private static final String [] CMD = { + "create-app-image", + "--runtime-image", "runtime", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + }; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + JPackageHelper.createRuntime(); + JPackageCreateAppImageRuntimeBase.testCreateAppImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageRuntimeBase.testCreateAppImageToolProvider(CMD); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageTempRootTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageTempRootTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; + + /* + * @test + * @requires (os.family == "windows") + * @summary jpackage create image to test --temp-root + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageTempRootTest + */ +public class JPackageCreateAppImageTempRootTest { + private static final String OUTPUT = "output"; + private static String buildRoot = null; + private static final String BUILD_ROOT = "buildRoot"; + private static final String BUILD_ROOT_TB = "buildRootToolProvider"; + + private static final String [] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + }; + + private static final String [] CMD_BUILD_ROOT = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--temp-root", "TBD"}; + + private static void validate(boolean retain) throws Exception { + File br = new File(buildRoot); + if (retain) { + if (!br.exists()) { + throw new AssertionError(br.getAbsolutePath() + " does not exist"); + } + } else { + if (br.exists()) { + throw new AssertionError(br.getAbsolutePath() + " exist"); + } + } + } + + private static void init(boolean toolProvider) { + if (toolProvider) { + buildRoot = BUILD_ROOT_TB; + } else { + buildRoot = BUILD_ROOT; + } + + CMD_BUILD_ROOT[CMD_BUILD_ROOT.length - 1] = buildRoot; + } + + private static void testTempRoot() throws Exception { + init(false); + JPackageHelper.executeCLI(true, CMD); + validate(false); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeCLI(true, CMD_BUILD_ROOT); + validate(true); + } + + private static void testTempRootToolProvider() throws Exception { + init(true); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeToolProvider(true, CMD); + validate(false); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeToolProvider(true, CMD_BUILD_ROOT); + validate(true); + } + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + testTempRoot(); + testTempRootToolProvider(); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @summary jpackage create image test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageTest + */ +public class JPackageCreateAppImageTest { + private static final String OUTPUT = "output"; + + private static final String [] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + }; + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + JPackageCreateAppImageBase.testCreateAppImage(CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageCreateAppImageBase.testCreateAppImageToolProvider(CMD); + } +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageVerboseTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageVerboseTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary jpackage create image verbose test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageVerboseTest + */ +public class JPackageCreateAppImageVerboseTest { + private static final String OUTPUT = "output"; + private static final String[] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + }; + + private static final String[] CMD_VERBOSE = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--verbose"}; + + private static void validate(String result, String resultVerbose) + throws Exception { + String[] r = result.split("\n"); + String[] rv = resultVerbose.split("\n"); + + if (r.length >= rv.length) { + System.err.println("r.length: " + r.length); + System.err.println(result); + System.err.println("rv.length: " + rv.length); + System.err.println(resultVerbose); + throw new AssertionError( + "non-verbose output is less or equal to verbose output"); + } + } + + private static void testCreateAppImage() throws Exception { + String result = JPackageHelper.executeCLI(true, CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + String resultVerbose = JPackageHelper.executeCLI(true, CMD_VERBOSE); + validate(result, resultVerbose); + } + + private static void testCreateAppImageToolProvider() throws Exception { + JPackageHelper.deleteOutputFolder(OUTPUT); + String result = JPackageHelper.executeToolProvider(true, CMD); + JPackageHelper.deleteOutputFolder(OUTPUT); + String resultVerbose = + JPackageHelper.executeToolProvider(true, CMD_VERBOSE); + validate(result, resultVerbose); + } + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + testCreateAppImage(); + testCreateAppImageToolProvider(); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageVersionTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageVersionTest.java Fri Apr 05 11:24:44 2019 -0400 @@ -0,0 +1,103 @@ + +import java.io.File; +import java.nio.file.Files; + +/* + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary jpackage create image --app-version test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageVersionTest + */ +public class JPackageCreateAppImageVersionTest { + private static final String OUTPUT = "output"; + private static final String appCfg = JPackagePath.getAppCfg(); + private static final String VERSION = "2.3"; + private static final String VERSION_DEFAULT = "1.0"; + + private static final String[] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + }; + + private static final String[] CMD_VERSION = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + "--main-class", "Hello", + "--app-version", VERSION}; + + private static void validate(String version) + throws Exception { + File outfile = new File(appCfg); + if (!outfile.exists()) { + throw new AssertionError(appCfg + " was not created"); + } + + String output = Files.readString(outfile.toPath()); + if (version == null) { + version = VERSION_DEFAULT; + } + + String expected = "app.version=" + version; + if (!output.contains(expected)) { + System.err.println("Expected: " + expected); + throw new AssertionError("Cannot find expected entry in config file"); + } + } + + private static void testVersion() throws Exception { + JPackageHelper.executeCLI(true, CMD); + validate(null); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeCLI(true, CMD_VERSION); + validate(VERSION); + } + + private static void testVersionToolProvider() throws Exception { + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeToolProvider(true, CMD); + validate(null); + JPackageHelper.deleteOutputFolder(OUTPUT); + JPackageHelper.executeToolProvider(true, CMD_VERSION); + validate(VERSION); + } + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + testVersion(); + testVersionToolProvider(); + } + +} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherBase.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherBase.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; - -public class JPackageCreateImageAddLauncherBase { - private static final String app = JPackagePath.getApp(); - private static final String app2 = JPackagePath.getAppSL(); - private static final String appOutput = JPackagePath.getAppOutputFile(); - private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); - - // Note: quotes in argument for add launcher is not support by test - private static final String ARGUMENT1 = "argument 1"; - private static final String ARGUMENT2 = "argument 2"; - private static final String ARGUMENT3 = "argument 3"; - - private static final List arguments = new ArrayList<>(); - - private static final String PARAM1 = "-Dparam1=Some Param 1"; - private static final String PARAM2 = "-Dparam2=Some Param 2"; - private static final String PARAM3 = "-Dparam3=Some Param 3"; - - private static final List vmArguments = new ArrayList<>(); - - private static void validateResult(List args, List vmArgs) - throws Exception { - 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"); - - if (result.length != (args.size() + vmArgs.size() + 2)) { - throw new AssertionError("Unexpected number of lines: " - + result.length); - } - - if (!result[0].trim().equals("jpackage test application")) { - throw new AssertionError("Unexpected result[0]: " + result[0]); - } - - if (!result[1].trim().equals("args.length: " + args.size())) { - throw new AssertionError("Unexpected result[1]: " + result[1]); - } - - int index = 2; - for (String arg : args) { - if (!result[index].trim().equals(arg)) { - throw new AssertionError("Unexpected result[" + index + "]: " - + result[index]); - } - index++; - } - - for (String vmArg : vmArgs) { - if (!result[index].trim().equals(vmArg)) { - throw new AssertionError("Unexpected result[" + index + "]: " - + result[index]); - } - index++; - } - } - - private static void validate() throws Exception { - int retVal = JPackageHelper.execute(null, app); - if (retVal != 0) { - throw new AssertionError("Test application exited with error: " - + retVal); - } - validateResult(new ArrayList<>(), new ArrayList<>()); - - retVal = JPackageHelper.execute(null, app2); - if (retVal != 0) { - throw new AssertionError("Test application exited with error: " - + retVal); - } - validateResult(arguments, vmArguments); - } - - public static void testCreateImage(String [] cmd) throws Exception { - JPackageHelper.executeCLI(true, cmd); - validate(); - } - - public static void testCreateImageToolProvider(String [] cmd) throws Exception { - JPackageHelper.executeToolProvider(true, cmd); - validate(); - } - - public static void createSLProperties() throws Exception { - arguments.add(ARGUMENT1); - arguments.add(ARGUMENT2); - arguments.add(ARGUMENT3); - - String argumentsMap = - JPackageHelper.listToArgumentsMap(arguments, true); - - vmArguments.add(PARAM1); - vmArguments.add(PARAM2); - vmArguments.add(PARAM3); - - String vmArgumentsMap = - JPackageHelper.listToArgumentsMap(vmArguments, true); - - try (PrintWriter out = new PrintWriter(new BufferedWriter( - new FileWriter("sl.properties")))) { - out.println("name=test2"); - out.println("arguments=" + argumentsMap); - out.println("java-options=" + vmArgumentsMap); - } - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherModuleTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherModuleTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @summary jpackage create image with additional launcher test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageAddLauncherBase - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageAddLauncherModuleTest - */ -public class JPackageCreateImageAddLauncherModuleTest { - private static final String OUTPUT = "output"; - private static final String [] CMD = { - "create-image", - "--output", OUTPUT, - "--name", "test", - "--module", "com.hello/com.hello.Hello", - "--module-path", "input", - "--add-launcher", "sl.properties"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloModule(); - JPackageCreateImageAddLauncherBase.createSLProperties(); - JPackageCreateImageAddLauncherBase.testCreateImage(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageAddLauncherBase.testCreateImageToolProvider(CMD); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageAddLauncherTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @summary jpackage create image with additional launcher test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageAddLauncherBase - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageAddLauncherTest - */ -public class JPackageCreateImageAddLauncherTest { - private static final String OUTPUT = "output"; - private static final String [] CMD = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar", - "--add-launcher", "sl.properties"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - JPackageCreateImageAddLauncherBase.createSLProperties(); - JPackageCreateImageAddLauncherBase.testCreateImage(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageAddLauncherBase.testCreateImageToolProvider(CMD); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsBase.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsBase.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; - -public class JPackageCreateImageArgumentsBase { - - 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 ARGUMENT1 = "argument"; - private static final String ARGUMENT2 = "Some Arguments"; - private static final String ARGUMENT3 = "Value \"with\" quotes"; - - private static final String ARGUMENT_CMD1 = "test"; - - private static final List arguments = new ArrayList<>(); - private static final List argumentsCmd = new ArrayList<>(); - - public static void initArguments(boolean toolProvider, String[] cmd) { - if (arguments.isEmpty()) { - arguments.add(ARGUMENT1); - arguments.add(ARGUMENT2); - arguments.add(ARGUMENT3); - } - - if (argumentsCmd.isEmpty()) { - argumentsCmd.add(ARGUMENT_CMD1); - } - - String argumentsMap - = JPackageHelper.listToArgumentsMap(arguments, toolProvider); - cmd[cmd.length - 1] = argumentsMap; - } - - private static void validateResult(String[] result, List args) - throws Exception { - if (result.length != (args.size() + 2)) { - throw new AssertionError( - "Unexpected number of lines: " + result.length); - } - - if (!result[0].trim().equals("jpackage test application")) { - throw new AssertionError("Unexpected result[0]: " + result[0]); - } - - if (!result[1].trim().equals("args.length: " + args.size())) { - throw new AssertionError("Unexpected result[1]: " + result[1]); - } - - int index = 2; - for (String arg : args) { - if (!result[index].trim().equals(arg)) { - throw new AssertionError( - "Unexpected result[" + index + "]: " + result[index]); - } - index++; - } - } - - private static void validate(String arg, List expectedArgs) - throws Exception { - int retVal; - - if (arg == null) { - retVal = JPackageHelper.execute(null, app); - } else { - retVal = JPackageHelper.execute(null, app, arg); - } - if (retVal != 0) { - throw new AssertionError("Test application exited with error: " - + retVal); - } - - File outfile = new File(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, expectedArgs); - } - - public static void testCreateImage(String[] cmd) throws Exception { - initArguments(false, cmd); - JPackageHelper.executeCLI(true, cmd); - validate(null, arguments); - validate(ARGUMENT_CMD1, argumentsCmd); - } - - public static void testCreateImageToolProvider(String[] cmd) throws Exception { - initArguments(true, cmd); - JPackageHelper.executeToolProvider(true, cmd); - validate(null, arguments); - validate(ARGUMENT_CMD1, argumentsCmd); - } -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsModuleTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsModuleTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @summary jpackage create image with --arguments test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageArgumentsBase - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageArgumentsModuleTest - */ -public class JPackageCreateImageArgumentsModuleTest { - private static final String OUTPUT = "output"; - - private static final String[] CMD = { - "create-image", - "--output", OUTPUT, - "--name", "test", - "--module", "com.hello/com.hello.Hello", - "--module-path", "input", - "--arguments", "TBD"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloModule(); - JPackageCreateImageArgumentsBase.testCreateImage(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageArgumentsBase.testCreateImageToolProvider(CMD); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageArgumentsTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @summary jpackage create image with --arguments test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageArgumentsBase - * @modules jdk.jpackage - * @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, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar", - "--arguments", "TBD"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - JPackageCreateImageArgumentsBase.testCreateImage(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageArgumentsBase.testCreateImageToolProvider(CMD); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageBase.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageBase.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.nio.file.Files; - -public abstract class JPackageCreateImageBase { - private static final String app = JPackagePath.getApp(); - private static final String appOutput = JPackagePath.getAppOutputFile(); - private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); - - private static void validateResult(String[] result) throws Exception { - if (result.length != 2) { - throw new AssertionError( - "Unexpected number of lines: " + result.length); - } - - if (!result[0].trim().equals("jpackage test application")) { - throw new AssertionError("Unexpected result[0]: " + result[0]); - } - - if (!result[1].trim().equals("args.length: 0")) { - throw new AssertionError("Unexpected result[1]: " + result[1]); - } - } - - private static void validate() throws Exception { - int retVal = JPackageHelper.execute(null, app); - if (retVal != 0) { - throw new AssertionError( - "Test application exited with error: " + retVal); - } - - File outfile = new File(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); - } - - public static void testCreateImage(String [] cmd) throws Exception { - JPackageHelper.executeCLI(true, cmd); - validate(); - } - - public static void testCreateImageToolProvider(String [] cmd) throws Exception { - JPackageHelper.executeToolProvider(true, cmd); - validate(); - } -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageIconTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageIconTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.nio.file.Files; - -/* - * @test - * @summary jpackage create image to verify --icon - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @modules jdk.jpackage - * @run main/othervm -Xmx512m 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(); - - private static final String[] CMD = { - "create-image", - "--input", "input", - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar", - "--icon", getIconPath(), - "--output", OUTPUT}; - - private static void validateResult(String[] result) throws Exception { - if (result.length != 2) { - throw new AssertionError( - "Unexpected number of lines: " + result.length); - } - - if (!result[0].trim().equals("jpackage test application")) { - throw new AssertionError("Unexpected result[0]: " + result[0]); - } - - if (!result[1].trim().equals("args.length: 0")) { - throw new AssertionError("Unexpected result[1]: " + result[1]); - } - } - - private static void validate() throws Exception { - int retVal = JPackageHelper.execute(null, app); - if (retVal != 0) { - throw new AssertionError( - "Test application exited with error: " + retVal); - } - - File outfile = new File(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 validateIcon() throws Exception { - File origIcon = new File(getIconPath()); - File icon = new File(JPackagePath.getAppIcon()); - if (origIcon.length() != icon.length()) { - System.err.println("origIcon.length(): " + origIcon.length()); - System.err.println("icon.length(): " + icon.length()); - throw new AssertionError("Icons size does not match"); - } - } - - private static void testIcon() throws Exception { - JPackageHelper.executeCLI(true, CMD); - validate(); - validateIcon(); - } - - private static void testIconToolProvider() throws Exception { - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeToolProvider(true, CMD); - validate(); - validateIcon(); - } - - private static String getIconPath() { - String ext = ".ico"; - if (JPackageHelper.isOSX()) { - ext = ".icns"; - } else if (JPackageHelper.isLinux()) { - ext = ".png"; - } - - String path = JPackagePath.getTestSrcRoot() + File.separator + "resources" - + File.separator + "icon" + ext; - - return path; - } - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - testIcon(); - testIconToolProvider(); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageInputFilesTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageInputFilesTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; - - /* - * @test - * @summary jpackage create image input/files test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @modules jdk.jpackage - * @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 = - "input" + File.separator + "hello.jar"; - private static final String appInputFilePath; - private static final String appJarFilePath; - - static { - appInputFilePath = JPackagePath.getAppWorkingDir() + File.separator + "input.txt"; - appJarFilePath = JPackagePath.getAppWorkingDir() + File.separator + "hello.jar"; - } - - private static final String [] CMD_1 = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello"}; - - private static final String [] CMD_2 = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; - - private static void validate1() throws Exception { - File input = new File(appInputFilePath); - if (!input.exists()) { - throw new AssertionError("Unexpected file does not exist: " - + input.getAbsolutePath()); - } - - File jar = new File(appJarFilePath); - if (!jar.exists()) { - throw new AssertionError("Unexpected file does not exist: " - + jar.getAbsolutePath()); - } - } - - private static void validate2() throws Exception { - File input = new File(appInputFilePath); - if (input.exists()) { - throw new AssertionError("Unexpected file exist: " - + input.getAbsolutePath()); - } - - File jar = new File(appJarFilePath); - if (!jar.exists()) { - throw new AssertionError("Unexpected file does not exist: " - + jar.getAbsolutePath()); - } - } - - private static void testCreateImage() throws Exception { - 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(); - } - - private static void createInputFile() throws Exception { - try (PrintWriter out = new PrintWriter( - new BufferedWriter(new FileWriter(inputFile)))) { - out.println("jpackgaer resource file"); - } - } - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - - createInputFile(); - - testCreateImage(); - testCreateImageToolProvider(); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageJavaOptionsBase.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageJavaOptionsBase.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; - -public class JPackageCreateImageJavaOptionsBase { - - 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 ARGUMENT1 = "-Dparam1=Some Param 1"; - private static final String ARGUMENT2 = "-Dparam2=Some \"Param\" 2"; - private static final String ARGUMENT3 = - "-Dparam3=Some \"Param\" with \" 3"; - - private static final List arguments = new ArrayList<>(); - - private static void initArguments(boolean toolProvider, String [] cmd) { - if (arguments.isEmpty()) { - arguments.add(ARGUMENT1); - arguments.add(ARGUMENT2); - arguments.add(ARGUMENT3); - } - - String argumentsMap = JPackageHelper.listToArgumentsMap(arguments, - toolProvider); - cmd[cmd.length - 1] = argumentsMap; - } - - private static void initArguments2(boolean toolProvider, String [] cmd) { - int index = cmd.length - 6; - - cmd[index++] = "--java-options"; - arguments.clear(); - arguments.add(ARGUMENT1); - cmd[index++] = JPackageHelper.listToArgumentsMap(arguments, - toolProvider); - - cmd[index++] = "--java-options"; - arguments.clear(); - arguments.add(ARGUMENT2); - cmd[index++] = JPackageHelper.listToArgumentsMap(arguments, - toolProvider); - - cmd[index++] = "--java-options"; - arguments.clear(); - arguments.add(ARGUMENT3); - cmd[index++] = JPackageHelper.listToArgumentsMap(arguments, - toolProvider); - - arguments.clear(); - arguments.add(ARGUMENT1); - arguments.add(ARGUMENT2); - arguments.add(ARGUMENT3); - } - - private static void validateResult(String[] result, List args) - throws Exception { - if (result.length != (args.size() + 2)) { - for (String r : result) { - System.err.println(r.trim()); - } - throw new AssertionError("Unexpected number of lines: " - + result.length); - } - - if (!result[0].trim().equals("jpackage test application")) { - throw new AssertionError("Unexpected result[0]: " + result[0]); - } - - if (!result[1].trim().equals("args.length: 0")) { - throw new AssertionError("Unexpected result[1]: " + result[1]); - } - - int index = 2; - for (String arg : args) { - if (!result[index].trim().equals(arg)) { - throw new AssertionError("Unexpected result[" + index + "]: " - + result[index]); - } - index++; - } - } - - private static void validate(List expectedArgs) throws Exception { - int retVal = JPackageHelper.execute(null, app); - if (retVal != 0) { - throw new AssertionError("Test application exited with error: " - + retVal); - } - - File outfile = new File(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, expectedArgs); - } - - public static void testCreateImageJavaOptions(String [] cmd) throws Exception { - initArguments(false, cmd); - JPackageHelper.executeCLI(true, cmd); - validate(arguments); - } - - public static void testCreateImageJavaOptionsToolProvider(String [] cmd) throws Exception { - initArguments(true, cmd); - JPackageHelper.executeToolProvider(true, cmd); - validate(arguments); - } - - public static void testCreateImageJavaOptions2(String [] cmd) throws Exception { - initArguments2(false, cmd); - JPackageHelper.executeCLI(true, cmd); - validate(arguments); - } - - public static void testCreateImageJavaOptions2ToolProvider(String [] cmd) throws Exception { - initArguments2(true, cmd); - JPackageHelper.executeToolProvider(true, cmd); - validate(arguments); - } -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageJavaOptionsModuleTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageJavaOptionsModuleTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @summary jpackage create image with --java-options test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageJavaOptionsBase - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageJavaOptionsModuleTest - */ -public class JPackageCreateImageJavaOptionsModuleTest { - private static final String OUTPUT = "output"; - - private static final String[] CMD = { - "create-image", - "--output", OUTPUT, - "--name", "test", - "--module", "com.hello/com.hello.Hello", - "--module-path", "input", - "--java-options", "TBD"}; - - private static final String[] CMD2 = { - "create-image", - "--output", OUTPUT, - "--name", "test", - "--module", "com.hello/com.hello.Hello", - "--module-path", "input", - "--java-options", "TBD", - "--java-options", "TBD", - "--java-options", "TBD"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloModule(); - - JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptionsToolProvider(CMD); - - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions2(CMD2); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions2ToolProvider(CMD2); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageJavaOptionsTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageJavaOptionsTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @summary jpackage create image with --java-options test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageJavaOptionsBase - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageJavaOptionsTest - */ -public class JPackageCreateImageJavaOptionsTest { - private static final String OUTPUT = "output"; - - private static final String[] CMD = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar", - "--java-options", "TBD"}; - - private static final String[] CMD2 = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar", - "--java-options", "TBD", - "--java-options", "TBD", - "--java-options", "TBD"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptionsToolProvider(CMD); - - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions2(CMD2); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageJavaOptionsBase.testCreateImageJavaOptions2ToolProvider(CMD2); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageMainClassAttributeTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageMainClassAttributeTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.nio.file.Files; - -/* - * @test - * @summary jpackage create image with no main class arguments and with main-class attribute - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @modules jdk.jpackage - * @run main/othervm -Xmx512m 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(); - - private static final String[] CMD = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--files", "hello.jar"}; - - private static void validateResult(String[] result) throws Exception { - if (result.length != 2) { - throw new AssertionError( - "Unexpected number of lines: " + result.length); - } - - if (!result[0].trim().equals("jpackage test application")) { - throw new AssertionError("Unexpected result[0]: " + result[0]); - } - - if (!result[1].trim().equals("args.length: 0")) { - throw new AssertionError("Unexpected result[1]: " + result[1]); - } - } - - private static void validate() throws Exception { - int retVal = JPackageHelper.execute(null, app); - if (retVal != 0) { - throw new AssertionError( - "Test application exited with error: " + retVal); - } - - File outfile = new File(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 testMainClassAttribute() throws Exception { - JPackageHelper.executeCLI(true, CMD); - validate(); - } - - private static void testMainClassAttributeToolProvider() throws Exception { - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeToolProvider(true, CMD); - validate(); - } - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJarWithMainClass(); - testMainClassAttribute(); - testMainClassAttributeToolProvider(); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageModularJarTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageModularJarTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @summary jpackage create image modular jar test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageBase - * @modules jdk.jpackage - * @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, - "--name", "test", - "--main-jar", "com.hello.jar", - "--main-class", "com.hello.Hello", - "--files", "com.hello.jar", - }; - - private static final String [] CMD2 = { - "create-image", - "--output", OUTPUT, - "--name", "test", - "--module", "com.hello/com.hello.Hello", - "--module-path", "input/com.hello.jar", - }; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloModule(); - - JPackageCreateImageBase.testCreateImage(CMD1); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageBase.testCreateImageToolProvider(CMD1); - - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageBase.testCreateImage(CMD2); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageBase.testCreateImageToolProvider(CMD2); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageModuleTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageModuleTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @summary jpackage create image module test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageBase - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageModuleTest - */ -public class JPackageCreateImageModuleTest { - private static final String OUTPUT = "output"; - - private static final String [] CMD = { - "create-image", - "--output", OUTPUT, - "--name", "test", - "--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); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageNoNameTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageNoNameTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.nio.file.Files; - -/* - * @test - * @summary jpackage create image with no --name - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @modules jdk.jpackage - * @run main/othervm -Xmx512m 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(); - - private static final String[] CMD = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; - - private static void validateResult(String[] result) throws Exception { - if (result.length != 2) { - throw new AssertionError( - "Unexpected number of lines: " + result.length); - } - - if (!result[0].trim().equals("jpackage test application")) { - throw new AssertionError("Unexpected result[0]: " + result[0]); - } - - if (!result[1].trim().equals("args.length: 0")) { - throw new AssertionError("Unexpected result[1]: " + result[1]); - } - } - - private static void validate() throws Exception { - int retVal = JPackageHelper.execute(null, app); - if (retVal != 0) { - throw new AssertionError( - "Test application exited with error: " + retVal); - } - - File outfile = new File(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 testMainClassAttribute() throws Exception { - JPackageHelper.executeCLI(true, CMD); - validate(); - } - - private static void testMainClassAttributeToolProvider() throws Exception { - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeToolProvider(true, CMD); - validate(); - } - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - testMainClassAttribute(); - testMainClassAttributeToolProvider(); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeBase.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeBase.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; -import java.nio.file.Files; - - public class JPackageCreateImageRuntimeBase { - private static final String app = JPackagePath.getApp(); - private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); - private static final String runtimeJava = JPackagePath.getRuntimeJava(); - private static final String runtimeJavaOutput = "javaOutput.txt"; - private static final String appOutput = JPackagePath.getAppOutputFile(); - - private static void validateResult(String[] result) throws Exception { - if (result.length != 2) { - throw new AssertionError("Unexpected number of lines: " + result.length); - } - - if (!result[0].trim().equals("jpackage test application")) { - throw new AssertionError("Unexpected result[0]: " + result[0]); - } - - if (!result[1].trim().equals("args.length: 0")) { - throw new AssertionError("Unexpected result[1]: " + result[1]); - } - } - - private static void validate() throws Exception { - int retVal = JPackageHelper.execute(null, app); - if (retVal != 0) { - throw new AssertionError("Test application exited with error: " + retVal); - } - - File outfile = new File(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 validateRuntime() throws Exception { - int retVal = JPackageHelper.execute(new File(runtimeJavaOutput), runtimeJava, "--list-modules"); - if (retVal != 0) { - throw new AssertionError("Test application exited with error: " + retVal); - } - - File outfile = new File(runtimeJavaOutput); - if (!outfile.exists()) { - throw new AssertionError(runtimeJavaOutput + " was not created"); - } - - String output = Files.readString(outfile.toPath()); - String[] result = output.split("\n"); - if (result.length != 1) { - throw new AssertionError("Unexpected number of lines: " + result.length); - } - - if (!result[0].startsWith("java.base")) { - throw new AssertionError("Unexpected result: " + result[0]); - } - } - - public static void testCreateImage(String [] cmd) throws Exception { - JPackageHelper.executeCLI(true, cmd); - validate(); - validateRuntime(); - } - - public static void testCreateImageToolProvider(String [] cmd) throws Exception { - JPackageHelper.executeToolProvider(true, cmd); - validate(); - validateRuntime(); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeModuleTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeModuleTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @summary jpackage create image runtime test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageRuntimeBase - * @modules jdk.jpackage - * @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, - "--name", "test", - "--module", "com.hello/com.hello.Hello", - "--module-path", "input"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloModule(); - JPackageHelper.createRuntime(); - JPackageCreateImageRuntimeBase.testCreateImage(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageRuntimeBase.testCreateImageToolProvider(CMD); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageRuntimeTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @summary jpackage create image runtime test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageRuntimeBase - * @modules jdk.jpackage - * @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, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - JPackageHelper.createRuntime(); - JPackageCreateImageRuntimeBase.testCreateImage(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageRuntimeBase.testCreateImageToolProvider(CMD); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageTempRootTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageTempRootTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.io.File; - - /* - * @test - * @requires (os.family == "windows") - * @summary jpackage create image to test --temp-root - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @modules jdk.jpackage - * @run main/othervm -Xmx512m JPackageCreateImageTempRootTest - */ -public class JPackageCreateImageTempRootTest { - private static final String OUTPUT = "output"; - private static String buildRoot = null; - private static final String BUILD_ROOT = "buildRoot"; - private static final String BUILD_ROOT_TB = "buildRootToolProvider"; - - private static final String [] CMD = { - "create-image", - "--input", "input", - "--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", - "--temp-root", "TBD"}; - - private static void validate(boolean retain) throws Exception { - File br = new File(buildRoot); - if (retain) { - if (!br.exists()) { - throw new AssertionError(br.getAbsolutePath() + " does not exist"); - } - } else { - if (br.exists()) { - throw new AssertionError(br.getAbsolutePath() + " exist"); - } - } - } - - private static void init(boolean toolProvider) { - if (toolProvider) { - buildRoot = BUILD_ROOT_TB; - } else { - buildRoot = BUILD_ROOT; - } - - CMD_BUILD_ROOT[CMD_BUILD_ROOT.length - 1] = buildRoot; - } - - private static void testTempRoot() throws Exception { - init(false); - JPackageHelper.executeCLI(true, CMD); - validate(false); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeCLI(true, CMD_BUILD_ROOT); - validate(true); - } - - private static void testTempRootToolProvider() throws Exception { - init(true); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeToolProvider(true, CMD); - validate(false); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeToolProvider(true, CMD_BUILD_ROOT); - validate(true); - } - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - testTempRoot(); - testTempRootToolProvider(); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - /* - * @test - * @summary jpackage create image test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @build JPackageCreateImageBase - * @modules jdk.jpackage - * @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, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - JPackageCreateImageBase.testCreateImage(CMD); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageCreateImageBase.testCreateImageToolProvider(CMD); - } -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageVerboseTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageVerboseTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @summary jpackage create image verbose test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @modules jdk.jpackage - * @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, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; - - private static final String[] CMD_VERBOSE = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar", - "--verbose"}; - - private static void validate(String result, String resultVerbose) - throws Exception { - String[] r = result.split("\n"); - String[] rv = resultVerbose.split("\n"); - - if (r.length >= rv.length) { - System.err.println("r.length: " + r.length); - System.err.println(result); - System.err.println("rv.length: " + rv.length); - System.err.println(resultVerbose); - throw new AssertionError( - "non-verbose output is less or equal to verbose output"); - } - } - - private static void 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); - } - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - testCreateImage(); - testCreateImageToolProvider(); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java --- a/test/jdk/tools/jpackage/createimage/JPackageCreateImageVersionTest.java Fri Apr 05 10:55:51 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ - -import java.io.File; -import java.nio.file.Files; - -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @summary jpackage create image --app-version test - * @library ../helpers - * @build JPackageHelper - * @build JPackagePath - * @modules jdk.jpackage - * @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"; - - private static final String[] CMD = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; - - private static final String[] CMD_VERSION = { - "create-image", - "--input", "input", - "--output", OUTPUT, - "--name", "test", - "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar", - "--app-version", VERSION}; - - private static void validate(String version) - throws Exception { - File outfile = new File(appCfg); - if (!outfile.exists()) { - throw new AssertionError(appCfg + " was not created"); - } - - String output = Files.readString(outfile.toPath()); - if (version == null) { - version = VERSION_DEFAULT; - } - - String expected = "app.version=" + version; - if (!output.contains(expected)) { - System.err.println("Expected: " + expected); - throw new AssertionError("Cannot find expected entry in config file"); - } - } - - private static void testVersion() throws Exception { - JPackageHelper.executeCLI(true, CMD); - validate(null); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeCLI(true, CMD_VERSION); - validate(VERSION); - } - - private static void testVersionToolProvider() throws Exception { - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeToolProvider(true, CMD); - validate(null); - JPackageHelper.deleteOutputFolder(OUTPUT); - JPackageHelper.executeToolProvider(true, CMD_VERSION); - validate(VERSION); - } - - public static void main(String[] args) throws Exception { - JPackageHelper.createHelloImageJar(); - testVersion(); - testVersionToolProvider(); - } - -} diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBase.java --- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -72,8 +72,7 @@ "--output", "output", "--name", TEST_NAME, "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; + "--main-class", "Hello" }; } public static void run(String name, String ext) throws Exception { diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBundleNameBase.java --- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBundleNameBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerBundleNameBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -75,7 +75,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--linux-bundle-name", BUNDLE_NAME}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerFileAssociationsBase.java --- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerFileAssociationsBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerFileAssociationsBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -137,7 +137,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--file-associations", "fa.properties"}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerInstallDirBase.java --- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerInstallDirBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerInstallDirBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -79,7 +79,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--install-dir", "/opt/jpackage"}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseBase.java --- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -74,7 +74,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--license-file", JPackagePath.getLicenseFilePath()}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseTypeBase.java --- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseTypeBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerLicenseTypeBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -96,7 +96,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--linux-rpm-license-type", JP_LICENSE_TYPE}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerMaintainerBase.java --- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerMaintainerBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerMaintainerBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -92,7 +92,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--linux-deb-maintainer", EMAIL}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerPackageDepsBase.java --- a/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerPackageDepsBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/linux/base/JPackageCreateInstallerPackageDepsBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -120,7 +120,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--linux-package-deps", DEP_NAME.toLowerCase()}; CMD_DEP = new String[]{ "create-installer", @@ -129,8 +128,7 @@ "--output", "output", "--name", DEP_NAME, "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; + "--main-class", "Hello"}; } public static void run(String name, String ext) throws Exception { diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerBase.java --- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -66,8 +66,7 @@ "--output", "output", "--name", TEST_NAME, "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; + "--main-class", "Hello"}; } public static void run(String name, String ext) throws Exception { diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerFileAssociationsBase.java --- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerFileAssociationsBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerFileAssociationsBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -131,7 +131,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--file-associations", "fa.properties"}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerInstallDirBase.java --- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerInstallDirBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerInstallDirBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -67,7 +67,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--install-dir", "/Applications/jpackage"}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerLicenseBase.java --- a/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerLicenseBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/macosx/base/JPackageCreateInstallerLicenseBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -68,7 +68,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--license-file", JPackagePath.getLicenseFilePath()}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -74,8 +74,7 @@ "--output", "output", "--name", TEST_NAME, "--main-jar", "hello.jar", - "--main-class", "Hello", - "--files", "hello.jar"}; + "--main-class", "Hello"}; } public static void run(String name, String ext) throws Exception { diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -150,7 +150,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--file-associations", "fa.properties"}; } else { CMD = new String[]{ @@ -161,7 +160,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--file-associations", "fa.properties", "--install-dir", installDir}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerInstallDirBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerInstallDirBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerInstallDirBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -83,7 +83,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--install-dir", INSTALL_DIR, "--win-shortcut"}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerLicenseBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerLicenseBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerLicenseBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -75,7 +75,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--license-file", JPackagePath.getLicenseFilePath()}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinDirChooserBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinDirChooserBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinDirChooserBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -75,7 +75,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--win-dir-chooser"}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -75,7 +75,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--win-menu"}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuGroupBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuGroupBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinMenuGroupBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -75,7 +75,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--win-menu", "--win-menu-group", TEST_NAME}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinPerUserInstallBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinPerUserInstallBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinPerUserInstallBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -75,7 +75,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--win-per-user-install", "--win-menu", "--win-menu-group", TEST_NAME}; diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinRegistryNameBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinRegistryNameBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinRegistryNameBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -151,7 +151,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--file-associations", "fa.properties", "--win-registry-name", WIN_REGISTRY_NAME}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinShortcutBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinShortcutBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinShortcutBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -81,7 +81,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar", "--win-shortcut"}; } diff -r b3b59183df78 -r 4948a1944cf9 test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinUpgradeUUIDBase.java --- a/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinUpgradeUUIDBase.java Fri Apr 05 10:55:51 2019 -0400 +++ b/test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerWinUpgradeUUIDBase.java Fri Apr 05 11:24:44 2019 -0400 @@ -102,7 +102,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar" + File.pathSeparator + FILE_1, "--app-version", "1.0", "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"}; OUTPUT_2 = "output" + File.separator + TEST_NAME + "-2.0." + EXT; @@ -114,7 +113,6 @@ "--name", TEST_NAME, "--main-jar", "hello.jar", "--main-class", "Hello", - "--files", "hello.jar" + File.pathSeparator + FILE_2, "--app-version", "2.0", "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"}; }