use of org.bndtools.templating.FolderResource in project bndtools by bndtools.
the class MustacheTemplateEngineTest method testBasic.
@Test
public void testBasic() throws Exception {
MustacheTemplateEngine engine = new MustacheTemplateEngine();
ResourceMap input = new ResourceMap();
input.put("{{srcDir}}/", new FolderResource());
input.put("{{srcDir}}/{{packageDir}}/", new FolderResource());
input.put("{{srcDir}}/{{packageDir}}/package-info.java", new StringResource("package {{packageName}};"));
Map<String, List<Object>> params = new HashMap<>();
params.put("srcDir", Collections.<Object>singletonList("src"));
params.put("packageDir", Collections.<Object>singletonList("org/example/foo"));
params.put("packageName", Collections.<Object>singletonList("org.example.foo"));
ResourceMap output = engine.generateOutputs(input, params, new NullProgressMonitor());
assertEquals(3, output.size());
assertEquals("package org.example.foo;", IO.collect(output.get("src/org/example/foo/package-info.java").getContent()));
}
Aggregations