Examples of HashMapContext


Examples of org.apache.abdera.i18n.templates.HashMapContext

    @Test
    public void test16() throws Exception {
        String t = "http://www.google.com/search?q={term}";
        String e =
            "http://www.google.com/search?q=\u00ce\u00f1\u0163\u00e9\u0072\u00f1\u00e5\u0163\u00ee\u00f6\u00f1\u00e5\u013c\u00ee\u017e\u00e5\u0163\u00ee\u00f6\u00f1";
        HashMapContext c = new HashMapContext();
        c.setIri(true);
        c
            .put("term",
                 "\u00ce\u00f1\u0163\u00e9\u0072\u00f1\u00e5\u0163\u00ee\u00f6\u00f1\u00e5\u013c\u00ee\u017e\u00e5\u0163\u00ee\u00f6\u00f1");
        eval(t, e, c); // use the IriEvaluator so that pct-encoding is done correctly for IRI's
    }
View Full Code Here

Examples of org.apache.abdera.i18n.templates.HashMapContext

    @Test
    public void test17() throws Exception {
        String t = new String("bar{-prefix|/é/|var}/".getBytes("UTF-8"), "UTF-8");
        String e = new String("bar/é/foo/".getBytes("UTF-8"), "UTF-8");
        HashMapContext c = new HashMapContext();
        c.setIri(true);
        c.put("var", "foo");
        eval(t, e, c);
    }
View Full Code Here

Examples of org.apache.abdera.i18n.templates.HashMapContext

public class RouteTest {
    @Test
    public void testSimpleRoute() throws Exception {
        Route route = new Route("feed", "/:collection");

        HashMapContext ctx = new HashMapContext();
        ctx.put("collection", "test");
        assertEquals("/test", route.expand(ctx));

        assertTrue(route.match("/foo"));
        assertFalse(route.match("/foo/test"));
        assertFalse(route.match("foo"));
View Full Code Here

Examples of org.apache.abdera.i18n.templates.HashMapContext

    @Test
    public void testStaticRoute() throws Exception {
        Route route = new Route("feed", "/feed");

        HashMapContext ctx = new HashMapContext();
        assertEquals("/feed", route.expand(ctx));

        assertTrue(route.match("/feed"));
        assertFalse(route.match("/feed/test"));
        assertFalse(route.match("feed"));
View Full Code Here

Examples of org.apache.abdera.i18n.templates.HashMapContext

    @Test
    public void testTwoPathRoute() throws Exception {
        Route route = new Route("entry", "/:collection/:entry");

        HashMapContext ctx = new HashMapContext();
        ctx.put("collection", "c");
        ctx.put("entry", "e");
        assertEquals("/c/e", route.expand(ctx));

        assertFalse(route.match("/foo"));
        assertTrue(route.match("/foo/test"));
        assertFalse(route.match("foo"));
View Full Code Here

Examples of org.apache.abdera.i18n.templates.HashMapContext

    public void testTwoPathRouteWithSubstitution() throws Exception {
        Map<String, String> defaults = new HashMap<String, String>();
        defaults.put("collection", "c");
        Route route = new Route("entry", "/:collection/:entry", defaults, null);

        HashMapContext ctx = new HashMapContext();
        ctx.put("entry", "e");
        assertEquals("/c/e", route.expand(ctx));
    }
View Full Code Here

Examples of org.apache.abdera.i18n.templates.HashMapContext

    @Test
    public void testDashedRoute() throws Exception {
        Route route = new Route("entry", ":collection/:entry-:foo");

        HashMapContext ctx = new HashMapContext();
        ctx.put("collection", "c");
        ctx.put("entry", "e");
        ctx.put("foo", "f");
        assertEquals("c/e-f", route.expand(ctx));

        assertTrue(route.match("1/2-3"));
        assertFalse(route.match("1/2-"));
        assertFalse(route.match("1/-"));
View Full Code Here

Examples of org.apache.abdera.i18n.templates.HashMapContext

    public void testDashedRouteWithSubstitution() throws Exception {
        Map<String, String> defaults = new HashMap<String, String>();
        defaults.put("foo", "f");
        Route route = new Route("entry", ":collection/:entry-:foo", defaults, null);

        HashMapContext ctx = new HashMapContext();
        ctx.put("collection", "c");
        ctx.put("entry", "e");
        assertEquals("c/e-f", route.expand(ctx));

        assertTrue(route.match("1/2-3"));
        assertFalse(route.match("1/2-"));
        assertFalse(route.match("1/-"));
View Full Code Here

Examples of org.apache.abdera.i18n.templates.HashMapContext

    @SuppressWarnings("unchecked")
    private Context getContext(Object param) {
        Context context = new EmptyContext();
        if (param != null) {
            if (param instanceof Map) {
                context = new HashMapContext(cleanMapCtx(param), true);
            } else if (param instanceof Context) {
                context = (Context)param;
            } else {
                context = new ObjectContext(param, true);
            }
View Full Code Here

Examples of org.apache.commons.jexl.context.HashMapContext

     * The current implementation creates a new instance of
     * {@link HashMapContext}.
     * @return a new JexlContext
     */
    protected JexlContext newContext() {
        return new HashMapContext();
    }
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.