Search in sources :

Example 1 with JspTemplateEngine

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);
}
Also used : FreemarkerTemplateEngine(org.apache.struts2.components.template.FreemarkerTemplateEngine) TemplateEngine(org.apache.struts2.components.template.TemplateEngine) JspTemplateEngine(org.apache.struts2.components.template.JspTemplateEngine) JspTemplateEngine(org.apache.struts2.components.template.JspTemplateEngine) Template(org.apache.struts2.components.template.Template)

Example 2 with 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);
}
Also used : FreemarkerTemplateEngine(org.apache.struts2.components.template.FreemarkerTemplateEngine) TemplateEngine(org.apache.struts2.components.template.TemplateEngine) JspTemplateEngine(org.apache.struts2.components.template.JspTemplateEngine) JspTemplateEngine(org.apache.struts2.components.template.JspTemplateEngine) Template(org.apache.struts2.components.template.Template)

Example 3 with JspTemplateEngine

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");
}
Also used : Container(com.opensymphony.xwork2.inject.Container) TemplateEngineManager(org.apache.struts2.components.template.TemplateEngineManager) Mock(com.mockobjects.dynamic.Mock) JspTemplateEngine(org.apache.struts2.components.template.JspTemplateEngine) FreemarkerTemplateEngine(org.apache.struts2.components.template.FreemarkerTemplateEngine)

Example 4 with JspTemplateEngine

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");
}
Also used : TemplateEngineManager(org.apache.struts2.components.template.TemplateEngineManager) Mock(com.mockobjects.dynamic.Mock) JspTemplateEngine(org.apache.struts2.components.template.JspTemplateEngine) FreemarkerTemplateEngine(org.apache.struts2.components.template.FreemarkerTemplateEngine)

Aggregations

FreemarkerTemplateEngine (org.apache.struts2.components.template.FreemarkerTemplateEngine)4 JspTemplateEngine (org.apache.struts2.components.template.JspTemplateEngine)4 Mock (com.mockobjects.dynamic.Mock)2 Template (org.apache.struts2.components.template.Template)2 TemplateEngine (org.apache.struts2.components.template.TemplateEngine)2 TemplateEngineManager (org.apache.struts2.components.template.TemplateEngineManager)2 Container (com.opensymphony.xwork2.inject.Container)1