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

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


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


        hashMap = new HashMap<String, Object>();
        hashMap.put("var1", "somevalue");
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var2", "somevalue");
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        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[] {null});
View Full Code Here

        hashMap = new HashMap<String, Object>();
        hashMap.put("var2", "somevalue");
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        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[] {null});
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        hashMap = new HashMap<String, Object>();
        hashMap.put("var2", new String[] {""});
View Full Code Here

        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[] {null});
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        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"});
View Full Code Here

        hashMap = new HashMap<String, Object>();
        hashMap.put("var2", new String[] {null});
        assertEquals("instantiate template", "artifacts", template.expand(hashMap));
        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));
    }
View Full Code Here

        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

     */
    private static String getCategoriesDocBaseUri(Categories cats, ResourceRecord record) {
        String categoriesDocBaseUri = null;
        MultivaluedMap<String, String> templateParams = cats.getTemplateParameters();
        UriTemplateProcessor template = record.getTemplateProcessor();
        categoriesDocBaseUri = template.expand(templateParams);
        return categoriesDocBaseUri;
    }

    /**
     * Order by workspace, then by title. Workspace value must be always
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

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.