Package org.apache.cocoon.components.treeprocessor

Examples of org.apache.cocoon.components.treeprocessor.InvokeContext


    }
   
    public void testPrefixedSitemapVariable() throws PatternException {
        String expr = "123{sitemap:1}/def";
   
        InvokeContext context = new InvokeContext(true);
        context.enableLogging(getLogger());

        Map sitemapElements = new HashMap();
        sitemapElements.put("1", "abc");
        context.pushMap("label", sitemapElements);
        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
        assertEquals("123abc/def", resolver.resolve(context, getObjectModel()));
    }
View Full Code Here


    }

    public void testMultilevelSitemapVariables() throws PatternException {
        String expr = "from {../1} to {1}";
       
        InvokeContext context = new InvokeContext(true);
        context.enableLogging(getLogger());

        Map sitemapElements;
        sitemapElements = new HashMap();
        sitemapElements.put("1", "juliet");
        context.pushMap("label1", sitemapElements);
       
        sitemapElements = new HashMap();
        sitemapElements.put("1", "oscar");
        context.pushMap("label2", sitemapElements);

        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
        assertEquals("from juliet to oscar", resolver.resolve(context, getObjectModel()));
    }
View Full Code Here

    }

    public void testRootSitemapVariables() throws PatternException {
        String expr = "from {/1} to {1}";
       
        InvokeContext context = new InvokeContext(true);
        context.enableLogging(getLogger());

        Map sitemapElements;
        sitemapElements = new HashMap();
        sitemapElements.put("1", "juliet");
        context.pushMap("label1", sitemapElements);
       
        sitemapElements = new HashMap();
        sitemapElements.put("1", "oscar");
        context.pushMap("label2", sitemapElements);

        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
        assertEquals("from juliet to oscar", resolver.resolve(context, getObjectModel()));
    }
View Full Code Here

    }
   
    public void testColonInTextContent() throws PatternException {
        String expr = "http://cocoon.apache.org";
       
        InvokeContext context = new InvokeContext(true);
        context.enableLogging(getLogger());

        Map sitemapElements;
        sitemapElements = new HashMap();
        context.pushMap("label", sitemapElements);
       
        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
        assertEquals("http://cocoon.apache.org", resolver.resolve(context, getObjectModel()));
    }
View Full Code Here

    }
   
    public void testColonBeginningTextContent() throws PatternException {
        String expr = ":colon-starts-this";
       
        InvokeContext context = new InvokeContext(true);
        context.enableLogging(getLogger());

        Map sitemapElements;
        sitemapElements = new HashMap();
        context.pushMap("label", sitemapElements);
       
        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
        assertEquals(":colon-starts-this", resolver.resolve(context, getObjectModel()));
    }
View Full Code Here

    }
   
    public void testEmbeddedColon() throws PatternException {
        String expr = "{1}:{1}";
       
        InvokeContext context = new InvokeContext(true);
        context.enableLogging(getLogger());

        Map sitemapElements;
        sitemapElements = new HashMap();
        sitemapElements.put("1", "abc");
        context.pushMap("label", sitemapElements);
       
        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
        assertEquals("abc:abc", resolver.resolve(context, getObjectModel()));
    }
View Full Code Here

    }

    public void testEscapedBraces() throws PatternException {
        String expr = "This is a \\{brace\\}";
       
        InvokeContext context = new InvokeContext(true);
        context.enableLogging(getLogger());

        Map sitemapElements;
        sitemapElements = new HashMap();
        context.pushMap("label", sitemapElements);

        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
        assertEquals("This is a {brace}", resolver.resolve(context, getObjectModel()));
    }
View Full Code Here

        assertEquals("This is a {brace}", resolver.resolve(context, getObjectModel()));
    }

    public void testModuleWithoutOption() throws PatternException {
        String expr = "{baselink:}";
        InvokeContext context = new InvokeContext(true);
        context.enableLogging(getLogger());
       
        Map sitemapElements = new HashMap();
        context.pushMap("sitemap", sitemapElements);
        PreparedVariableResolver resolver = new PreparedVariableResolver(expr, getManager());
        assertEquals("", resolver.resolve(context, getObjectModel()));
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.treeprocessor.InvokeContext

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.