Package org.apache.commons.jelly

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


    public void testCData() throws Exception {
        Jelly jelly = new Jelly();
        jelly.setScript("file:src/test/org/apache/commons/jelly/test/xml/testCData.jelly");
        Script script = jelly.compileScript();
        JellyContext context = new JellyContext();
        script.run(context, XMLOutput.createDummyXMLOutput());

        String output = (String) context.getVariable("foo");
        assertTrue("'foo' is not null", output != null);

        String golden = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
View Full Code Here


    public void testDummyXMLOutput() throws Exception {
        // without validation
        setUp("producesOutput.jelly");
        Script script = this.jelly.compileScript();
        script.run(this.context,this.xmlOutput);
        assertTrue("should have set 'foo' variable to 'bar'",
                   this.context.getVariable("foo").equals("bar"));

    }
View Full Code Here

    public void testInvalidXML1NoValidation() throws Exception {
        // without validation
        setUp("invalidScript1.jelly");
        Script script = jelly.compileScript();
        script.run(context,xmlOutput);
        assertTrue("should have set 'foo' variable to 'bar'",
                   context.getVariable("foo").equals("bar"));

        // do it again, explicitly setting the validateXML variable
        setUp("invalidScript1.jelly");
View Full Code Here

        // do it again, explicitly setting the validateXML variable
        setUp("invalidScript1.jelly");
        jelly.setValidateXML(false);
        script = jelly.compileScript();
        script.run(context,xmlOutput);
        assertTrue("should have set 'foo' variable to 'bar'",
                   context.getVariable("foo").equals("bar"));
    }

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

    public void testValidXML1Validation()throws Exception {
        // with validation
        setUp("validScript1.jelly");
        jelly.setValidateXML(true);
        Script script = jelly.compileScript();
        script.run(context,xmlOutput);
        assertTrue("should have set 'foo' variable to 'bar'",
                   context.getVariable("foo").equals("bar"));
    }

}
View Full Code Here

        getJellyContext().setVariable("myList",
              new Object[] {"0", "VOID", "1", "VOID", "2", "VOID",
                            "3", "VOID", "4", "VOID", "5"});
        getJellyContext().setVariable("testMyList", Boolean.TRUE);
        script.run(getJellyContext(), getXMLOutput());

        String resultOrdered =
                (String) getJellyContext().getVariable("result.ordered");
        System.err.println("raw result is '" + resultOrdered + "'");
        resultOrdered = StringUtils.replace(resultOrdered, " ", "");
View Full Code Here

    {
        setUpScript("testForEachTag.jelly");
        Script script = getJelly().compileScript();

        getJellyContext().setVariable("testNumList", Boolean.TRUE);
        script.run(getJellyContext(), getXMLOutput());

        String resultOrdered =
                (String) getJellyContext().getVariable("result.ordered");
        System.err.println("raw result is '" + resultOrdered + "'");
        resultOrdered = StringUtils.replace(resultOrdered, " ", "");
View Full Code Here

        Script script = getJelly().compileScript();

        getJellyContext().setVariable( "test.Integer.MAX_VALUE",
                                       Boolean.TRUE );

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

        assertEquals( new Integer(java.lang.Integer.MAX_VALUE),
                      getJellyContext().getVariable("value" ) );
    }
View Full Code Here

        Script script = getJelly().compileScript();

        getJellyContext().setVariable( "test.InvalidGet", Boolean.TRUE );

        try {
            script.run( getJellyContext(), getXMLOutput() );
        } catch(JellyTagException jte) {
            return;
        }

        fail("JellyTagException not thrown.");
View Full Code Here

     */
    public void testSimple() throws Exception{
        setUpScript("testUseBeanTag.jelly");
        Script script = getJelly().compileScript();
        getJellyContext().setVariable("test.simple",Boolean.TRUE);
        script.run(getJellyContext(),getXMLOutput());
        assertNotNull(getJellyContext().getVariable("foo"));
        assertTrue(getJellyContext().getVariable("foo") instanceof Customer);
        Customer customer = (Customer)(getJellyContext().getVariable("foo"));
        assertEquals("name not set", "testing", customer.getName());
        assertEquals("city not set", "sydney", customer.getCity());
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.