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

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


        assertEquals("instantiate template7", "food()", template7.expand(hashMap));
    }

    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"));
View Full Code Here


        assertEquals("varA", "a~b", result.getFirst("varA"));
    }

    public void testReservedMatch() {
        UriTemplateProcessor template = new BitWorkingUriTemplateProcessor("/prefix/{varA}");
        UriTemplateMatcher matcher = template.matcher();
        MultivaluedMap<String, String> result = matcher.match("/prefix/a%3Ab");
        assertNotNull("match ok :", result);
        assertEquals("match size :", 1, result.size());
        assertEquals("varA", "a%3Ab", result.getFirst("varA"));
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 =
View Full Code Here

        UriTemplateProcessor processor =
            JaxRsUriTemplateProcessor.newNormalizedInstance("/path1/path2/./../path3");
        assertEquals("path1/path3", processor.getTemplate());

        processor = (JaxRsUriTemplateProcessor)JaxRsUriTemplateProcessor.newNormalizedInstance("");
        UriTemplateMatcher matcher = processor.matcher();
        boolean matches = matcher.matches("");
        assertTrue(matches);
        assertTrue(matcher.isExactMatch());

        processor = (JaxRsUriTemplateProcessor)JaxRsUriTemplateProcessor.newNormalizedInstance("/");
View Full Code Here

        boolean matches = matcher.matches("");
        assertTrue(matches);
        assertTrue(matcher.isExactMatch());

        processor = (JaxRsUriTemplateProcessor)JaxRsUriTemplateProcessor.newNormalizedInstance("/");
        matcher = processor.matcher();
        matches = matcher.matches("");
        assertTrue(matches);
        assertTrue(matcher.isExactMatch());

    }
View Full Code Here

        pattern = Pattern.compile(".*");
      }
     
    };
    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

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.