use of org.apache.struts2.components.template.JspTemplateEngine in project struts by apache.
the class TemplateEngineManagerTest method testTemplateTypeFromTemplateNameAndDefaults.
public void testTemplateTypeFromTemplateNameAndDefaults() {
TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), null);
assertTrue(engine instanceof JspTemplateEngine);
}
use of org.apache.struts2.components.template.JspTemplateEngine in project struts by apache.
the class VelocityTemplateEngineTest method testTemplateTypeFromTemplateNameAndDefaults.
public void testTemplateTypeFromTemplateNameAndDefaults() {
TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), null);
assertTrue(engine instanceof JspTemplateEngine);
engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo.vm"), null);
assertTrue(engine instanceof VelocityTemplateEngine);
}
use of org.apache.struts2.components.template.JspTemplateEngine 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.JspTemplateEngine 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