Resource { public void walk(Walker walker) throws IOException { walk(walker, new File(".")); } protected  Resource();  Resource(File path);  Resource(File directory, String targetPath); File getPath(); String getTargetPath(); File getDirectory(); List<String> getIncludes(); Resource include(String... patterns); List<String> getExcludes(); Resource exclude(String... patterns); boolean isFlatten(); Resource flatten(boolean b); boolean isIgnoreDefaultExcludes(); Resource ignoreDefaultExcludes(boolean b); boolean isSkipPngCrush(); Resource skipPngCrush(boolean b); void walk(Walker walker); void walk(Walker walker, File destDir); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test @Ignore public void testResourceWithNullDirectoryAndNullTargetPath() throws Exception { File f = createDirStructure("src/test1.txt", "src/test2.txt", "src/woo/test3.txt"); String savedUserDir = System.getProperty("user.dir"); System.setProperty("user.dir", new File(f, "src").getAbsolutePath()); try { Resource res = new Resource(null, null); res.walk(walker, new File("/dest")); assertEquals( Arrays.asList("/dest/test1.txt", "/dest/test2.txt", "/dest/woo/test3.txt"), walker.paths); } finally { System.setProperty("user.dir", savedUserDir); } }
@Test public void testSimpleResourceWithFile() throws Exception { File f = createDirStructure("test.txt"); Resource res = new Resource(new File(f, "test.txt")); res.walk(walker, new File("/dest")); assertEquals(Arrays.asList("/dest/test.txt"), walker.paths); }
@Test public void testSimpleResourceWithDir() throws Exception { File f = createDirStructure("src/test1.txt", "src/test2.txt", "src/woo/test3.txt"); Resource res = new Resource(new File(f, "src")); res.walk(walker, new File("/dest")); assertEquals( Arrays.asList("/dest/src/test1.txt", "/dest/src/test2.txt", "/dest/src/woo/test3.txt"), walker.paths); }
@Test public void testSimpleResourceWithDirAndDefaultExcludes() throws Exception { File f = createDirStructure("src/test1.txt", "src/test2.txt", "src/test2.txt~", "src/.svn/foo"); Resource res = new Resource(new File(f, "src")); res.walk(walker, new File("/dest")); assertEquals(Arrays.asList("/dest/src/test1.txt", "/dest/src/test2.txt"), walker.paths); }
@Test public void testResourceWithDirectoryAndNullTargetPath() throws Exception { File f = createDirStructure("src/test1.txt", "src/test2.txt", "src/woo/test3.txt"); Resource res = new Resource(new File(f, "src"), null); res.walk(walker, new File("/dest")); assertEquals( Arrays.asList("/dest/test1.txt", "/dest/test2.txt", "/dest/woo/test3.txt"), walker.paths); }
@Test public void testResourceWithNullDirectoryAndNullTargetPath() throws Exception { File f = createDirStructure("src/test1.txt", "src/test2.txt", "src/woo/test3.txt"); String savedUserDir = System.getProperty("user.dir"); System.setProperty("user.dir", new File(f, "src").getAbsolutePath()); try { Resource res = new Resource(null, null); res.walk(walker, new File("/dest")); assertEquals( Arrays.asList("/dest/test1.txt", "/dest/test2.txt", "/dest/woo/test3.txt"), walker.paths); } finally { System.setProperty("user.dir", savedUserDir); } }
@Test public void testResourceWithDirectoryAndTargetPath() throws Exception { File f = createDirStructure("src/test1.txt", "src/test2.txt", "src/woo/test3.txt"); Resource res = new Resource(new File(f, "src"), "foo"); res.walk(walker, new File("/dest")); assertEquals( Arrays.asList("/dest/foo/test1.txt", "/dest/foo/test2.txt", "/dest/foo/woo/test3.txt"), walker.paths); }
@Test public void testResourceWithDirectoryAndDefaultExcludes() throws Exception { File f = createDirStructure("src/test1.txt", "src/test2.txt", "src/woo/test3.txt", "src/test2.txt~", "src/.svn/foo"); Resource res = new Resource(new File(f, "src"), null); res.walk(walker, new File("/dest")); assertEquals( Arrays.asList("/dest/test1.txt", "/dest/test2.txt", "/dest/woo/test3.txt"), walker.paths); }