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

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


        hashMap = new HashMap<String, Object>();
        hashMap.put("var2", new String[] {""});
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var2", new String[] {"a", "b"});
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
    }

    public void testPrefixOperator() {
        UriTemplateProcessor template = new BitWorkingUriTemplateProcessor("{-prefix|/|var}/cat");
        UriTemplateProcessor template3 =
View Full Code Here


        hashMap = new HashMap<String, Object>();
        hashMap.put("var", new String[] {"animals", "domestic"});
        assertEquals("instantiate template", "/animals/domestic/cat", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var", new String[] {"hello", "baby", "go", "home"});
        assertEquals("instantiate template3", "telegram:stophellostopbabystopgostophome", template3
            .expand(hashMap));
    }

    public void testOperatorInvalidSyntax() {
        try {
View Full Code Here

        String[][] carsDefined = { {"car1", "Ford"}, {"car2", "Opel"}};
        assertMatchTemplate(template1, "cars(old*new:good)my?car1=Ford&car2=Opel", carsDefined);
        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        hashMap.put("car1", "Ford");
        hashMap.put("car2", "Opel");
        assertEquals("instantiate template1", "cars(old*new:good)my?car1=Ford&car2=Opel", template1
            .expand(hashMap));

        UriTemplateProcessor template2 =
            new BitWorkingUriTemplateProcessor("vegetables|{-list|?|vegs}");
        String[][] vegsDefined = {{"vegs", "carrot", "leek"}};
View Full Code Here

            new BitWorkingUriTemplateProcessor("vegetables|{-list|?|vegs}");
        String[][] vegsDefined = {{"vegs", "carrot", "leek"}};
        assertMatchTemplate(template2, "vegetables|carrot?leek", vegsDefined);
        hashMap = new HashMap<String, Object>();
        hashMap.put("vegs", new String[] {"carrot", "leek"});
        assertEquals("instantiate template2", "vegetables|carrot?leek", template2.expand(hashMap));

        UriTemplateProcessor template3 =
            new BitWorkingUriTemplateProcessor("vegetables{-prefix|?|vegs}");
        assertMatchTemplate(template3, "vegetables?carrot?leek", vegsDefined);
        hashMap = new HashMap<String, Object>();
View Full Code Here

        UriTemplateProcessor template3 =
            new BitWorkingUriTemplateProcessor("vegetables{-prefix|?|vegs}");
        assertMatchTemplate(template3, "vegetables?carrot?leek", vegsDefined);
        hashMap = new HashMap<String, Object>();
        hashMap.put("vegs", new String[] {"carrot", "leek"});
        assertEquals("instantiate template3", "vegetables?carrot?leek", template3.expand(hashMap));

        UriTemplateProcessor template4 =
            new BitWorkingUriTemplateProcessor("vegetables|{-suffix|?|vegs}");
        assertMatchTemplate(template4, "vegetables|carrot?leek?", vegsDefined);
        hashMap = new HashMap<String, Object>();
View Full Code Here

        UriTemplateProcessor template4 =
            new BitWorkingUriTemplateProcessor("vegetables|{-suffix|?|vegs}");
        assertMatchTemplate(template4, "vegetables|carrot?leek?", vegsDefined);
        hashMap = new HashMap<String, Object>();
        hashMap.put("vegs", new String[] {"carrot", "leek"});
        assertEquals("instantiate template4", "vegetables|carrot?leek?", template4.expand(hashMap));

        UriTemplateProcessor template5 =
            new BitWorkingUriTemplateProcessor("translator({-join|?|czech,english})");
        String[][] translation = { {"czech", "pes"}, {"english", "dog"}};
        assertMatchTemplate(template5, "translator(english=dog?czech=pes)", translation);
View Full Code Here

        String[][] translation = { {"czech", "pes"}, {"english", "dog"}};
        assertMatchTemplate(template5, "translator(english=dog?czech=pes)", translation);
        hashMap = new HashMap<String, Object>();
        hashMap.put("english", "dog");
        hashMap.put("czech", "pes");
        assertEquals("instantiate template5", "translator(czech=pes?english=dog)", template5
            .expand(hashMap));

        UriTemplateProcessor template6 =
            new BitWorkingUriTemplateProcessor("food{-opt|?|meat,milk}");
        String[][] empty = {};
View Full Code Here

            new BitWorkingUriTemplateProcessor("food{-opt|?|meat,milk}");
        String[][] empty = {};
        assertMatchTemplate(template6, "food?", empty);
        hashMap = new HashMap<String, Object>();
        hashMap.put("meat", "poultry");
        assertEquals("instantiate template6", "food?", template6.expand(hashMap));

        UriTemplateProcessor template7 =
            new BitWorkingUriTemplateProcessor("food{-neg|()|meat,milk}");
        assertMatchTemplate(template7, "food()", empty);
        hashMap = new HashMap<String, Object>();
View Full Code Here

        UriTemplateProcessor template7 =
            new BitWorkingUriTemplateProcessor("food{-neg|()|meat,milk}");
        assertMatchTemplate(template7, "food()", empty);
        hashMap = new HashMap<String, Object>();
        assertEquals("instantiate template7", "food()", template7.expand(hashMap));
    }

    public void testUnreservedMatch() {
        UriTemplateProcessor template = new BitWorkingUriTemplateProcessor("/prefix/{varA}");
        UriTemplateMatcher matcher = template.matcher();
View Full Code Here

    public void testEncodedSubstitutedValues() {
        UriTemplateProcessor templateVar = new BitWorkingUriTemplateProcessor("/var/{var}");
        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        hashMap.put("var", "enc:oded");
        assertEquals("values encoded", "/var/enc%3Aoded", templateVar.expand(hashMap));

        UriTemplateProcessor templateJoin =
            new BitWorkingUriTemplateProcessor("/join/{-join|;|join}");
        hashMap = new HashMap<String, Object>();
        hashMap.put("join", "enc:oded");
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.