< prev index next >

test/langtools/tools/jdeps/DotFileTest.java

Print this page

        

*** 25,35 **** * @test * @bug 8003562 * @summary Basic tests for jdeps -dotoutput option * @modules java.management * jdk.jdeps/com.sun.tools.jdeps ! * @build Test p.Foo p.Bar * @run main DotFileTest */ import java.io.File; import java.io.IOException; --- 25,36 ---- * @test * @bug 8003562 * @summary Basic tests for jdeps -dotoutput option * @modules java.management * jdk.jdeps/com.sun.tools.jdeps ! * @library /tools/lib ! * @build toolbox.ToolBox Test p.Foo p.Bar * @run main DotFileTest */ import java.io.File; import java.io.IOException;
*** 41,61 **** --- 42,66 ---- import java.nio.file.Paths; import java.util.*; import java.util.regex.*; import java.util.stream.Collectors; + import toolbox.ToolBox; + public class DotFileTest { public static void main(String... args) throws Exception { int errors = 0; errors += new DotFileTest().run(); if (errors > 0) throw new Exception(errors + " errors found"); } + final ToolBox toolBox; final Path dir; final Path dotoutput; DotFileTest() { + this.toolBox = new ToolBox(); this.dir = Paths.get(System.getProperty("test.classes", ".")); this.dotoutput = dir.resolve("dots"); } int run() throws IOException {
*** 167,182 **** checkResult("profiles", expect, profiles, result); } Map<String,String> jdeps(List<String> args, Path dotfile) throws IOException { if (Files.exists(dotoutput)) { ! try (DirectoryStream<Path> stream = Files.newDirectoryStream(dotoutput)) { ! for (Path p : stream) { ! Files.delete(p); ! } ! } ! Files.delete(dotoutput); } // invoke jdeps StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); System.err.println("jdeps " + args.stream().collect(Collectors.joining(" "))); --- 172,185 ---- checkResult("profiles", expect, profiles, result); } Map<String,String> jdeps(List<String> args, Path dotfile) throws IOException { if (Files.exists(dotoutput)) { ! // delete contents of directory, then directory, ! // waiting for confirmation on Windows ! toolBox.cleanDirectory(dotoutput); ! toolBox.deleteFiles(dotoutput); } // invoke jdeps StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); System.err.println("jdeps " + args.stream().collect(Collectors.joining(" ")));
< prev index next >