Package org.apache.commons.jelly

Examples of org.apache.commons.jelly.Script


        assertEquals("Jane Doe",customer.getName());
    }

    public void testNewWithNullArg() throws Exception {
        setUpScript("testNewTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("test.newWithNullArg",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        assertNotNull(getJellyContext().getVariable("foo"));
        assertTrue(getJellyContext().getVariable("foo") instanceof Customer);
        Customer customer = (Customer)(getJellyContext().getVariable("foo"));
        assertNull(customer.getName());
    }
View Full Code Here


        assertNull(customer.getName());
    }

    public void testNewWithNewArg() throws Exception {
        setUpScript("testNewTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("test.newWithNewArg",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        {
            assertNotNull(getJellyContext().getVariable("foo"));
            assertTrue(getJellyContext().getVariable("foo") instanceof Customer);
            Customer customer = (Customer)(getJellyContext().getVariable("foo"));
            assertNotNull(customer.getName());
View Full Code Here

        }
    }

    public void testNewWithUseBeanArg() throws Exception {
        setUpScript("testNewTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("test.newWithUseBeanArg",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        assertNotNull(getJellyContext().getVariable("foo"));
        assertTrue(getJellyContext().getVariable("foo") instanceof Customer);
        Customer customer = (Customer)(getJellyContext().getVariable("foo"));
        assertEquals("Jane Doe",customer.getName());
        assertEquals("Chicago",customer.getCity());
View Full Code Here

        }
    }

    public void testDefaultWithoutSwitch() throws Exception {
        setUpScript("testSwitchTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("default.without.switch",new Boolean(true));
        try {
            script.run(getJellyContext(),getXMLOutput());
            fail("Expected JellyException");
        } catch(JellyException e) {
            // expected
        }
    }
View Full Code Here

        }
    }

    public void testCaseWithoutValue() throws Exception {
        setUpScript("testSwitchTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("case.without.value",new Boolean(true));
        try {
            script.run(getJellyContext(),getXMLOutput());
            fail("Expected MissingAttributeException");
        } catch(MissingAttributeException e) {
            // expected
        }
    }
View Full Code Here

        }
    }

    public void testMultipleDefaults() throws Exception {
        setUpScript("testSwitchTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("multiple.defaults",new Boolean(true));
        try {
            script.run(getJellyContext(),getXMLOutput());
            fail("Expected JellyException");
        } catch(JellyException e) {
            // expected
        }
    }
View Full Code Here

        }
    }

    public void testCaseAfterDefault() throws Exception {
        setUpScript("testSwitchTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("case.after.default",new Boolean(true));
        try {
            script.run(getJellyContext(),getXMLOutput());
            fail("Expected JellyException");
        } catch(JellyException e) {
            // expected
        }
    }
View Full Code Here

    }

    public void testSimpleBreakTag() throws Exception
    {
        setUpScript("testBreakTag.jelly");
        Script script = getJelly().compileScript();

        script.run(getJellyContext(), getXMLOutput());

        String simpleResult = (String) getJellyContext().getVariable("simpleResult");

        assertEquals("simpleResult", "12345", simpleResult);
    }
View Full Code Here

    }

    public void testConditionalBreakTag() throws Exception
    {
        setUpScript("testBreakTag.jelly");
        Script script = getJelly().compileScript();

        script.run(getJellyContext(), getXMLOutput());

        String simpleResult = (String) getJellyContext().getVariable("conditionalResult");

        assertEquals("conditionalResult", "12345", simpleResult);
    }
View Full Code Here

    }

    public void testVarBreakTag() throws Exception
    {
        setUpScript("testBreakTag.jelly");
        Script script = getJelly().compileScript();

        script.run(getJellyContext(), getXMLOutput());

        String varBroken = (String) getJellyContext().getVariable("varBroken");

        assertEquals("varBroken", "true", varBroken);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jelly.Script

Copyright © 2018 www.massapicom. 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.