Package org.apache.wink.common.internal.uritemplate

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateProcessor.expand()


        UriTemplateProcessor templateList =
            new BitWorkingUriTemplateProcessor("/list/{-list|/|list}");
        hashMap = new HashMap<String, Object>();
        hashMap.put("list", new String[] {"enc:oded"});
        assertEquals("values encoded", "/list/enc%3Aoded", templateList.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("list", new String[] {"enc:oded", "enc:oded"});
        assertEquals("values encoded", "/list/enc%3Aoded/enc%3Aoded", templateList.expand(hashMap));

        UriTemplateProcessor templatePrefix =
View Full Code Here


        hashMap = new HashMap<String, Object>();
        hashMap.put("list", new String[] {"enc:oded"});
        assertEquals("values encoded", "/list/enc%3Aoded", templateList.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("list", new String[] {"enc:oded", "enc:oded"});
        assertEquals("values encoded", "/list/enc%3Aoded/enc%3Aoded", templateList.expand(hashMap));

        UriTemplateProcessor templatePrefix =
            new BitWorkingUriTemplateProcessor("/prefix{-prefix|/|prefix}");
        hashMap = new HashMap<String, Object>();
        hashMap.put("prefix", "enc:oded");
View Full Code Here

        UriTemplateProcessor templatePrefix =
            new BitWorkingUriTemplateProcessor("/prefix{-prefix|/|prefix}");
        hashMap = new HashMap<String, Object>();
        hashMap.put("prefix", "enc:oded");
        assertEquals("values encoded", "/prefix/enc%3Aoded", templatePrefix.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("prefix", new String[] {"enc:oded", "enc:oded"});
        assertEquals("values encoded", "/prefix/enc%3Aoded/enc%3Aoded", templatePrefix
            .expand(hashMap));
View Full Code Here

        hashMap = new HashMap<String, Object>();
        hashMap.put("prefix", "enc:oded");
        assertEquals("values encoded", "/prefix/enc%3Aoded", templatePrefix.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("prefix", new String[] {"enc:oded", "enc:oded"});
        assertEquals("values encoded", "/prefix/enc%3Aoded/enc%3Aoded", templatePrefix
            .expand(hashMap));

        UriTemplateProcessor templateSuffix =
            new BitWorkingUriTemplateProcessor("/suffix/{-suffix|/|suffix}");
        hashMap = new HashMap<String, Object>();
View Full Code Here

        UriTemplateProcessor templateSuffix =
            new BitWorkingUriTemplateProcessor("/suffix/{-suffix|/|suffix}");
        hashMap = new HashMap<String, Object>();
        hashMap.put("suffix", "enc:oded");
        assertEquals("values encoded", "/suffix/enc%3Aoded/", templateSuffix.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("suffix", new String[] {"enc:oded", "enc:oded"});
        assertEquals("values encoded", "/suffix/enc%3Aoded/enc%3Aoded/", templateSuffix
            .expand(hashMap));
    }
View Full Code Here

        hashMap = new HashMap<String, Object>();
        hashMap.put("suffix", "enc:oded");
        assertEquals("values encoded", "/suffix/enc%3Aoded/", templateSuffix.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("suffix", new String[] {"enc:oded", "enc:oded"});
        assertEquals("values encoded", "/suffix/enc%3Aoded/enc%3Aoded/", templateSuffix
            .expand(hashMap));
    }

    /**
     * Test of registration and unregistration of operators. Since operators are
View Full Code Here

    public void testInstantiate() {
        UriTemplateProcessor templateA =
            new BitWorkingUriTemplateProcessor("/part1/{variable}/part2");
        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        hashMap.put("variable", "value");
        assertEquals("instantiate template", "/part1/value/part2", templateA.expand(hashMap));
    }

    public void testInstantiateDefaultValue() {
        UriTemplateProcessor templateA =
            new BitWorkingUriTemplateProcessor("/part1/{variable=default_value}/part2");
View Full Code Here

        UriTemplateProcessor templateA =
            new BitWorkingUriTemplateProcessor("/part1/{variable=default_value}/part2");

        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        hashMap.put("variable", "my_value");
        assertEquals("instantiate template with some value", "/part1/my_value/part2", templateA
            .expand(hashMap));

        hashMap = new HashMap<String, Object>();
        hashMap.put("variable", (String)null);
        assertEquals("instantiate template with default value if null",
View Full Code Here

        hashMap = new HashMap<String, Object>();
        hashMap.put("variable", (String)null);
        assertEquals("instantiate template with default value if null",
                     "/part1/default_value/part2",
                     templateA.expand(hashMap));

        hashMap = new HashMap<String, Object>();
        assertEquals("instantiate template with default value if not-defined",
                     "/part1/default_value/part2",
                     templateA.expand(hashMap));
View Full Code Here

                     templateA.expand(hashMap));

        hashMap = new HashMap<String, Object>();
        assertEquals("instantiate template with default value if not-defined",
                     "/part1/default_value/part2",
                     templateA.expand(hashMap));
    }

    public void testInstantiateNegative() {
        UriTemplateProcessor template =
            new BitWorkingUriTemplateProcessor("/part1/{variableA}/part2/{variableB}");
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.