@Override public Reader getReader(String resourceName) { Path.Relative partialPath = (Path.Relative)Path.parse(resourceName); Timestamped<Resource> partial = context.resolveResource(partialPath); if (partial != null) { return new StringReader(partial.getObject().getCharSequence().toString()); } else { return null; } }
public final CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return assertContent().getObject().getCharSequence(); }
@Override public Reader getReader(String resourceName) { Path.Relative partialPath = (Path.Relative)Path.parse(resourceName); Timestamped<Resource> partial = context.resolveResource(partialPath); if (partial != null) { return new StringReader(partial.getObject().getCharSequence().toString()); } else { return null; } }
public final CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return assertContent().getObject().getCharSequence(); }
public String assertContent() { try { Resource content = sourcePath.getResource(path).getObject(); return content.getCharSequence().toString(); } catch (Exception e) { throw AbstractTestCase.failure(e); } }
public String assertContent() { try { Resource content = sourcePath.getResource(path).getObject(); return content.getCharSequence().toString(); } catch (Exception e) { throw AbstractTestCase.failure(e); } }
assertEquals("new_foo_value", output.getResource(foo).getObject().getCharSequence(Charset.defaultCharset())); File juu = children.get("juu.txt"); assertEquals("juu_value", output.getResource(juu).getObject().getCharSequence(Charset.defaultCharset()).toString());
assertEquals("new_foo_value", output.getResource(foo).getObject().getCharSequence(Charset.defaultCharset())); File juu = children.get("juu.txt"); assertEquals("juu_value", output.getResource(juu).getObject().getCharSequence(Charset.defaultCharset()).toString());
M templateAST; try { templateAST = provider.parse(new ParseContext(), resource.getObject().getCharSequence());
M templateAST; try { templateAST = provider.parse(new ParseContext(), resource.getObject().getCharSequence());
@Test public void testFoo() throws IOException { RAMFileSystem ramFS = new RAMFileSystem(); ramFS.updateResource(new String[]{"a", "b"}, new Resource("foo")); // CompositeFileSystem composite = new CompositeFileSystem(ramFS); Context root = composite.getRoot(); Context a = composite.getChild(root, "a"); assertNotNull(a); assertEquals(PathType.DIR, composite.typeOf(a)); // Context b = composite.getChild(a, "b"); assertNotNull(b); assertEquals(PathType.FILE, composite.typeOf(b)); assertEquals(Tools.list("a", "b"), composite.getNames(b)); // Timestamped<Resource> content = composite.getResource(b); assertNotNull(content); assertEquals("foo", content.getObject().getCharSequence().toString()); } }
@Test public void testFoo() throws IOException { RAMFileSystem ramFS = new RAMFileSystem(); ramFS.updateResource(new String[]{"a", "b"}, new Resource("foo")); // CompositeFileSystem composite = new CompositeFileSystem(ramFS); Context root = composite.getRoot(); Context a = composite.getChild(root, "a"); assertNotNull(a); assertEquals(PathType.DIR, composite.typeOf(a)); // Context b = composite.getChild(a, "b"); assertNotNull(b); assertEquals(PathType.FILE, composite.typeOf(b)); assertEquals(Tools.list("a", "b"), composite.getNames(b)); // Timestamped<Resource> content = composite.getResource(b); assertNotNull(content); assertEquals("foo", content.getObject().getCharSequence().toString()); } }