8230726: Improve jpackage jtreg tests
Submitted-by: asemenyuk
Reviewed-by: herrick, almatvee
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Executor.java Tue Sep 10 09:18:19 2019 -0400
@@ -22,13 +22,17 @@
*/
package jdk.jpackage.test;
-import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.spi.ToolProvider;
+import java.util.stream.Stream;
public final class Executor extends CommandArguments<Executor> {
@@ -38,6 +42,17 @@
public Executor setExecutable(String v) {
executable = v;
+ if (executable != null) {
+ toolProvider = null;
+ }
+ return this;
+ }
+
+ public Executor setToolProvider(ToolProvider v) {
+ toolProvider = v;
+ if (toolProvider != null) {
+ executable = null;
+ }
return this;
}
@@ -89,21 +104,29 @@
return assertExitCodeIs(0);
}
- int exitCode;
- List<String> output;
+ final int exitCode;
+ private List<String> output;
}
public Result execute() {
+ if (toolProvider != null) {
+ return runToolProvider();
+ }
+
try {
- return executeImpl();
+ if (executable != null) {
+ return runExecutable();
+ }
} catch (RuntimeException e) {
throw e;
- } catch (Exception e) {
+ } catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
+
+ throw new IllegalStateException("No command to execute");
}
- private Result executeImpl() throws Exception {
+ private Result runExecutable() throws IOException, InterruptedException {
List<String> command = new ArrayList<>();
command.add(executable);
command.addAll(args);
@@ -141,11 +164,41 @@
}
}
- public String getPrintableCommandLine() {
- return "[" + executable + "]; args(" + args.size() + ")=" + Arrays.toString(
- args.toArray());
+ private Result runToolProvider() {
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+
+ Test.trace("Execute " + getPrintableCommandLine() + "...");
+ Result reply = new Result(toolProvider.run(pw, pw, args.toArray(
+ String[]::new)));
+ Test.trace("Done. Exit code: " + reply.exitCode);
+
+ List lines = List.of(writer.toString().split("\\R", -1));
+
+ if (saveOutputType == SaveOutputType.FIRST_LINE) {
+ reply.output = Stream.of(lines).findFirst().get();
+ } else if (saveOutputType == SaveOutputType.FULL) {
+ reply.output = Collections.unmodifiableList(lines);
+ }
+ return reply;
}
+ public String getPrintableCommandLine() {
+ String argsStr = String.format("; args(%d)=%s", args.size(),
+ Arrays.toString(args.toArray()));
+
+ if (toolProvider == null && executable == null) {
+ return "[null]; " + argsStr;
+ }
+
+ if (toolProvider != null) {
+ return String.format("tool provider=[%s]; ", toolProvider.name()) + argsStr;
+ }
+
+ return String.format("[%s]; ", executable) + argsStr;
+ }
+
+ private ToolProvider toolProvider;
private String executable;
private SaveOutputType saveOutputType;
private Path directory;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/HelloApp.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+package jdk.jpackage.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+
+public class HelloApp {
+ static void addTo(JPackageCommand cmd) {
+ cmd.addAction(new Runnable() {
+ @Override
+ public void run() {
+ String mainClass = "Hello";
+ Path jar = cmd.inputDir().resolve("hello.jar");
+ new JarBuilder()
+ .setOutputJar(jar.toFile())
+ .setMainClass(mainClass)
+ .addSourceFile(Test.TEST_SRC_ROOT.resolve(
+ Path.of("apps", "image", mainClass + ".java")))
+ .create();
+ cmd.addArguments("--main-jar", jar.getFileName().toString());
+ cmd.addArguments("--main-class", mainClass);
+ }
+ });
+
+ if (PackageType.WINDOWS.contains(cmd.packageType())) {
+ cmd.addArguments("--win-console");
+ }
+ }
+
+ public static void verifyOutputFile(Path outputFile, String ... args) {
+ Test.assertFileExists(outputFile, true);
+
+ List<String> output = null;
+ try {
+ output = Files.readAllLines(outputFile);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ final int expectedNumberOfLines = 2 + args.length;
+ Test.assertEquals(expectedNumberOfLines, output.size(), String.format(
+ "Check file [%s] contains %d text lines", outputFile,
+ expectedNumberOfLines));
+
+ Test.assertEquals("jpackage test application", output.get(0),
+ String.format(
+ "Check contents of the first text line in [%s] file",
+ outputFile));
+
+ Test.assertEquals(String.format("args.length: %d", args.length),
+ output.get(1), String.format(
+ "Check contents of the second text line in [%s] file",
+ outputFile));
+
+ Enumeration<String> argsEnum = Collections.enumeration(List.of(args));
+ AtomicInteger counter = new AtomicInteger(2);
+ output.stream().skip(2).sequential().forEach(line -> Test.assertEquals(
+ argsEnum.nextElement(), line, String.format(
+ "Check contents of %d text line in [%s] file",
+ counter.incrementAndGet(), outputFile)));
+ }
+
+ public static void executeAndVerifyOutput(Path helloAppLauncher,
+ String... defaultLauncherArgs) {
+ File outputFile = Test.workDir().resolve(OUTPUT_FILENAME).toFile();
+ new Executor()
+ .setDirectory(outputFile.getParentFile().toPath())
+ .setExecutable(helloAppLauncher.toString())
+ .execute()
+ .assertExitCodeIsZero();
+
+ verifyOutputFile(outputFile.toPath(), defaultLauncherArgs);
+ }
+
+ public final static String OUTPUT_FILENAME = "appOutput.txt";
+}
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java Tue Sep 10 09:18:19 2019 -0400
@@ -22,17 +22,17 @@
*/
package jdk.jpackage.test;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Supplier;
+import java.util.stream.Stream;
/**
* jpackage command line with prerequisite actions. Prerequisite actions can be
@@ -53,6 +53,8 @@
}
public void setArgumentValue(String argName, String newValue) {
+ verifyMutable();
+
String prevArg = null;
ListIterator<String> it = args.listIterator();
while (it.hasNext()) {
@@ -75,8 +77,12 @@
}
}
+ public boolean hasArgument(String argName) {
+ return args.contains(argName);
+ }
+
public <T> T getArgumentValue(String argName,
- Supplier<T> defaultValueSupplier,
+ Function<JPackageCommand, T> defaultValueSupplier,
Function<String, T> stringConverter) {
String prevArg = null;
for (String arg : args) {
@@ -86,15 +92,42 @@
prevArg = arg;
}
if (defaultValueSupplier != null) {
- return defaultValueSupplier.get();
+ return defaultValueSupplier.apply(this);
}
return null;
}
public String getArgumentValue(String argName,
+ Function<JPackageCommand, String> defaultValueSupplier) {
+ return getArgumentValue(argName, defaultValueSupplier, v -> v);
+ }
+
+ public <T> T getArgumentValue(String argName,
+ Supplier<T> defaultValueSupplier,
+ Function<String, T> stringConverter) {
+ return getArgumentValue(argName, (unused) -> defaultValueSupplier.get(),
+ stringConverter);
+ }
+
+ public String getArgumentValue(String argName,
Supplier<String> defaultValueSupplier) {
- return getArgumentValue(argName, defaultValueSupplier,
- (v) -> v);
+ return getArgumentValue(argName, defaultValueSupplier, v -> v);
+ }
+
+ public String getArgumentValue(String argName) {
+ return getArgumentValue(argName, (Supplier<String>)null);
+ }
+
+ public String[] getAllArgumentValues(String argName) {
+ List<String> values = new ArrayList<>();
+ String prevArg = null;
+ for (String arg : args) {
+ if (prevArg != null && prevArg.equals(argName)) {
+ values.add(arg);
+ }
+ prevArg = arg;
+ }
+ return values.toArray(String[]::new);
}
public PackageType packageType() {
@@ -104,24 +137,23 @@
}
public Path outputDir() {
- return getArgumentValue("--output",
- () -> Test.defaultOutputDir(),
- (v) -> Path.of(v));
+ return getArgumentValue("--output", () -> Test.defaultOutputDir(), Path::of);
}
public Path inputDir() {
- return getArgumentValue("--input",
- () -> Test.defaultInputDir(),
- (v) -> Path.of(v));
+ return getArgumentValue("--input", () -> Test.defaultInputDir(),Path::of);
}
public String version() {
- return getArgumentValue("--version", () -> "1.0");
+ return getArgumentValue("--app-version", () -> "1.0");
}
public String name() {
- return getArgumentValue("--name",
- () -> getArgumentValue("--main-class", null));
+ return getArgumentValue("--name", () -> getArgumentValue("--main-class"));
+ }
+
+ public boolean isRuntime() {
+ return getArgumentValue("--runtime-image", () -> false, v -> true);
}
public JPackageCommand setDefaultInputOutput() {
@@ -131,48 +163,157 @@
return this;
}
- public JPackageCommand setHelloApp() {
+ JPackageCommand addAction(Runnable action) {
verifyMutable();
- actions.add(new Runnable() {
- @Override
- public void run() {
- String mainClass = "Hello";
- Path jar = inputDir().resolve("hello.jar");
- new JarBuilder()
- .setOutputJar(jar.toFile())
- .setMainClass(mainClass)
- .addSourceFile(Test.TEST_SRC_ROOT.resolve(
- Path.of("apps", "image", mainClass + ".java")))
- .create();
- addArguments("--main-jar", jar.getFileName().toString());
- addArguments("--main-class", mainClass);
- }
- });
+ actions.add(action);
return this;
}
+ public static JPackageCommand helloAppImage() {
+ JPackageCommand cmd = new JPackageCommand();
+ cmd.setDefaultInputOutput().setDefaultAppName();
+ HelloApp.addTo(cmd);
+ return cmd;
+ }
+
public JPackageCommand setPackageType(PackageType type) {
verifyMutable();
type.applyTo(this);
return this;
}
+ JPackageCommand setDefaultAppName() {
+ StackTraceElement st[] = Thread.currentThread().getStackTrace();
+ for (StackTraceElement ste : st) {
+ if ("main".equals(ste.getMethodName())) {
+ String name = ste.getClassName();
+ name = Stream.of(name.split("[.$]")).reduce((f, l) -> l).get();
+ addArguments("--name", name);
+ break;
+ }
+ }
+ return this;
+ }
+
public Path outputBundle() {
- switch (packageType()) {
- case LINUX_RPM:
- case LINUX_DEB:
- return outputDir().resolve(LinuxHelper.getBundleName(this));
+ final PackageType type = packageType();
+ if (PackageType.IMAGE == type) {
+ return null;
+ }
+
+ String bundleName = null;
+ if (PackageType.LINUX.contains(type)) {
+ bundleName = LinuxHelper.getBundleName(this);
+ } else if (PackageType.WINDOWS.contains(type)) {
+ bundleName = WindowsHelper.getBundleName(this);
+ } else if (PackageType.MAC.contains(type)) {
+ bundleName = MacHelper.getBundleName(this);
}
- return null;
+
+ return outputDir().resolve(bundleName);
+ }
+
+ /**
+ * Returns path to directory where application will be installed.
+ *
+ * E.g. on Linux for app named Foo default the function will return
+ * `/opt/foo`
+ */
+ public Path appInstallationDirectory() {
+ final PackageType type = packageType();
+ if (PackageType.IMAGE == type) {
+ return null;
+ }
+
+ if (PackageType.LINUX.contains(type)) {
+ // Launcher is in "bin" subfolder of the installation directory.
+ return launcherInstallationPath().getParent().getParent();
+ }
+
+ if (PackageType.WINDOWS.contains(type)) {
+ return WindowsHelper.getInstallationDirectory(this);
+ }
+
+ if (PackageType.MAC.contains(type)) {
+ return MacHelper.getInstallationDirectory(this);
+ }
+
+ throw new IllegalArgumentException("Unexpected package type");
}
+ /**
+ * Returns path where application launcher will be installed.
+ * If the command will package Java run-time only, still returns path to
+ * application launcher.
+ *
+ * E.g. on Linux for app named Foo default the function will return
+ * `/opt/foo/bin/Foo`
+ */
public Path launcherInstallationPath() {
- switch (packageType()) {
- case LINUX_RPM:
- case LINUX_DEB:
- return LinuxHelper.getLauncherPath(this);
+ final PackageType type = packageType();
+ if (PackageType.IMAGE == type) {
+ return null;
+ }
+
+ if (PackageType.LINUX.contains(type)) {
+ return outputDir().resolve(LinuxHelper.getLauncherPath(this));
+ }
+
+ if (PackageType.WINDOWS.contains(type)) {
+ return appInstallationDirectory().resolve(name() + ".exe");
+ }
+
+ if (PackageType.MAC.contains(type)) {
+ return appInstallationDirectory().resolve(Path.of("Contents", "MacOS", name()));
}
- return null;
+
+ throw new IllegalArgumentException("Unexpected package type");
+ }
+
+ /**
+ * Returns path to application image directory.
+ *
+ * E.g. if --output is set to `foo` and --name is set to `bar` the function
+ * will return `foo/bar` path.
+ *
+ * @throws IllegalArgumentException is command is doing platform packaging
+ */
+ public Path appImage() {
+ final PackageType type = packageType();
+ if (PackageType.IMAGE != type) {
+ throw new IllegalArgumentException("Unexpected package type");
+ }
+
+ return outputDir().resolve(name());
+ }
+
+ /**
+ * Returns path to application launcher relative to image directory.
+ *
+ * E.g. if --name is set to `Foo` the function will return `bin/Foo` path on
+ * Linux, and `Foo.exe` on Windows.
+ *
+ * @throws IllegalArgumentException is command is doing platform packaging
+ */
+ public Path launcherPathInAppImage() {
+ final PackageType type = packageType();
+ if (PackageType.IMAGE != type) {
+ throw new IllegalArgumentException("Unexpected package type");
+ }
+
+ if (Test.isLinux()) {
+ return Path.of("bin", name());
+ }
+
+ if (Test.isOSX()) {
+ return Path.of("Contents", "MacOS", name());
+ }
+
+ if (Test.isWindows()) {
+ return Path.of(name() + ".exe");
+ }
+
+ throw new IllegalArgumentException("Unexpected package type");
}
public Executor.Result execute() {
@@ -186,34 +327,21 @@
.execute();
}
- static void verifyHelloApp(Path helloAppLauncher) {
- File outputFile = Test.workDir().resolve("appOutput.txt").toFile();
- new Executor()
- .setDirectory(outputFile.getParentFile().toPath())
- .setExecutable(helloAppLauncher.toString())
- .execute()
- .assertExitCodeIsZero();
-
- Test.assertTrue(outputFile.exists(), String.format(
- "Check file [%s] exists", outputFile));
+ String getPrintableCommandLine() {
+ return new Executor()
+ .setExecutable(JavaTool.JPACKAGE)
+ .addArguments(args)
+ .getPrintableCommandLine();
+ }
- List<String> output = null;
- try {
- output = Files.readAllLines(outputFile.toPath());
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- Test.assertEquals(2, output.size(), String.format(
- "Check file [%s] contains %d text lines", outputFile, 2));
+ void verifyIsOfType(Collection<PackageType> types) {
+ verifyIsOfType(types.toArray(PackageType[]::new));
+ }
- Test.assertEquals("jpackage test application", output.get(0),
- String.format(
- "Check contents of the first text line in [%s] file",
- outputFile));
-
- Test.assertEquals("args.length: 0", output.get(1), String.format(
- "Check contents of the second text line in [%s] file",
- outputFile));
+ void verifyIsOfType(PackageType ... types) {
+ if (!Arrays.asList(types).contains(packageType())) {
+ throw new IllegalArgumentException("Unexpected package type");
+ }
}
@Override
@@ -229,7 +357,7 @@
@Override
public Map<String, PackageType> get() {
Map<String, PackageType> reply = new HashMap<>();
- for (PackageType type : PackageType.values()) {
+ for (PackageType type : PackageType.NATIVE) {
reply.put(type.getName(), type);
}
return reply;
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JavaTool.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JavaTool.java Tue Sep 10 09:18:19 2019 -0400
@@ -27,14 +27,15 @@
import java.io.File;
import java.nio.file.Path;
+import java.util.spi.ToolProvider;
public enum JavaTool {
JAVAC("javac"), JPACKAGE("jpackage"), JAR("jar");
- private File path;
JavaTool(String name) {
+ this.name = name;
path = Path.of(System.getProperty("java.home"), "bin", name).toFile();
- if (!path.exists()) {
+ if (Test.isWindows()) {
path = new File(path.toString() + ".exe");
}
if (!path.exists()) {
@@ -46,4 +47,11 @@
File getPath() {
return path;
}
+
+ ToolProvider asToolProvider() {
+ return ToolProvider.findFirst(name).orElse(null);
+ }
+
+ private File path;
+ private String name;
}
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LinuxHelper.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LinuxHelper.java Tue Sep 10 09:18:19 2019 -0400
@@ -1,148 +1,161 @@
-/*
- * 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.
- */
-package jdk.jpackage.test;
-
-import java.nio.file.Path;
-import java.util.HashMap;
-import java.util.Map;
-
-public class LinuxHelper {
- static String getRelease(JPackageCommand cmd) {
- return cmd.getArgumentValue("--linux-app-release", () -> "1");
- }
-
- static String getPackageName(JPackageCommand cmd) {
- return cmd.name().toLowerCase();
- }
-
- static String getBundleName(JPackageCommand cmd) {
- final String release = getRelease(cmd);
- final String version = cmd.version();
-
- final PackageType packageType = cmd.packageType();
- String format = null;
- switch (packageType) {
- case LINUX_DEB:
- format = "%s_%s-%s_%s";
- break;
-
- case LINUX_RPM:
- format = "%s-%s-%s.%s";
- break;
- }
- return String.format(format,
- getPackageName(cmd), version, release, getPackageArch(packageType))
- + packageType.getSuffix();
- }
-
- static Path getLauncherPath(JPackageCommand cmd) {
- final String launcherName = cmd.name();
- final Path packageFile = cmd.outputBundle();
-
- Executor exec = new Executor();
- exec.saveOutput();
- final PackageType packageType = PackageType.fromSuffix(
- packageFile.toString());
- switch (packageType) {
- case LINUX_DEB:
- exec.setExecutable("dpkg")
- .addArgument("--contents")
- .addArgument(packageFile);
- break;
-
- case LINUX_RPM:
- exec.setExecutable("rpm")
- .addArgument("-qpl")
- .addArgument(packageFile);
- break;
- }
-
- final String launcherRelativePath = Path.of("/", "bin", launcherName).toString();
- for (String line : exec.execute().assertExitCodeIsZero().getOutput()) {
- if (line.endsWith(launcherRelativePath)) {
- if (packageType == PackageType.LINUX_DEB) {
- // Typical text lines produced by dpkg look like:
- // drwxr-xr-x root/root 0 2019-08-30 05:30 ./opt/appcategorytest/runtime/lib/
- // -rw-r--r-- root/root 574912 2019-08-30 05:30 ./opt/appcategorytest/runtime/lib/libmlib_image.so
- // Need to skip all fields but absolute path to file.
- line = line.substring(line.indexOf(" ./") + 2);
- }
- return Path.of(line);
- }
- }
-
- Test.assertUnexpected(String.format("Failed to find %s in %s package",
- launcherName));
- return null;
- }
-
- public static String getDebBundleProperty(Path bundle, String fieldName) {
- return new Executor()
- .saveFirstLineOfOutput()
- .setExecutable("dpkg-deb")
- .addArguments("-f", bundle.toString(), fieldName)
- .execute()
- .assertExitCodeIsZero().getFirstLineOfOutput();
- }
-
- public static String geRpmBundleProperty(Path bundle, String fieldName) {
- return new Executor()
- .saveFirstLineOfOutput()
- .setExecutable("rpm")
- .addArguments(
- "-qp",
- "--queryformat",
- String.format("%%{%s}", fieldName),
- bundle.toString())
- .execute()
- .assertExitCodeIsZero().getFirstLineOfOutput();
- }
-
- private static String getPackageArch(PackageType type) {
- if (archs == null) {
- archs = new HashMap<>();
- }
-
- String arch = archs.get(type);
- if (arch == null) {
- Executor exec = new Executor();
- exec.saveFirstLineOfOutput();
- switch (type) {
- case LINUX_DEB:
- exec.setExecutable("dpkg").addArgument(
- "--print-architecture");
- break;
-
- case LINUX_RPM:
- exec.setExecutable("rpmbuild").addArgument(
- "--eval=%{_target_cpu}");
- break;
- }
- arch = exec.execute().assertExitCodeIsZero().getFirstLineOfOutput();
- archs.put(type, arch);
- }
- return arch;
- }
-
- static private Map<PackageType, String> archs;
-}
+/*
+ * 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.
+ */
+package jdk.jpackage.test;
+
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+
+public class LinuxHelper {
+ private static String getRelease(JPackageCommand cmd) {
+ return cmd.getArgumentValue("--linux-app-release", () -> "1");
+ }
+
+ public static String getPackageName(JPackageCommand cmd) {
+ cmd.verifyIsOfType(PackageType.LINUX);
+ return cmd.getArgumentValue("--linux-bundle-name",
+ () -> cmd.name().toLowerCase());
+ }
+
+ static String getBundleName(JPackageCommand cmd) {
+ cmd.verifyIsOfType(PackageType.LINUX);
+
+ final PackageType packageType = cmd.packageType();
+ String format = null;
+ switch (packageType) {
+ case LINUX_DEB:
+ format = "%s_%s-%s_%s";
+ break;
+
+ case LINUX_RPM:
+ format = "%s-%s-%s.%s";
+ break;
+ }
+
+ final String release = getRelease(cmd);
+ final String version = cmd.version();
+
+ return String.format(format,
+ getPackageName(cmd), version, release, getPackageArch(packageType))
+ + packageType.getSuffix();
+ }
+
+ public static Stream<Path> getPackageFiles(JPackageCommand cmd) {
+ cmd.verifyIsOfType(PackageType.LINUX);
+
+ final PackageType packageType = cmd.packageType();
+ final Path packageFile = cmd.outputBundle();
+
+ Executor exec = new Executor();
+ exec.saveOutput();
+ switch (packageType) {
+ case LINUX_DEB:
+ exec.setExecutable("dpkg")
+ .addArgument("--contents")
+ .addArgument(packageFile);
+ break;
+
+ case LINUX_RPM:
+ exec.setExecutable("rpm")
+ .addArgument("-qpl")
+ .addArgument(packageFile);
+ break;
+ }
+
+ Stream<String> lines = exec.execute().assertExitCodeIsZero().getOutput().stream();
+ if (packageType == PackageType.LINUX_DEB) {
+ // Typical text lines produced by dpkg look like:
+ // drwxr-xr-x root/root 0 2019-08-30 05:30 ./opt/appcategorytest/runtime/lib/
+ // -rw-r--r-- root/root 574912 2019-08-30 05:30 ./opt/appcategorytest/runtime/lib/libmlib_image.so
+ // Need to skip all fields but absolute path to file.
+ lines = lines.map(line -> line.substring(line.indexOf(" ./") + 2));
+ }
+ return lines.map(Path::of);
+ }
+
+ static Path getLauncherPath(JPackageCommand cmd) {
+ cmd.verifyIsOfType(PackageType.LINUX);
+
+ final String launcherName = cmd.name();
+ final String launcherRelativePath = Path.of("/bin", launcherName).toString();
+
+ return getPackageFiles(cmd).filter(path -> path.toString().endsWith(
+ launcherRelativePath)).findFirst().or(() -> {
+ Test.assertUnexpected(String.format(
+ "Failed to find %s in %s package", launcherName,
+ getPackageName(cmd)));
+ return null;
+ }).get();
+ }
+
+ static String getDebBundleProperty(Path bundle, String fieldName) {
+ return new Executor()
+ .saveFirstLineOfOutput()
+ .setExecutable("dpkg-deb")
+ .addArguments("-f", bundle.toString(), fieldName)
+ .execute()
+ .assertExitCodeIsZero().getFirstLineOfOutput();
+ }
+
+ static String geRpmBundleProperty(Path bundle, String fieldName) {
+ return new Executor()
+ .saveFirstLineOfOutput()
+ .setExecutable("rpm")
+ .addArguments(
+ "-qp",
+ "--queryformat",
+ String.format("%%{%s}", fieldName),
+ bundle.toString())
+ .execute()
+ .assertExitCodeIsZero().getFirstLineOfOutput();
+ }
+
+ private static String getPackageArch(PackageType type) {
+ if (archs == null) {
+ archs = new HashMap<>();
+ }
+
+ String arch = archs.get(type);
+ if (arch == null) {
+ Executor exec = new Executor();
+ exec.saveFirstLineOfOutput();
+ switch (type) {
+ case LINUX_DEB:
+ exec.setExecutable("dpkg").addArgument(
+ "--print-architecture");
+ break;
+
+ case LINUX_RPM:
+ exec.setExecutable("rpmbuild").addArgument(
+ "--eval=%{_target_cpu}");
+ break;
+ }
+ arch = exec.execute().assertExitCodeIsZero().getFirstLineOfOutput();
+ archs.put(type, arch);
+ }
+ return arch;
+ }
+
+ static private Map<PackageType, String> archs;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+package jdk.jpackage.test;
+
+import java.nio.file.Path;
+
+public class MacHelper {
+
+ static String getBundleName(JPackageCommand cmd) {
+ cmd.verifyIsOfType(PackageType.MAC);
+ return String.format("%s-%s%s", getPackageName(cmd), cmd.version(),
+ cmd.packageType().getSuffix());
+ }
+
+ static Path getInstallationDirectory(JPackageCommand cmd) {
+ cmd.verifyIsOfType(PackageType.MAC);
+ String installDir = Path.of(cmd.getArgumentValue("--install-dir",
+ () -> ""), cmd.name()).toString() + ".app";
+ return Path.of("/Applications", installDir);
+ }
+
+ private static String getPackageName(JPackageCommand cmd) {
+ return cmd.getArgumentValue("--mac-bundle-name",
+ () -> cmd.name().toLowerCase());
+ }
+}
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -1,313 +1,347 @@
-/*
- * 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.
- */
-package jdk.jpackage.test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * Instance of PackageTest is for configuring and running a single jpackage
- * command to produce platform specific package bundle.
- *
- * Provides methods hook up custom configuration of jpackage command and
- * verification of the output bundle.
- */
-public final class PackageTest {
-
- /**
- * Default test configuration for jpackage command. Default jpackage command
- * initialization includes:
- * <li>Set --input and --output parameters.
- * <li>Set --name parameter. Value of the parameter is the name of the first
- * class with main function found in the callers stack.
- * Defaults can be
- * overridden with custom initializers set with subsequent addInitializer()
- * function calls.
- */
- public PackageTest() {
- setJPackageExitCode(0);
- handlers = new HashMap<>();
- Arrays.asList(PackageType.values()).stream().forEach(
- v -> handlers.put(v, new Handler(v)));
- }
-
- public PackageTest setJPackageExitCode(int v) {
- expectedJPackageExitCode = 0;
- return this;
- }
-
- public PackageTest addInitializer(Consumer<JPackageCommand> v,
- PackageType... types) {
- normailize(types).forEach(
- type -> handlers.get(type).addInitializer(v));
- return this;
- }
-
- public PackageTest addBundleVerifier(
- BiConsumer<JPackageCommand, Executor.Result> v, PackageType... types) {
- normailize(types).forEach(
- type -> handlers.get(type).addBundleVerifier(v));
- return this;
- }
-
- public PackageTest addBundleVerifier(
- Consumer<JPackageCommand> v, PackageType... types) {
- return addBundleVerifier((cmd, unused) -> v.accept(cmd), types);
- }
-
- public PackageTest addInstallVerifier(Consumer<JPackageCommand> v,
- PackageType... types) {
- normailize(types).forEach(
- type -> handlers.get(type).addInstallVerifier(v));
- return this;
- }
-
- public PackageTest addUninstallVerifier(Consumer<JPackageCommand> v,
- PackageType... types) {
- normailize(types).forEach(
- type -> handlers.get(type).addUninstallVerifier(v));
- return this;
- }
-
- public PackageTest configureHelloApp(PackageType... types) {
- addInitializer(cmd -> cmd.setHelloApp(), types);
- addInstallVerifier(cmd -> JPackageCommand.verifyHelloApp(
- cmd.launcherInstallationPath()), types);
- return this;
- }
-
- public void run() {
- List<Handler> supportedHandlers = handlers.values().stream()
- .filter(entry -> !entry.isVoid())
- .collect(Collectors.toList());
-
- if (supportedHandlers.isEmpty()) {
- return;
- }
-
- Supplier<JPackageCommand> initializer = new Supplier<>() {
- @Override
- public JPackageCommand get() {
- JPackageCommand cmd = new JPackageCommand().setDefaultInputOutput();
- if (bundleOutputDir != null) {
- cmd.setArgumentValue("--output", bundleOutputDir.toString());
- }
- setDefaultAppName(cmd);
- return cmd;
- }
- };
-
- supportedHandlers.forEach(handler -> handler.accept(initializer.get()));
- }
-
- private class Handler implements Consumer<JPackageCommand> {
-
- Handler(PackageType type) {
- this.type = type;
- initializers = new ArrayList<>();
- bundleVerifiers = new ArrayList<>();
- installVerifiers = new ArrayList<>();
- uninstallVerifiers = new ArrayList<>();
- }
-
- boolean isVoid() {
- return initializers.isEmpty();
- }
-
- void addInitializer(Consumer<JPackageCommand> v) {
- if (isSupported()) {
- initializers.add(v);
- }
- }
-
- void addBundleVerifier(BiConsumer<JPackageCommand, Executor.Result> v) {
- if (isSupported()) {
- bundleVerifiers.add(v);
- }
- }
-
- void addInstallVerifier(Consumer<JPackageCommand> v) {
- if (isSupported()) {
- installVerifiers.add(v);
- }
- }
-
- void addUninstallVerifier(Consumer<JPackageCommand> v) {
- if (isSupported()) {
- uninstallVerifiers.add(v);
- }
- }
-
- @Override
- public void accept(JPackageCommand cmd) {
- type.applyTo(cmd);
-
- initializers.stream().forEach(v -> v.accept(cmd));
- switch (action) {
- case CREATE:
- Executor.Result result = cmd.execute();
- result.assertExitCodeIs(expectedJPackageExitCode);
- final File bundle = cmd.outputBundle().toFile();
- if (expectedJPackageExitCode == 0) {
- Test.assertTrue(bundle.exists(), String.format(
- "Check file [%s] exists", bundle));
- } else {
- Test.assertFalse(bundle.exists(), String.format(
- "Check file [%s] doesn't exist", bundle));
- }
-
- verifyPackageBundle(JPackageCommand.createImmutable(cmd), result);
- break;
-
- case VERIFY_INSTALLED:
- verifyPackageInstalled(JPackageCommand.createImmutable(cmd));
- break;
-
- case VERIFY_UNINSTALLED:
- verifyPackageUninstalled(JPackageCommand.createImmutable(cmd));
- break;
- }
- }
-
- private void verifyPackageBundle(JPackageCommand cmd, Executor.Result result) {
- bundleVerifiers.stream().forEach(v -> v.accept(cmd, result));
- }
-
- private void verifyPackageInstalled(JPackageCommand cmd) {
- verifyInstalledLauncher(cmd.launcherInstallationPath().toFile());
- installVerifiers.stream().forEach(v -> v.accept(cmd));
- }
-
- private void verifyPackageUninstalled(JPackageCommand cmd) {
- verifyUninstalledLauncher(cmd.launcherInstallationPath().toFile());
- uninstallVerifiers.stream().forEach(v -> v.accept(cmd));
- }
-
- private boolean isSupported() {
- return type.getName() != null && type.isSupported();
- }
-
- private final PackageType type;
- private final List<Consumer<JPackageCommand>> initializers;
- private final List<BiConsumer<JPackageCommand, Executor.Result>> bundleVerifiers;
- private final List<Consumer<JPackageCommand>> installVerifiers;
- private final List<Consumer<JPackageCommand>> uninstallVerifiers;
- }
-
- private void setDefaultAppName(JPackageCommand cmd) {
- StackTraceElement st[] = Thread.currentThread().getStackTrace();
- for (StackTraceElement ste : st) {
- if ("main".equals(ste.getMethodName())) {
- String name = ste.getClassName();
- name = name.substring(name.lastIndexOf('.') + 1);
- cmd.addArguments("--name", name);
- break;
- }
- }
- }
-
- private Stream<PackageType> normailize(PackageType[] types) {
- if (types == null || types.length == 0) {
- return Arrays.stream(PackageType.values());
- }
- return Arrays.stream(types).distinct();
- }
-
- private void verifyInstalledLauncher(File launcher) {
- Test.assertTrue(launcher.isFile(), String.format(
- "Check application launcher [%s] is a file", launcher));
- Test.assertTrue(launcher.canExecute(), String.format(
- "Check application launcher [%s] can be executed", launcher));
- }
-
- private void verifyUninstalledLauncher(File launcher) {
- Test.assertFalse(launcher.exists(), String.format(
- "Check application launcher [%s] is not installed", launcher));
- File installDir = launcher.getParentFile().getParentFile();
- Test.assertFalse(installDir.exists(), String.format(
- "Check application installation directory [%s] is not available",
- installDir));
- }
-
- private int expectedJPackageExitCode;
- private Map<PackageType, Handler> handlers;
-
- /**
- * Test action.
- */
- static private enum Action {
- /**
- * Create bundle.
- */
- CREATE,
-
- /**
- * Verify bundle installed.
- */
- VERIFY_INSTALLED,
-
- /**
- * Verify bundle uninstalled.
- */
- VERIFY_UNINSTALLED
- };
- private final static Action action;
- private final static File bundleOutputDir;
-
- static {
- final String JPACKAGE_TEST_OUTPUT = "jpackage.test.output";
-
- String val = System.getProperty(JPACKAGE_TEST_OUTPUT);
- if (val == null) {
- bundleOutputDir = null;
- } else {
- bundleOutputDir = new File(val).getAbsoluteFile();
-
- Test.assertTrue(bundleOutputDir.isDirectory(), String.format(
- "Check value of %s property [%s] references a directory",
- JPACKAGE_TEST_OUTPUT, bundleOutputDir));
- Test.assertTrue(bundleOutputDir.canWrite(), String.format(
- "Check value of %s property [%s] references writable directory",
- JPACKAGE_TEST_OUTPUT, bundleOutputDir));
- }
- }
-
- static {
- if (System.getProperty("jpackage.verify.install") != null) {
- action = Action.VERIFY_INSTALLED;
- } else if (System.getProperty("jpackage.verify.uninstall") != null) {
- action = Action.VERIFY_UNINSTALLED;
- } else {
- action = Action.CREATE;
- }
- }
-}
+/*
+ * 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.
+ */
+package jdk.jpackage.test;
+
+import java.io.File;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * Instance of PackageTest is for configuring and running a single jpackage
+ * command to produce platform specific package bundle.
+ *
+ * Provides methods hook up custom configuration of jpackage command and
+ * verification of the output bundle.
+ */
+public final class PackageTest {
+
+ /**
+ * Default test configuration for jpackage command. Default jpackage command
+ * initialization includes:
+ * <li>Set --input and --output parameters.
+ * <li>Set --name parameter. Value of the parameter is the name of the first
+ * class with main function found in the callers stack. Defaults can be
+ * overridden with custom initializers set with subsequent addInitializer()
+ * function calls.
+ */
+ public PackageTest() {
+ action = DEFAULT_ACTION;
+ forTypes();
+ setJPackageExitCode(0);
+ handlers = new HashMap<>();
+ currentTypes.forEach(v -> handlers.put(v, new Handler(v)));
+ }
+
+ public PackageTest forTypes(PackageType... types) {
+ Collection<PackageType> newTypes;
+ if (types == null || types.length == 0) {
+ newTypes = PackageType.NATIVE;
+ } else {
+ newTypes = Set.of(types);
+ }
+ currentTypes = newTypes.stream().filter(type -> type.isSupported()).collect(
+ Collectors.toUnmodifiableSet());
+ return this;
+ }
+
+ public PackageTest forTypes(Collection<PackageType> types) {
+ return forTypes(types.toArray(PackageType[]::new));
+ }
+
+ public PackageTest setJPackageExitCode(int v) {
+ expectedJPackageExitCode = 0;
+ return this;
+ }
+
+ public PackageTest addInitializer(Consumer<JPackageCommand> v) {
+ currentTypes.stream().forEach(type -> handlers.get(type).addInitializer(
+ v));
+ return this;
+ }
+
+ public PackageTest addBundleVerifier(
+ BiConsumer<JPackageCommand, Executor.Result> v) {
+ currentTypes.stream().forEach(
+ type -> handlers.get(type).addBundleVerifier(v));
+ return this;
+ }
+
+ public PackageTest addBundleVerifier(Consumer<JPackageCommand> v) {
+ return addBundleVerifier((cmd, unused) -> v.accept(cmd));
+ }
+
+ public PackageTest addBundlePropertyVerifier(String propertyName,
+ BiConsumer<String, String> pred) {
+ return addBundleVerifier(cmd -> {
+ String propertyValue = null;
+ switch (cmd.packageType()) {
+ case LINUX_DEB:
+ propertyValue = LinuxHelper.getDebBundleProperty(
+ cmd.outputBundle(), propertyName);
+ break;
+
+ case LINUX_RPM:
+ propertyValue = LinuxHelper.geRpmBundleProperty(
+ cmd.outputBundle(), propertyName);
+ break;
+
+ default:
+ throw new UnsupportedOperationException();
+ }
+
+ pred.accept(propertyName, propertyValue);
+ });
+ }
+
+ public PackageTest addBundlePropertyVerifier(String propertyName,
+ String expectedPropertyValue) {
+ return addBundlePropertyVerifier(propertyName, (unused, v) -> {
+ Test.assertEquals(expectedPropertyValue, v, String.format(
+ "Check value of %s property is [%s]", propertyName, v));
+ });
+ }
+
+ public PackageTest addInstallVerifier(Consumer<JPackageCommand> v) {
+ currentTypes.stream().forEach(
+ type -> handlers.get(type).addInstallVerifier(v));
+ return this;
+ }
+
+ public PackageTest addUninstallVerifier(Consumer<JPackageCommand> v) {
+ currentTypes.stream().forEach(
+ type -> handlers.get(type).addUninstallVerifier(v));
+ return this;
+ }
+
+ public PackageTest configureHelloApp() {
+ addInitializer(cmd -> HelloApp.addTo(cmd));
+ addInstallVerifier(cmd -> HelloApp.executeAndVerifyOutput(
+ cmd.launcherInstallationPath(), cmd.getAllArgumentValues(
+ "--arguments")));
+ return this;
+ }
+
+ public void run() {
+ List<Handler> supportedHandlers = handlers.values().stream()
+ .filter(entry -> !entry.isVoid())
+ .collect(Collectors.toList());
+
+ if (supportedHandlers.isEmpty()) {
+ // No handlers with initializers found. Nothing to do.
+ return;
+ }
+
+ Supplier<JPackageCommand> initializer = new Supplier<>() {
+ @Override
+ public JPackageCommand get() {
+ JPackageCommand cmd = new JPackageCommand().setDefaultInputOutput();
+ if (bundleOutputDir != null) {
+ cmd.setArgumentValue("--output", bundleOutputDir.toString());
+ }
+ cmd.setDefaultAppName();
+ return cmd;
+ }
+ };
+
+ supportedHandlers.forEach(handler -> handler.accept(initializer.get()));
+ }
+
+ public PackageTest setAction(Action value) {
+ action = value;
+ return this;
+ }
+
+ public Action getAction() {
+ return action;
+ }
+
+ private class Handler implements Consumer<JPackageCommand> {
+
+ Handler(PackageType type) {
+ if (!PackageType.NATIVE.contains(type)) {
+ throw new IllegalArgumentException(
+ "Attempt to configure a test for image packaging");
+ }
+ this.type = type;
+ initializers = new ArrayList<>();
+ bundleVerifiers = new ArrayList<>();
+ installVerifiers = new ArrayList<>();
+ uninstallVerifiers = new ArrayList<>();
+ }
+
+ boolean isVoid() {
+ return initializers.isEmpty();
+ }
+
+ void addInitializer(Consumer<JPackageCommand> v) {
+ initializers.add(v);
+ }
+
+ void addBundleVerifier(BiConsumer<JPackageCommand, Executor.Result> v) {
+ bundleVerifiers.add(v);
+ }
+
+ void addInstallVerifier(Consumer<JPackageCommand> v) {
+ installVerifiers.add(v);
+ }
+
+ void addUninstallVerifier(Consumer<JPackageCommand> v) {
+ uninstallVerifiers.add(v);
+ }
+
+ @Override
+ public void accept(JPackageCommand cmd) {
+ type.applyTo(cmd);
+
+ initializers.stream().forEach(v -> v.accept(cmd));
+ switch (action) {
+ case CREATE:
+ Executor.Result result = cmd.execute();
+ result.assertExitCodeIs(expectedJPackageExitCode);
+ Test.assertFileExists(cmd.outputBundle(),
+ expectedJPackageExitCode == 0);
+ verifyPackageBundle(JPackageCommand.createImmutable(cmd),
+ result);
+ break;
+
+ case VERIFY_INSTALLED:
+ verifyPackageInstalled(JPackageCommand.createImmutable(cmd));
+ break;
+
+ case VERIFY_UNINSTALLED:
+ verifyPackageUninstalled(
+ JPackageCommand.createImmutable(cmd));
+ break;
+ }
+ }
+
+ private void verifyPackageBundle(JPackageCommand cmd,
+ Executor.Result result) {
+ bundleVerifiers.stream().forEach(v -> v.accept(cmd, result));
+ }
+
+ private void verifyPackageInstalled(JPackageCommand cmd) {
+ Test.trace(String.format("Verify installed: %s",
+ cmd.getPrintableCommandLine()));
+ if (cmd.isRuntime()) {
+ Test.assertDirectoryExists(
+ cmd.appInstallationDirectory().resolve("runtime"), false);
+ Test.assertDirectoryExists(
+ cmd.appInstallationDirectory().resolve("app"), false);
+ }
+
+ Test.assertExecutableFileExists(cmd.launcherInstallationPath(),
+ !cmd.isRuntime());
+
+ if (PackageType.WINDOWS.contains(cmd.packageType())) {
+ new WindowsHelper.AppVerifier(cmd);
+ }
+
+ installVerifiers.stream().forEach(v -> v.accept(cmd));
+ }
+
+ private void verifyPackageUninstalled(JPackageCommand cmd) {
+ Test.trace(String.format("Verify uninstalled: %s",
+ cmd.getPrintableCommandLine()));
+ if (!cmd.isRuntime()) {
+ Test.assertFileExists(cmd.launcherInstallationPath(), false);
+ Test.assertDirectoryExists(cmd.appInstallationDirectory(), false);
+ }
+
+ if (PackageType.WINDOWS.contains(cmd.packageType())) {
+ new WindowsHelper.AppVerifier(cmd);
+ }
+
+ uninstallVerifiers.stream().forEach(v -> v.accept(cmd));
+ }
+
+ private final PackageType type;
+ private final List<Consumer<JPackageCommand>> initializers;
+ private final List<BiConsumer<JPackageCommand, Executor.Result>> bundleVerifiers;
+ private final List<Consumer<JPackageCommand>> installVerifiers;
+ private final List<Consumer<JPackageCommand>> uninstallVerifiers;
+ }
+
+ private Collection<PackageType> currentTypes;
+ private int expectedJPackageExitCode;
+ private Map<PackageType, Handler> handlers;
+ private Action action;
+
+ /**
+ * Test action.
+ */
+ static public enum Action {
+ /**
+ * Create bundle.
+ */
+ CREATE,
+ /**
+ * Verify bundle installed.
+ */
+ VERIFY_INSTALLED,
+ /**
+ * Verify bundle uninstalled.
+ */
+ VERIFY_UNINSTALLED
+ };
+ private final static Action DEFAULT_ACTION;
+ private final static File bundleOutputDir;
+
+ static {
+ final String JPACKAGE_TEST_OUTPUT = "jpackage.test.output";
+
+ String val = System.getProperty(JPACKAGE_TEST_OUTPUT);
+ if (val == null) {
+ bundleOutputDir = null;
+ } else {
+ bundleOutputDir = new File(val).getAbsoluteFile();
+
+ Test.assertTrue(bundleOutputDir.isDirectory(), String.format(
+ "Check value of %s property [%s] references a directory",
+ JPACKAGE_TEST_OUTPUT, bundleOutputDir));
+ Test.assertTrue(bundleOutputDir.canWrite(), String.format(
+ "Check value of %s property [%s] references writable directory",
+ JPACKAGE_TEST_OUTPUT, bundleOutputDir));
+ }
+ }
+
+ static {
+ if (System.getProperty("jpackage.verify.install") != null) {
+ DEFAULT_ACTION = Action.VERIFY_INSTALLED;
+ } else if (System.getProperty("jpackage.verify.uninstall") != null) {
+ DEFAULT_ACTION = Action.VERIFY_UNINSTALLED;
+ } else {
+ DEFAULT_ACTION = Action.CREATE;
+ }
+ }
+}
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageType.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageType.java Tue Sep 10 09:18:19 2019 -0400
@@ -20,27 +20,34 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package jdk.jpackage.test;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* jpackage package type traits.
*/
public enum PackageType {
- WIN_MSI(".msi", "jdk.jpackage.internal.WinMsiBundler"),
- WIN_EXE(".exe", "jdk.jpackage.internal.WinMsiBundler"),
- LINUX_DEB(".deb", "jdk.jpackage.internal.LinuxDebBundler"),
- LINUX_RPM(".rpm", "jdk.jpackage.internal.LinuxRpmBundler"),
- OSX_DMG(".dmg", "jdk.jpackage.internal.MacDmgBundler"),
+ WIN_MSI(".msi",
+ Test.isWindows() ? "jdk.jpackage.internal.WinMsiBundler" : null),
+ WIN_EXE(".exe",
+ Test.isWindows() ? "jdk.jpackage.internal.WinMsiBundler" : null),
+ LINUX_DEB(".deb",
+ Test.isLinux() ? "jdk.jpackage.internal.LinuxDebBundler" : null),
+ LINUX_RPM(".rpm",
+ Test.isLinux() ? "jdk.jpackage.internal.LinuxRpmBundler" : null),
+ MAC_DMG(".dmg", Test.isOSX() ? "jdk.jpackage.internal.MacDmgBundler" : null),
+ MAC_PKG(".pkg", Test.isOSX() ? "jdk.jpackage.internal.MacPkgBundler" : null),
IMAGE(null, null);
PackageType(String bundleSuffix, String bundlerClass) {
suffix = bundleSuffix;
- if (bundlerClass != null) {
+ if (bundlerClass != null && !Inner.DISABLED_PACKAGERS.contains(getName())) {
supported = isBundlerSupported(bundlerClass);
} else {
supported = false;
@@ -72,7 +79,7 @@
static PackageType fromSuffix(String packageFilename) {
if (packageFilename != null) {
- for (PackageType v: values()) {
+ for (PackageType v : values()) {
if (packageFilename.endsWith(v.getSuffix())) {
return v;
}
@@ -85,14 +92,32 @@
try {
Class clazz = Class.forName(bundlerClass);
Method isSupported = clazz.getDeclaredMethod("isSupported");
- return ((Boolean)isSupported.invoke(clazz));
+ return ((Boolean) isSupported.invoke(clazz));
} catch (ClassNotFoundException ex) {
return false;
- } catch (NoSuchMethodException|IllegalAccessException|InvocationTargetException ex) {
+ } catch (IllegalAccessException | InvocationTargetException ex) {
throw new RuntimeException(ex);
+ } catch (NoSuchMethodException ex) {
+ // Not all bundler classes has isSupported() method.
+ return true;
}
}
private final String suffix;
private final boolean supported;
+
+ public final static Set<PackageType> LINUX = Set.of(LINUX_DEB, LINUX_RPM);
+ public final static Set<PackageType> WINDOWS = Set.of(WIN_EXE, WIN_MSI);
+ public final static Set<PackageType> MAC = Set.of(MAC_PKG, MAC_DMG);
+ public final static Set<PackageType> NATIVE = Stream.concat(
+ Stream.concat(LINUX.stream(), WINDOWS.stream()),
+ MAC.stream()).collect(Collectors.toUnmodifiableSet());
+
+ private final static class Inner {
+
+ private final static Set<String> DISABLED_PACKAGERS = Stream.of(
+ Optional.ofNullable(
+ System.getProperty("jpackage.test.disabledPackagers")).orElse(
+ "").split(",")).collect(Collectors.toUnmodifiableSet());
+ }
}
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Test.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/Test.java Tue Sep 10 09:18:19 2019 -0400
@@ -1,170 +1,291 @@
-/*
- * 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.
- */
-package jdk.jpackage.test;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-public class Test {
-
- static final Path TEST_SRC_ROOT = new Supplier<Path>() {
- @Override
- public Path get() {
- Path root = Path.of(System.getProperty("test.src"));
-
- for (int i = 0; i != 10; ++i) {
- if (root.resolve("apps").toFile().isDirectory()) {
- return root.toAbsolutePath();
- }
- root = root.resolve("..");
- }
-
- throw new RuntimeException("Failed to locate apps directory");
- }
- }.get();
-
- static Path workDir() {
- return Path.of(".");
- }
-
- static Path defaultInputDir() {
- return workDir().resolve("input");
- }
-
- static Path defaultOutputDir() {
- return workDir().resolve("output");
- }
-
- static private void log(String v) {
- System.err.println(v);
- }
-
- public static void trace(String v) {
- if (TRACE) {
- log("TRACE: " + v);
- }
- }
-
- private static void traceAssert(String v) {
- if (TRACE_ASSERTS) {
- log("TRACE: " + v);
- }
- }
-
- public static void error(String v) {
- log("ERROR: " + v);
- throw new AssertionError(v);
- }
-
- static Path createTempDirectory() throws IOException {
- return Files.createTempDirectory("jpackage_");
- }
-
- static Path createTempFile(String suffix) throws IOException {
- return File.createTempFile("jpackage_", suffix).toPath();
- }
-
- private static String concatMessages(String msg, String msg2) {
- if (msg2 != null && !msg2.isBlank()) {
- return msg + ": " + msg2;
- }
- return msg;
- }
-
- public static void assertEquals(int expected, int actual, String msg) {
- if (expected != actual) {
- error(concatMessages(String.format(
- "Expected [%d]. Actual [%d]", expected, actual),
- msg));
- }
-
- traceAssert(String.format("assertEquals(%d): %s", expected, msg));
- }
-
- public static void assertEquals(String expected, String actual, String msg) {
- if (expected == null && actual == null) {
- return;
- }
-
- if (actual == null || !expected.equals(actual)) {
- error(concatMessages(String.format(
- "Expected [%s]. Actual [%s]", expected, actual),
- msg));
- }
-
- traceAssert(String.format("assertEquals(%s): %s", expected, msg));
- }
-
- public static void assertNotEquals(int expected, int actual, String msg) {
- if (expected == actual) {
- error(concatMessages(String.format("Unexpected [%d] value", actual),
- msg));
- }
-
- traceAssert(String.format("assertNotEquals(%d, %d): %s", expected,
- actual, msg));
- }
-
- public static void assertTrue(boolean actual, String msg) {
- if (!actual) {
- error(concatMessages("Unexpected FALSE", msg));
- }
-
- traceAssert(String.format("assertTrue(): %s", msg));
- }
-
- public static void assertFalse(boolean actual, String msg) {
- if (actual) {
- error(concatMessages("Unexpected TRUE", msg));
- }
-
- traceAssert(String.format("assertFalse(): %s", msg));
- }
-
- public static void assertUnexpected(String msg) {
- error(concatMessages("Unexpected", msg));
- }
-
- private static final boolean TRACE;
- private static final boolean TRACE_ASSERTS;
-
- static {
- String val = System.getProperty("jpackage.test.suppress-logging");
- if (val == null) {
- TRACE = true;
- TRACE_ASSERTS = true;
- } else {
- Set<String> logOptions = Set.of(val.toLowerCase().split(","));
- TRACE = !(logOptions.contains("trace") || logOptions.contains("t"));
- TRACE_ASSERTS = !(logOptions.contains("assert") || logOptions.contains(
- "a"));
- }
- }
-}
+/*
+ * 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.
+ */
+package jdk.jpackage.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardWatchEventKinds;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
+import java.nio.file.WatchEvent;
+import java.nio.file.WatchKey;
+import java.nio.file.WatchService;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+public class Test {
+
+ public static final Path TEST_SRC_ROOT = new Supplier<Path>() {
+ @Override
+ public Path get() {
+ Path root = Path.of(System.getProperty("test.src"));
+
+ for (int i = 0; i != 10; ++i) {
+ if (root.resolve("apps").toFile().isDirectory()) {
+ return root.toAbsolutePath();
+ }
+ root = root.resolve("..");
+ }
+
+ throw new RuntimeException("Failed to locate apps directory");
+ }
+ }.get();
+
+ public static Path workDir() {
+ return Path.of(".");
+ }
+
+ static Path defaultInputDir() {
+ return workDir().resolve("input");
+ }
+
+ static Path defaultOutputDir() {
+ return workDir().resolve("output");
+ }
+
+ static boolean isWindows() {
+ return (OS.contains("win"));
+ }
+
+ static boolean isOSX() {
+ return (OS.contains("mac"));
+ }
+
+ static boolean isLinux() {
+ return ((OS.contains("nix") || OS.contains("nux")));
+ }
+
+ static private void log(String v) {
+ System.err.println(v);
+ }
+
+ public static void trace(String v) {
+ if (TRACE) {
+ log("TRACE: " + v);
+ }
+ }
+
+ private static void traceAssert(String v) {
+ if (TRACE_ASSERTS) {
+ log("TRACE: " + v);
+ }
+ }
+
+ public static void error(String v) {
+ log("ERROR: " + v);
+ throw new AssertionError(v);
+ }
+
+ public static Path createTempDirectory() throws IOException {
+ return Files.createTempDirectory("jpackage_");
+ }
+
+ public static Path createTempFile(String suffix) throws IOException {
+ return File.createTempFile("jpackage_", suffix).toPath();
+ }
+
+ public static void waitForFileCreated(Path fileToWaitFor,
+ long timeoutSeconds) throws IOException {
+
+ trace(String.format("Wait for file [%s] to be available", fileToWaitFor));
+
+ WatchService ws = FileSystems.getDefault().newWatchService();
+
+ Path watchDirectory = fileToWaitFor.toAbsolutePath().getParent();
+ watchDirectory.register(ws, ENTRY_CREATE, ENTRY_MODIFY);
+
+ long waitUntil = System.currentTimeMillis() + timeoutSeconds * 1000;
+ for (;;) {
+ long timeout = waitUntil - System.currentTimeMillis();
+ assertTrue(timeout > 0, String.format(
+ "Check timeout value %d is positive", timeout));
+
+ WatchKey key = null;
+ try {
+ key = ws.poll(timeout, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ if (key == null) {
+ if (fileToWaitFor.toFile().exists()) {
+ trace(String.format(
+ "File [%s] is available after poll timeout expired",
+ fileToWaitFor));
+ return;
+ }
+ assertUnexpected(String.format("Timeout expired", timeout));
+ }
+
+ for (WatchEvent<?> event : key.pollEvents()) {
+ if (event.kind() == StandardWatchEventKinds.OVERFLOW) {
+ continue;
+ }
+ Path contextPath = (Path) event.context();
+ if (Files.isSameFile(watchDirectory.resolve(contextPath),
+ fileToWaitFor)) {
+ trace(String.format("File [%s] is available", fileToWaitFor));
+ return;
+ }
+ }
+
+ if (!key.reset()) {
+ assertUnexpected("Watch key invalidated");
+ }
+ }
+ }
+
+ private static String concatMessages(String msg, String msg2) {
+ if (msg2 != null && !msg2.isBlank()) {
+ return msg + ": " + msg2;
+ }
+ return msg;
+ }
+
+ public static void assertEquals(int expected, int actual, String msg) {
+ if (expected != actual) {
+ error(concatMessages(String.format(
+ "Expected [%d]. Actual [%d]", expected, actual),
+ msg));
+ }
+
+ traceAssert(String.format("assertEquals(%d): %s", expected, msg));
+ }
+
+ public static void assertEquals(String expected, String actual, String msg) {
+ if (expected == null && actual == null) {
+ return;
+ }
+
+ if (actual == null || !expected.equals(actual)) {
+ error(concatMessages(String.format(
+ "Expected [%s]. Actual [%s]", expected, actual),
+ msg));
+ }
+
+ traceAssert(String.format("assertEquals(%s): %s", expected, msg));
+ }
+
+ public static void assertNotEquals(int expected, int actual, String msg) {
+ if (expected == actual) {
+ error(concatMessages(String.format("Unexpected [%d] value", actual),
+ msg));
+ }
+
+ traceAssert(String.format("assertNotEquals(%d, %d): %s", expected,
+ actual, msg));
+ }
+
+ public static void assertNull(Object value, String msg) {
+ if (value != null) {
+ error(concatMessages(String.format("Unexpected not null value [%s]",
+ value), msg));
+ }
+
+ traceAssert(String.format("assertNull(): %s", msg));
+ }
+
+ public static void assertNotNull(Object value, String msg) {
+ if (value == null) {
+ error(concatMessages("Unexpected null value", msg));
+ }
+
+ traceAssert(String.format("assertNotNull(%s): %s", value, msg));
+ }
+
+ public static void assertTrue(boolean actual, String msg) {
+ if (!actual) {
+ error(concatMessages("Unexpected FALSE", msg));
+ }
+
+ traceAssert(String.format("assertTrue(): %s", msg));
+ }
+
+ public static void assertFalse(boolean actual, String msg) {
+ if (actual) {
+ error(concatMessages("Unexpected TRUE", msg));
+ }
+
+ traceAssert(String.format("assertFalse(): %s", msg));
+ }
+
+ public static void assertPathExists(Path path, boolean exists) {
+ if (exists) {
+ assertTrue(path.toFile().exists(), String.format(
+ "Check [%s] path exists", path));
+ } else {
+ assertFalse(path.toFile().exists(), String.format(
+ "Check [%s] path doesn't exist", path));
+ }
+ }
+
+ public static void assertDirectoryExists(Path path, boolean exists) {
+ assertPathExists(path, exists);
+ if (exists) {
+ assertTrue(path.toFile().isDirectory(), String.format(
+ "Check [%s] is a directory", path));
+ }
+ }
+
+ public static void assertFileExists(Path path, boolean exists) {
+ assertPathExists(path, exists);
+ if (exists) {
+ assertTrue(path.toFile().isFile(), String.format(
+ "Check [%s] is a file", path));
+ }
+ }
+
+ public static void assertExecutableFileExists(Path path, boolean exists) {
+ assertFileExists(path, exists);
+ if (exists) {
+ assertTrue(path.toFile().canExecute(), String.format(
+ "Check [%s] file is executable", path));
+ }
+ }
+
+ public static void assertUnexpected(String msg) {
+ error(concatMessages("Unexpected", msg));
+ }
+
+ private static final boolean TRACE;
+ private static final boolean TRACE_ASSERTS;
+
+ static {
+ String val = System.getProperty("jpackage.test.suppress-logging");
+ if (val == null) {
+ TRACE = true;
+ TRACE_ASSERTS = true;
+ } else {
+ Set<String> logOptions = Set.of(val.toLowerCase().split(","));
+ TRACE = !(logOptions.contains("trace") || logOptions.contains("t"));
+ TRACE_ASSERTS = !(logOptions.contains("assert") || logOptions.contains(
+ "a"));
+ }
+ }
+
+ private static final String OS = System.getProperty("os.name").toLowerCase();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/WindowsHelper.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,245 @@
+/*
+ * 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.
+ */
+package jdk.jpackage.test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class WindowsHelper {
+
+ static String getBundleName(JPackageCommand cmd) {
+ cmd.verifyIsOfType(PackageType.WINDOWS);
+ return String.format("%s-%s%s", cmd.name(), cmd.version(),
+ cmd.packageType().getSuffix());
+ }
+
+ static Path getInstallationDirectory(JPackageCommand cmd) {
+ cmd.verifyIsOfType(PackageType.WINDOWS);
+ Path installDir = Path.of(
+ cmd.getArgumentValue("--install-dir", () -> cmd.name()));
+ if (isUserLocalInstall(cmd)) {
+ return USER_LOCAL.resolve(installDir);
+ }
+ return PROGRAM_FILES.resolve(installDir);
+ }
+
+ private static boolean isUserLocalInstall(JPackageCommand cmd) {
+ return cmd.hasArgument("--win-per-user-install");
+ }
+
+ static class AppVerifier {
+
+ AppVerifier(JPackageCommand cmd) {
+ cmd.verifyIsOfType(PackageType.WINDOWS);
+ this.cmd = cmd;
+ verifyStartMenuShortcut();
+ verifyDesktopShortcut();
+ verifyFileAssociationsRegistry();
+ }
+
+ private void verifyDesktopShortcut() {
+ boolean appInstalled = cmd.launcherInstallationPath().toFile().exists();
+ if (cmd.hasArgument("--win-shortcut")) {
+ if (isUserLocalInstall(cmd)) {
+ verifyUserLocalDesktopShortcut(appInstalled);
+ verifySystemDesktopShortcut(false);
+ } else {
+ verifySystemDesktopShortcut(appInstalled);
+ verifyUserLocalDesktopShortcut(false);
+ }
+ } else {
+ verifySystemDesktopShortcut(false);
+ verifyUserLocalDesktopShortcut(false);
+ }
+ }
+
+ private Path desktopShortcutPath() {
+ return Path.of(cmd.name() + ".lnk");
+ }
+
+ private void verifySystemDesktopShortcut(boolean exists) {
+ Path dir = Path.of(queryRegistryValueCache(
+ SYSTEM_SHELL_FOLDERS_REGKEY, "Common Desktop"));
+ Test.assertFileExists(dir.resolve(desktopShortcutPath()), exists);
+ }
+
+ private void verifyUserLocalDesktopShortcut(boolean exists) {
+ Path dir = Path.of(
+ queryRegistryValueCache(USER_SHELL_FOLDERS_REGKEY, "Desktop"));
+ Test.assertFileExists(dir.resolve(desktopShortcutPath()), exists);
+ }
+
+ private void verifyStartMenuShortcut() {
+ boolean appInstalled = cmd.launcherInstallationPath().toFile().exists();
+ if (cmd.hasArgument("--win-menu") || !cmd.hasArgument("--win-shortcut")) {
+ if (isUserLocalInstall(cmd)) {
+ verifyUserLocalStartMenuShortcut(appInstalled);
+ verifySystemStartMenuShortcut(false);
+ } else {
+ verifySystemStartMenuShortcut(appInstalled);
+ verifyUserLocalStartMenuShortcut(false);
+ }
+ } else {
+ verifySystemStartMenuShortcut(false);
+ verifyUserLocalStartMenuShortcut(false);
+ }
+ }
+
+ private Path startMenuShortcutPath() {
+ return Path.of(cmd.getArgumentValue("--win-menu-group",
+ () -> "Unknown"), cmd.name() + ".lnk");
+ }
+
+ private void verifySystemStartMenuShortcut(boolean exists) {
+ Path dir = Path.of(queryRegistryValueCache(
+ SYSTEM_SHELL_FOLDERS_REGKEY, "Common Programs"));
+ Test.assertFileExists(dir.resolve(startMenuShortcutPath()), exists);
+ }
+
+ private void verifyUserLocalStartMenuShortcut(boolean exists) {
+ Path dir = Path.of(queryRegistryValueCache(
+ USER_SHELL_FOLDERS_REGKEY, "Programs"));
+ Test.assertFileExists(dir.resolve(startMenuShortcutPath()), exists);
+ }
+
+ private void verifyFileAssociationsRegistry() {
+ Path faFile = cmd.getArgumentValue("--file-associations",
+ () -> (Path) null, Path::of);
+ if (faFile == null) {
+ return;
+ }
+
+ boolean appInstalled = cmd.launcherInstallationPath().toFile().exists();
+ try {
+ Test.trace(String.format(
+ "Get file association properties from [%s] file",
+ faFile));
+ Map<String, String> faProps = Files.readAllLines(faFile).stream().filter(
+ line -> line.trim().startsWith("extension=") || line.trim().startsWith(
+ "mime-type=")).map(
+ line -> {
+ String[] keyValue = line.trim().split("=", 2);
+ return Map.entry(keyValue[0], keyValue[1]);
+ }).collect(Collectors.toMap(
+ entry -> entry.getKey(),
+ entry -> entry.getValue()));
+ String suffix = faProps.get("extension");
+ String contentType = faProps.get("mime-type");
+ Test.assertNotNull(suffix, String.format(
+ "Check file association suffix [%s] is found in [%s] property file",
+ suffix, faFile));
+ Test.assertNotNull(contentType, String.format(
+ "Check file association content type [%s] is found in [%s] property file",
+ contentType, faFile));
+ verifyFileAssociations(appInstalled, "." + suffix, contentType);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private void verifyFileAssociations(boolean exists, String suffix,
+ String contentType) {
+ String contentTypeFromRegistry = queryRegistryValue(Path.of(
+ "HKLM\\Software\\Classes", suffix).toString(),
+ "Content Type");
+ String suffixFromRegistry = queryRegistryValue(
+ "HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\" + contentType,
+ "Extension");
+
+ if (exists) {
+ Test.assertEquals(suffix, suffixFromRegistry,
+ "Check suffix in registry is as expected");
+ Test.assertEquals(contentType, contentTypeFromRegistry,
+ "Check content type in registry is as expected");
+ } else {
+ Test.assertNull(suffixFromRegistry,
+ "Check suffix in registry not found");
+ Test.assertNull(contentTypeFromRegistry,
+ "Check content type in registry not found");
+ }
+ }
+
+ private final JPackageCommand cmd;
+ }
+
+ private static String queryRegistryValue(String keyPath, String valueName) {
+ Executor.Result status = new Executor()
+ .setExecutable("reg")
+ .saveOutput()
+ .addArguments("query", keyPath, "/v", valueName)
+ .execute();
+ if (status.exitCode == 1) {
+ // Should be the case of no such registry value or key
+ String lookupString = "ERROR: The system was unable to find the specified registry key or value.";
+ status.getOutput().stream().filter(line -> line.equals(lookupString)).findFirst().orElseThrow(
+ () -> new RuntimeException(String.format(
+ "Failed to find [%s] string in the output",
+ lookupString)));
+ Test.trace(String.format(
+ "Registry value [%s] at [%s] path not found", valueName,
+ keyPath));
+ return null;
+ }
+
+ String value = status.assertExitCodeIsZero().getOutput().stream().skip(2).findFirst().orElseThrow();
+ // Extract the last field from the following line:
+ // Common Desktop REG_SZ C:\Users\Public\Desktop
+ value = value.split(" REG_SZ ")[1];
+
+ Test.trace(String.format("Registry value [%s] at [%s] path is [%s]",
+ valueName, keyPath, value));
+
+ return value;
+ }
+
+ private static String queryRegistryValueCache(String keyPath,
+ String valueName) {
+ String key = String.format("[%s][%s]", keyPath, valueName);
+ String value = REGISTRY_VALUES.get(key);
+ if (value == null) {
+ value = queryRegistryValue(keyPath, valueName);
+ REGISTRY_VALUES.put(key, value);
+ }
+
+ return value;
+ }
+
+ // jtreg resets %ProgramFiles% environment variable by some reason.
+ private final static Path PROGRAM_FILES = Path.of(Optional.ofNullable(
+ System.getenv("ProgramFiles")).orElse("C:\\Program Files"));
+
+ private final static Path USER_LOCAL = Path.of(System.getProperty(
+ "user.home"),
+ "AppData", "Local");
+
+ private final static String SYSTEM_SHELL_FOLDERS_REGKEY = "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
+ private final static String USER_SHELL_FOLDERS_REGKEY = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
+
+ private static final Map<String, String> REGISTRY_VALUES = new HashMap<>();
+}
--- a/test/jdk/tools/jpackage/linux/AppCategoryTest.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/linux/AppCategoryTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -1,75 +1,67 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import jdk.jpackage.test.LinuxHelper;
-import jdk.jpackage.test.PackageTest;
-import jdk.jpackage.test.PackageType;
-import jdk.jpackage.test.Test;
-
-
-/**
- * Test --linux-app-category parameter. Output of the test should be
- * appcategorytest_1.0-1_amd64.deb or appcategorytest-1.0-1.amd64.rpm package
- * bundle. The output package should provide the same functionality as the
- * default package.
- *
- * deb:
- * Section property of the package should be set to Foo value.
- *
- * rpm:
- * Group property of the package should be set to Foo value.
- */
-
-
-/*
- * @test
- * @summary jpackage with --linux-app-category
- * @library ../helpers
- * @requires (os.family == "linux")
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=360 -Xmx512m AppCategoryTest
- */
-public class AppCategoryTest {
-
- public static void main(String[] args) throws Exception {
- final String CATEGORY = "Foo";
-
- new PackageTest().configureHelloApp().addInitializer(cmd -> {
- cmd.addArguments("--linux-app-category", CATEGORY);
- }).addBundleVerifier(cmd -> {
- final String field = "Section";
- String value = LinuxHelper.getDebBundleProperty(
- cmd.outputBundle(), field);
- Test.assertEquals(CATEGORY, value,
- String.format("Check value of %s field is [%s]",
- field, CATEGORY));
- }, PackageType.LINUX_DEB).addBundleVerifier(cmd -> {
- final String field = "Group";
- String value = LinuxHelper.geRpmBundleProperty(
- cmd.outputBundle(), field);
- Test.assertEquals(CATEGORY, value,
- String.format("Check value of %s field is [%s]",
- field, CATEGORY));
- }, PackageType.LINUX_RPM).run();
- }
-}
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+
+/**
+ * Test --linux-app-category parameter. Output of the test should be
+ * appcategorytest_1.0-1_amd64.deb or appcategorytest-1.0-1.amd64.rpm package
+ * bundle. The output package should provide the same functionality as the
+ * default package.
+ *
+ * deb:
+ * Section property of the package should be set to Foo value.
+ *
+ * rpm:
+ * Group property of the package should be set to Foo value.
+ */
+
+
+/*
+ * @test
+ * @summary jpackage with --linux-app-category
+ * @library ../helpers
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m AppCategoryTest
+ */
+public class AppCategoryTest {
+
+ public static void main(String[] args) throws Exception {
+ final String CATEGORY = "Foo";
+
+ new PackageTest()
+ .forTypes(PackageType.LINUX)
+ .configureHelloApp()
+ .addInitializer(cmd -> {
+ cmd.addArguments("--linux-app-category", CATEGORY);
+ })
+ .forTypes(PackageType.LINUX_DEB)
+ .addBundlePropertyVerifier("Section", CATEGORY)
+ .forTypes(PackageType.LINUX_RPM)
+ .addBundlePropertyVerifier("Group", CATEGORY)
+ .run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/BundleNameTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+
+/**
+ * Test --linux-bundle-name parameter. Output of the test should be
+ * quickbrownfox2_1.0-1_amd64.deb or quickbrownfox2-1.0-1.amd64.rpm package
+ * bundle. The output package should provide the same functionality as the
+ * default package.
+ *
+ * deb:
+ * Package property of the package should be set to quickbrownfox2.
+ *
+ * rpm:
+ * Name property of the package should be set to quickbrownfox2.
+ */
+
+
+/*
+ * @test
+ * @summary jpackage with --linux-bundle-name
+ * @library ../helpers
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m BundleNameTest
+ */
+public class BundleNameTest {
+
+ public static void main(String[] args) throws Exception {
+ final String PACKAGE_NAME = "quickbrownfox2";
+
+ new PackageTest()
+ .forTypes(PackageType.LINUX)
+ .configureHelloApp()
+ .addInitializer(cmd -> {
+ cmd.addArguments("--linux-bundle-name", PACKAGE_NAME);
+ })
+ .forTypes(PackageType.LINUX_DEB)
+ .addBundlePropertyVerifier("Package", PACKAGE_NAME)
+ .forTypes(PackageType.LINUX_RPM)
+ .addBundlePropertyVerifier("Name", PACKAGE_NAME)
+ .run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/LicenseTypeTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,57 @@
+/*
+ * 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 jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+
+/**
+ * Test --linux-rpm-license-type parameter. Output of the test should be
+ * licensetypetest-1.0-1.amd64.rpm package bundle. The output package
+ * should provide the same functionality as the
+ * default package.
+ * License property of the package should be set to JP_LICENSE_TYPE.
+ */
+
+
+/*
+ * @test
+ * @summary jpackage with --linux-rpm-license-type
+ * @library ../helpers
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m LicenseTypeTest
+ */
+public class LicenseTypeTest {
+
+ public static void main(String[] args) throws Exception {
+ final String LICENSE_TYPE = "JP_LICENSE_TYPE";
+
+ new PackageTest().forTypes(PackageType.LINUX_RPM).configureHelloApp()
+ .addInitializer(cmd -> {
+ cmd.addArguments("--linux-rpm-license-type", LICENSE_TYPE);
+ })
+ .addBundlePropertyVerifier("License", LICENSE_TYPE)
+ .run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/MaintainerTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,64 @@
+/*
+ * 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 jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+import jdk.jpackage.test.Test;
+
+
+/**
+ * Test --linux-deb-maintainer parameter. Output of the test should be
+ * maintainertest_1.0-1_amd64.deb package bundle. The output package
+ * should provide the same functionality as the
+ * default package.
+ * Value of Maintainer property of the package should contain
+ * jpackage-test@java.com email address.
+ */
+
+
+/*
+ * @test
+ * @summary jpackage with --linux-deb-maintainer
+ * @library ../helpers
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m MaintainerTest
+ */
+public class MaintainerTest {
+
+ public static void main(String[] args) throws Exception {
+ final String MAINTAINER = "jpackage-test@java.com";
+
+ new PackageTest().forTypes(PackageType.LINUX_DEB).configureHelloApp()
+ .addInitializer(cmd -> {
+ cmd.addArguments("--linux-deb-maintainer", MAINTAINER);
+ })
+ .addBundlePropertyVerifier("Maintainer", (propName, propValue) -> {
+ String lookupValue = "<" + MAINTAINER + ">";
+ Test.assertTrue(propValue.endsWith(lookupValue),
+ String.format("Check value of %s property [%s] ends with %s",
+ propName, propValue, lookupValue));
+ })
+ .run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/linux/PackageDepsTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+
+/**
+ * Test --linux-package-deps parameter. Output of the test should be
+ * apackagedepstestprereq_1.0-1_amd64.deb and packagedepstest_1.0-1_amd64.deb or
+ * apackagedepstestprereq-1.0-1.amd64.rpm and packagedepstest-1.0-1.amd64.rpm
+ * package bundles. The output packages should provide the same functionality as
+ * the default package.
+ *
+ * deb: Value of Depends property of packagedepstest package should contain
+ * apackagedepstestprereq word.
+ *
+ * rpm: Value of Requires property of packagedepstest package should contain
+ * apackagedepstestprereq word.
+ */
+
+
+/*
+ * @test
+ * @summary jpackage with --linux-package-deps
+ * @library ../helpers
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m PackageDepsTest
+ */
+public class PackageDepsTest {
+
+ // Pick the name of prerequisite package to be alphabetically
+ // preceeding the main package name.
+ // This is needed to make Bash script batch installing/uninstalling packages
+ // produced by jtreg tests install/uninstall packages in the right order.
+ static class APackageDepsTestPrereq {
+
+ public static void main(String[] args) throws Exception {
+ new PackageTest().forTypes(PackageType.LINUX).configureHelloApp().run();
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ final String PREREQ_PACKAGE_NAME = "apackagedepstestprereq";
+
+ APackageDepsTestPrereq.main(args);
+
+ new PackageTest()
+ .forTypes(PackageType.LINUX)
+ .configureHelloApp()
+ .addInitializer(cmd -> {
+ cmd.addArguments("--linux-package-deps", PREREQ_PACKAGE_NAME);
+ })
+ .forTypes(PackageType.LINUX_DEB)
+ .addBundlePropertyVerifier("Depends", PREREQ_PACKAGE_NAME)
+ .forTypes(PackageType.LINUX_RPM)
+ .addBundlePropertyVerifier("Requires", PREREQ_PACKAGE_NAME)
+ .run();
+ }
+}
--- a/test/jdk/tools/jpackage/linux/ReleaseTest.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/linux/ReleaseTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -1,74 +1,71 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import jdk.jpackage.test.LinuxHelper;
-import jdk.jpackage.test.PackageTest;
-import jdk.jpackage.test.PackageType;
-import jdk.jpackage.test.Test;
-
-
-/**
- * Test --linux-app-release parameter. Output of the test should be
- * releasetest_1.0-Rc3_amd64.deb or releasetest-1.0-Rc3.amd64.rpm package
- * bundle. The output package should provide the same functionality as the
- * default package.
- *
- * deb:
- * Version property of the package should end with -Rc3 substring.
- *
- * rpm:
- * Release property of the package should be set to Rc3 value.
- */
-
-/*
- * @test
- * @summary jpackage with --linux-app-release
- * @library ../helpers
- * @requires (os.family == "linux")
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=360 -Xmx512m ReleaseTest
- */
-public class ReleaseTest {
-
- public static void main(String[] args) throws Exception {
- final String RELEASE = "Rc3";
-
- new PackageTest().configureHelloApp().addInitializer(cmd -> {
- cmd.addArguments("--linux-app-release", RELEASE);
- }).addBundleVerifier(cmd -> {
- final String field = "Version";
- String version = LinuxHelper.getDebBundleProperty(
- cmd.outputBundle(), field);
- Test.assertTrue(version.endsWith("-" + RELEASE),
- String.format("Check value of %s field [%s] ends with %s",
- field, version, RELEASE));
- }, PackageType.LINUX_DEB).addBundleVerifier(cmd -> {
- final String field = "Release";
- String value = LinuxHelper.geRpmBundleProperty(
- cmd.outputBundle(), "Release");
- Test.assertEquals(RELEASE, value,
- String.format("Check value of %s field is [%s]",
- field, RELEASE));
- }, PackageType.LINUX_RPM).run();
- }
-}
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+import jdk.jpackage.test.Test;
+
+
+/**
+ * Test --linux-app-release parameter. Output of the test should be
+ * releasetest_1.0-Rc3_amd64.deb or releasetest-1.0-Rc3.amd64.rpm package
+ * bundle. The output package should provide the same functionality as the
+ * default package.
+ *
+ * deb:
+ * Version property of the package should end with -Rc3 substring.
+ *
+ * rpm:
+ * Release property of the package should be set to Rc3 value.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --linux-app-release
+ * @library ../helpers
+ * @requires (os.family == "linux")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m ReleaseTest
+ */
+public class ReleaseTest {
+
+ public static void main(String[] args) throws Exception {
+ final String RELEASE = "Rc3";
+
+ new PackageTest()
+ .forTypes(PackageType.LINUX)
+ .configureHelloApp()
+ .addInitializer(cmd -> {
+ cmd.addArguments("--linux-app-release", RELEASE);
+ })
+ .forTypes(PackageType.LINUX_RPM)
+ .addBundlePropertyVerifier("Release", RELEASE)
+ .forTypes(PackageType.LINUX_DEB)
+ .addBundlePropertyVerifier("Version", (propName, propValue) -> {
+ Test.assertTrue(propValue.endsWith("-" + RELEASE),
+ String.format("Check value of %s property [%s] ends with %s",
+ propName, propValue, RELEASE));
+ })
+ .run();
+ }
+}
--- a/test/jdk/tools/jpackage/linux/base/Base.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-
-public class Base {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static String getArch(String[] commandLine) throws Exception {
- File out = File.createTempFile(commandLine[0], ".out");
- out.deleteOnExit();
- int code = JPackageHelper.execute(out, commandLine);
- if (code != 0) {
- throw new AssertionError("Error: unable to get arch");
- }
- return Files.readString(out.toPath()).strip();
- }
-
- static String getBundlePath(String basename, String ext) throws Exception {
- return getBundlePath(basename, "1.0", "1", ext);
- }
-
- static String getBundlePath(String basename, String version, String release, String ext)
- throws Exception {
- String name;
- if (ext.equals("rpm")) {
- String arch = getArch(new String[] { "rpmbuild", "--eval=%{_target_cpu}" });
- name = basename + "-" + version + "-" + release + "." + arch;
- } else {
- String arch = getArch(new String[] { "dpkg", "--print-architecture" });
- name = basename + "_" + version + "-" + release + "_" + arch;
- }
- return Path.of("output", name + "." + ext).toString();
- }
-
- private static void init(String name, String ext) throws Exception {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = getBundlePath(TEST_NAME, EXT);
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello" };
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/base/BundleNameBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class BundleNameBase {
-
- private static String TEST_NAME;
- private static String BUNDLE_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) throws Exception {
- TEST_NAME = name;
- BUNDLE_NAME = "jpackage-test-bundle-name";
- EXT = ext;
- OUTPUT = Base.getBundlePath(BUNDLE_NAME, EXT);
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--linux-bundle-name", BUNDLE_NAME};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/base/FileAssociationsBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.Desktop;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class FileAssociationsBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String TEST_EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void validateAppOutput() throws Exception {
- File outFile = new File("appOutput.txt");
- int count = 10;
- boolean bOutputCreated = false;
- while (count > 0) {
- if (!outFile.exists()) {
- Thread.sleep(3000);
- count--;
- } else {
- bOutputCreated = true;
- break;
- }
- }
-
- if (!bOutputCreated) {
- throw new AssertionError(outFile.getAbsolutePath() + " was not created");
- }
-
- String output = Files.readString(outFile.toPath());
- String[] result = output.split("\n");
- if (result.length != 3) {
- System.err.println(output);
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 1")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- File faFile = new File(TEST_NAME + "." + TEST_EXT);
- if (!result[2].trim().equals(faFile.getAbsolutePath())) {
- throw new AssertionError("Unexpected result[2]: " + result[2]);
- }
- }
-
- private static void verifyInstall() throws Exception {
- createAssociationsTestFile();
- Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
- validateAppOutput();
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void createAssociationsTestFile() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
- out.println(TEST_NAME);
- }
- }
-
- private static void createAssociationsProperties() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter("fa.properties")))) {
- out.println("extension=" + TEST_EXT);
- out.println("mime-type=application/x-jpackage-" + TEST_EXT);
- out.println("description=jpackage test extention");
- }
- }
-
- private static void init(String name, String ext) throws Exception {
- TEST_NAME = name;
- EXT = ext;
- TEST_EXT = "jptest1";
- OUTPUT = Base.getBundlePath(TEST_NAME, EXT);
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--file-associations", "fa.properties"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- createAssociationsProperties();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/base/InstallDirBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class InstallDirBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp("jpackage", TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder("jpackage", TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- folderPath = JPackagePath.getLinuxInstallFolder("jpackage", null);
- folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) throws Exception {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = Base.getBundlePath(TEST_NAME, EXT);
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--install-dir", "/opt/jpackage"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/base/LicenseBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-
-public class LicenseBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- File licenseFile = null;
- if (EXT.equals("rpm")) {
- licenseFile = getRpmLicenseFileInstallLocation();
- } else if (EXT.equals("deb")) {
- licenseFile = getDebLicenseFileInstallLocation();
- }
- if (!licenseFile.exists()) {
- throw new AssertionError(
- "Error: " + licenseFile.getAbsolutePath() + " not found");
- }
- }
-
- private static File getRpmLicenseFileInstallLocation() throws Exception {
- final String infoResult = "infoResult.txt";
- int retVal = JPackageHelper.execute(new File(infoResult), "rpm",
- "--eval", "%{_defaultlicensedir}");
- if (retVal != 0) {
- throw new AssertionError("rpm exited with error: " + retVal);
- }
-
- final String rootLicenseDir = Files.readString(Path.of(infoResult)).replaceAll(
- "(\\r|\\n)", "");
-
- retVal = JPackageHelper.execute(new File(infoResult), "rpm",
- "-q", "--queryformat", "%{name}-%{version}",
- TEST_NAME.toLowerCase());
- if (retVal != 0) {
- throw new AssertionError("rpm exited with error: " + retVal);
- }
-
- final String testPackageName = Files.readString(Path.of(infoResult));
-
- return Path.of(rootLicenseDir, testPackageName, new File(
- JPackagePath.getLicenseFilePath()).getName()).toFile();
- }
-
- private static File getDebLicenseFileInstallLocation() throws Exception {
- return Path.of("/usr", "share", "doc", TEST_NAME.toLowerCase(),
- "copyright").toFile();
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError(
- "Error: " + folder.getAbsolutePath() + " exist");
- }
-
- if (EXT.equals("rpm")) {
- final File licenseFileFolder = getRpmLicenseFileInstallLocation().getParentFile();
- if (folder.exists()) {
- throw new AssertionError(
- "Error: " + licenseFileFolder.getAbsolutePath() + " exist");
- }
- } else if (EXT.equals("deb")) {
- final File licenseFileFolder = getDebLicenseFileInstallLocation().getParentFile();
- if (folder.exists()) {
- throw new AssertionError(
- "Error: " + licenseFileFolder.getAbsolutePath() + " exist");
- }
- }
- }
-
- private static void init(String name, String ext) throws Exception {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = Base.getBundlePath(TEST_NAME, EXT);
- CMD = new String [] {
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--license-file", JPackagePath.getLicenseFilePath()};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/base/LicenseTypeBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class LicenseTypeBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String JP_LICENSE_TYPE;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static final String infoResult = "infoResult.txt";
- private static void validatePackage() throws Exception {
- int retVal = JPackageHelper.execute(new File(infoResult),"rpm",
- "-qp", "--queryformat", "%{license}", OUTPUT.toLowerCase());
- if (retVal != 0) {
- throw new AssertionError("rpm exited with error: " + retVal);
- }
-
- File outfile = new File(infoResult);
- if (!outfile.exists()) {
- throw new AssertionError(infoResult + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- if (!output.equals(JP_LICENSE_TYPE)) {
- throw new AssertionError("Unexpected result: " + output);
- }
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- validatePackage();
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) throws Exception {
- TEST_NAME = name;
- EXT = ext;
- JP_LICENSE_TYPE = "JP_LICENSE_TYPE";
- OUTPUT = Base.getBundlePath(TEST_NAME, EXT);
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--linux-rpm-license-type", JP_LICENSE_TYPE};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/base/MaintainerBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MaintainerBase {
-
- private static String TEST_NAME;
- private static String EMAIL;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static final String infoResult = "infoResult.txt";
- private static void validatePackage() throws Exception {
- int retVal = JPackageHelper.execute(new File(infoResult), "dpkg",
- "--info", OUTPUT.toLowerCase());
- if (retVal != 0) {
- throw new AssertionError("dpkg exited with error: " + retVal);
- }
-
- File outfile = new File(infoResult);
- if (!outfile.exists()) {
- throw new AssertionError(infoResult + " was not created");
- }
-
- boolean maintainerFound = false;
- for (String line: Files.readAllLines(outfile.toPath())) {
- if (line.matches("^[ ]*Maintainer:.*$")) {
- maintainerFound = true;
- if (!line.contains(EMAIL)) {
- throw new AssertionError("Unexpected result: " + line);
- }
- }
- }
- if (!maintainerFound) {
- throw new AssertionError("Maintainer field not found");
- }
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- validatePackage();
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) throws Exception {
- TEST_NAME = name;
- EMAIL = "jpackage-test@java.com";
- EXT = ext;
- OUTPUT = Base.getBundlePath(TEST_NAME, EXT);
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--linux-deb-maintainer", EMAIL};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/base/PackageDepsBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +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 PackageDepsBase {
-
- private static String TEST_NAME;
- private static String DEP_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String OUTPUT_DEP;
- private static String[] CMD;
- private static String[] CMD_DEP;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT.toLowerCase());
- files.add(OUTPUT_DEP.toLowerCase());
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static final String infoResult = "infoResult.txt";
- private static void validatePackage() throws Exception {
- if (EXT.equals("rpm")) {
- int retVal = JPackageHelper.execute(new File(infoResult),"rpm",
- "--query", "--package", "--requires", OUTPUT.toLowerCase());
- if (retVal != 0) {
- throw new AssertionError("rpm exited with error: " + retVal);
- }
- } else {
- int retVal = JPackageHelper.execute(new File(infoResult), "dpkg",
- "--info", OUTPUT.toLowerCase());
- if (retVal != 0) {
- throw new AssertionError("dpkg exited with error: " + retVal);
- }
- }
-
- File outfile = new File(infoResult);
- if (!outfile.exists()) {
- throw new AssertionError(infoResult + " was not created");
- }
-
- String output = Files.readString(outfile.toPath());
- if (!output.contains(DEP_NAME.toLowerCase())) {
- throw new AssertionError("Unexpected result: " + output);
- }
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageHelper.executeCLI(true, CMD_DEP);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- JPackageInstallerHelper.validateOutput(OUTPUT_DEP);
- validatePackage();
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getLinuxInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- app = JPackagePath.getLinuxInstalledApp(DEP_NAME);
- JPackageInstallerHelper.validateApp(app);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- folderPath = JPackagePath.getLinuxInstallFolder(DEP_NAME);
- folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) throws Exception {
- TEST_NAME = name;
- DEP_NAME = name + "Dep";
- EXT = ext;
- OUTPUT = Base.getBundlePath(TEST_NAME, EXT);
- OUTPUT_DEP = Base.getBundlePath(DEP_NAME, EXT);
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--linux-package-deps", DEP_NAME.toLowerCase()};
- CMD_DEP = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", DEP_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/deb/BundleNameTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build BundleNameBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=360 -Xmx512m BundleNameTest
- */
-public class BundleNameTest {
- private static final String TEST_NAME = "bundlenametest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- BundleNameBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/deb/FileAssociationsTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build FileAssociationsBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=360 -Xmx512m FileAssociationsTest
- */
-public class FileAssociationsTest {
- private static final String TEST_NAME = "fileassociationstest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- FileAssociationsBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/deb/InstallDirTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build InstallDirBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=360 -Xmx512m InstallDirTest
- */
-public class InstallDirTest {
- private static final String TEST_NAME = "installdirtest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- InstallDirBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/deb/LicenseTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build LicenseBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=360 -Xmx512m LicenseTest
- */
-public class LicenseTest {
- private static final String TEST_NAME = "licensetest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- LicenseBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/deb/MaintainerTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build MaintainerBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=360 -Xmx512m MaintainerTest
- */
-public class MaintainerTest {
- private static final String TEST_NAME = "maintainertest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- MaintainerBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/deb/PackageDepsTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build PackageDepsBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=420 -Xmx512m PackageDepsTest
- */
-public class PackageDepsTest {
- private static final String TEST_NAME = "packagedepstest";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- PackageDepsBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/deb/Test.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build Base
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm/timeout=300 -Xmx512m Test
- */
-public class Test {
- private static final String TEST_NAME = "test";
- private static final String EXT = "deb";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.LinuxDebBundler.isSupported()) {
- Base.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/linux/deb/install.sh Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-ARCH=$(dpkg --print-architecture)
-sudo dpkg -i test_1.0-*_${ARCH}.deb
-sudo dpkg -i fileassociationstest_1.0-*_${ARCH}.deb
-sudo dpkg -i licensetest_1.0-*_${ARCH}.deb
-sudo dpkg -i installdirtest_1.0-*_${ARCH}.deb
-sudo dpkg -i jpackage-test-bundle-name_1.0-*_${ARCH}.deb
-sudo dpkg -i maintainertest_1.0-*_${ARCH}.deb
-sudo dpkg -i packagedepstestdep_1.0-*_${ARCH}.deb
-sudo dpkg -i packagedepstest_1.0-*_${ARCH}.deb
--- a/test/jdk/tools/jpackage/linux/deb/uninstall.sh Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-sudo dpkg -r test
-sudo dpkg -r fileassociationstest
-sudo dpkg -r licensetest
-sudo dpkg -r installdirtest
-sudo dpkg -r jpackage-test-bundle-name
-sudo dpkg -r maintainertest
-sudo dpkg -r packagedepstest
-sudo dpkg -r packagedepstestdep
--- a/test/jdk/tools/jpackage/linux/rpm/BundleNameTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build BundleNameBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m BundleNameTest
- */
-public class BundleNameTest {
- private static final String TEST_NAME = "BundleNameTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- BundleNameBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/linux/rpm/FileAssociationsTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build FileAssociationsBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m FileAssociationsTest
- */
-public class FileAssociationsTest {
- private static final String TEST_NAME = "FileAssociationsTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- FileAssociationsBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/linux/rpm/InstallDirTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build InstallDirBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m InstallDirTest
- */
-public class InstallDirTest {
- private static final String TEST_NAME = "InstallDirTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- InstallDirBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/linux/rpm/LicenseTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build LicenseBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m LicenseTest
- */
-public class LicenseTest {
- private static final String TEST_NAME = "LicenseTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- LicenseBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/linux/rpm/LicenseTypeTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build LicenseTypeBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m LicenseTypeTest
- */
-public class LicenseTypeTest {
- private static final String TEST_NAME = "LicenseTypeTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- LicenseTypeBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/linux/rpm/PackageDepsTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build PackageDepsBase
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm/timeout=240 -Xmx512m PackageDepsTest
- */
-public class PackageDepsTest {
- private static final String TEST_NAME = "PackageDepsTest";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- PackageDepsBase.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/linux/rpm/Test.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build Base
- * @requires (os.family == "linux")
- * @modules jdk.jpackage
- * @run main/othervm -Xmx512m Test
- */
-public class Test {
- private static final String TEST_NAME = "Test";
- private static final String EXT = "rpm";
-
- public static void main(String[] args) throws Exception {
- Base.run(TEST_NAME, EXT);
- }
-}
--- a/test/jdk/tools/jpackage/linux/rpm/install.sh Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-ARCH=$(rpmbuild --eval='%{_target_cpu}')
-sudo rpm --install fileassociationstest-1.0-1.${ARCH}.rpm
-sudo rpm --install installdirtest-1.0-1.${ARCH}.rpm
-sudo rpm --install licensetest-1.0-1.${ARCH}.rpm
-sudo rpm --install licensetypetest-1.0-1.${ARCH}.rpm
-sudo rpm --install packagedepstestdep-1.0-1.${ARCH}.rpm
-sudo rpm --install packagedepstest-1.0-1.${ARCH}.rpm
-sudo rpm --install test-1.0-1.${ARCH}.rpm
-sudo rpm --install jpackage-test-bundle-name-1.0-1.${ARCH}.rpm
--- a/test/jdk/tools/jpackage/linux/rpm/uninstall.sh Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-sudo rpm -e fileassociationstest
-sudo rpm -e installdirtest
-sudo rpm -e licensetest
-sudo rpm -e licensetypetest
-sudo rpm -e packagedepstest
-sudo rpm -e packagedepstestdep
-sudo rpm -e test
-sudo rpm -e jpackage-test-bundle-name
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/FileAssociationsTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Desktop;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import jdk.jpackage.test.HelloApp;
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.Test;
+
+/**
+ * Test --file-associations parameter.
+ * Output of the test should be fileassociationstest*.* installer.
+ * The output installer should provide the same functionality as the default
+ * installer (see description of the default installer in SimplePackageTest.java)
+ * plus configure file associations.
+ * After installation files with ".jptest1" suffix should be associated with
+ * the test app.
+ *
+ * Suggested test scenario is to create empty file with ".jptest1" suffix,
+ * double click on it and make sure that test application was launched in
+ * response to double click event with the path to test .jptest1 file
+ * on the commend line.
+ *
+ * On Linux use "echo > foo.jptest1" and not "touch foo.jptest1" to create
+ * test file as empty files are always interpreted as plain text and will not
+ * be opened with the test app. This is a known bug.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --file-associations
+ * @library ../helpers
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m FileAssociationsTest
+ */
+public class FileAssociationsTest {
+ public static void main(String[] args) throws Exception {
+ new PackageTest().configureHelloApp()
+ .addInitializer(cmd -> {
+ initFaPropsFile();
+ cmd.addArguments("--file-associations", FA_PROPS_FILE.toString());
+ })
+ .addInstallVerifier(cmd -> {
+ Path testFile = null;
+ try {
+ testFile = Test.createTempFile("." + FA_SUFFIX);
+ // Write something in test file.
+ // On Ubuntu and Oracle Linux empty files are considered
+ // plain text. Seems like a system bug.
+ //
+ // [asemenyu@spacewalk ~]$ rm gg.jptest1
+ // $ touch foo.jptest1
+ // $ xdg-mime query filetype foo.jptest1
+ // text/plain
+ // $ echo > foo.jptest1
+ // $ xdg-mime query filetype foo.jptest1
+ // application/x-jpackage-jptest1
+ //
+ Files.write(testFile, Arrays.asList(""));
+
+ final Path appOutput = Path.of(HelloApp.OUTPUT_FILENAME);
+ Files.deleteIfExists(appOutput);
+
+ Test.trace(String.format("Use desktop to open [%s] file", testFile));
+ Desktop.getDesktop().open(testFile.toFile());
+ Test.waitForFileCreated(appOutput, 7);
+
+ // Wait a little bit after file has been created to
+ // make sure there are no pending writes into it.
+ Thread.sleep(3000);
+ HelloApp.verifyOutputFile(appOutput, testFile.toString());
+ } catch (IOException | InterruptedException ex) {
+ throw new RuntimeException(ex);
+ } finally {
+ if (testFile != null) {
+ try {
+ Files.deleteIfExists(testFile);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ })
+ .run();
+ }
+
+ private static void initFaPropsFile() {
+ try {
+ Files.write(FA_PROPS_FILE, Arrays.asList(
+ "extension=" + FA_SUFFIX,
+ "mime-type=application/x-jpackage-" + FA_SUFFIX,
+ "description=jpackage test extention"));
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private final static String FA_SUFFIX = "jptest1";
+ private final static Path FA_PROPS_FILE = Test.workDir().resolve("fa.properties");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/InstallDirTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Supplier;
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+/**
+ * Test --install-dir parameter. Output of the test should be installdirtest*.*
+ * package bundle. The output package should provide the same functionality as
+ * the default package but install test application in specified directory.
+ *
+ * Linux:
+ *
+ * Application should be installed in /opt/jpackage/installdirtest folder.
+ *
+ * Mac:
+ *
+ * Application should be installed in /Applications/jpackage/installdirtest.app
+ * folder.
+ *
+ * Windows:
+ *
+ * Application should be installed in %ProgramFiles%/TestVendor/InstallDirTest1234
+ * folder.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --install-dir
+ * @library ../helpers
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m InstallDirTest
+ */
+public class InstallDirTest {
+
+ public static void main(String[] args) throws Exception {
+ final Map<PackageType, String> INSTALL_DIRS = new Supplier<Map<PackageType, String>>() {
+ @Override
+ public Map<PackageType, String> get() {
+ Map<PackageType, String> reply = new HashMap<>();
+ reply.put(PackageType.WIN_MSI, Path.of("TestVendor",
+ "InstallDirTest1234").toString());
+ reply.put(PackageType.WIN_EXE, reply.get(PackageType.WIN_MSI));
+
+ reply.put(PackageType.LINUX_DEB,
+ Path.of("/opt", "jpackage").toString());
+ reply.put(PackageType.LINUX_RPM,
+ reply.get(PackageType.LINUX_DEB));
+
+ reply.put(PackageType.MAC_PKG, Path.of("/Application",
+ "jpackage").toString());
+ reply.put(PackageType.MAC_DMG, reply.get(PackageType.MAC_PKG));
+
+ return reply;
+ }
+ }.get();
+
+ new PackageTest().configureHelloApp()
+ .addInitializer(cmd -> {
+ cmd.addArguments("--install-dir", INSTALL_DIRS.get(
+ cmd.packageType()));
+ }).run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/LicenseTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.io.File;
+import jdk.jpackage.test.JPackageCommand;
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+import jdk.jpackage.test.LinuxHelper;
+import jdk.jpackage.test.Executor;
+import jdk.jpackage.test.Test;
+
+/**
+ * Test --license-file parameter. Output of the test should be licensetest*.*
+ * package bundle. The output package should provide the same functionality as
+ * the default package and also incorporate license information from
+ * test/jdk/tools/jpackage/resources/license.txt file from OpenJDK repo.
+ *
+ * deb:
+ *
+ * Package should install license file /usr/share/doc/licensetest/copyright
+ * file.
+ *
+ * rpm:
+ *
+ * Package should install license file in
+ * %{_defaultlicensedir}/licensetest-1.0/license.txt file.
+ *
+ * Mac:
+ *
+ * Windows
+ *
+ * Installer should display license text matching contents of the license file
+ * during installation.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --license-file
+ * @library ../helpers
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m LicenseTest
+ */
+public class LicenseTest {
+ public static void main(String[] args) throws Exception {
+ new PackageTest().configureHelloApp()
+ .addInitializer(cmd -> {
+ cmd.addArguments("--license-file", LICENSE_FILE.toString());
+ })
+ .forTypes(PackageType.LINUX_DEB)
+ .addBundleVerifier(cmd -> {
+ verifyLicenseFileInLinuxPackage(cmd, debLicenseFile(cmd));
+ })
+ .addInstallVerifier(cmd -> {
+ verifyLicenseFileInstalledLinux(debLicenseFile(cmd));
+ })
+ .addUninstallVerifier(cmd -> {
+ verifyLicenseFileNotInstalledLinux(debLicenseFile(cmd));
+ })
+ .forTypes(PackageType.LINUX_RPM)
+ .addBundleVerifier(cmd -> {
+ verifyLicenseFileInLinuxPackage(cmd,rpmLicenseFile(cmd));
+ })
+ .addInstallVerifier(cmd -> {
+ verifyLicenseFileInstalledLinux(rpmLicenseFile(cmd));
+ })
+ .addUninstallVerifier(cmd -> {
+ verifyLicenseFileNotInstalledLinux(rpmLicenseFile(cmd));
+ })
+ .run();
+ }
+
+ private static Path rpmLicenseFile(JPackageCommand cmd) {
+ final Path licenseRoot = Path.of(
+ new Executor()
+ .setExecutable("rpm")
+ .addArguments("--eval", "%{_defaultlicensedir}")
+ .saveFirstLineOfOutput()
+ .execute()
+ .assertExitCodeIsZero().getFirstLineOfOutput());
+ final Path licensePath = licenseRoot.resolve(String.format("%s-%s",
+ LinuxHelper.getPackageName(cmd), cmd.version())).resolve(
+ LICENSE_FILE.getFileName());
+ return licensePath;
+ }
+
+ private static Path debLicenseFile(JPackageCommand cmd) {
+ final Path licensePath = Path.of("/usr", "share", "doc",
+ LinuxHelper.getPackageName(cmd), "copyright");
+ return licensePath;
+ }
+
+ private static void verifyLicenseFileInLinuxPackage(JPackageCommand cmd,
+ Path expectedLicensePath) {
+ Test.assertTrue(LinuxHelper.getPackageFiles(cmd).filter(path -> path.equals(
+ expectedLicensePath)).findFirst().orElse(null) != null,
+ String.format("Check license file [%s] is in %s package",
+ expectedLicensePath, LinuxHelper.getPackageName(cmd)));
+ }
+
+ private static void verifyLicenseFileInstalledLinux(Path licenseFile) {
+ Test.assertTrue(Files.isReadable(licenseFile), String.format(
+ "Check license file [%s] is readable", licenseFile));
+ try {
+ Test.assertTrue(Files.readAllLines(licenseFile).equals(
+ Files.readAllLines(LICENSE_FILE)), String.format(
+ "Check contents of package license file [%s] are the same as contents of source license file [%s]",
+ licenseFile, LICENSE_FILE));
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private static void verifyLicenseFileNotInstalledLinux(Path licenseFile) {
+ Test.assertDirectoryExists(licenseFile.getParent(), false);
+ }
+
+ private static final Path LICENSE_FILE = Test.TEST_SRC_ROOT.resolve(
+ Path.of("resources", "license.txt"));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/RuntimePackageTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,61 @@
+/*
+ * 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 jdk.jpackage.test.PackageTest;
+
+/**
+ * Test --runtime-image parameter.
+ * Output of the test should be RuntimePackageTest*.* installer.
+ * The installer should install Java Runtime without an application.
+ * Installation directory should not have "app" subfolder and should not have
+ * an application launcher.
+ *
+ *
+ * Windows:
+ *
+ * Java runtime should be installed in %ProgramFiles%\RuntimePackageTest directory.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --runtime-image
+ * @library ../helpers
+ * @comment Temporary disable for Linux and OSX until functionality implemented
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m RuntimePackageTest
+ */
+public class RuntimePackageTest {
+
+ public static void main(String[] args) {
+ new PackageTest()
+ .addInitializer(cmd -> {
+ cmd.addArguments("--runtime-image", System.getProperty("java.home"));
+ // Remove --input parameter from jpackage command line as we don't
+ // create input directory in the test and jpackage fails
+ // if --input references non existant directory.
+ cmd.setArgumentValue("--input", null);
+ })
+ .run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/SimplePackageTest.java Tue Sep 10 09:18:19 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.
+ */
+
+import jdk.jpackage.test.PackageTest;
+
+/**
+ * Simple platform specific packaging test. Output of the test should be
+ * simplepackagetest*.* package bundle.
+ *
+ * Windows:
+ *
+ * The installer should not have license text. It should not have an option
+ * to change the default installation directory.
+ * Test application should be installed in %ProgramFiles%\SimplePackageTest directory.
+ * Installer should install test app for all users (machine wide).
+ * Installer should create a shortcut for application launcher in Windows Menu.
+ */
+
+/*
+ * @test
+ * @summary Simple jpackage command run
+ * @library ../helpers
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm/timeout=360 -Xmx512m SimplePackageTest
+ */
+public class SimplePackageTest {
+
+ public static void main(String[] args) throws Exception {
+ new PackageTest().configureHelloApp().run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/share/manage_packages.sh Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,185 @@
+#!/bin/bash
+
+#
+# Script to install/uninstall packages produced by jpackage jtreg
+# tests doing platform specific packaging.
+#
+# The script will install/uninstall all packages from the files
+# found in the current directory or the one specified with command line option.
+#
+# When jtreg jpackage tests are executed with jpackage.test.output
+# Java property set, produced package files (msi, exe, deb, rpm, etc.) will
+# be saved in the directory specified with this property.
+#
+# Usage example:
+# # Set directory where to save package files from jtreg jpackage tests
+# JTREG_OUTPUT_DIR=/tmp/jpackage_jtreg_packages
+#
+# # Run tests and fill $JTREG_OUTPUT_DIR directory with package files
+# jtreg -Djpackage.test.output=$JTREG_OUTPUT_DIR ...
+#
+# # Install all packages
+# manage_pachages.sh -d $JTREG_OUTPUT_DIR
+#
+# # Uninstall all packages
+# manage_pachages.sh -d $JTREG_OUTPUT_DIR -u
+#
+
+#
+# When using with MSI installers, Cygwin shell from which this script is
+# executed should be started as administrator. Otherwise silent installation
+# won't work.
+#
+
+# Fail fast
+set -e; set -o pipefail;
+
+
+help_usage ()
+{
+ echo "Usage: `basename $0` [OPTION]"
+ echo "Options:"
+ echo " -h - print this message"
+ echo " -v - verbose output"
+ echo " -d <dir> - path to directory where to look for package files"
+ echo " -u - uninstall packages instead of the default install"
+ echo " -t - dry run, print commands but don't execute them"
+}
+
+error ()
+{
+ echo "$@" > /dev/stderr
+}
+
+fatal ()
+{
+ error "$@"
+ exit 1
+}
+
+fatal_with_help_usage ()
+{
+ error "$@"
+ help_usage
+ exit 1
+}
+
+
+# Directory where to look for package files.
+package_dir=$PWD
+
+# Script debug.
+verbose=
+
+# Operation mode.
+mode=install
+
+dryrun=
+
+while getopts "vhd:ut" argname; do
+ case "$argname" in
+ v) verbose=yes;;
+ t) dryrun=yes;;
+ u) mode=uninstall;;
+ d) package_dir="$OPTARG";;
+ h) help_usage; exit 0;;
+ ?) help_usage; exit 1;;
+ esac
+done
+shift $(( OPTIND - 1 ))
+
+[ -d "$package_dir" ] || fatal_with_help_usage "Package directory [$package_dir] is not a directory"
+
+[ -z "$verbose" ] || set -x
+
+
+function find_packages_of_type ()
+{
+ # sort output alphabetically
+ find "$package_dir" -maxdepth 1 -type f -name '*.'"$1" | sort
+}
+
+function find_packages ()
+{
+ local package_suffixes=(deb rpm msi exe)
+ for suffix in "${package_suffixes[@]}"; do
+ if [ "$mode" == "uninstall" ]; then
+ packages=$(find_packages_of_type $suffix | tac)
+ else
+ packages=$(find_packages_of_type $suffix)
+ fi
+ if [ -n "$packages" ]; then
+ package_type=$suffix
+ break;
+ fi
+ done
+}
+
+
+# RPM
+install_cmd_rpm ()
+{
+ echo sudo rpm --install "$@"
+}
+uninstall_cmd_rpm ()
+{
+ local package_name=$(rpm -qp --queryformat '%{Name}' "$@")
+ echo sudo rpm -e "$package_name"
+}
+
+# DEB
+install_cmd_deb ()
+{
+ echo sudo dpkg -i "$@"
+}
+uninstall_cmd_deb ()
+{
+ local package_name=$(dpkg-deb -f "$@" Package)
+ echo sudo dpkg -r "$package_name"
+}
+
+# MSI
+install_cmd_msi ()
+{
+ echo msiexec /qn /norestart /i $(cygpath -w "$@")
+}
+uninstall_cmd_msi ()
+{
+ echo msiexec /qn /norestart /x $(cygpath -w "$@")
+}
+
+# EXE
+install_cmd_exe ()
+{
+ echo "$@"
+}
+uninstall_cmd_exe ()
+{
+ error No implemented
+}
+
+
+# Find packages
+packages=
+find_packages
+if [ -z "$packages" ]; then
+ echo "No packages found in $package_dir directory"
+ exit
+fi
+
+# Build list of commands to execute
+declare -a commands
+for p in $packages; do
+ commands[${#commands[@]}]=$(${mode}_cmd_${package_type} "$p")
+done
+
+if [ -z "$dryrun" ]; then
+ # Run commands
+ for cmd in "${commands[@]}"; do
+ echo Running: $cmd
+ $cmd || true;
+ done
+else
+ # Print commands
+ for cmd in "${commands[@]}"; do echo $cmd; done
+fi
--- a/test/jdk/tools/jpackage/windows/WinConsoleTest.java Fri Sep 06 17:42:06 2019 -0400
+++ b/test/jdk/tools/jpackage/windows/WinConsoleTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -21,116 +21,74 @@
* questions.
*/
-import java.io.IOException;
import java.nio.file.Path;
import java.io.InputStream;
import java.io.FileInputStream;
+import java.io.IOException;
+
+import jdk.jpackage.internal.IOUtils;
+import jdk.jpackage.test.Test;
+import jdk.jpackage.test.HelloApp;
+import jdk.jpackage.test.JPackageCommand;
/*
* @test
- * @summary jpackage create image win console test
+ * @summary jpackage with --win-console
* @library ../helpers
- * @library ../share
- * @build JPackageHelper
- * @build JPackagePath
- * @build Base
* @requires (os.family == "windows")
- * @modules jdk.jpackage
+ * @modules jdk.jpackage/jdk.jpackage.internal
* @run main/othervm -Xmx512m WinConsoleTest
*/
+public class WinConsoleTest {
-public class WinConsoleTest {
- private static final String NAME = "test";
- private static final String OUTPUT = "output";
- private static final String OUTPUT_WIN_CONSOLE = "outputWinConsole";
- private static final int BUFFER_SIZE = 512;
- private static final int GUI_SUBSYSTEM = 2;
- private static final int CONSOLE_SUBSYSTEM = 3;
+ public static void main(String[] args) throws IOException {
+ JPackageCommand cmd = JPackageCommand.helloAppImage();
+ final Path launcherPath = cmd.appImage().resolve(
+ cmd.launcherPathInAppImage());
+
+ IOUtils.deleteRecursive(cmd.outputDir().toFile());
+ cmd.execute().assertExitCodeIsZero();
+ HelloApp.executeAndVerifyOutput(launcherPath);
+ checkSubsystem(launcherPath, false);
- private static final String [] CMD = {
- "--input", "input",
- "--output", OUTPUT,
- "--name", NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- };
+ IOUtils.deleteRecursive(cmd.outputDir().toFile());
+ cmd.addArgument("--win-console").execute().assertExitCodeIsZero();
+ HelloApp.executeAndVerifyOutput(launcherPath);
+ checkSubsystem(launcherPath, true);
+ }
- private static final String [] CMD_WIN_CONSOLE = {
- "--input", "input",
- "--output", OUTPUT_WIN_CONSOLE,
- "--name", NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-console"
- };
+ private static void checkSubsystem(Path path, boolean isConsole) throws
+ IOException {
+ final int subsystemGui = 2;
+ final int subsystemConsole = 3;
+ final int bufferSize = 512;
- private static void checkSubsystem(boolean console) throws Exception {
- Path path = Path.of(console ? OUTPUT_WIN_CONSOLE : OUTPUT,
- NAME, NAME + ".exe");
-
- System.out.println("validate path: " + path.toString());
- Base.validate(path.toString());
+ final int expectedSubsystem = isConsole ? subsystemConsole : subsystemGui;
try (InputStream inputStream = new FileInputStream(path.toString())) {
- byte [] bytes = new byte[BUFFER_SIZE];
- if (inputStream.read(bytes) != BUFFER_SIZE) {
- throw new AssertionError("Wrong number of bytes read");
- }
+ byte[] bytes = new byte[bufferSize];
+ Test.assertEquals(bufferSize, inputStream.read(bytes),
+ String.format("Check %d bytes were read from %s file",
+ bufferSize, path));
// Check PE header for console or Win GUI app.
// https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_image_nt_headers
- for (int i = 0; i < (bytes.length - 4); i++) {
- if (bytes[i] == 0x50 && bytes[i + 1] == 0x45 &&
- bytes[i + 2] == 0x0 && bytes[i + 3] == 0x0) {
+ for (int i = 0; i < (bytes.length - 4); i++) {
+ if (bytes[i] == 0x50 && bytes[i + 1] == 0x45
+ && bytes[i + 2] == 0x0 && bytes[i + 3] == 0x0) {
// Signature, File Header and subsystem offset.
i = i + 4 + 20 + 68;
byte subsystem = bytes[i];
- if (console) {
- if (subsystem != CONSOLE_SUBSYSTEM) {
- throw new AssertionError("Unexpected subsystem: "
- + subsystem);
- } else {
- return;
- }
- } else {
- if (subsystem != GUI_SUBSYSTEM) {
- throw new AssertionError("Unexpected subsystem: "
- + subsystem);
- } else {
- return;
- }
- }
+ Test.assertEquals(expectedSubsystem, subsystem,
+ String.format("Check subsystem of PE [%s] file",
+ path));
+ return;
}
}
}
- throw new AssertionError("Unable to verify PE header");
- }
-
- private static void validate() throws Exception {
- checkSubsystem(false);
- checkSubsystem(true);
- }
-
- private static void testCreateAppImage(String [] cmd) throws Exception {
- JPackageHelper.executeCLI(true, cmd);
- }
-
- private static void testCreateAppImageToolProvider(String [] cmd)
- throws Exception {
- JPackageHelper.executeToolProvider(true, cmd);
- }
-
- public static void main(String[] args) throws Exception {
- JPackageHelper.createHelloImageJar();
- testCreateAppImage(CMD);
- testCreateAppImage(CMD_WIN_CONSOLE);
- validate();
- JPackageHelper.deleteOutputFolder(OUTPUT);
- JPackageHelper.deleteOutputFolder(OUTPUT_WIN_CONSOLE);
- testCreateAppImageToolProvider(CMD);
- testCreateAppImageToolProvider(CMD_WIN_CONSOLE);
- validate();
+ Test.assertUnexpected(String.format(
+ "Subsystem not found in PE header of [%s] file", path));
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/WinDirChooserTest.java Tue Sep 10 09:18:19 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.
+ */
+
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+/**
+ * Test --win-dir-chooser parameter. Output of the test should be
+ * WinDirChooserTest-1.0.exe installer. The output installer should provide the
+ * same functionality as the default installer (see description of the default
+ * installer in SimplePackageTest.java) plus provide an option for user to
+ * change the default installation directory.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --win-dir-chooser
+ * @library ../helpers
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinDirChooserTest
+ */
+
+public class WinDirChooserTest {
+ public static void main(String[] args) {
+ new PackageTest()
+ .forTypes(PackageType.WINDOWS)
+ .configureHelloApp()
+ .addInitializer(cmd -> cmd.addArgument("--win-dir-chooser")).run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/WinMenuGroupTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,55 @@
+/*
+ * 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 jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+/**
+ * Test --win-menu and --win-menu-group parameters.
+ * Output of the test should be WinMenuGroupTest-1.0.exe installer.
+ * The output installer should provide the
+ * same functionality as the default installer (see description of the default
+ * installer in SimplePackageTest.java) plus
+ * it should create a shortcut for application launcher in Windows Menu in
+ * "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\WinMenuGroupTest_MenuGroup" folder.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --win-menu and --win-menu-group
+ * @library ../helpers
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinMenuGroupTest
+ */
+
+public class WinMenuGroupTest {
+ public static void main(String[] args) {
+ new PackageTest()
+ .forTypes(PackageType.WINDOWS)
+ .configureHelloApp()
+ .addInitializer(cmd -> cmd.addArguments(
+ "--win-menu", "--win-menu-group", "WinMenuGroupTest_MenuGroup"))
+ .run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/WinMenuTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+/**
+ * Test --win-menu parameter. Output of the test should be WinMenuTest-1.0.exe
+ * installer. The output installer should provide the same functionality as the
+ * default installer (see description of the default installer in
+ * SimplePackageTest.java).
+ */
+
+/*
+ * @test
+ * @summary jpackage with --win-menu
+ * @library ../helpers
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinMenuTest
+ */
+
+public class WinMenuTest {
+ public static void main(String[] args) {
+ new PackageTest()
+ .forTypes(PackageType.WINDOWS)
+ .configureHelloApp()
+ .addInitializer(cmd -> cmd.addArgument("--win-menu")).run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/WinPerUserInstallTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,56 @@
+/*
+ * 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 jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+/**
+ * Test --win-per-user-install, --win-menu, --win-menu-group parameters.
+ * Output of the test should be WinPerUserInstallTest-1.0.exe installer. The
+ * output installer should provide the same functionality as the default
+ * installer (see description of the default installer in
+ * SimplePackageTest.java) plus it should create application menu in Windows
+ * Menu and installation should be per user and not machine wide.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --win-per-user-install, --win-menu, --win-menu-group
+ * @library ../helpers
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinPerUserInstallTest
+ */
+
+public class WinPerUserInstallTest {
+ public static void main(String[] args) {
+ new PackageTest()
+ .forTypes(PackageType.WINDOWS)
+ .configureHelloApp()
+ .addInitializer(cmd -> cmd.addArguments(
+ "--win-menu",
+ "--win-menu-group", "WinPerUserInstallTest_MenuGroup",
+ "--win-per-user-install"))
+ .run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/WinShortcutTest.java Tue Sep 10 09:18:19 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.
+ */
+
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+/**
+ * Test --win-shortcut parameter. Output of the test should be
+ * WinShortcutTest-1.0.exe installer. The output installer should provide the
+ * same functionality as the default installer (see description of the default
+ * installer in SimplePackageTest.java) plus install application shortcut on the
+ * desktop.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --win-shortcut
+ * @library ../helpers
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinShortcutTest
+ */
+
+public class WinShortcutTest {
+ public static void main(String[] args) {
+ new PackageTest()
+ .forTypes(PackageType.WINDOWS)
+ .configureHelloApp()
+ .addInitializer(cmd -> cmd.addArgument("--win-shortcut"))
+ .run();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/jpackage/windows/WinUpgradeUUIDTest.java Tue Sep 10 09:18:19 2019 -0400
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.jpackage.test.PackageTest;
+import jdk.jpackage.test.PackageType;
+
+/**
+ * Test both --win-upgrade-uuid and --app-version parameters. Output of the test
+ * should be WinUpgradeUUIDTest-1.0.exe and WinUpgradeUUIDTest-2.0.exe
+ * installers. Both output installers should provide the same functionality as
+ * the default installer (see description of the default installer in
+ * SimplePackageTest.java) but have the same product code and different
+ * versions. Running WinUpgradeUUIDTest-2.0.exe installer should automatically
+ * uninstall older version of the test application previously installed with
+ * WinUpgradeUUIDTest-1.0.exe installer.
+ */
+
+/*
+ * @test
+ * @summary jpackage with --win-upgrade-uuid and --app-version
+ * @library ../helpers
+ * @requires (os.family == "windows")
+ * @modules jdk.jpackage/jdk.jpackage.internal
+ * @run main/othervm -Xmx512m WinUpgradeUUIDTest
+ */
+
+public class WinUpgradeUUIDTest {
+ public static void main(String[] args) {
+ PackageTest test = init();
+ if (test.getAction() != PackageTest.Action.VERIFY_INSTALLED) {
+ test.run();
+ }
+
+ test = init();
+ test.addInitializer(cmd -> {
+ cmd.setArgumentValue("--app-version", "2.0");
+ cmd.setArgumentValue("--arguments", "bar");
+ });
+ test.run();
+ }
+
+ private static PackageTest init() {
+ return new PackageTest()
+ .forTypes(PackageType.WINDOWS)
+ .configureHelloApp()
+ .addInitializer(cmd -> cmd.addArguments("--win-upgrade-uuid",
+ "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"));
+ }
+}
--- a/test/jdk/tools/jpackage/windows/base/Base.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class Base {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/FileAssociationsBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.Desktop;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-
-public class FileAssociationsBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String TEST_EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void validateAppOutput() throws Exception {
- File outFile = new File("appOutput.txt");
- int count = 10;
- boolean bOutputCreated = false;
- while (count > 0) {
- if (!outFile.exists()) {
- Thread.sleep(3000);
- count--;
- } else {
- bOutputCreated = true;
- break;
- }
- }
-
- if (!bOutputCreated) {
- throw new AssertionError(outFile.getAbsolutePath() + " was not created");
- }
-
- String output = Files.readString(outFile.toPath());
- String[] result = output.split("\n");
- if (result.length != 3) {
- System.err.println(output);
- throw new AssertionError(
- "Unexpected number of lines: " + result.length);
- }
-
- if (!result[0].trim().equals("jpackage test application")) {
- throw new AssertionError("Unexpected result[0]: " + result[0]);
- }
-
- if (!result[1].trim().equals("args.length: 1")) {
- throw new AssertionError("Unexpected result[1]: " + result[1]);
- }
-
- File faFile = new File(TEST_NAME + "." + TEST_EXT);
- if (!result[2].trim().equals(faFile.getAbsolutePath())) {
- throw new AssertionError("Unexpected result[2]: " + result[2]);
- }
- }
-
- private static void verifyInstall() throws Exception {
- createFileAssociationsTestFile();
- Desktop.getDesktop().open(new File(TEST_NAME + "." + TEST_EXT));
- validateAppOutput();
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
-
- // Validate registry
- String[] values1 = {TEST_NAME};
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, values1, true);
- String[] values2 = {TEST_EXT};
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, values2, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate registry
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, null, false);
- JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, null, false);
- }
-
- private static void createFileAssociationsTestFile() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
- out.println(TEST_NAME);
- }
- }
-
- private static void createFileAssociationsProperties() throws Exception {
- try (PrintWriter out = new PrintWriter(new BufferedWriter(
- new FileWriter("fa.properties")))) {
- out.println("extension=" + TEST_EXT);
- out.println("mime-type=application/x-jpackage-" + TEST_EXT);
- out.println("description=jpackage test extention");
- }
- }
-
- private static void init(String name, String ext, String installDir, String testExt) {
- TEST_NAME = name;
- EXT = ext;
- TEST_EXT = testExt;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- if (installDir == null) {
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--file-associations", "fa.properties"};
- } else {
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--file-associations", "fa.properties",
- "--install-dir", installDir};
- }
- }
-
- public static void run(String name, String ext, String installDir, String testExt) throws Exception {
- init(name, ext, installDir, testExt);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- createFileAssociationsProperties();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/InstallDirBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class InstallDirBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
- private static String INSTALL_DIR;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(INSTALL_DIR, TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate desktop shortcut
- JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(INSTALL_DIR);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate desktop shortcut
- JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- INSTALL_DIR = "TestVendor" + File.separator + TEST_NAME;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--install-dir", INSTALL_DIR,
- "--win-shortcut"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/LicenseBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class LicenseBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String [] {
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--license-file", JPackagePath.getLicenseFilePath()};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/RuntimeBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class RuntimeBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- // NOP by design.
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--output", "output",
- "--name", TEST_NAME,
- "--runtime-image", System.getProperty("java.home")};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/WinDirChooserBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WinDirChooserBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-dir-chooser"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/WinMenuBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WinMenuBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-console",
- "--win-menu"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/WinMenuGroupBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WinMenuGroupBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu(TEST_NAME, TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu(TEST_NAME, TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-menu",
- "--win-menu-group", TEST_NAME + "_MenuGroup"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/WinPerUserInstallBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WinPerUserInstallBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinUserLocalInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateUserLocalStartMenu(TEST_NAME, TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinUserLocalInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateUserLocalStartMenu(TEST_NAME, TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-per-user-install",
- "--win-menu",
- "--win-menu-group", TEST_NAME};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/WinShortcutBase.java Fri Sep 06 17:42:06 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.util.ArrayList;
-import java.util.List;
-
-public class WinShortcutBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT;
- private static String[] CMD;
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD);
- JPackageInstallerHelper.validateOutput(OUTPUT);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate desktop shortcut
- JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, true);
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
-
- // Validate start menu
- JPackageInstallerHelper.validateStartMenu("Unknown", TEST_NAME, false);
-
- // Validate desktop shortcut
- JPackageInstallerHelper.validateDesktopShortcut(TEST_NAME, false);
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--win-console",
- "--win-shortcut"};
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/base/WinUpgradeUUIDBase.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-public class WinUpgradeUUIDBase {
-
- private static String TEST_NAME;
- private static String EXT;
- private static String OUTPUT_1;
- private static String[] CMD_1;
- private static String OUTPUT_2;
- private static String[] CMD_2;
- private static final String FILE_1 = "file1.txt";
- private static final String FILE_2 = "file2.txt";
-
- private static void copyResults() throws Exception {
- List<String> files = new ArrayList<>();
- files.add(OUTPUT_1);
- files.add(OUTPUT_2);
- JPackageInstallerHelper.copyTestResults(files);
- }
-
- private static void testCreateInstaller() throws Exception {
- JPackageHelper.executeCLI(true, CMD_1);
- JPackageInstallerHelper.validateOutput(OUTPUT_1);
- JPackageHelper.executeCLI(true, CMD_2);
- JPackageInstallerHelper.validateOutput(OUTPUT_2);
- copyResults();
- }
-
- private static void verifyInstall() throws Exception {
- String app = JPackagePath.getWinInstalledApp(TEST_NAME);
- JPackageInstallerHelper.validateApp(app);
-
- String file1Path = JPackagePath.getWinInstalledAppFolder(TEST_NAME) + File.separator + FILE_1;
- File file1 = new File(file1Path);
- if (EXT.equals("msi")) {
- if (file1.exists()) {
- throw new AssertionError("Unexpected file does exist: "
- + file1.getAbsolutePath());
- }
- } else if (EXT.equals("exe")) {
- if (!file1.exists()) {
- throw new AssertionError("Unexpected file does not exist: "
- + file1.getAbsolutePath());
- }
- } else {
- throw new AssertionError("Unknown installer type: " + EXT);
- }
-
- String file2Path = JPackagePath.getWinInstalledAppFolder(TEST_NAME) + File.separator + FILE_2;
- File file2 = new File(file2Path);
- if (!file2.exists()) {
- throw new AssertionError("Unexpected file does not exist: "
- + file2.getAbsolutePath());
- }
- }
-
- private static void verifyUnInstall() throws Exception {
- String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME);
- File folder = new File(folderPath);
- if (folder.exists()) {
- throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
- }
- }
-
- private static void init(String name, String ext) {
- TEST_NAME = name;
- EXT = ext;
- OUTPUT_1 = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
- CMD_1 = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--app-version", "1.0",
- "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"};
- OUTPUT_2 = "output" + File.separator + TEST_NAME + "-2.0." + EXT;
- CMD_2 = new String[]{
- "--package-type", EXT,
- "--input", "input",
- "--output", "output",
- "--name", TEST_NAME,
- "--main-jar", "hello.jar",
- "--main-class", "Hello",
- "--app-version", "2.0",
- "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"};
- }
-
- private static void createInputFile(String name, String context) throws Exception {
- try (PrintWriter out = new PrintWriter(
- new BufferedWriter(new FileWriter("input" + File.separator + name)))) {
- out.println(context);
- }
- }
-
- public static void run(String name, String ext) throws Exception {
- init(name, ext);
-
- if (JPackageInstallerHelper.isVerifyInstall()) {
- verifyInstall();
- } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
- verifyUnInstall();
- } else {
- JPackageHelper.createHelloInstallerJar();
- createInputFile(FILE_1, FILE_1);
- createInputFile(FILE_2, FILE_2);
- testCreateInstaller();
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/FileAssociationsInstallDirTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +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 both --file-associations and --install-dir parameters.
- * Output of the test should be FileAssociationsInstallDirTest-1.0.exe installer.
- * For the expected behavior and suggested testing see descriptions of
- * FileAssociationsTest and InstallDirTest tests.
- * Note: file association suffix is ".jptest3" and not ".jptest1" as in
- * FileAssociationsTest test.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build FileAssociationsBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m FileAssociationsInstallDirTest
- */
-public class FileAssociationsInstallDirTest {
- private static final String TEST_NAME = "FileAssociationsInstallDirTest";
- private static final String EXT = "exe";
- private static final String INSTALL_DIR
- = "TestVendor\\FileAssociationsInstallDirTestDir";
- private static final String TEST_EXT = "jptest3";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- FileAssociationsBase.run(TEST_NAME, EXT, INSTALL_DIR, TEST_EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/FileAssociationsTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +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 --file-associations parameter.
- * Output of the test should be FileAssociationsTest-1.0.exe installer.
- * The output installer should provide the same functionality as the default
- * installer (see description of the default installer in Test.java) plus
- * configure file associations.
- * After installation files with ".jptest1" suffix should be associated with
- * the test app.
- *
- * Suggested test scenario is to create empty file with ".jptest1" suffix,
- * double click on it and make sure that test application was launched in
- * response to double click event with the path to test .jptest1 file
- * on the commend line.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build FileAssociationsBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m FileAssociationsTest
- */
-public class FileAssociationsTest {
- private static final String TEST_NAME = "FileAssociationsTest";
- private static final String EXT = "exe";
- private static final String TEST_EXT = "jptest1";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- FileAssociationsBase.run(TEST_NAME, EXT, null, TEST_EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/InstallDirTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 --install-dir parameter.
- * Output of the test should be InstallDirTest-1.0.exe installer.
- * The output installer should provide the same functionality as the default
- * installer (see description of the default installer in Test.java) but
- * install test app in %ProgramFiles%\TestVendor\InstallDirTest instead of
- * %ProgramFiles%\InstallDirTest directory.
- */
-
-/*
- * @test
- * @summary jpackage create installer install dir test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build InstallDirBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m InstallDirTest
- */
-public class InstallDirTest {
- private static final String TEST_NAME = "InstallDirTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- InstallDirBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/LicenseTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 --license-file parameter.
- * Output of the test should be LicenseTest-1.0.exe installer.
- * The output installer should provide the same functionality as the default
- * installer (see description of the default installer in Test.java) plus
- * should display license text matching contents of
- * test/jdk/tools/jpackage/resources/license.txt file from OpenJDK repo.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build LicenseBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m LicenseTest
- */
-public class LicenseTest {
- private static final String TEST_NAME = "LicenseTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- LicenseBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/RuntimeTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.lang.invoke.MethodHandles;
-
-/*
- * Test --runtime-image parameter.
- * Output of the test should be RuntimeTest-1.0.exe installer.
- * The installer should install Java Runtime without an application.
- * Installation directory should not have "app" subfolder and should not have
- * an application launcher.
- * No shortcuts should be created in Windows Menu.
- * Java runtime should be installed in %ProgramFiles%\RuntimeTest directory.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build RuntimeBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m RuntimeTest
- */
-public class RuntimeTest {
-
- private static final String TEST_NAME = MethodHandles.lookup().lookupClass().getName();
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- RuntimeBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/Test.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +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 defaults for exe installer.
- * Output of the test should be Test-1.0.exe installer.
- * The installer should not have license text. It should not have an option
- * to change the default installation directory.
- * Test application should be installed in %ProgramFiles%\Test directory.
- * Installer should install test app for all users (machine wide).
- * Installer should create a shortcut for application launcher in Windows Menu.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build Base
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m Test
- */
-public class Test {
- private static final String TEST_NAME = "Test";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- Base.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/WinDirChooserTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 --win-dir-chooser parameter.
- * Output of the test should be WinDirChooserTest-1.0.exe installer.
- * The output installer should provide the same functionality as the default
- * installer (see description of the default installer in Test.java) plus
- * provide an option for user to change the default installation directory.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinDirChooserBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinDirChooserTest
- */
-public class WinDirChooserTest {
- private static final String TEST_NAME = "WinDirChooserTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinDirChooserBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/WinMenuGroupTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 --win-menu and --win-menu-group parameters.
- * Output of the test should be WinMenuGroupTest-1.0.exe installer.
- * The output installer should provide the same functionality as the default
- * installer (see description of the default installer in Test.java) plus
- * it should create a shortcut for application launcher in Windows Menu in
- * "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\WinMenuGroupTest_MenuGroup" folder.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinMenuGroupBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinMenuGroupTest
- */
-public class WinMenuGroupTest {
- private static final String TEST_NAME = "WinMenuGroupTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinMenuGroupBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/WinMenuTest.java Fri Sep 06 17:42:06 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 --win-menu parameter.
- * Output of the test should be WinMenuTest-1.0.exe installer.
- * The output installer should provide the same functionality as the default
- * installer (see description of the default installer in Test.java).
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinMenuBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinMenuTest
- */
-public class WinMenuTest {
- private static final String TEST_NAME = "WinMenuTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinMenuBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/WinPerUserInstallTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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 --win-per-user-install, --win-menu, --win-menu-group parameters.
- * Output of the test should be WinPerUserInstallTest-1.0.exe installer.
- * The output installer should provide the same functionality as the default installer
- * (see description of the default installer in Test.java) plus it should
- * create application menu in Windows Menu and installation should be per
- * user and not machine wide.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinPerUserInstallBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinPerUserInstallTest
- */
-public class WinPerUserInstallTest {
- private static final String TEST_NAME = "WinPerUserInstallTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinPerUserInstallBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/WinShortcutTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 --win-shortcut parameter.
- * Output of the test should be WinShortcutTest-1.0.exe installer.
- * The output installer should provide the same functionality as the default installer
- * (see description of the default installer in Test.java) plus install
- * application shortcut on the desktop.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinShortcutBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinShortcutTest
- */
-public class WinShortcutTest {
- private static final String TEST_NAME = "WinShortcutTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinShortcutBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/WinUpgradeUUIDTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +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 both --win-upgrade-uuid and --app-version parameters.
- * Output of the test should be WinUpgradeUUIDTest-1.0.exe
- * and WinUpgradeUUIDTest-2.0.exe installers.
- * Both output installers should provide the same functionality as the default
- * installer (see description of the default installer in Test.java) but have
- * the same product code and different versions.
- * Running WinUpgradeUUIDTest-2.0.exe installer should automatically
- * uninstall older version of the test application previously installed with
- * WinUpgradeUUIDTest-1.0.exe installer.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinUpgradeUUIDBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinUpgradeUUIDTest
- */
-public class WinUpgradeUUIDTest {
- private static final String TEST_NAME = "WinUpgradeUUIDTest";
- private static final String EXT = "exe";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinUpgradeUUIDBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/exe/install.bat Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-Test-1.0.exe
-WinMenuTest-1.0.exe
-WinMenuGroupTest-1.0.exe
-WinPerUserInstallTest-1.0.exe
-FileAssociationsTest-1.0.exe
-ECHO Make sure that installer asks to select installation location. Install to default one.
-WinDirChooserTest-1.0.exe
-WinRegistryNameTest-1.0.exe
-WinShortcutTest-1.0.exe
-ECHO Make sure that installer shows license
-LicenseTest-1.0.exe
-WinUpgradeUUIDTest-1.0.exe
-WinUpgradeUUIDTest-2.0.exe
-InstallDirTest-1.0.exe
-FileAssociationsInstallDirTest-1.0.exe
-RuntimeTest-1.0.exe
-PAUSE
--- a/test/jdk/tools/jpackage/windows/exe/uninstall.bat Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-"%ProgramFiles%\Test\unins000.exe"
-"%ProgramFiles%\WinMenuTest\unins000.exe"
-"%ProgramFiles%\WinMenuGroupTest\unins000.exe"
-"%localappdata%\WinPerUserInstallTest\unins000.exe"
-"%ProgramFiles%\FileAssociationsTest\unins000.exe"
-"%ProgramFiles%\WinDirChooserTest\unins000.exe"
-"%ProgramFiles%\WinRegistryNameTest\unins000.exe"
-"%ProgramFiles%\WinShortcutTest\unins000.exe"
-"%ProgramFiles%\LicenseTest\unins000.exe"
-"%ProgramFiles%\WinUpgradeUUIDTest\unins000.exe"
-"%ProgramFiles%\TestVendor\InstallDirTestDir\unins000.exe"
-"%ProgramFiles%\TestVendor\FileAssociationsInstallDirTestDir\unins000.exe"
-"%ProgramFiles%\RuntimeTest\unins000.exe"
-PAUSE
--- a/test/jdk/tools/jpackage/windows/msi/FileAssociationsInstallDirTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build FileAssociationsBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m FileAssociationsInstallDirTest
- */
-public class FileAssociationsInstallDirTest {
- private static final String TEST_NAME = "FileAssociationsInstallDirTest";
- private static final String EXT = "msi";
- private static final String INSTALL_DIR
- = "TestVendor\\FileAssociationsInstallDirTestDir";
- private static final String TEST_EXT = "jptest3";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- FileAssociationsBase.run(TEST_NAME,
- EXT, INSTALL_DIR, TEST_EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/FileAssociationsTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build FileAssociationsBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m FileAssociationsTest
- */
-public class FileAssociationsTest {
- private static final String TEST_NAME = "FileAssociationsTest";
- private static final String EXT = "msi";
- private static final String TEST_EXT = "jptest1";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- FileAssociationsBase.run(TEST_NAME,
- EXT, null, TEST_EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/InstallDirTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer install dir test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build InstallDirBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m InstallDirTest
- */
-public class InstallDirTest {
- private static final String TEST_NAME = "InstallDirTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- InstallDirBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/LicenseTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build LicenseBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m LicenseTest
- */
-public class LicenseTest {
- private static final String TEST_NAME = "LicenseTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- LicenseBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/RuntimeTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.lang.invoke.MethodHandles;
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build RuntimeBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m RuntimeTest
- */
-public class RuntimeTest {
-
- private static final String TEST_NAME = MethodHandles.lookup().lookupClass().getName();
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- RuntimeBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/Test.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build Base
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m Test
- */
-public class Test {
- private static final String TEST_NAME = "Test";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- Base.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/WinDirChooserTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinDirChooserBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinDirChooserTest
- */
-public class WinDirChooserTest {
- private static final String TEST_NAME = "WinDirChooserTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinDirChooserBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/WinMenuGroupTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinMenuGroupBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinMenuGroupTest
- */
-public class WinMenuGroupTest {
- private static final String TEST_NAME = "WinMenuGroupTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinMenuGroupBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/WinMenuTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinMenuBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinMenuTest
- */
-public class WinMenuTest {
- private static final String TEST_NAME = "WinMenuTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinMenuBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/WinPerUserInstallTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinPerUserInstallBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinPerUserInstallTest
- */
-public class WinPerUserInstallTest {
- private static final String TEST_NAME = "WinPerUserInstallTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinPerUserInstallBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/WinShortcutTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinShortcutBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinShortcutTest
- */
-public class WinShortcutTest {
- private static final String TEST_NAME = "WinShortcutTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinShortcutBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/WinUpgradeUUIDTest.java Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary jpackage create installer test
- * @library ../../helpers
- * @library ../base
- * @build JPackageHelper
- * @build JPackagePath
- * @build JPackageInstallerHelper
- * @build WinUpgradeUUIDBase
- * @requires (os.family == "windows")
- * @modules jdk.jpackage
- * @modules jdk.jpackage/jdk.jpackage.internal
- * @run main/othervm -Xmx512m WinUpgradeUUIDTest
- */
-public class WinUpgradeUUIDTest {
- private static final String TEST_NAME = "WinUpgradeUUIDTest";
- private static final String EXT = "msi";
-
- public static void main(String[] args) throws Exception {
- if (jdk.jpackage.internal.WinMsiBundler.isSupported()) {
- WinUpgradeUUIDBase.run(TEST_NAME, EXT);
- }
- }
-}
--- a/test/jdk/tools/jpackage/windows/msi/install.bat Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-Test-1.0.msi
-WinMenuTest-1.0.msi
-WinMenuGroupTest-1.0.msi
-WinPerUserInstallTest-1.0.msi
-FileAssociationsTest-1.0.msi
-ECHO Make sure that installer asks to select installation location. Install to default one.
-WinDirChooserTest-1.0.msi
-WinRegistryNameTest-1.0.msi
-WinShortcutTest-1.0.msi
-ECHO Make sure that installer shows license
-LicenseTest-1.0.msi
-WinUpgradeUUIDTest-1.0.msi
-WinUpgradeUUIDTest-2.0.msi
-InstallDirTest-1.0.msi
-FileAssociationsInstallDirTest-1.0.msi
-RuntimeTest-1.0.msi
-PAUSE
--- a/test/jdk/tools/jpackage/windows/msi/uninstall.bat Fri Sep 06 17:42:06 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-MSIEXEC /uninstall Test-1.0.msi
-MSIEXEC /uninstall WinMenuTest-1.0.msi
-MSIEXEC /uninstall WinMenuGroupTest-1.0.msi
-MSIEXEC /uninstall WinPerUserInstallTest-1.0.msi
-MSIEXEC /uninstall FileAssociationsTest-1.0.msi
-MSIEXEC /uninstall WinDirChooserTest-1.0.msi
-MSIEXEC /uninstall WinRegistryNameTest-1.0.msi
-MSIEXEC /uninstall WinShortcutTest-1.0.msi
-MSIEXEC /uninstall LicenseTest-1.0.msi
-MSIEXEC /uninstall WinUpgradeUUIDTest-2.0.msi
-MSIEXEC /uninstall InstallDirTest-1.0.msi
-MSIEXEC /uninstall FileAssociationsInstallDirTest-1.0.msi
-MSIEXEC /uninstall RuntimeTest-1.0.msi
-PAUSE