8236134: files missing in putback to JDK-8233270
Reviewed-by: herrick, prr, almatvee
This commit is contained in:
parent
b4459723ad
commit
df75426b4f
@ -1,64 +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.
|
||||
*/
|
||||
|
||||
package com.other;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public class Other {
|
||||
|
||||
private static final String MSG = "other jpackage test application";
|
||||
private static final int EXPECTED_NUM_OF_PARAMS = 3; // Starts at 1
|
||||
|
||||
public static void main(String[] args) {
|
||||
String outputFile = "appOutput.txt";
|
||||
File file = new File(outputFile);
|
||||
|
||||
try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file)))) {
|
||||
System.out.println(MSG);
|
||||
out.println(MSG);
|
||||
|
||||
System.out.println("args.length: " + args.length);
|
||||
out.println("args.length: " + args.length);
|
||||
|
||||
for (String arg : args) {
|
||||
System.out.println(arg);
|
||||
out.println(arg);
|
||||
}
|
||||
|
||||
for (int index = 1; index <= EXPECTED_NUM_OF_PARAMS; index++) {
|
||||
String value = System.getProperty("param" + index);
|
||||
if (value != null) {
|
||||
System.out.println("-Dparam" + index + "=" + value);
|
||||
out.println("-Dparam" + index + "=" + value);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.err.println(ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,26 +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.
|
||||
*/
|
||||
|
||||
module com.other {
|
||||
exports com.other;
|
||||
}
|
@ -0,0 +1,239 @@
|
||||
/*
|
||||
* 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.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.jpackage.test.Functional.ThrowingBiConsumer;
|
||||
|
||||
public final class AdditionalLauncher {
|
||||
|
||||
public AdditionalLauncher(String name) {
|
||||
this.name = name;
|
||||
this.rawProperties = new ArrayList<>();
|
||||
setPersistenceHandler(null);
|
||||
}
|
||||
|
||||
public AdditionalLauncher setDefaultArguments(String... v) {
|
||||
defaultArguments = new ArrayList<>(List.of(v));
|
||||
return this;
|
||||
}
|
||||
|
||||
public AdditionalLauncher addDefaultArguments(String... v) {
|
||||
if (defaultArguments == null) {
|
||||
return setDefaultArguments(v);
|
||||
}
|
||||
|
||||
defaultArguments.addAll(List.of(v));
|
||||
return this;
|
||||
}
|
||||
|
||||
public AdditionalLauncher setJavaOptions(String... v) {
|
||||
javaOptions = new ArrayList<>(List.of(v));
|
||||
return this;
|
||||
}
|
||||
|
||||
public AdditionalLauncher addJavaOptions(String... v) {
|
||||
if (javaOptions == null) {
|
||||
return setJavaOptions(v);
|
||||
}
|
||||
|
||||
javaOptions.addAll(List.of(v));
|
||||
return this;
|
||||
}
|
||||
|
||||
public AdditionalLauncher addRawProperties(Map.Entry<String, String>... v) {
|
||||
return addRawProperties(List.of(v));
|
||||
}
|
||||
|
||||
public AdditionalLauncher addRawProperties(
|
||||
Collection<Map.Entry<String, String>> v) {
|
||||
rawProperties.addAll(v);
|
||||
return this;
|
||||
}
|
||||
|
||||
public AdditionalLauncher setIcon(Path iconPath) {
|
||||
if (iconPath == NO_ICON) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
icon = iconPath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AdditionalLauncher setNoIcon() {
|
||||
icon = NO_ICON;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AdditionalLauncher setPersistenceHandler(
|
||||
ThrowingBiConsumer<Path, List<Map.Entry<String, String>>> handler) {
|
||||
if (handler != null) {
|
||||
createFileHandler = ThrowingBiConsumer.toBiConsumer(handler);
|
||||
} else {
|
||||
createFileHandler = TKit::createPropertiesFile;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void applyTo(JPackageCommand cmd) {
|
||||
cmd.addPrerequisiteAction(this::initialize);
|
||||
cmd.addVerifyAction(this::verify);
|
||||
}
|
||||
|
||||
public void applyTo(PackageTest test) {
|
||||
test.addInitializer(this::initialize);
|
||||
test.addInstallVerifier(this::verify);
|
||||
}
|
||||
|
||||
private void initialize(JPackageCommand cmd) {
|
||||
final Path propsFile = TKit.workDir().resolve(name + ".properties");
|
||||
|
||||
cmd.addArguments("--add-launcher", String.format("%s=%s", name,
|
||||
propsFile));
|
||||
|
||||
List<Map.Entry<String, String>> properties = new ArrayList<>();
|
||||
if (defaultArguments != null) {
|
||||
properties.add(Map.entry("arguments",
|
||||
JPackageCommand.escapeAndJoin(defaultArguments)));
|
||||
}
|
||||
|
||||
if (javaOptions != null) {
|
||||
properties.add(Map.entry("java-options",
|
||||
JPackageCommand.escapeAndJoin(javaOptions)));
|
||||
}
|
||||
|
||||
if (icon != null) {
|
||||
final String iconPath;
|
||||
if (icon == NO_ICON) {
|
||||
iconPath = "";
|
||||
} else {
|
||||
iconPath = icon.toAbsolutePath().toString().replace('\\', '/');
|
||||
}
|
||||
properties.add(Map.entry("icon", iconPath));
|
||||
}
|
||||
|
||||
properties.addAll(rawProperties);
|
||||
|
||||
createFileHandler.accept(propsFile, properties);
|
||||
}
|
||||
|
||||
private static Path iconInResourceDir(JPackageCommand cmd,
|
||||
String launcherName) {
|
||||
Path resourceDir = cmd.getArgumentValue("--resource-dir", () -> null,
|
||||
Path::of);
|
||||
if (resourceDir != null) {
|
||||
Path icon = resourceDir.resolve(
|
||||
Optional.ofNullable(launcherName).orElseGet(() -> cmd.name())
|
||||
+ TKit.ICON_SUFFIX);
|
||||
if (Files.exists(icon)) {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void verifyIcon(JPackageCommand cmd) throws IOException {
|
||||
var verifier = new LauncherIconVerifier().setLauncherName(name);
|
||||
|
||||
if (TKit.isOSX()) {
|
||||
// On Mac should be no icon files for additional launchers.
|
||||
verifier.applyTo(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean withLinuxDesktopFile = false;
|
||||
|
||||
final Path effectiveIcon = Optional.ofNullable(icon).orElseGet(
|
||||
() -> iconInResourceDir(cmd, name));
|
||||
while (effectiveIcon != NO_ICON) {
|
||||
if (effectiveIcon != null) {
|
||||
withLinuxDesktopFile = true;
|
||||
verifier.setExpectedIcon(effectiveIcon);
|
||||
break;
|
||||
}
|
||||
|
||||
Path customMainLauncherIcon = cmd.getArgumentValue("--icon",
|
||||
() -> iconInResourceDir(cmd, null), Path::of);
|
||||
if (customMainLauncherIcon != null) {
|
||||
withLinuxDesktopFile = true;
|
||||
verifier.setExpectedIcon(customMainLauncherIcon);
|
||||
break;
|
||||
}
|
||||
|
||||
verifier.setExpectedDefaultIcon();
|
||||
break;
|
||||
}
|
||||
|
||||
if (TKit.isLinux() && !cmd.isImagePackageType()) {
|
||||
if (effectiveIcon != NO_ICON && !withLinuxDesktopFile) {
|
||||
withLinuxDesktopFile = Stream.of("--linux-shortcut").anyMatch(
|
||||
cmd::hasArgument);
|
||||
verifier.setExpectedDefaultIcon();
|
||||
}
|
||||
Path desktopFile = LinuxHelper.getDesktopFile(cmd, name);
|
||||
if (withLinuxDesktopFile) {
|
||||
TKit.assertFileExists(desktopFile);
|
||||
} else {
|
||||
TKit.assertPathExists(desktopFile, false);
|
||||
}
|
||||
}
|
||||
|
||||
verifier.applyTo(cmd);
|
||||
}
|
||||
|
||||
private void verify(JPackageCommand cmd) throws IOException {
|
||||
verifyIcon(cmd);
|
||||
|
||||
Path launcherPath = cmd.appLauncherPath(name);
|
||||
|
||||
TKit.assertExecutableFileExists(launcherPath);
|
||||
|
||||
if (cmd.isFakeRuntime(String.format(
|
||||
"Not running %s launcher", launcherPath))) {
|
||||
return;
|
||||
}
|
||||
|
||||
HelloApp.assertApp(launcherPath)
|
||||
.addDefaultArguments(Optional
|
||||
.ofNullable(defaultArguments)
|
||||
.orElseGet(() -> List.of(cmd.getAllArgumentValues("--arguments"))))
|
||||
.addJavaOptions(Optional
|
||||
.ofNullable(javaOptions)
|
||||
.orElseGet(() -> List.of(cmd.getAllArgumentValues("--java-options"))))
|
||||
.executeAndVerifyOutput();
|
||||
}
|
||||
|
||||
private List<String> javaOptions;
|
||||
private List<String> defaultArguments;
|
||||
private Path icon;
|
||||
private final String name;
|
||||
private final List<Map.Entry<String, String>> rawProperties;
|
||||
private BiConsumer<Path, List<Map.Entry<String, String>>> createFileHandler;
|
||||
|
||||
private final static Path NO_ICON = Path.of("");
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
public final class LauncherIconVerifier {
|
||||
public LauncherIconVerifier() {
|
||||
}
|
||||
|
||||
public LauncherIconVerifier setLauncherName(String v) {
|
||||
launcherName = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LauncherIconVerifier setExpectedIcon(Path v) {
|
||||
expectedIcon = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LauncherIconVerifier setExpectedDefaultIcon() {
|
||||
expectedIcon = getDefaultIcon();
|
||||
return this;
|
||||
}
|
||||
|
||||
public void applyTo(JPackageCommand cmd) throws IOException {
|
||||
final String curLauncherName;
|
||||
final String label;
|
||||
if (launcherName == null) {
|
||||
curLauncherName = cmd.name();
|
||||
label = "main";
|
||||
} else {
|
||||
curLauncherName = launcherName;
|
||||
label = String.format("[%s]", launcherName);
|
||||
}
|
||||
|
||||
Path iconPath = cmd.appLayout().destktopIntegrationDirectory().resolve(
|
||||
curLauncherName + TKit.ICON_SUFFIX);
|
||||
|
||||
if (expectedIcon == null) {
|
||||
TKit.assertPathExists(iconPath, false);
|
||||
return;
|
||||
}
|
||||
|
||||
TKit.assertFileExists(iconPath);
|
||||
TKit.assertTrue(-1 == Files.mismatch(expectedIcon, iconPath),
|
||||
String.format(
|
||||
"Check icon file [%s] of %s launcher is a copy of source icon file [%s]",
|
||||
iconPath, label, expectedIcon));
|
||||
}
|
||||
|
||||
public static Path getDefaultIcon() {
|
||||
final String[] components;
|
||||
if (TKit.isOSX()) {
|
||||
components = new String[] { "macosx", "java.icns" };
|
||||
} else if (TKit.isLinux()) {
|
||||
components = new String[] { "linux", "java32.png" };
|
||||
} else if (TKit.isWindows()) {
|
||||
components = new String[] { "windows", "java48.ico" };
|
||||
} else {
|
||||
throw TKit.throwUnknownPlatformError();
|
||||
}
|
||||
|
||||
return TKit.SRC_ROOT.resolve(Path.of(components[0],
|
||||
"classes/jdk/incubator/jpackage/internal/resources", components[1]));
|
||||
}
|
||||
|
||||
private String launcherName;
|
||||
private Path expectedIcon;
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* 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.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public abstract class RunnablePackageTest {
|
||||
public final void run(Action... actions) {
|
||||
final List<Action> actionList = new ArrayList<>();
|
||||
actionList.add(Action.INITIALIZE);
|
||||
if (actions.length == 0) {
|
||||
actionList.addAll(DEFAULT_ACTIONS);
|
||||
} else {
|
||||
actionList.addAll(Stream.of(actions)
|
||||
.filter(Predicate.not(Action.INITIALIZE::equals))
|
||||
.filter(Predicate.not(Action.FINALIZE::equals))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
actionList.add(Action.FINALIZE);
|
||||
|
||||
var actionGroups = groupActions(actionList);
|
||||
TKit.trace(String.format("Actions: " + Arrays.deepToString(
|
||||
actionGroups.toArray(Action[][]::new))));
|
||||
|
||||
runActions(actionGroups);
|
||||
}
|
||||
|
||||
protected void runActions(List<Action[]> actions) {
|
||||
actions.forEach(this::runAction);
|
||||
}
|
||||
|
||||
protected abstract void runAction(Action... action);
|
||||
|
||||
/**
|
||||
* Test action.
|
||||
*/
|
||||
static public enum Action {
|
||||
/**
|
||||
* Init test.
|
||||
*/
|
||||
INITIALIZE,
|
||||
/**
|
||||
* Create bundle.
|
||||
*/
|
||||
CREATE,
|
||||
/**
|
||||
* Verify unpacked/installed package.
|
||||
*/
|
||||
VERIFY_INSTALL,
|
||||
/**
|
||||
* Verify uninstalled package.
|
||||
*/
|
||||
VERIFY_UNINSTALL,
|
||||
/**
|
||||
* Unpack package bundle.
|
||||
*/
|
||||
UNPACK,
|
||||
/**
|
||||
* Install package.
|
||||
*/
|
||||
INSTALL,
|
||||
/**
|
||||
* Uninstall package.
|
||||
*/
|
||||
UNINSTALL,
|
||||
/**
|
||||
* Finalize test.
|
||||
*/
|
||||
FINALIZE;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name().toLowerCase().replace('_', '-');
|
||||
}
|
||||
|
||||
public final static Action[] CREATE_AND_UNPACK = new Action[] {
|
||||
CREATE, UNPACK, VERIFY_INSTALL
|
||||
};
|
||||
};
|
||||
|
||||
private List<Action[]> groupActions(List<Action> actions) {
|
||||
List<Action[]> groups = new ArrayList<>();
|
||||
List<Action> group = null;
|
||||
for (var action: actions) {
|
||||
if (group == null) {
|
||||
group = new ArrayList<>();
|
||||
group.add(action);
|
||||
} else if (group.get(group.size() - 1) == Action.INSTALL
|
||||
&& action == Action.VERIFY_INSTALL) {
|
||||
// Group `install` and `verify install` actions together
|
||||
group.add(action);
|
||||
} else {
|
||||
groups.add(group.toArray(Action[]::new));
|
||||
group.clear();
|
||||
group.add(action);
|
||||
}
|
||||
}
|
||||
if (group != null) {
|
||||
groups.add(group.toArray(Action[]::new));
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
private final static List<Action> DEFAULT_ACTIONS;
|
||||
|
||||
static {
|
||||
final String propertyName = "action";
|
||||
List<String> actions = TKit.tokenizeConfigPropertyAsList(propertyName);
|
||||
if (actions == null || actions.isEmpty()) {
|
||||
DEFAULT_ACTIONS = List.of(Action.CREATE_AND_UNPACK);
|
||||
} else {
|
||||
try {
|
||||
DEFAULT_ACTIONS = actions.stream()
|
||||
.map(String::toUpperCase)
|
||||
.map(v -> v.replace('-', '_'))
|
||||
.map(Action::valueOf)
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Unrecognized value of %s property: [%s]",
|
||||
TKit.getConfigPropertyName(propertyName),
|
||||
TKit.getConfigProperty(propertyName)), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,231 +0,0 @@
|
||||
#!/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
|
||||
}
|
||||
|
||||
# For macOS
|
||||
if !(type "tac" &> /dev/null;) then
|
||||
tac_cmd='tail -r'
|
||||
else
|
||||
tac_cmd=tac
|
||||
fi
|
||||
|
||||
# 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 pkg dmg)
|
||||
for suffix in "${package_suffixes[@]}"; do
|
||||
if [ "$mode" == "uninstall" ]; then
|
||||
packages=$(find_packages_of_type $suffix | $tac_cmd)
|
||||
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
|
||||
}
|
||||
|
||||
# PKG
|
||||
install_cmd_pkg ()
|
||||
{
|
||||
echo sudo /usr/sbin/installer -allowUntrusted -pkg "\"$@\"" -target /
|
||||
}
|
||||
uninstall_cmd_pkg ()
|
||||
{
|
||||
local pname=`basename $@`
|
||||
local appname="$(cut -d'-' -f1 <<<"$pname")"
|
||||
if [ "$appname" = "CommonInstallDirTest" ]; then
|
||||
echo sudo rm -rf "/Applications/jpackage/\"$appname.app\""
|
||||
else
|
||||
echo sudo rm -rf "/Applications/\"$appname.app\""
|
||||
fi
|
||||
}
|
||||
|
||||
# DMG
|
||||
install_cmd_dmg ()
|
||||
{
|
||||
local pname=`basename $@`
|
||||
local appname="$(cut -d'-' -f1 <<<"$pname")"
|
||||
local command=()
|
||||
if [ "$appname" = "CommonLicenseTest" ]; then
|
||||
command+=("{" yes "|" hdiutil attach "\"$@\"" ">" /dev/null)
|
||||
else
|
||||
command+=("{" hdiutil attach "\"$@\"" ">" /dev/null)
|
||||
fi
|
||||
|
||||
command+=(";" sudo cp -R "\"/Volumes/$appname/$appname.app\"" /Applications ">" /dev/null)
|
||||
command+=(";" hdiutil detach "\"/Volumes/$appname\"" ">" /dev/null ";}")
|
||||
|
||||
echo "${command[@]}"
|
||||
}
|
||||
uninstall_cmd_dmg ()
|
||||
{
|
||||
local pname=`basename $@`
|
||||
local appname="$(cut -d'-' -f1 <<<"$pname")"
|
||||
echo sudo rm -rf "/Applications/\"$appname.app\""
|
||||
}
|
||||
|
||||
# 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
|
||||
IFS=$'\n'
|
||||
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
|
||||
eval $cmd || true;
|
||||
done
|
||||
else
|
||||
# Print commands
|
||||
for cmd in "${commands[@]}"; do echo $cmd; done
|
||||
fi
|
BIN
test/jdk/tools/jpackage/resources/icon2.icns
Normal file
BIN
test/jdk/tools/jpackage/resources/icon2.icns
Normal file
Binary file not shown.
BIN
test/jdk/tools/jpackage/resources/icon2.ico
Normal file
BIN
test/jdk/tools/jpackage/resources/icon2.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
test/jdk/tools/jpackage/resources/icon2.png
Normal file
BIN
test/jdk/tools/jpackage/resources/icon2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
BIN
test/jdk/tools/jpackage/resources/icon3.ico
Normal file
BIN
test/jdk/tools/jpackage/resources/icon3.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
test/jdk/tools/jpackage/resources/icon3.png
Normal file
BIN
test/jdk/tools/jpackage/resources/icon3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
BIN
test/jdk/tools/jpackage/resources/icon4.ico
Normal file
BIN
test/jdk/tools/jpackage/resources/icon4.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
test/jdk/tools/jpackage/resources/icon4.png
Normal file
BIN
test/jdk/tools/jpackage/resources/icon4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -21,31 +21,45 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary jpackage create image with additional launcher test
|
||||
* @library ../helpers
|
||||
* @build JPackageHelper
|
||||
* @build JPackagePath
|
||||
* @build AddLauncherBase
|
||||
* @modules jdk.incubator.jpackage
|
||||
* @run main/othervm -Xmx512m AddLauncherModuleTest
|
||||
*/
|
||||
public class AddLauncherModuleTest {
|
||||
private static final String OUTPUT = "output";
|
||||
private static final String [] CMD = {
|
||||
"--type", "app-image",
|
||||
"--dest", OUTPUT,
|
||||
"--name", "test",
|
||||
"--module", "com.hello/com.hello.Hello",
|
||||
"--module-path", "input",
|
||||
"--add-launcher", "test2=sl.properties"};
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
JPackageHelper.createHelloModule();
|
||||
AddLauncherBase.createSLProperties();
|
||||
AddLauncherBase.testCreateAppImageToolProvider(
|
||||
CMD);
|
||||
function readMsi(msiPath, callback) {
|
||||
var installer = new ActiveXObject('WindowsInstaller.Installer')
|
||||
var database = installer.OpenDatabase(msiPath, 0 /* msiOpenDatabaseModeReadOnly */)
|
||||
|
||||
return callback(database)
|
||||
}
|
||||
|
||||
|
||||
function queryAllProperties(db) {
|
||||
var reply = {}
|
||||
|
||||
var view = db.OpenView("SELECT `Property`, `Value` FROM Property")
|
||||
view.Execute()
|
||||
|
||||
try {
|
||||
while(true) {
|
||||
var record = view.Fetch()
|
||||
if (!record) {
|
||||
break
|
||||
}
|
||||
|
||||
var name = record.StringData(1)
|
||||
var value = record.StringData(2)
|
||||
|
||||
reply[name] = value
|
||||
}
|
||||
} finally {
|
||||
view.Close()
|
||||
}
|
||||
|
||||
return reply
|
||||
}
|
||||
|
||||
|
||||
(function () {
|
||||
var msi = WScript.arguments(0)
|
||||
var propName = WScript.arguments(1)
|
||||
|
||||
var props = readMsi(msi, queryAllProperties)
|
||||
WScript.Echo(props[propName])
|
||||
})()
|
@ -1,193 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AddLauncherBase {
|
||||
private static final String app = JPackagePath.getApp();
|
||||
private static final String appOutput = JPackagePath.getAppOutputFile();
|
||||
|
||||
// Note: quotes in argument for add launcher is not support by test
|
||||
private static final String ARGUMENT1 = "argument 1";
|
||||
private static final String ARGUMENT2 = "argument 2";
|
||||
private static final String ARGUMENT3 = "argument 3";
|
||||
|
||||
private static final List<String> arguments = new ArrayList<>();
|
||||
|
||||
private static final String PARAM1 = "-Dparam1=Some Param 1";
|
||||
private static final String PARAM2 = "-Dparam2=Some Param 2";
|
||||
private static final String PARAM3 = "-Dparam3=Some Param 3";
|
||||
|
||||
private static final List<String> vmArguments = new ArrayList<>();
|
||||
private static final List<String> empty = new ArrayList<>();
|
||||
|
||||
private static void validateResult(List<String> args, List<String> vmArgs)
|
||||
throws Exception {
|
||||
File outfile = new File(appOutput);
|
||||
if (!outfile.exists()) {
|
||||
throw new AssertionError(appOutput + " was not created");
|
||||
}
|
||||
|
||||
String output = Files.readString(outfile.toPath());
|
||||
String[] result = output.split("\n");
|
||||
|
||||
int expected = 2 + args.size() + vmArgs.size();
|
||||
|
||||
if (result.length != expected) {
|
||||
throw new AssertionError("Unexpected number of lines: "
|
||||
+ result.length + " expected: " + expected + " - results: " + output);
|
||||
}
|
||||
|
||||
if (!result[0].trim().endsWith("jpackage test application")) {
|
||||
throw new AssertionError("Unexpected result[0]: " + result[0]);
|
||||
}
|
||||
|
||||
if (!result[1].trim().equals("args.length: " + args.size())) {
|
||||
throw new AssertionError("Unexpected result[1]: " + result[1]);
|
||||
}
|
||||
|
||||
int index = 2;
|
||||
for (String arg : args) {
|
||||
if (!result[index].trim().equals(arg)) {
|
||||
throw new AssertionError("Unexpected result["
|
||||
+ index + "]: " + result[index]);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
for (String vmArg : vmArgs) {
|
||||
if (!result[index].trim().equals(vmArg)) {
|
||||
throw new AssertionError("Unexpected result["
|
||||
+ index + "]: " + result[index]);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
private static void validate(boolean includeArgs, String name)
|
||||
throws Exception {
|
||||
int retVal = JPackageHelper.execute(null, app);
|
||||
if (retVal != 0) {
|
||||
throw new AssertionError("Test application " + app
|
||||
+ " exited with error: " + retVal);
|
||||
}
|
||||
validateResult(new ArrayList<>(), new ArrayList<>());
|
||||
|
||||
String app2 = JPackagePath.getAppSL(name);
|
||||
retVal = JPackageHelper.execute(null, app2);
|
||||
if (retVal != 0) {
|
||||
throw new AssertionError("Test application " + app2
|
||||
+ " exited with error: " + retVal);
|
||||
}
|
||||
if (includeArgs) {
|
||||
validateResult(arguments, vmArguments);
|
||||
} else {
|
||||
validateResult(empty, empty);
|
||||
}
|
||||
}
|
||||
|
||||
public static void testCreateAppImage(String [] cmd) throws Exception {
|
||||
testCreateAppImage(cmd, true, "test2");
|
||||
}
|
||||
|
||||
public static void testCreateAppImage(String [] cmd,
|
||||
boolean includeArgs, String name) throws Exception {
|
||||
JPackageHelper.executeCLI(true, cmd);
|
||||
validate(includeArgs, name);
|
||||
}
|
||||
|
||||
public static void testCreateAppImageToolProvider(String [] cmd)
|
||||
throws Exception {
|
||||
testCreateAppImageToolProvider(cmd, true, "test2");
|
||||
}
|
||||
|
||||
public static void testCreateAppImageToolProvider(String [] cmd,
|
||||
boolean includeArgs, String name) throws Exception {
|
||||
JPackageHelper.executeToolProvider(true, cmd);
|
||||
validate(includeArgs, name);
|
||||
}
|
||||
|
||||
public static void testCreateAppImage(String [] cmd,
|
||||
ArrayList<String> argList, ArrayList <String> optionList)
|
||||
throws Exception {
|
||||
JPackageHelper.executeCLI(true, cmd);
|
||||
int retVal = JPackageHelper.execute(null, app);
|
||||
if (retVal != 0) {
|
||||
throw new AssertionError("Test application " + app
|
||||
+ " exited with error: " + retVal);
|
||||
}
|
||||
validateResult(argList, optionList);
|
||||
String name = "test4";
|
||||
|
||||
String app2 = JPackagePath.getAppSL(name);
|
||||
retVal = JPackageHelper.execute(null, app2);
|
||||
if (retVal != 0) {
|
||||
throw new AssertionError("Test application " + app2
|
||||
+ " exited with error: " + retVal);
|
||||
}
|
||||
validateResult(arguments, vmArguments);
|
||||
}
|
||||
|
||||
public static void createSLProperties() throws Exception {
|
||||
arguments.add(ARGUMENT1);
|
||||
arguments.add(ARGUMENT2);
|
||||
arguments.add(ARGUMENT3);
|
||||
|
||||
String argumentsMap =
|
||||
JPackageHelper.listToArgumentsMap(arguments, true);
|
||||
|
||||
vmArguments.add(PARAM1);
|
||||
vmArguments.add(PARAM2);
|
||||
vmArguments.add(PARAM3);
|
||||
|
||||
String vmArgumentsMap =
|
||||
JPackageHelper.listToArgumentsMap(vmArguments, true);
|
||||
|
||||
try (PrintWriter out = new PrintWriter(new BufferedWriter(
|
||||
new FileWriter("sl.properties")))) {
|
||||
out.println("arguments=" + argumentsMap);
|
||||
out.println("java-options=" + vmArgumentsMap);
|
||||
}
|
||||
|
||||
try (PrintWriter out = new PrintWriter(new BufferedWriter(
|
||||
new FileWriter("m1.properties")))) {
|
||||
out.println("module=com.hello/com.hello.Hello");
|
||||
out.println("main-jar=");
|
||||
}
|
||||
|
||||
try (PrintWriter out = new PrintWriter(new BufferedWriter(
|
||||
new FileWriter("j1.properties")))) {
|
||||
out.println("main-jar hello.jar");
|
||||
out.println("main-class Hello");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,83 +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.util.ArrayList;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary jpackage create image with additional launcher test
|
||||
* @library ../helpers
|
||||
* @build JPackageHelper
|
||||
* @build JPackagePath
|
||||
* @build AddLauncherBase
|
||||
* @modules jdk.incubator.jpackage
|
||||
* @run main/othervm -Xmx512m AddLauncherTest
|
||||
*/
|
||||
public class AddLauncherTest {
|
||||
private static final String OUTPUT = "output";
|
||||
private static final String [] CMD = {
|
||||
"--type", "app-image",
|
||||
"--input", "input",
|
||||
"--dest", OUTPUT,
|
||||
"--name", "test",
|
||||
"--main-jar", "hello.jar",
|
||||
"--main-class", "Hello",
|
||||
"--add-launcher", "test2=sl.properties"};
|
||||
|
||||
private final static String OPT1 = "-Dparam1=xxx";
|
||||
private final static String OPT2 = "-Dparam2=yyy";
|
||||
private final static String OPT3 = "-Dparam3=zzz";
|
||||
private final static String ARG1 = "original-argument";
|
||||
|
||||
private static final String [] CMD1 = {
|
||||
"--type", "app-image",
|
||||
"--input", "input",
|
||||
"--dest", OUTPUT,
|
||||
"--name", "test",
|
||||
"--main-jar", "hello.jar",
|
||||
"--main-class", "Hello",
|
||||
"--java-options", OPT1,
|
||||
"--java-options", OPT2,
|
||||
"--java-options", OPT3,
|
||||
"--arguments", ARG1,
|
||||
"--add-launcher", "test4=sl.properties"};
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
JPackageHelper.createHelloImageJar();
|
||||
AddLauncherBase.createSLProperties();
|
||||
AddLauncherBase.testCreateAppImage(CMD);
|
||||
|
||||
ArrayList <String> argList = new ArrayList <String> ();
|
||||
argList.add(ARG1);
|
||||
|
||||
ArrayList <String> optList = new ArrayList <String> ();
|
||||
optList.add(OPT1);
|
||||
optList.add(OPT2);
|
||||
optList.add(OPT3);
|
||||
|
||||
JPackageHelper.deleteOutputFolder(OUTPUT);
|
||||
AddLauncherBase.testCreateAppImage(CMD1, argList, optList);
|
||||
}
|
||||
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary jpackage create image with additional launcher test
|
||||
* @library ../helpers
|
||||
* @build JPackageHelper
|
||||
* @build JPackagePath
|
||||
* @build AddLauncherBase
|
||||
* @modules jdk.incubator.jpackage
|
||||
* @run main/othervm -Xmx512m AddLaunchersTest
|
||||
*/
|
||||
public class AddLaunchersTest {
|
||||
private static final String OUTPUT = "output";
|
||||
private static final String [] CMD1 = {
|
||||
"--description", "Test non modular app with multiple add-launchers where one is modular app and other is non modular app",
|
||||
"--type", "app-image",
|
||||
"--input", "input",
|
||||
"--dest", OUTPUT,
|
||||
"--name", "test",
|
||||
"--main-jar", "hello.jar",
|
||||
"--main-class", "Hello",
|
||||
"--module-path", "module",
|
||||
"--add-modules", "com.hello,java.desktop",
|
||||
"--add-launcher", "test3=j1.properties",
|
||||
"--add-launcher", "test4=m1.properties"};
|
||||
|
||||
private static final String [] CMD2 = {
|
||||
"--description", "Test modular app with multiple add-launchers where one is modular app and other is non modular app",
|
||||
"--type", "app-image",
|
||||
"--input", "input",
|
||||
"--dest", OUTPUT,
|
||||
"--name", "test",
|
||||
"--module", "com.hello/com.hello.Hello",
|
||||
"--module-path", "module",
|
||||
"--add-launcher", "test5=jl.properties",
|
||||
"--add-launcher", "test6=m1.properties"};
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
JPackageHelper.createHelloImageJar();
|
||||
JPackageHelper.createHelloModule();
|
||||
AddLauncherBase.createSLProperties();
|
||||
|
||||
JPackageHelper.deleteOutputFolder(OUTPUT);
|
||||
AddLauncherBase.testCreateAppImageToolProvider(
|
||||
CMD1, false, "test3");
|
||||
|
||||
JPackageHelper.deleteOutputFolder(OUTPUT);
|
||||
AddLauncherBase.testCreateAppImage(
|
||||
CMD1, false, "test4");
|
||||
|
||||
JPackageHelper.deleteOutputFolder(OUTPUT);
|
||||
AddLauncherBase.testCreateAppImage(
|
||||
CMD2, false, "test5");
|
||||
|
||||
JPackageHelper.deleteOutputFolder(OUTPUT);
|
||||
AddLauncherBase.testCreateAppImageToolProvider(
|
||||
CMD2, false, "test6");
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user