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

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


        hashMap.put("var2", "kate");
        assertEquals("instantiate template", "people%3Fvar1=mary&var2=kate", template
            .expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var3", "joe");
        assertEquals("instantiate template", "people%3F", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        assertEquals("instantiate template", "people%3F", template.expand(hashMap));

        try {
            hashMap = new HashMap<String, Object>();
View Full Code Here


            .expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var3", "joe");
        assertEquals("instantiate template", "people%3F", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        assertEquals("instantiate template", "people%3F", template.expand(hashMap));

        try {
            hashMap = new HashMap<String, Object>();
            hashMap.put("var1", new String[] {"joe", "max"});
            template.expand(hashMap);
View Full Code Here

        assertEquals("instantiate template", "people%3F", template.expand(hashMap));

        try {
            hashMap = new HashMap<String, Object>();
            hashMap.put("var1", new String[] {"joe", "max"});
            template.expand(hashMap);
            fail("variable must not be a list");
        } catch (IllegalArgumentException expected) {
        }

    }
View Full Code Here

        assertMatchTemplate(template, "artifacts;", empty);
        assertMatchTemplate(template, "artifacts;;", null);

        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        hashMap.put("var1", (String)null);
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var2", (String)null);
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var1", (String)null);
View Full Code Here

        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        hashMap.put("var1", (String)null);
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var2", (String)null);
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var1", (String)null);
        hashMap.put("var2", (String)null);
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
View Full Code Here

        hashMap.put("var2", (String)null);
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var1", (String)null);
        hashMap.put("var2", (String)null);
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var1", "");
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var2", "");
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.