Package org.apache.commons.jelly

Examples of org.apache.commons.jelly.Script.run()


    public void testInvokeThatDoesNotHandleException() throws Exception {
        setUpScript("testInvokeTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("test.invokeThatDoesNotHandleException",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        String exceptionMessage = (String) getJellyContext().getVariable("exceptionMessage");
        assertNotNull( exceptionMessage );
        assertNotNull( getJellyContext().getVariable("exceptionBean"));
        JellyException jellyException = (JellyException) getJellyContext().getVariable("jellyException");
        assertNotNull( jellyException );
View Full Code Here


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

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

        String data = (String)getJellyContext().getVariable("testFileTag");

        //FIXME This doesn't take into account attribute ordering
        assertEquals("fully qualified attributes not passed",
View Full Code Here

    public void testSimpleSwitch() throws Exception {
        setUpScript("testSwitchTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("switch.on.a","two");
        script.run(getJellyContext(),getXMLOutput());
        assertNull("should not have 'a.one' variable set",
                   getJellyContext().getVariable("a.one"));
        assertTrue("should have set 'a.two' variable to 'true'",
                   getJellyContext().getVariable("a.two").equals("true"));
        assertNull("should not have 'a.three' variable set",
View Full Code Here

    public void testFallThru() throws Exception {
        setUpScript("testSwitchTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("switch.on.a","one");
        script.run(getJellyContext(),getXMLOutput());
        assertTrue("should have set 'a.one' variable to 'true'",
                   getJellyContext().getVariable("a.one").equals("true"));
        assertTrue("should have set 'a.two' variable to 'true'",
                   getJellyContext().getVariable("a.two").equals("true"));
        assertNull("should not have 'a.three' variable set",
View Full Code Here

    public void testDefault() throws Exception {
        setUpScript("testSwitchTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("switch.on.a","negative one");
        script.run(getJellyContext(),getXMLOutput());
        assertNull("should not have 'a.one' variable set",
                   getJellyContext().getVariable("a.one"));
        assertNull("should not have 'a.two' variable set",
                   getJellyContext().getVariable("a.two"));
        assertNull("should not have 'a.three' variable set",
View Full Code Here

    public void testNullCase() throws Exception {
        setUpScript("testSwitchTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("switch.on.a",null);
        script.run(getJellyContext(),getXMLOutput());
        assertNull("should not have 'a.one' variable set",
                   getJellyContext().getVariable("a.one"));
        assertNull("should not have 'a.two' variable set",
                   getJellyContext().getVariable("a.two"));
        assertNull("should not have 'a.three' variable set",
View Full Code Here

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

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

            // add the system properties and the command line arguments
            JellyContext context = jelly.getJellyContext();
            context.setVariable("args", args);
            context.setVariable("commandLine", cmdLine);
            script.run(context, output);

            // now lets wait for all threads to close
            Runtime.getRuntime().addShutdownHook(new Thread() {
                    public void run() {
                        try {
View Full Code Here

            script.run(context, output);
        }
*/
        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            Script script = (Script) iter.next();
            script.run(context, output);
        }
    }
   
    /**
     * Trim the body of the script.
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.