76 "}"; 77 ClassFileInstaller.writeClassToDisk("mypackage/MyReference", 78 InMemoryJavaCompiler.compile("mypackage.MyReference", source2), 79 classDir); 80 81 JarBuilder.build("myjavanaming", "mypackage/MyReference"); 82 appJar = TestCommon.getTestJar("myjavanaming.jar"); 83 84 System.out.println("Test dumping with --patch-module"); 85 OutputAnalyzer output = 86 TestCommon.dump(appJar, 87 TestCommon.list("javax/naming/Reference", "mypackage/MyReference"), 88 "--patch-module=java.naming=" + moduleJar, 89 "-Xlog:class+load", 90 "PatchMain", "javax.naming.Reference", "mypackage.MyReference"); 91 output.shouldHaveExitValue(1) 92 .shouldContain("Cannot use the following option when dumping the shared archive: --patch-module"); 93 94 String classPath = appJar + File.pathSeparator + classDir; 95 System.out.println("classPath: " + classPath); 96 output = TestCommon.execCommon( 97 "-XX:+UnlockDiagnosticVMOptions", 98 "-cp", classPath, 99 "--patch-module=java.naming=" + moduleJar, 100 "-Xlog:class+load", 101 "PatchMain", "javax.naming.Reference", "mypackage.MyReference"); 102 output.shouldHaveExitValue(0) 103 .shouldContain("CDS is disabled") 104 .shouldContain("MyReference source: file:") 105 .shouldContain("I pass!"); 106 } 107 } | 76 "}"; 77 ClassFileInstaller.writeClassToDisk("mypackage/MyReference", 78 InMemoryJavaCompiler.compile("mypackage.MyReference", source2), 79 classDir); 80 81 JarBuilder.build("myjavanaming", "mypackage/MyReference"); 82 appJar = TestCommon.getTestJar("myjavanaming.jar"); 83 84 System.out.println("Test dumping with --patch-module"); 85 OutputAnalyzer output = 86 TestCommon.dump(appJar, 87 TestCommon.list("javax/naming/Reference", "mypackage/MyReference"), 88 "--patch-module=java.naming=" + moduleJar, 89 "-Xlog:class+load", 90 "PatchMain", "javax.naming.Reference", "mypackage.MyReference"); 91 output.shouldHaveExitValue(1) 92 .shouldContain("Cannot use the following option when dumping the shared archive: --patch-module"); 93 94 String classPath = appJar + File.pathSeparator + classDir; 95 System.out.println("classPath: " + classPath); 96 TestCommon.run( 97 "-XX:+UnlockDiagnosticVMOptions", 98 "-cp", classPath, 99 "--patch-module=java.naming=" + moduleJar, 100 "-Xlog:class+load", 101 "PatchMain", "javax.naming.Reference", "mypackage.MyReference") 102 .assertSilentlyDisabledCDS(out -> { 103 out.shouldHaveExitValue(0) 104 .shouldContain("MyReference source: file:") 105 .shouldContain("I pass!"); 106 }); 107 } 108 } |