< prev index next >
jdk/test/tools/launcher/modules/patch/basic/PatchTest.java
Print this page
*** 25,35 ****
* @test
* @library /lib/testlibrary
* @modules jdk.compiler
* @build PatchTest CompilerUtils JarUtils jdk.testlibrary.*
* @run testng PatchTest
! * @summary Basic test for -Xpatch
*/
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
--- 25,35 ----
* @test
* @library /lib/testlibrary
* @modules jdk.compiler
* @build PatchTest CompilerUtils JarUtils jdk.testlibrary.*
* @run testng PatchTest
! * @summary Basic test for --patch-module
*/
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
*** 43,59 ****
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
! * Compiles and launches a test that uses -Xpatch with two directories of
! * classes to override existing and add new classes to modules in the
! * boot layer.
*
! * The classes overridden or added via -Xpatch all define a public no-arg
! * constructor and override toString to return "hi". This allows the launched
! * test to check that the overridden classes are loaded.
*/
@Test
public class PatchTest {
--- 43,59 ----
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
! * Compiles and launches a test that uses --patch-module with two directories
! * of classes to override existing classes and add new classes to modules in
! * the boot layer.
*
! * The classes overridden or added via --patch-module all define a public
! * no-arg constructor and override toString to return "hi". This allows the
! * launched test to check that the overridden classes are loaded.
*/
@Test
public class PatchTest {
*** 74,84 ****
// destination directory for patches packaged as JAR files
private static final Path PATCHES_DIR = Paths.get("patches");
! // the classes overridden or added with -Xpatch
private static final String[] CLASSES = {
// java.base = boot loader
"java.base/java.text.Annotation", // override class
"java.base/java.text.AnnotationBuddy", // add class to package
--- 74,84 ----
// destination directory for patches packaged as JAR files
private static final Path PATCHES_DIR = Paths.get("patches");
! // the classes overridden or added with --patch-module
private static final String[] CLASSES = {
// java.base = boot loader
"java.base/java.text.Annotation", // override class
"java.base/java.text.AnnotationBuddy", // add class to package
*** 135,164 ****
{
// the argument to the test is the list of classes overridden or added
String arg = Stream.of(CLASSES).collect(Collectors.joining(","));
int exitValue
! = executeTestJava("-Xpatch:java.base=" + basePatches,
! "-Xpatch:jdk.naming.dns=" + dnsPatches,
! "-Xpatch:jdk.compiler=" + compilerPatches,
! "-XaddExports:java.base/java.lang2=test",
! "-XaddExports:jdk.naming.dns/com.sun.jndi.dns=test",
! "-XaddExports:jdk.naming.dns/com.sun.jndi.dns2=test",
! "-XaddExports:jdk.compiler/com.sun.tools.javac2=test",
! "-addmods", "jdk.naming.dns,jdk.compiler",
! "-mp", MODS_DIR.toString(),
"-m", "test/jdk.test.Main", arg)
.outputTo(System.out)
.errorTo(System.out)
.getExitValue();
assertTrue(exitValue == 0);
}
/**
! * Run test with -Xpatch and exploded patches
*/
public void testWithExplodedPatches() throws Exception {
// patches1/java.base:patches2/java.base
String basePatches = PATCHES1_DIR.resolve("java.base")
--- 135,164 ----
{
// the argument to the test is the list of classes overridden or added
String arg = Stream.of(CLASSES).collect(Collectors.joining(","));
int exitValue
! = executeTestJava("--patch-module", "java.base=" + basePatches,
! "--patch-module", "jdk.naming.dns=" + dnsPatches,
! "--patch-module", "jdk.compiler=" + compilerPatches,
! "--add-exports", "java.base/java.lang2=test",
! "--add-exports", "jdk.naming.dns/com.sun.jndi.dns=test",
! "--add-exports", "jdk.naming.dns/com.sun.jndi.dns2=test",
! "--add-exports", "jdk.compiler/com.sun.tools.javac2=test",
! "--add-modules", "jdk.naming.dns,jdk.compiler",
! "--module-path", MODS_DIR.toString(),
"-m", "test/jdk.test.Main", arg)
.outputTo(System.out)
.errorTo(System.out)
.getExitValue();
assertTrue(exitValue == 0);
}
/**
! * Run test with ---patch-module and exploded patches
*/
public void testWithExplodedPatches() throws Exception {
// patches1/java.base:patches2/java.base
String basePatches = PATCHES1_DIR.resolve("java.base")
*** 173,183 ****
runTest(basePatches, dnsPatches, compilerPatches);
}
/**
! * Run test with -Xpatch and patches in JAR files
*/
public void testWithJarPatches() throws Exception {
// patches/java.base-1.jar:patches/java-base-2.jar
String basePatches = PATCHES_DIR.resolve("java.base-1.jar")
--- 173,183 ----
runTest(basePatches, dnsPatches, compilerPatches);
}
/**
! * Run test with ---patch-module and patches in JAR files
*/
public void testWithJarPatches() throws Exception {
// patches/java.base-1.jar:patches/java-base-2.jar
String basePatches = PATCHES_DIR.resolve("java.base-1.jar")
*** 193,203 ****
}
/**
! * Run test with -Xpatch and patches in JAR files and exploded patches
*/
public void testWithJarAndExplodedPatches() throws Exception {
// patches/java.base-1.jar:patches2/java.base
String basePatches = PATCHES_DIR.resolve("java.base-1.jar")
--- 193,203 ----
}
/**
! * Run test with ---patch-module and patches in JAR files and exploded patches
*/
public void testWithJarAndExplodedPatches() throws Exception {
// patches/java.base-1.jar:patches2/java.base
String basePatches = PATCHES_DIR.resolve("java.base-1.jar")
< prev index next >