53 " System.out.println(\"I pass!\"); " +
54 " } " +
55 "}";
56
57 ClassFileInstaller.writeClassToDisk("javax/naming/myspi/NamingManager",
58 InMemoryJavaCompiler.compile("javax.naming.myspi.NamingManager", source, "--patch-module=java.naming"),
59 System.getProperty("test.classes"));
60
61 // Build the jar file that will be used for the module "java.naming".
62 JarBuilder.build("javanaming", "javax/naming/myspi/NamingManager");
63 moduleJar = TestCommon.getTestJar("javanaming.jar");
64
65 System.out.println("Test dumping with --patch-module");
66 OutputAnalyzer output =
67 TestCommon.dump(null,
68 TestCommon.list("javax/naming/myspi/NamingManager"),
69 "--patch-module=java.naming=" + moduleJar,
70 "-Xlog:class+load",
71 "-Xlog:class+path=info",
72 "PatchMain", "javax.naming.myspi.NamingManager");
73 TestCommon.checkDump(output, "Preload Warning: Cannot find javax/naming/myspi/NamingManager");
74
75 TestCommon.run(
76 "-XX:+UnlockDiagnosticVMOptions",
77 "--patch-module=java.naming=" + moduleJar,
78 "-Xlog:class+load",
79 "-Xlog:class+path=info",
80 "PatchMain", "javax.naming.myspi.NamingManager")
81 .assertNormalExit("I pass!");
82 }
83 }
|
53 " System.out.println(\"I pass!\"); " +
54 " } " +
55 "}";
56
57 ClassFileInstaller.writeClassToDisk("javax/naming/myspi/NamingManager",
58 InMemoryJavaCompiler.compile("javax.naming.myspi.NamingManager", source, "--patch-module=java.naming"),
59 System.getProperty("test.classes"));
60
61 // Build the jar file that will be used for the module "java.naming".
62 JarBuilder.build("javanaming", "javax/naming/myspi/NamingManager");
63 moduleJar = TestCommon.getTestJar("javanaming.jar");
64
65 System.out.println("Test dumping with --patch-module");
66 OutputAnalyzer output =
67 TestCommon.dump(null,
68 TestCommon.list("javax/naming/myspi/NamingManager"),
69 "--patch-module=java.naming=" + moduleJar,
70 "-Xlog:class+load",
71 "-Xlog:class+path=info",
72 "PatchMain", "javax.naming.myspi.NamingManager");
73 output.shouldHaveExitValue(1)
74 .shouldContain("Cannot use the following option when dumping the shared archive: --patch-module");
75
76 TestCommon.run(
77 "-XX:+UnlockDiagnosticVMOptions",
78 "--patch-module=java.naming=" + moduleJar,
79 "-Xlog:class+load",
80 "-Xlog:class+path=info",
81 "PatchMain", "javax.naming.myspi.NamingManager")
82 .assertSilentlyDisabledCDS(0, "I pass!");
83 }
84 }
|