Package freenet.crypt

Examples of freenet.crypt.MultiHashInputStream$Digester


                // do nothing
            }

        };

        Digester digester = newLoader( new AbstractRulesModule()
        {

            @Override
            protected void configure()
            {
                // do nothing
            }

        } ).setErrorHandler( expected ).newDigester();

        ErrorHandler actual = digester.getErrorHandler();

        assertSame( expected, actual );
    }
View Full Code Here


                // just fake method
                return 0;
            }
        };

        Digester digester = newLoader( new AbstractRulesModule()
        {

            @Override
            protected void configure()
            {
                // do nothing
            }

        } ).setDocumentLocator( expected ).newDigester();

        Locator actual = digester.getDocumentLocator();

        assertSame( expected, actual );
    }
View Full Code Here

    @Test
    public void digester155()
    {
        ClassLoader expected = getClass().getClassLoader();

        Digester digester = newLoader( new AbstractRulesModule()
        {

            @Override
            protected void configure()
            {
                // do nothing
            }

        } ).setClassLoader( expected ).newDigester();

        ClassLoader actual = digester.getClassLoader();

        assertSame( expected, actual );
    }
View Full Code Here

                + "</digester-rules>";

        String xml = "<?xml version='1.0' ?><root><foo><bar>short</bar></foo></root>";

        List<String> list = new ArrayList<String>();
        Digester digester = newLoader( new FromXmlRulesModule()
        {

            @Override
            protected void loadRules()
            {
                loadXMLRulesFromText( rulesXml );
            }

        }).newDigester();
        digester.push( list );
        digester.parse( new StringReader( xml ) );

        assertEquals( "Number of entries", 1, list.size() );
        assertEquals( "Entry value", "short", list.get( 0 ) );
    }
View Full Code Here

        dateConverter.setPatterns( new String[] { "yyyy-MM-dd'T'HH:mm" } );
        ConvertUtils.register( dateConverter, Date.class );

        String filename = args[0];

        Digester digester = newLoader( new FromAnnotationsRuleModule()
        {

            @Override
            protected void configureRules()
            {
                bindRulesFrom( Feed.class );
            }

        } ).newDigester();

        try
        {
            Feed feed = digester.parse( filename );
            System.out.println( feed );
        }
        catch ( IOException ioe )
        {
            System.out.println( "Error reading input file:" + ioe.getMessage() );
View Full Code Here

        dateConverter.setPatterns( new String[] { "yyyy-MM-dd'T'HH:mm" } );
        ConvertUtils.register( dateConverter, Date.class );

        String filename = args[0];

        Digester digester = newLoader( new AtomRulesModule() ).newDigester();

        try
        {
            Feed feed = digester.parse( filename );
            System.out.println( feed );
        }
        catch ( IOException ioe )
        {
            System.out.println( "Error reading input file:" + ioe.getMessage() );
View Full Code Here

        input.append( "  file='src/test/resources/org/apache/commons/digester3/plugins/xmlrules1.xml'" );
        input.append( "  />" );
        input.append( "  <object plugin-id='testobject'/>" );
        input.append( "</root>" );

        Digester digester = new Digester();
        PluginRules rc = new PluginRules();
        digester.setRules( rc );

        PluginDeclarationRule pdr = new PluginDeclarationRule();
        digester.addRule( "root/plugin", pdr );

        PluginCreateRule pcr = new PluginCreateRule( ObjectTestImpl.class );
        digester.addRule( "root/object", pcr );

        try
        {
            digester.parse( new StringReader( input.toString() ) );
        }
        catch ( Exception e )
        {
            throw e;
        }

        Object root = digester.getRoot();
        assertEquals( ObjectTestImpl.class, root.getClass() );
        ObjectTestImpl testObject = (ObjectTestImpl) root;
        assertEquals( "xmlrules1", testObject.getValue() );
    }
View Full Code Here

        input.append( "  resource='org/apache/commons/digester3/plugins/xmlrules2.xml'" );
        input.append( "  />" );
        input.append( "  <object plugin-id='testobject'/>" );
        input.append( "</root>" );

        Digester digester = new Digester();
        PluginRules rc = new PluginRules();
        digester.setRules( rc );

        PluginDeclarationRule pdr = new PluginDeclarationRule();
        digester.addRule( "root/plugin", pdr );

        PluginCreateRule pcr = new PluginCreateRule( ObjectTestImpl.class );
        digester.addRule( "root/object", pcr );

        try
        {
            digester.parse( new StringReader( input.toString() ) );
        }
        catch ( Exception e )
        {
            throw e;
        }

        Object root = digester.getRoot();
        assertEquals( ObjectTestImpl.class, root.getClass() );
        ObjectTestImpl testObject = (ObjectTestImpl) root;
        assertEquals( "xmlrules2", testObject.getValue() );
    }
View Full Code Here

        input.append( "  class='org.apache.commons.digester3.plugins.ObjectTestImpl'" );
        input.append( "  />" );
        input.append( "  <object plugin-id='testobject'/>" );
        input.append( "</root>" );

        Digester digester = new Digester();
        PluginRules rc = new PluginRules();
        digester.setRules( rc );

        PluginDeclarationRule pdr = new PluginDeclarationRule();
        digester.addRule( "root/plugin", pdr );

        PluginCreateRule pcr = new PluginCreateRule( ObjectTestImpl.class );
        digester.addRule( "root/object", pcr );

        try
        {
            digester.parse( new StringReader( input.toString() ) );
        }
        catch ( Exception e )
        {
            throw e;
        }

        Object root = digester.getRoot();
        assertEquals( ObjectTestImpl.class, root.getClass() );
        ObjectTestImpl testObject = (ObjectTestImpl) root;
        assertEquals( "xmlrules-ruleinfo", testObject.getValue() );
    }
View Full Code Here

    public void testPredeclaration()
        throws Exception
    {
        // * tests that rules can be declared via a PluginDeclarationRule

        Digester digester = new Digester();
        PluginRules rc = new PluginRules();
        digester.setRules( rc );

        PluginDeclarationRule pdr = new PluginDeclarationRule();
        digester.addRule( "root/plugin", pdr );

        PluginCreateRule pcr = new PluginCreateRule( Widget.class );
        digester.addRule( "root/widget", pcr );
        digester.addSetNext( "root/widget", "addChild" );

        Container root = new Container();
        digester.push( root );

        try
        {
            digester.parse( Utils.getInputStream( this, "test3.xml" ) );
        }
        catch ( Exception e )
        {
            throw e;
        }
View Full Code Here

TOP

Related Classes of freenet.crypt.MultiHashInputStream$Digester

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.