Search in sources :

Example 31 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class IncludeTest method testInclude.

@Test
public void testInclude() throws Exception {
    User user = User.getTestUser();
    Template t = gt.getTemplate("/tag/include_template.html");
    this.bind(t, "user", user);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/include_expected.html"), str);
    t = gt.getTemplate("/tag/include_template.html");
    this.bind(t, "user", user);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/include_expected.html"), str);
}
Also used : User(org.beetl.core.User) Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 32 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class IncludeTest method testIncludeRel.

@Test
public void testIncludeRel() throws Exception {
    User user = User.getTestUser();
    Template t = gt.getTemplate("/tag/main_include_template.html");
    this.bind(t, "user", user);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/main_include_expected.html"), str);
    t = gt.getTemplate("/tag/main_include_template.html");
    this.bind(t, "user", user);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/main_include_expected.html"), str);
}
Also used : User(org.beetl.core.User) Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 33 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class LayoutTagTest method testLayout.

@Test
public void testLayout() throws Exception {
    User user = User.getTestUser();
    Template t = gt.getTemplate("/tag/layout_template.html");
    this.bind(t, "user", user);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/layout_expected.html"), str);
    t = gt.getTemplate("/tag/layout_template.html");
    this.bind(t, "user", user);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/layout_expected.html"), str);
}
Also used : User(org.beetl.core.User) Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 34 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class IncDecOneTest method testAll.

@Test
public void testAll() throws Exception {
    Template t = gt.getTemplate("/exp/incdecone_template.html");
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/incdecone_expected.html"), str);
// t = gt.getTemplate("/exp/incdecone_template.html");
// 
// str = t.render();
// AssertJUnit.assertEquals(this.getFileContent("/exp/incdecone_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 35 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class JsonTest method testOrder.

@Test
public void testOrder() throws Exception {
    Template t = gt.getTemplate("/exp/json/order_template.html");
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/json/order_expected.html"), str);
    t = gt.getTemplate("/exp/json/order_template.html");
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/json/order_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Aggregations

Template (org.beetl.core.Template)122 Test (org.testng.annotations.Test)96 GroupTemplate (org.beetl.core.GroupTemplate)41 Map (java.util.Map)15 User (org.beetl.core.User)14 HashMap (java.util.HashMap)13 Configuration (org.beetl.core.Configuration)13 FileResourceLoader (org.beetl.core.resource.FileResourceLoader)6 StringTemplateResourceLoader (org.beetl.core.resource.StringTemplateResourceLoader)6 Context (org.beetl.core.Context)5 JSONObject (com.alibaba.fastjson.JSONObject)4 List (java.util.List)4 ClasspathResourceLoader (org.beetl.core.resource.ClasspathResourceLoader)4 VirtualAttributeEval (org.beetl.core.VirtualAttributeEval)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 BodyContent (org.beetl.core.BodyContent)2 BeetlException (org.beetl.core.exception.BeetlException)2 WebRender (org.beetl.ext.web.WebRender)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1