Package org.apache.commons.jelly

Examples of org.apache.commons.jelly.JellyContext


    public static TestSuite suite() throws Exception {
        return new TestSuite(TestDefaultNamespaceFilter.class);
    }

    public void setUp() throws Exception {
        context = new JellyContext();
        xmlOutput = XMLOutput.createXMLOutput(new StringWriter());

        jelly = new Jelly();

        String script = "nsFilterTest.jelly";
View Full Code Here


     */
    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";
        golden += "<!DOCTYPE foo [\n";
        golden += "  <!ELEMENT foo (#PCDATA)>\n";
View Full Code Here

    public static TestSuite suite() throws Exception {
        return new TestSuite(TestNonexistentTags.class);
    }

    public void setUp(String scriptName) throws Exception {
        context = new JellyContext();
        xmlOutput = XMLOutput.createDummyXMLOutput();

        jelly = new Jelly();

        String script = scriptName;
View Full Code Here

    public static TestSuite suite() throws Exception {
        return new TestSuite(TestDummyXMLOutput.class);
    }

    public void setUp(String scriptName) throws Exception {
        this.context = new JellyContext();
        this.xmlOutput = XMLOutput.createDummyXMLOutput();

        this.jelly = new Jelly();

        String script = scriptName;
View Full Code Here

    public static TestSuite suite() throws Exception {
        return new TestSuite(TestXMLValidation.class);
    }

    public void setUp(String scriptName) throws Exception {
        context = new JellyContext();
        xmlOutput = XMLOutput.createXMLOutput(new StringWriter());

        jelly = new Jelly();

        String script = scriptName;
View Full Code Here

        // We don't want any taglib references in the context or Jelly
        // gets confused. All we want are the variables for interpolation. We
        // can change this but I think we would like to avoid general Jelly
        // idiom in the POM anyway.
        JellyContext context = new JellyContext();
        JellyUtils.populateVariables( context, originalContext );

        // We don't want the context or the parent being written out into the XML which
        // is the interpolated POM.
        project.setContext( null );
View Full Code Here

    throws ProcessingException,SAXException,IOException {

        super.setup(resolver, objectModel, src, params);

        // Initialize the Jelly context
        this.jellyContext = new JellyContext();
       
        // Update JellyContext with sitemap parameters
        this.updateContext(params);
    }
View Full Code Here

        // or something?
        TestCase testCase = new TestCase(name) {
            protected void runTest() throws Throwable {
                // create a new child context so that each test case
                // will have its own variable scopes
                JellyContext newContext = new JellyContext( context );

                // disable inheritence of variables and tag libraries
                newContext.setExportLibraries(false);
                newContext.setExport(false);

                // invoke the test case
                getBody().run(newContext, output);
            }
        };
View Full Code Here

    public static TestSuite suite() throws Exception {
        return new TestSuite(TestXMLParserCache.class);
    }

    public void setUp(String scriptName) throws Exception {
        context = new JellyContext();
        xmlOutput = XMLOutput.createXMLOutput(new StringWriter());

        jelly = new Jelly();

        String script = scriptName;
View Full Code Here

                + "jelly-test-case"
                + " </j:jelly>";
       ByteArrayOutputStream output = new ByteArrayOutputStream();
       XMLOutput xmlOutput = XMLOutput.createXMLOutput(output);
       InputSource script = new InputSource( new StringReader(message.toString()) );
       JellyContext context = new JellyContext();
       context.runScript( script, xmlOutput);
       output.close();
       //check that the output confirms the expected
       assertEquals("jelly-test-case", new String(output.toByteArray()));
    }
View Full Code Here

TOP

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

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.