Java Code Examples for jdk.testlibrary.FileUtils#deleteFileTreeUnchecked()
The following examples show how to use
jdk.testlibrary.FileUtils#deleteFileTreeUnchecked() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageModules.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test public void singleModularJar() throws Throwable { FileUtils.deleteFileTreeUnchecked(JARS_DIR); Files.createDirectories(JARS_DIR); Path converterJar = JARS_DIR.resolve("converter.jar"); jar("--create", "--file", converterJar.toString(), "--warn-if-resolved=incubating", "-C", MODS_DIR.resolve("message.converter").toString() , ".") .assertSuccess(); java(Paths.get(JAVA_HOME), "--module-path", JARS_DIR.toString(), "--add-modules", "message.converter", "-cp", CP_DIR.toString(), "test.ConvertToLowerCase", "HEllo WoRlD") .assertSuccess() .resultChecker(r -> { r.assertContains("WARNING: Using incubator modules: message.converter"); }); }
Example 2
Source File: UserModuleTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@BeforeTest public void compileAll() throws Throwable { if (!hasJmods()) return; for (String mn : modules) { Path msrc = SRC_DIR.resolve(mn); assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "--module-source-path", SRC_DIR.toString(), "--add-exports", "java.base/jdk.internal.module=" + mn, "--add-exports", "java.base/jdk.internal.org.objectweb.asm=" + mn)); } if (Files.exists(IMAGE)) { FileUtils.deleteFileTreeUnchecked(IMAGE); } createImage(IMAGE, "m1", "m3"); createJmods("m1", "m4"); }
Example 3
Source File: PatchSystemModules.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static void createJars() throws Throwable { FileUtils.deleteFileTreeUnchecked(JARS_DIR); Files.createDirectories(JARS_DIR); Path m1 = JARS_DIR.resolve("m1.jar"); Path m2 = JARS_DIR.resolve("m2.jar"); // hash m1 in m2's Hashes attribute jar("--create", "--file=" + m1.toString(), "-C", MODS_DIR.resolve("m1").toString(), "."); jar("--create", "--file=" + m2.toString(), "--module-path", JARS_DIR.toString(), "--hash-modules", "m1", "-C", MODS_DIR.resolve("m2").toString(), "."); }
Example 4
Source File: CompiledVersionTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@BeforeTest public void compileAll() throws Throwable { if (!hasJmods()) return; for (int i=0; i < modules.length; i++) { String mn = modules[i]; String version = versions[i]; Path msrc = SRC_DIR.resolve(mn); if (version.equals("0")) { assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "--add-exports", "java.base/jdk.internal.module=m1", "--add-exports", "java.base/jdk.internal.org.objectweb.asm=m1", "--module-source-path", SRC_DIR.toString())); } else { assertTrue(CompilerUtils.compile(msrc, MODS_DIR, "--add-exports", "java.base/jdk.internal.module=m1", "--add-exports", "java.base/jdk.internal.org.objectweb.asm=m1", "--module-source-path", SRC_DIR.toString(), "--module-version", version)); } } if (Files.exists(IMAGE)) { FileUtils.deleteFileTreeUnchecked(IMAGE); } createImage(IMAGE, modules); }
Example 5
Source File: PatchSystemModules.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static void createImage() throws Throwable { FileUtils.deleteFileTreeUnchecked(IMAGE); String mpath = JARS_DIR.toString() + File.pathSeparator + JMODS.toString(); execTool("jlink", "--module-path", mpath, "--add-modules", "m1", "--output", IMAGE.toString()); }
Example 6
Source File: ImageModules.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "singleModule") public void singleModule(String extraJmodArg, List<String> addModsTokens, Consumer<ToolResult> assertExitCode, List<String> expectedOutput, List<String> unexpectedOutput) throws Throwable { if (Files.notExists(JDK_JMODS)) { System.out.println("JDK jmods not found test cannot run."); return; } FileUtils.deleteFileTreeUnchecked(JMODS_DIR); FileUtils.deleteFileTreeUnchecked(IMAGE); Files.createDirectories(JMODS_DIR); Path converterJmod = JMODS_DIR.resolve("converter.jmod"); jmod("create", "--class-path", MODS_DIR.resolve("message.converter").toString(), extraJmodArg, converterJmod.toString()) .assertSuccess(); String mpath = JDK_JMODS.toString() + File.pathSeparator + JMODS_DIR.toString(); jlink("--module-path", mpath, "--add-modules", JAVA_BASE + ",message.converter", "--output", IMAGE.toString()) .assertSuccess(); for (String addModsToken : addModsTokens) { String[] props = new String[] {"", "-Djdk.system.module.finder.disabledFastPath"}; for (String systemProp : props) java(IMAGE, systemProp, "--add-modules", addModsToken, "-cp", CP_DIR.toString(), "test.ConvertToLowerCase", "HEllo WoRlD") .resultChecker(assertExitCode) .resultChecker(r -> { expectedOutput.forEach(e -> r.assertContains(e)); unexpectedOutput.forEach(e -> r.assertDoesNotContains(e)); }); } }
Example 7
Source File: ImageModules.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "twoModules") public void doNotResolveByDefaultTwoModules(String extraFirstJmodArg, String extraSecondJmodArg, List<String> addModsTokens, Consumer<ToolResult> assertExitCode, List<String> expectedOutput, List<String> unexpectedOutput) throws Throwable { if (Files.notExists(JDK_JMODS)) { System.out.println("JDK jmods not found test cannot run."); return; } FileUtils.deleteFileTreeUnchecked(JMODS_DIR); FileUtils.deleteFileTreeUnchecked(IMAGE); Files.createDirectories(JMODS_DIR); Path writerJmod = JMODS_DIR.resolve("writer.jmod"); Path converterJmod = JMODS_DIR.resolve("converter.jmod"); jmod("create", extraFirstJmodArg, "--class-path", MODS_DIR.resolve("message.writer").toString(), writerJmod.toString()); jmod("create", "--class-path", MODS_DIR.resolve("message.converter").toString(), extraSecondJmodArg, converterJmod.toString()) .assertSuccess(); String mpath = JDK_JMODS.toString() + File.pathSeparator + JMODS_DIR.toString(); jlink("--module-path", mpath, "--add-modules", JAVA_BASE + ",message.writer,message.converter", "--output", IMAGE.toString()) .assertSuccess(); for (String addModsToken : addModsTokens) { String[] props = new String[] {"", "-Djdk.system.module.finder.disabledFastPath"}; for (String systemProp : props) java(IMAGE, systemProp, "--add-modules", addModsToken, "-cp", CP_DIR.toString(), "test.WriteUpperCase", "hello chegar !!!") .resultChecker(assertExitCode) .resultChecker(r -> { expectedOutput.forEach(e -> r.assertContains(e)); unexpectedOutput.forEach(e -> r.assertDoesNotContains(e)); }); } }