Search in sources :

Example 11 with User

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

the class VarBindingSeqSampleTag method render.

@Override
public void render() {
    this.binds("abc", new User("lijz"));
    this.doBodyRender();
}
Also used : User(org.beetl.core.User)

Example 12 with User

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

the class DynamicTest method testDynamicUser2.

@Test
public void testDynamicUser2() throws Exception {
    /*语法兼容1.x*/
    Map map = new HashMap();
    map.put("name", "joelli");
    map.put("age", 36);
    Template t = gt.getTemplate("/type/dynamic_user2_template.html");
    this.bind(t, "user", map);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/type/dynamic_user2_expected.html"), str);
    User user = User.getTestUser();
    t = gt.getTemplate("/type/dynamic_user2_template.html");
    this.bind(t, "user", user);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/type/dynamic_user2_expected.html"), str);
}
Also used : User(org.beetl.core.User) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 13 with User

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

the class DynamicTest method testDynamicAll.

@Test
public void testDynamicAll() throws Exception {
    Map map = new HashMap();
    map.put("name", "joelli");
    map.put("age", 36);
    Template t = gt.getTemplate("/type/dynamic_all_template.html");
    this.bind(t, "user", map);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/type/dynamic_all_expected.html"), str);
    User user = User.getTestUser();
    t = gt.getTemplate("/type/dynamic_all_template.html");
    this.bind(t, "user", user);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/type/dynamic_all_expected.html"), str);
}
Also used : User(org.beetl.core.User) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 14 with User

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

the class SimpleVATest method testUserAttribute.

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

Example 15 with User

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

the class LayoutTagTest method testLayoutInclude.

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

Aggregations

User (org.beetl.core.User)16 Template (org.beetl.core.Template)14 Test (org.testng.annotations.Test)14 HashMap (java.util.HashMap)5 Map (java.util.Map)5 List (java.util.List)2 JSONObject (com.alibaba.fastjson.JSONObject)1 Context (org.beetl.core.Context)1 VirtualClassAttribute (org.beetl.core.VirtualClassAttribute)1