Package org.apache.commons.jelly

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


        if (var != null) {
            context.setVariable(var, script);
        }
        else {
            // invoke the script
            script.run(context, output);
        }
    }

    // Properties
    //-------------------------------------------------------------------------
View Full Code Here


        setUpScript("outputGood.jelly");
        Script script = getJelly().compileScript();
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
       
        script.run(getJellyContext(),XMLOutput.createXMLOutput(bos));
        assertEquals("<html></html>x",bos.toString());
    }
   
    public void testOutputBad() throws Exception {
        setUpScript("outputBad.jelly");
View Full Code Here

        setUpScript("outputBad.jelly");
        Script script = getJelly().compileScript();
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
       
        script.run(getJellyContext(),XMLOutput.createXMLOutput(bos));
        assertEquals("<html></html>",bos.toString());
    }
   
    public void testOutputBadGood() throws Exception {
        setUpScript("outputBad.jelly");
View Full Code Here

       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
       
        XMLOutput ouput = XMLOutput.createXMLOutput(bos);
       
        script.run(getJellyContext(),ouput);
        ouput.flush();
        assertEquals("<html></html>",bos.toString());
    }
   
    public void testOutputData() throws Exception {
View Full Code Here

        Script script = getJelly().compileScript();

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        XMLOutput ouput = XMLOutput.createXMLOutput(bos);

        script.run(getJellyContext(),ouput);
        ouput.flush();
        assertEquals("[string]",bos.toString().trim());
  }
}
View Full Code Here

        // without validation, should
        // not fail because validation is disabled
        setUp("invalidScript1.jelly");
        jelly.setValidateXML(false);
        Script script = jelly.compileScript();
        script.run(context,xmlOutput);
        assertTrue("should have set 'foo' variable to 'bar'",
                   context.getVariable("foo").equals("bar"));

        // if I enable xml validation, the script should fail
        // despite the cache
View Full Code Here

    public void testParserCache2() throws Exception {
        // no default namespace
        setUp("nsFilterTest.jelly");
        Script script = jelly.compileScript();
        script.run(context,xmlOutput);
        assertTrue("should have no var when default namspace is not set",
                   context.getVariable("usedDefaultNamespace") == null);

        // now we have a default namespace, so we
        // should see a variable, despite the XMLParser cache
View Full Code Here

        // now we have a default namespace, so we
        // should see a variable, despite the XMLParser cache
        jelly.setDefaultNamespaceURI("jelly:core");
        script = jelly.compileScript();
        script.run(context,xmlOutput);
        assertTrue("should have var when default namspace is set",
                   context.getVariable("usedDefaultNamespace").equals("true"));
    }
}
View Full Code Here

    }

    public void testNamespaceDefined() throws Exception {
        jelly.setDefaultNamespaceURI("jelly:core");
        Script script = jelly.compileScript();
        script.run(context,xmlOutput);
        assertTrue("should have set 'usedDefaultNamespace' variable",
                   context.getVariable("usedDefaultNamespace") != null);
    }

    public void testNamespaceNotDefined() throws Exception {
View Full Code Here

                   context.getVariable("usedDefaultNamespace") != null);
    }

    public void testNamespaceNotDefined() throws Exception {
        Script script = jelly.compileScript();
        script.run(context,xmlOutput);
        assertTrue("should not have set 'usedDefaultNamespace' variable",
                   context.getVariable("usedDefaultNamespace") == null);
    }
}
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.