public final P makePath(Iterable<String> path) throws IOException { return makePath(getRoot(), path); }
public final P makePath(Iterable<String> path) throws IOException { return makePath(getRoot(), path); }
public <D> void copy(Filter<P> filter, ReadWriteFileSystem<D> dst) throws IOException { copy(getRoot(), filter, dst, dst.getRoot()); }
public <D> void copy(Filter<P> filter, ReadWriteFileSystem<D> dst) throws IOException { copy(getRoot(), filter, dst, dst.getRoot()); }
@Test public void test() throws Exception { CompilerAssert<File,File> compilerAssert = compiler("juzu.overrideversion"); Compiler compiler = compilerAssert.assertCompile(); File root = compilerAssert.getClassOutput().getRoot(); File resource = new File(root, "juzu/overrideversion/assets/angular-ui-bootstrap/0.7.0/ui-bootstrap.js"); assertTrue(resource.exists()); assertTrue(resource.isFile()); } }
@Test public void testResource() throws IOException { Context ctx = new Context("common.live.resource"); ctx.init(); // assertEquals("bar", Tools.read(ctx.local.getResource("common/live/resource/foo.txt"))); // File dir = new File(ctx.compilerAssert2.getClassOutput().getRoot(), "common/live/resource"); assertTrue(dir.mkdirs()); File f = new File(dir, "foo.txt"); new FileWriter(f).append("bar_").close(); assertEquals("bar_", Tools.read(ctx.local.getResource("common/live/resource/foo.txt"))); } }
@Test public void testResource() throws IOException { Context ctx = new Context("common.live.resource"); ctx.init(); // assertEquals("bar", Tools.read(ctx.local.getResource("common/live/resource/foo.txt"))); // File dir = new File(ctx.compilerAssert2.getClassOutput().getRoot(), "common/live/resource"); assertTrue(dir.mkdirs()); File f = new File(dir, "foo.txt"); new FileWriter(f).append("bar_").close(); assertEquals("bar_", Tools.read(ctx.local.getResource("common/live/resource/foo.txt"))); } }
@Test public void testGetNames() throws IOException { ReadWriteFileSystem<P> fs = create(); assertFalse(fs.getNames(fs.getRoot()).iterator().hasNext()); List<String> expected = Tools.list("a", "b", "c"); P path = fs.makePath(expected); List<String> test = Tools.list(fs.getNames(path)); assertEquals(expected, test); }
@Test public void testGetNames() throws IOException { ReadWriteFileSystem<P> fs = create(); assertFalse(fs.getNames(fs.getRoot()).iterator().hasNext()); List<String> expected = Tools.list("a", "b", "c"); P path = fs.makePath(expected); List<String> test = Tools.list(fs.getNames(path)); assertEquals(expected, test); }
CompilerAssert<File, File> simpleHelper = compiler("plugin.template.tag.simple.render"); simpleHelper.assertCompile(); File classes = simpleHelper.getClassOutput().getRoot(); File services = new File(classes, "META-INF/services"); assertTrue(services.mkdirs());
CompilerAssert<File, File> simpleHelper = compiler("plugin.template.tag.simple.render"); simpleHelper.assertCompile(); File classes = simpleHelper.getClassOutput().getRoot(); File services = new File(classes, "META-INF/services"); assertTrue(services.mkdirs());
compiler.assertCompile(); ReadWriteFileSystem<File> classOutput = compiler.getClassOutput(); File f = new File(classOutput.getRoot(), "compiler/dot/foo/a.b.css"); InputStream in = new FileInputStream(f); String content = Tools.read(in);
compiler.assertCompile(); ReadWriteFileSystem<File> classOutput = compiler.getClassOutput(); File f = new File(classOutput.getRoot(), "compiler/dot/foo/a.b.css"); InputStream in = new FileInputStream(f); String content = Tools.read(in);
@Test public void testDelete() throws Exception { DeleteResourceProcessor processor = new DeleteResourceProcessor(); CompilerAssert<File, File> compiler = compiler("compiler.deleteresource").with(compilerProvider).with(processor); File foo = compiler.getClassOutput().makePath(compiler.getClassOutput().getRoot(), "foo.txt"); Tools.write("foo", foo); compiler.assertCompile(); assertTrue(processor.done); boolean expected = compilerProvider == JavaCompilerProvider.ECJ; assertEquals(expected, processor.deleted); assertEquals(!expected, foo.exists()); }
@Test public void testDelete() throws Exception { DeleteResourceProcessor processor = new DeleteResourceProcessor(); CompilerAssert<File, File> compiler = compiler("compiler.deleteresource").with(compilerProvider).with(processor); File foo = compiler.getClassOutput().makePath(compiler.getClassOutput().getRoot(), "foo.txt"); Tools.write("foo", foo); compiler.assertCompile(); assertTrue(processor.done); boolean expected = compilerProvider == JavaCompilerProvider.ECJ; assertEquals(expected, processor.deleted); assertEquals(!expected, foo.exists()); }
public FileResource<I> assertAddSource(String name, String ext, String content) { try { ReadWriteFileSystem<I> fs = strategy.sourcePath; String[] atoms = Tools.split(name, '.'); I path; if (atoms.length > 1) { path = fs.makePath(Tools.iterable(atoms, 0, atoms.length - 1)); fs.createDir(path); } else { path = fs.getRoot(); } path = fs.makePath(path, atoms[atoms.length - 1] + "." + ext); fs.updateResource(path, new Resource(content)); return new FileResource<I>(fs, path); } catch (IOException e) { throw AbstractTestCase.failure(e); } }
public FileResource<I> assertAddSource(String name, String ext, String content) { try { ReadWriteFileSystem<I> fs = strategy.sourcePath; String[] atoms = Tools.split(name, '.'); I path; if (atoms.length > 1) { path = fs.makePath(Tools.iterable(atoms, 0, atoms.length - 1)); fs.createDir(path); } else { path = fs.getRoot(); } path = fs.makePath(path, atoms[atoms.length - 1] + "." + ext); fs.updateResource(path, new Resource(content)); return new FileResource<I>(fs, path); } catch (IOException e) { throw AbstractTestCase.failure(e); } }