< prev index next >
test/jdk/tools/jpackage/share/jdk/jpackage/tests/ModulePathTest.java
Print this page
*** 22,31 ****
--- 22,32 ----
*/
package jdk.jpackage.tests;
import java.io.File;
+ import java.io.IOException;
import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
*** 69,79 ****
public ModulePathTest(String... modulePathArgs) {
this.modulePathArgs = List.of(modulePathArgs);
}
@Test
! public void test() {
final String moduleName = "com.foo";
JPackageCommand cmd = JPackageCommand.helloAppImage(
"benvenuto.jar:" + moduleName + "/com.foo.Hello");
// Build app jar file.
cmd.executePrerequisiteActions();
--- 70,80 ----
public ModulePathTest(String... modulePathArgs) {
this.modulePathArgs = List.of(modulePathArgs);
}
@Test
! public void test() throws IOException {
final String moduleName = "com.foo";
JPackageCommand cmd = JPackageCommand.helloAppImage(
"benvenuto.jar:" + moduleName + "/com.foo.Hello");
// Build app jar file.
cmd.executePrerequisiteActions();
*** 86,99 ****
// --module-path should be set in JPackageCommand.helloAppImage call
String goodModulePath = Objects.requireNonNull(cmd.getArgumentValue(
"--module-path"));
cmd.removeArgumentWithValue("--module-path");
! TKit.withTempDirectory("empty-dir", emptyDir -> {
! Path nonExistingDir = TKit.withTempDirectory("non-existing-dir",
! unused -> {
! });
Function<String, String> substitute = str -> {
String v = str;
v = v.replace(GOOD_PATH, goodModulePath);
v = v.replace(EMPTY_DIR, emptyDir.toString());
--- 87,99 ----
// --module-path should be set in JPackageCommand.helloAppImage call
String goodModulePath = Objects.requireNonNull(cmd.getArgumentValue(
"--module-path"));
cmd.removeArgumentWithValue("--module-path");
!
! Path emptyDir = TKit.createTempDirectory("empty-dir");
! Path nonExistingDir = TKit.withTempDirectory("non-existing-dir", x -> {});
Function<String, String> substitute = str -> {
String v = str;
v = v.replace(GOOD_PATH, goodModulePath);
v = v.replace(EMPTY_DIR, emptyDir.toString());
*** 119,134 ****
"Error: Module %s not found", moduleName);
}
List<String> output = cmd
.saveConsoleOutput(true)
! .execute()
! .assertExitCodeIs(1)
.getOutput();
TKit.assertTextStream(expectedErrorMessage).apply(output.stream());
}
- });
}
private final List<String> modulePathArgs;
private final static String GOOD_PATH = "@GoodPath@";
--- 119,132 ----
"Error: Module %s not found", moduleName);
}
List<String> output = cmd
.saveConsoleOutput(true)
! .execute(1)
.getOutput();
TKit.assertTextStream(expectedErrorMessage).apply(output.stream());
}
}
private final List<String> modulePathArgs;
private final static String GOOD_PATH = "@GoodPath@";
< prev index next >