< prev index next >
test/runtime/modules/PatchModule/PatchModuleTestJarDir.java
Print this page
rev 11608 : Harold's patch v1
*** 21,44 ****
* questions.
*/
/*
* @test
! * @summary Make sure -Xpatch works when a jar file and a directory is specified for a module
* @library /testlibrary
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
* @build BasicJarBuilder
! * @compile Xpatch2DirsMain.java
! * @run main XpatchTestJarDir
*/
import java.io.File;
import java.nio.file.Files;
import jdk.test.lib.*;
! public class XpatchTestJarDir {
private static String moduleJar;
public static void main(String[] args) throws Exception {
// Create a class file in the module java.naming. This class file
--- 21,44 ----
* questions.
*/
/*
* @test
! * @summary Make sure --patch-module works when a jar file and a directory is specified for a module
* @library /testlibrary
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
* @build BasicJarBuilder
! * @compile PatchModule2DirsMain.java
! * @run main PatchModuleTestJarDir
*/
import java.io.File;
import java.nio.file.Files;
import jdk.test.lib.*;
! public class PatchModuleTestJarDir {
private static String moduleJar;
public static void main(String[] args) throws Exception {
// Create a class file in the module java.naming. This class file
*** 86,101 ****
ClassFileInstaller.writeClassToDisk("javax/naming/spi/NamingManager2",
InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager2", source, "-Xmodule:java.naming"),
(System.getProperty("test.classes") + "/mods/java.naming"));
! // Supply -Xpatch with the name of the jar file for the module java.naming.
! ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xpatch:java.naming=" +
moduleJar +
File.pathSeparator +
System.getProperty("test.classes") + "/mods/java.naming",
! "Xpatch2DirsMain",
"javax.naming.spi.NamingManager1",
"javax.naming.spi.NamingManager2");
new OutputAnalyzer(pb.start())
.shouldContain("I pass one!")
--- 86,101 ----
ClassFileInstaller.writeClassToDisk("javax/naming/spi/NamingManager2",
InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager2", source, "-Xmodule:java.naming"),
(System.getProperty("test.classes") + "/mods/java.naming"));
! // Supply --patch-module with the name of the jar file for the module java.naming.
! ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=" +
moduleJar +
File.pathSeparator +
System.getProperty("test.classes") + "/mods/java.naming",
! "PatchModule2DirsMain",
"javax.naming.spi.NamingManager1",
"javax.naming.spi.NamingManager2");
new OutputAnalyzer(pb.start())
.shouldContain("I pass one!")
< prev index next >