Package org.apache.cocoon.sitemap.node.MatchNode

Examples of org.apache.cocoon.sitemap.node.MatchNode.MatcherContext.match()


    @Test
    public void endsWithMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "endsWith", ".xml");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc.xml");
        assertTrue(matches.containsValue("abc.xml"));
        assertTrue(matches.containsValue("abc"));
        assertEquals(2, matches.size());
    }
View Full Code Here


    @Test
    public void startsWithMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "startsWith", "abc");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc/44");
        assertTrue(matches.containsValue("abc/44"));
        assertTrue(matches.containsValue("/44"));
        assertEquals(2, matches.size());
    }
View Full Code Here

    @Test
    public void regexpMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "regexp", "([a-zA-Z\\-]+)/(.*)");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc/44");
        assertTrue(matches.containsValue("abc/44"));
        assertTrue(matches.containsValue("abc"));
        assertTrue(matches.containsValue("44"));
        assertEquals(3, matches.size());
    }
View Full Code Here

    @Test
    public void regexpMatchingAttributeWithSlash() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "regexp", "([a-zA-Z\\-]+)/(.*)");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc/44");
        assertTrue(matches.containsValue("abc/44"));
        assertTrue(matches.containsValue("abc"));
        assertTrue(matches.containsValue("44"));
        assertEquals(3, matches.size());
    }
View Full Code Here

    @Test
    public void containsMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "contains", "123");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("000123456");
        assertTrue(matches.containsValue("000123456"));
        assertEquals(1, matches.size());
    }

    @Test
View Full Code Here

    @Test
    public void equalsMatchingAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "equals", "123");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("123");
        assertTrue(matches.containsValue("123"));
        assertEquals(1, matches.size());
    }

    @Test
View Full Code Here

    @Test
    public void wildcardMatchingPathAttribute() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "wildcard", "abc/*/*");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc/def/ghi");
        assertTrue(matches.containsValue("abc/def/ghi"));
        assertTrue(matches.containsValue("def"));
        assertTrue(matches.containsValue("ghi"));
        assertEquals(3, matches.size());
    }
View Full Code Here

    @Test
    public void wildcardMatchingPathAttributeWithSlash() throws Exception {
        MatchNode matchNode = new MatchNode();
        PrivateAccessor.setField(matchNode, "wildcard", "abc/*/*");
        MatcherContext matcherContext = matchNode.lookupMatcherContext();
        Map<String, String> matches = matcherContext.match("abc/def/ghi");
        assertTrue(matches.containsValue("abc/def/ghi"));
        assertTrue(matches.containsValue("def"));
        assertTrue(matches.containsValue("ghi"));
        assertEquals(3, matches.size());
    }
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.