< prev index next >

test/tools/launcher/modules/patch/basic/PatchTest.java

Print this page

        

*** 23,33 **** /** * @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; --- 23,34 ---- /** * @test * @library /lib/testlibrary * @modules jdk.compiler ! * java.naming ! * @build PatchTest CompilerUtils JarUtils jdk.testlibrary.tasks.JavaTask * @run testng PatchTest * @summary Basic test for --patch-module */ import java.io.File;
*** 35,45 **** import java.nio.file.Path; import java.nio.file.Paths; import java.util.stream.Collectors; import java.util.stream.Stream; ! import static jdk.testlibrary.ProcessTools.*; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import static org.testng.Assert.*; --- 36,46 ---- import java.nio.file.Path; import java.nio.file.Paths; import java.util.stream.Collectors; import java.util.stream.Stream; ! import jdk.testlibrary.tasks.JavaTask; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import static org.testng.Assert.*;
*** 128,166 **** } /** * Run test with patches to java.base, jdk.naming.dns and jdk.compiler */ ! void runTest(String basePatches, String dnsPatches, String compilerPatches) ! throws Exception ! { // 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") + File.pathSeparator + PATCHES2_DIR.resolve("java.base"); --- 129,162 ---- } /** * Run test with patches to java.base, jdk.naming.dns and jdk.compiler */ ! void runTest(String basePatches, String dnsPatches, String compilerPatches) { // the argument to the test is the list of classes overridden or added String arg = Stream.of(CLASSES).collect(Collectors.joining(",")); ! new JavaTask() ! .patchModule("java.base", basePatches) ! .patchModule("jdk.naming.dns", dnsPatches) ! .patchModule("jdk.compiler", compilerPatches) ! .addExports("java.base", "java.lang2", "test") ! .addExports("jdk.naming.dns", "com.sun.jndi.dns", "test") ! .addExports("jdk.naming.dns", "com.sun.jndi.dns2", "test") ! .addExports("jdk.compiler", "com.sun.tools.javac2", "test") ! .addModules("jdk.naming.dns,jdk.compiler") ! .modulePath(MODS_DIR) ! .module("test", "jdk.test.Main") ! .classArgs(arg) ! .run(); } /** * Run test with ---patch-module and exploded patches */ ! public void testWithExplodedPatches() { // patches1/java.base:patches2/java.base String basePatches = PATCHES1_DIR.resolve("java.base") + File.pathSeparator + PATCHES2_DIR.resolve("java.base");
*** 175,185 **** /** * 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") + File.pathSeparator + PATCHES_DIR.resolve("java.base-2.jar"); --- 171,181 ---- /** * Run test with ---patch-module and patches in JAR files */ ! public void testWithJarPatches() { // patches/java.base-1.jar:patches/java-base-2.jar String basePatches = PATCHES_DIR.resolve("java.base-1.jar") + File.pathSeparator + PATCHES_DIR.resolve("java.base-2.jar");
*** 195,205 **** /** * 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") + File.pathSeparator + PATCHES2_DIR.resolve("java.base"); --- 191,201 ---- /** * Run test with ---patch-module and patches in JAR files and exploded patches */ ! public void testWithJarAndExplodedPatches() { // patches/java.base-1.jar:patches2/java.base String basePatches = PATCHES_DIR.resolve("java.base-1.jar") + File.pathSeparator + PATCHES2_DIR.resolve("java.base");
< prev index next >