Package org.apache.commons.digester3.xmlrules

Examples of org.apache.commons.digester3.xmlrules.FromXmlRuleSetTest


    public void testRuleSet1()
        throws SAXException, IOException
    {

        // Configure the digester as required
        RuleSet rs = new TestRuleSet();
        digester.addRuleSet( rs );

        // Parse our test input.
        Employee employee = digester.parse( getInputStream( "Test1.xml" ) );
View Full Code Here


        throws SAXException, IOException
    {

        // Configure the digester as required
        digester.setNamespaceAware( true );
        RuleSet rs = new TestRuleSet( null, "http://commons.apache.org/digester/Foo" );
        digester.addRuleSet( rs );

        // Parse our test input.
        Employee employee = digester.parse( getInputStream( "Test2.xml" ) );
View Full Code Here

        throws SAXException, IOException
    {

        // Configure the digester as required
        digester.setNamespaceAware( true );
        RuleSet rs = new TestRuleSet( null, "http://commons.apache.org/digester/Foo" );
        digester.addRuleSet( rs );

        // Parse our test input.
        Employee employee = digester.parse( getInputStream( "Test3.xml" ) );
View Full Code Here

     *
     * @return a new {@link Digester} instance
     */
    public Digester newDigester()
    {
        return this.newDigester( new RulesBase() );
    }
View Full Code Here

     * @param parser the user defined {@code SAXParser}
     * @return a new {@link Digester} instance
     */
    public Digester newDigester( SAXParser parser )
    {
        return newDigester( parser, new RulesBase() );
    }
View Full Code Here

     * @param reader The user defined {@code XMLReader}
     * @return a new {@link Digester} instance
     */
    public Digester newDigester( XMLReader reader )
    {
        return this.newDigester( reader, new RulesBase() );
    }
View Full Code Here

    @Before
    public void setUp()
    {

        digester = new Digester();
        digester.setRules( new RulesBase() );

    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected SetNestedPropertiesRule createRule()
    {
        SetNestedPropertiesRule rule = new SetNestedPropertiesRule( elementNames );
        rule.setTrimData( trimData );
        rule.setAllowUnknownChildElements( allowUnknownChildElements );
        return rule;
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected SetPropertiesRule createRule()
    {
        SetPropertiesRule rule = new SetPropertiesRule( aliases );
        rule.setIgnoreMissingProperty( ignoreMissingProperty );
        return rule;
    }
View Full Code Here

    @Test
    public void testSimpleRegexMatch()
    {

        SimpleRegexMatcher matcher = new SimpleRegexMatcher();

        // 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,
                      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,
                      matcher.match( "/alpha/beta/gamma", "*/alpha/beta/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '*/bet/gamma' ", false,
                      matcher.match( "/alpha/beta/gamma", "*/bet/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to 'alph?/beta/gamma' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alph?/beta/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/?lpha/beta/gamma' ", true,
                      matcher.match( "/alpha/beta/gamma", "/?lpha/beta/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/?beta/gamma' ", false,
                      matcher.match( "/alpha/beta/gamma", "/alpha/?beta/gamma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/?eta/*' ", true,
                      matcher.match( "/alpha/beta/gamma", "/alpha/?eta/*" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/?eta/*e' ", false,
                      matcher.match( "/alpha/beta/gamma", "/alpha/?eta/*e" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '*/?et?/?amma' ", true,
                      matcher.match( "/alpha/beta/gamma", "*/?et?/?amma" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma/beta/epsilon/beta/gamma/epsilon' to "
                          + " '*/beta/gamma/?p*n' ", true,
                      matcher.match( "/alpha/beta/gamma/beta/epsilon/beta/gamma/epsilon", "*/beta/gamma/?p*n" ) );
        assertEquals( "Simple Regex Match '/alpha/beta/gamma/beta/epsilon/beta/gamma/epsilon' to "
            + " '*/beta/gamma/?p*no' ", false, matcher.match( "/alpha/beta/gamma", "*/beta/gamma/?p*no" ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.digester3.xmlrules.FromXmlRuleSetTest

Copyright © 2018 www.massapicom. 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.