use of org.apache.struts2.components.template.FreemarkerTemplateEngine in project struts by apache.
the class TemplateEngineManagerTest method testTemplateTypeOverrides.
public void testTemplateTypeOverrides() {
TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), "ftl");
assertTrue(engine instanceof FreemarkerTemplateEngine);
engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo.ftl"), "");
assertTrue(engine instanceof FreemarkerTemplateEngine);
}
use of org.apache.struts2.components.template.FreemarkerTemplateEngine in project struts by apache.
the class TemplateEngineManagerTest method setUp.
public void setUp() throws Exception {
mgr = new TemplateEngineManager();
mockContainer = new Mock(Container.class);
mockContainer.matchAndReturn("getInstance", C.args(C.eq(TemplateEngine.class), C.eq("jsp")), new JspTemplateEngine());
mockContainer.matchAndReturn("getInstance", C.args(C.eq(TemplateEngine.class), C.eq("ftl")), new FreemarkerTemplateEngine());
mockContainer.matchAndReturn("getInstanceNames", C.args(C.eq(TemplateEngine.class)), new HashSet<String>() {
{
add("jsp");
add("vm");
add("ftl");
}
});
mgr.setContainer((Container) mockContainer.proxy());
mgr.setDefaultTemplateType("jsp");
}
use of org.apache.struts2.components.template.FreemarkerTemplateEngine in project struts by apache.
the class VelocityTemplateEngineTest method testTemplateTypeOverrides.
public void testTemplateTypeOverrides() {
TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), "ftl");
assertTrue(engine instanceof FreemarkerTemplateEngine);
engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo.vm"), "ftl");
assertTrue(engine instanceof VelocityTemplateEngine);
engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo.ftl"), "");
assertTrue(engine instanceof FreemarkerTemplateEngine);
}
use of org.apache.struts2.components.template.FreemarkerTemplateEngine in project struts by apache.
the class VelocityTemplateEngineTest method setUp.
public void setUp() throws Exception {
super.setUp();
mgr = new TemplateEngineManager();
Mock mockContainer = new Mock(Container.class);
mockContainer.matchAndReturn("getInstance", C.args(C.eq(TemplateEngine.class), C.eq("jsp")), new JspTemplateEngine());
mockContainer.matchAndReturn("getInstance", C.args(C.eq(TemplateEngine.class), C.eq("vm")), new VelocityTemplateEngine());
mockContainer.matchAndReturn("getInstance", C.args(C.eq(TemplateEngine.class), C.eq("ftl")), new FreemarkerTemplateEngine());
mockContainer.matchAndReturn("getInstanceNames", C.args(C.eq(TemplateEngine.class)), new HashSet<String>() {
{
add("jsp");
add("vm");
add("ftl");
}
});
mgr.setContainer((Container) mockContainer.proxy());
mgr.setDefaultTemplateType("jsp");
}
Aggregations