< prev index next >
test/tools/launcher/modules/basic/BasicTest.java
Print this page
*** 22,53 ****
*/
/**
* @test
* @library /lib/testlibrary
! * @modules jdk.jartool/sun.tools.jar
! * jdk.jlink/jdk.tools.jmod
! * jdk.compiler
* @build BasicTest CompilerUtils jdk.testlibrary.*
* @run testng BasicTest
* @summary Basic test of starting an application as a module
*/
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import jdk.testlibrary.ProcessTools;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
@Test
public class BasicTest {
private static final Path USER_DIR = Paths.get(System.getProperty("user.dir"));
private static final String TEST_SRC = System.getProperty("test.src");
--- 22,56 ----
*/
/**
* @test
* @library /lib/testlibrary
! * @modules jdk.compiler
! * jdk.jartool
! * jdk.jlink
* @build BasicTest CompilerUtils jdk.testlibrary.*
* @run testng BasicTest
* @summary Basic test of starting an application as a module
*/
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+ import java.util.spi.ToolProvider;
import jdk.testlibrary.ProcessTools;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
@Test
public class BasicTest {
+ private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar").get();
+ private static final ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod").get();
private static final Path USER_DIR = Paths.get(System.getProperty("user.dir"));
private static final String TEST_SRC = System.getProperty("test.src");
*** 130,143 ****
"--create",
"--file=" + jar,
"--main-class=" + MAIN_CLASS,
"-C", classes, "."
};
! boolean success
! = new sun.tools.jar.Main(System.out, System.out, "jar")
! .run(args);
! assertTrue(success);
// java --module-path mlib -module $TESTMODULE
int exitValue = exec("--module-path", dir.toString(),
"--module", TEST_MODULE);
assertTrue(exitValue == 0);
--- 133,144 ----
"--create",
"--file=" + jar,
"--main-class=" + MAIN_CLASS,
"-C", classes, "."
};
! int rc = JAR_TOOL.run(System.out, System.out, args);
! assertTrue(rc == 0);
// java --module-path mlib -module $TESTMODULE
int exitValue = exec("--module-path", dir.toString(),
"--module", TEST_MODULE);
assertTrue(exitValue == 0);
*** 162,173 ****
"create",
"--class-path", cp,
"--main-class", MAIN_CLASS,
jmod
};
! jdk.tools.jmod.JmodTask task = new jdk.tools.jmod.JmodTask();
! assertEquals(task.run(args), 0);
// java --module-path mods --module $TESTMODULE
int exitValue = exec("--module-path", dir.toString(),
"--module", TEST_MODULE);
assertTrue(exitValue != 0);
--- 163,174 ----
"create",
"--class-path", cp,
"--main-class", MAIN_CLASS,
jmod
};
!
! assertEquals(JMOD_TOOL.run(System.out, System.out, args), 0);
// java --module-path mods --module $TESTMODULE
int exitValue = exec("--module-path", dir.toString(),
"--module", TEST_MODULE);
assertTrue(exitValue != 0);
*** 227,240 ****
String[] args = {
"--create",
"--file=" + jar,
"-C", classes, "."
};
! boolean success
! = new sun.tools.jar.Main(System.out, System.out, "jar")
! .run(args);
! assertTrue(success);
// java --module-path mods -m $TESTMODULE
int exitValue = exec("--module-path", dir.toString(), "-m", TEST_MODULE);
assertTrue(exitValue != 0);
}
--- 228,239 ----
String[] args = {
"--create",
"--file=" + jar,
"-C", classes, "."
};
! int rc = JAR_TOOL.run(System.out, System.out, args);
! assertTrue(rc == 0);
// java --module-path mods -m $TESTMODULE
int exitValue = exec("--module-path", dir.toString(), "-m", TEST_MODULE);
assertTrue(exitValue != 0);
}
< prev index next >