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

Examples of org.apache.wink.common.internal.uritemplate.UriTemplateMatcher.match()


        result = matcher.match("/prefix/a%2Fb");
        assertNotNull("match ok /", result);
        assertEquals("match size /", 1, result.size());
        assertEquals("varA", "a%2Fb", result.getFirst("varA"));

        result = matcher.match("/prefix/%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D");
        assertNotNull("match ok ?#[]@!$&'()*+,;=", result);
        assertEquals("match size ?#[]@!$&'()*+,;=", 1, result.size());
        assertEquals("varA", "%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D", result
            .getFirst("varA"));
    }
View Full Code Here


    private static void assertMatchTemplate(UriTemplateProcessor template,
                                            String uri,
                                            String[][] variables) {

        UriTemplateMatcher matcher = template.matcher();
        MultivaluedMap<String, String> varMap = matcher.match(uri);
        if (variables == null) {

            // must not match
            assertNull(varMap);
        } else {
View Full Code Here

      }
     
    };
    processor.compile("{.*}");
    final UriTemplateMatcher uriTemplateMatcher = processor.matcher();
    uriTemplateMatcher.match("foo");
    return new ResourceInstance(rootResource,
        new ResourceRecord(metadata, objectFactory, processor), uriTemplateMatcher);
  }
 

View Full Code Here

    public void testMatch() {
        UriTemplateProcessor template =
            new BitWorkingUriTemplateProcessor("/prefix/{varA}/root/{variableB}/suffix");
        UriTemplateMatcher matcher = template.matcher();
        MultivaluedMap<String, String> result = matcher.match("/prefix/aaaaaa/root/BbBbB/suffix");
        assertNotNull("match ok", result);
        assertEquals("match size", 2, result.size());
        assertEquals("varA", "aaaaaa", result.getFirst("varA"));
        assertEquals("variableB", "BbBbB", result.getFirst("variableB"));
    }
View Full Code Here

    public void testMatchVariableDoubleUsage() {
        UriTemplateProcessor template =
            new BitWorkingUriTemplateProcessor("/prefix/{varA}/root/{varA}/suffix");
        UriTemplateMatcher matcher = template.matcher();
        MultivaluedMap<String, String> result = matcher.match("/prefix/aaaaaa/root/aaaaaa/suffix");
        assertNotNull("match ok", result);
        assertEquals("match size", 1, result.size());
        assertEquals("varA", "aaaaaa", result.getFirst("varA"));
    }
View Full Code Here

    public void testMatchNegative() {
        UriTemplateProcessor template =
            new BitWorkingUriTemplateProcessor("/prefix/{variable}/suffix");
        UriTemplateMatcher matcher = template.matcher();
        assertNull("not matching", matcher.match("aprefix/value/suffix"));
    }

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

    }

    public void testUnreservedMatch() {
        UriTemplateProcessor template = new BitWorkingUriTemplateProcessor("/prefix/{varA}");
        UriTemplateMatcher matcher = template.matcher();
        MultivaluedMap<String, String> result = matcher.match("/prefix/a.b");
        assertNotNull("match ok .", result);
        assertEquals("match size .", 1, result.size());
        assertEquals("varA", "a.b", result.getFirst("varA"));

        result = matcher.match("/prefix/a_b");
View Full Code Here

        MultivaluedMap<String, String> result = matcher.match("/prefix/a.b");
        assertNotNull("match ok .", result);
        assertEquals("match size .", 1, result.size());
        assertEquals("varA", "a.b", result.getFirst("varA"));

        result = matcher.match("/prefix/a_b");
        assertNotNull("match ok _", result);
        assertEquals("match size _", 1, result.size());
        assertEquals("varA", "a_b", result.getFirst("varA"));

        result = matcher.match("/prefix/a-b");
View Full Code Here

        result = matcher.match("/prefix/a_b");
        assertNotNull("match ok _", result);
        assertEquals("match size _", 1, result.size());
        assertEquals("varA", "a_b", result.getFirst("varA"));

        result = matcher.match("/prefix/a-b");
        assertNotNull("match ok -", result);
        assertEquals("match size ,", 1, result.size());
        assertEquals("varA", "a-b", result.getFirst("varA"));

        result = matcher.match("/prefix/a~b");
View Full Code Here

        result = matcher.match("/prefix/a-b");
        assertNotNull("match ok -", result);
        assertEquals("match size ,", 1, result.size());
        assertEquals("varA", "a-b", result.getFirst("varA"));

        result = matcher.match("/prefix/a~b");
        assertNotNull("match ok ~", result);
        assertEquals("match size ~", 1, result.size());
        assertEquals("varA", "a~b", result.getFirst("varA"));
    }
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.