Package org.apache.commons.digester3

Examples of org.apache.commons.digester3.SimpleRegexMatcher.match()


        rules.add( "/c/f", new TestRule( "beta" ) );
        rules.add( "/b", new TestRule( "gamma" ) );

        // now test a few patterns
        // check that all are return in the order which they were added
        List<Rule> matches = rules.match( "", "/b/c", null, null );
        assertEquals( "Wrong number of rules returned (1)", 0, matches.size() );

        matches = rules.match( "", "/b/c/f", null, null );
        assertEquals( "Wrong number of rules returned (2)", 0, matches.size() );
    }
View Full Code Here


        // now test a few patterns
        // check that all are return in the order which they were added
        List<Rule> matches = rules.match( "", "/b/c", null, null );
        assertEquals( "Wrong number of rules returned (1)", 0, matches.size() );

        matches = rules.match( "", "/b/c/f", null, null );
        assertEquals( "Wrong number of rules returned (2)", 0, matches.size() );
    }

    /** Test a mixed regex - in other words, one that sometimes returns true and sometimes false */
    @Test
View Full Code Here

        rules.add( "/match/me", new TestRule( "beta" ) );
        rules.add( "/match", new TestRule( "gamma" ) );

        // now test a few patterns
        // check that all are return in the order which they were added
        List<Rule> matches = rules.match( "", "/match", null, null );
        assertEquals( "Wrong number of rules returned (1)", 1, matches.size() );
        assertEquals( "Wrong Rule (1)", "beta", ( (TestRule) matches.get( 0 ) ).getIdentifier() );

        matches = rules.match( "", "/a/match", null, null );
        assertEquals( "Wrong Rule (2)", "beta", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
View Full Code Here

        // check that all are return in the order which they were added
        List<Rule> matches = rules.match( "", "/match", null, null );
        assertEquals( "Wrong number of rules returned (1)", 1, matches.size() );
        assertEquals( "Wrong Rule (1)", "beta", ( (TestRule) matches.get( 0 ) ).getIdentifier() );

        matches = rules.match( "", "/a/match", null, null );
        assertEquals( "Wrong Rule (2)", "beta", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
    }

    /** Test rules and clear methods */
    @Test
View Full Code Here

        assertEquals( "Wrong number of rules returned (1)", 3, matches.size() );
        assertEquals( "Rule Out Of Order (1)", "alpha", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
        assertEquals( "Rule Out Of Order (2)", "beta", ( (TestRule) matches.get( 1 ) ).getIdentifier() );
        assertEquals( "Rule Out Of Order (3)", "gamma", ( (TestRule) matches.get( 2 ) ).getIdentifier() );

        matches = rules.match( "", "/eggs", null, null );
        assertEquals( "Wrong number of rules returned (2)", 3, matches.size() );
        assertEquals( "Rule Out Of Order (4)", "alpha", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
        assertEquals( "Rule Out Of Order (5)", "beta", ( (TestRule) matches.get( 1 ) ).getIdentifier() );
        assertEquals( "Rule Out Of Order (6)", "gamma", ( (TestRule) matches.get( 2 ) ).getIdentifier() );
View Full Code Here

        rules.clear();
        matches = rules.rules();
        assertEquals( "Wrong number of rules returned (3)", 0, matches.size() );

        matches = rules.match( "", "/eggs", null, null );
        assertEquals( "Wrong number of rules returned (4)", 0, matches.size() );
    }

    @Test
    public void testSimpleRegexMatch()
View Full Code Here

        // SimpleLog log = new SimpleLog("{testSimpleRegexMatch:SimpleRegexMatcher]");
        // log.setLevel(SimpleLog.LOG_LEVEL_TRACE);

        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/beta/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma/epsilon' ", false,
                      matcher.match( "/alpha/beta/gamma", "/alpha/beta/gamma/epsilon" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/*" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*/gamma' ", true,
View Full Code Here

        // log.setLevel(SimpleLog.LOG_LEVEL_TRACE);

        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/beta/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma/epsilon' ", false,
                      matcher.match( "/alpha/beta/gamma", "/alpha/beta/gamma/epsilon" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/*" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*/gamma' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/*/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*me' ", false,
View Full Code Here

        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/beta/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma/epsilon' ", false,
                      matcher.match( "/alpha/beta/gamma", "/alpha/beta/gamma/epsilon" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/*" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*/gamma' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/*/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*me' ", false,
                      matcher.match( "/alpha/beta/gamma", "/alpha/*me" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '*/beta/gamma' ", true,
View Full Code Here

        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma/epsilon' ", false,
                      matcher.match( "/alpha/beta/gamma", "/alpha/beta/gamma/epsilon" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/*" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*/gamma' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/*/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*me' ", false,
                      matcher.match( "/alpha/beta/gamma", "/alpha/*me" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '*/beta/gamma' ", true,
                      matcher.match( "/alpha/beta/gamma", "*/beta/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '*/alpha/beta/gamma' ", true,
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.