Examples of XhtmlTemplate


Examples of org.pirkaengine.core.template.XhtmlTemplate

     */
    @Test
    public void create_method() throws ModelDeficientPropertyException {
       
        @SuppressWarnings("serial")
        Template template = new XhtmlTemplate("test") {
            @Override
            public Map<String, Object> createViewModel() {
                HashMap<String, Object> model = new HashMap<String, Object>();
                model.put("name", new Object());
                return model;
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

     */
    @Test
    public void create_composite() throws ModelDeficientPropertyException {
       
        @SuppressWarnings("serial")
        Template template = new XhtmlTemplate("test") {
            @Override
            public Map<String, Object> createViewModel() {
                HashMap<String, Object> model = new HashMap<String, Object>();
                model.put("name", new Object());
                model.put("price", new Object());
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

     */
    @Test
    public void create_nest() throws ModelDeficientPropertyException {
       
        @SuppressWarnings("serial")
        Template template = new XhtmlTemplate("test") {
            @Override
            public Map<String, Object> createViewModel() {
                HashMap<String, Object> nest = new HashMap<String, Object>();
                nest.put("name", new Object());
                HashMap<String, Object> model = new HashMap<String, Object>();
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

     * @throws ModelDeficientPropertyException
     */
    @Test(expected = ModelDeficientPropertyException.class)
    public void create_no_property() throws ModelDeficientPropertyException {
        @SuppressWarnings("serial")
        Template template = new XhtmlTemplate("test") {
            @Override
            public Map<String, Object> createViewModel() {
                HashMap<String, Object> model = new HashMap<String, Object>();
                model.put("name", new Object());
                return model;
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

*/
public class XhtmlTemplateTest {

    @Test
    public void createViewModel_simple() {
        XhtmlTemplate template = new XhtmlTemplate("test");
        template.stack(new ExpressionNode("foo"));
        Map<String, Object> expected = new HashMap<String, Object>();
        expected.put("foo", XhtmlTemplate.NULL_VALUE);
        Assert.assertEquals(expected, template.createViewModel());
    }
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

        Assert.assertEquals(expected, template.createViewModel());
    }

    @Test
    public void createViewModel_2_expressions() {
        XhtmlTemplate template = new XhtmlTemplate("test");
        template.stack(new ExpressionNode("foo"));
        template.stack(new ExpressionNode("bar"));
        Map<String, Object> expected = new HashMap<String, Object>();
        expected.put("foo", XhtmlTemplate.NULL_VALUE);
        expected.put("bar", XhtmlTemplate.NULL_VALUE);
        Assert.assertEquals(expected, template.createViewModel());
    }
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

        Assert.assertEquals(expected, template.createViewModel());
    }

    @Test
    public void createViewModel_nest_case() {
        XhtmlTemplate template = new XhtmlTemplate("test");
        template.stack(new ExpressionNode("foo.bar"));
        Map<String, Object> expected = new HashMap<String, Object>();
        Map<String, Object> foo = new HashMap<String, Object>();
        foo.put("bar", XhtmlTemplate.NULL_VALUE);
        expected.put("foo", foo);
        Assert.assertEquals(expected, template.createViewModel());
    }
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

        Assert.assertEquals(expected, template.createViewModel());
    }

    @Test
    public void createViewModel_composite_case() {
        XhtmlTemplate template = new XhtmlTemplate("test");
        template.stack(new ExpressionNode("foo.bar"));
        template.stack(new ExpressionNode("poo"));
        Map<String, Object> expected = new HashMap<String, Object>();
        Map<String, Object> foo = new HashMap<String, Object>();
        foo.put("bar", XhtmlTemplate.NULL_VALUE);
        expected.put("foo", foo);
        expected.put("poo", XhtmlTemplate.NULL_VALUE);
        Assert.assertEquals(expected, template.createViewModel());
    }
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

        Assert.assertEquals(expected, template.createViewModel());
    }

    @Test
    public void createViewModel_array() {
        XhtmlTemplate template = new XhtmlTemplate("test");
        StartTagNode start = new StartTagNode("li", "prk:for", "item in items");
        EndTagNode end = new EndTagNode("li");
        template.stack(new LoopNode(start, end, new Node[0]));
        Map<String, Object> expected = new HashMap<String, Object>();
        expected.put("items", new ArrayList<Map<String, Object>>());
        Assert.assertEquals(expected, template.createViewModel());
        Assert.assertEquals(new HashMap<String, Object>(), template.createArrayItemModel("items"));
    }
View Full Code Here

Examples of org.pirkaengine.core.template.XhtmlTemplate

        Assert.assertEquals(new HashMap<String, Object>(), template.createArrayItemModel("items"));
    }

    @Test
    public void createViewModel_array_simple() {
        XhtmlTemplate template = new XhtmlTemplate("test");
        StartTagNode start = new StartTagNode("li", "prk:for", "item in items");
        EndTagNode end = new EndTagNode("li");
        ExpressionNode node = new ExpressionNode("item");
        template.stack(new LoopNode(start, end, new Node[] { node }));

        Map<String, Object> expected = new HashMap<String, Object>();
        expected.put("items", new ArrayList<Map<String, Object>>());
        Assert.assertEquals(expected, template.createViewModel());

        Map<String, Object> expectedItem = new HashMap<String, Object>();
        expectedItem.put("toString", XhtmlTemplate.NULL_VALUE);
        Assert.assertEquals(expectedItem, template.createArrayItemModel("items"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.