Package org.apache.avalon.framework.parameters

Examples of org.apache.avalon.framework.parameters.Parameters


     * Testcase for count=1, blocknr=1
     */
    public void testFilter_1_1() throws Exception {
        getLogger().debug("testFilter_1_1");

        Parameters parameters = new Parameters();
        parameters.setParameter( "element-name", "leaf" );
        parameters.setParameter( "count", "1" );
        parameters.setParameter( "blocknr", "1" );

        String input = "resource://org/apache/cocoon/transformation/filter-input.xml";
        String result = "resource://org/apache/cocoon/transformation/filter-result-1-1.xml";
        String src =  null;
       
View Full Code Here


     * Testcase for count=3, blocknr=1
     */
    public void testFilter_3_1() throws Exception {
        getLogger().debug("testFilter_3_1");
       
        Parameters parameters = new Parameters();
        parameters.setParameter( "element-name", "leaf" );
        parameters.setParameter( "count", "3" );
        parameters.setParameter( "blocknr", "1" );
       
        String input = "resource://org/apache/cocoon/transformation/filter-input.xml";
        String result = "resource://org/apache/cocoon/transformation/filter-result-3-1.xml";
        String src =  null;
       
View Full Code Here

     * Testcase for count=1, blocknr=3
     */
    public void testFilter_1_3() throws Exception {
        getLogger().debug("testFilter_1_3");
       
        Parameters parameters = new Parameters();
        parameters.setParameter( "element-name", "leaf" );
        parameters.setParameter( "count", "1" );
        parameters.setParameter( "blocknr", "3" );
       
        String input = "resource://org/apache/cocoon/transformation/filter-input.xml";
        String result = "resource://org/apache/cocoon/transformation/filter-result-1-3.xml";
        String src =  null;
       
View Full Code Here

        super( name );
    }

    public void testRemoveParameter()
    {
        final Parameters parameters = new Parameters();
        parameters.setParameter( "key1", "value1" );
        assertEquals("Should only have one parameter", 1, parameters.getNames().length );
        parameters.setParameter( "key1", null );
        assertTrue( "key1 should no longer be a parameter", ! parameters.isParameter( "key1" ) );
        assertEquals( 0, parameters.getNames().length );
    }
View Full Code Here

        assertEquals( 0, parameters.getNames().length );
    }

    public void testIsParameter()
    {
        final Parameters parameters = new Parameters();
        parameters.setParameter( "key1", "value1" );
        assertTrue( "key1 should be a parameter", parameters.isParameter( "key1" ) );
        assertTrue( "key2 should not be a parameter", ! parameters.isParameter( "key2" ) );
    }
View Full Code Here

        assertTrue( "key2 should not be a parameter", ! parameters.isParameter( "key2" ) );
    }

    public void testGetParameter()
    {
        final Parameters parameters = new Parameters();
        parameters.setParameter( "key1", "value1" );

        try
        {
            assertEquals( "key1 should equal value1", "value1", parameters.getParameter( "key1" ) );
        }
        catch ( final ParameterException pe )
        {
            fail( pe.getMessage() );
        }

        try
        {
            parameters.getParameter( "key2" );
            fail( "Not inserted parameter 'key2' exists" );
        }
        catch( final ParameterException pe )
        {
            //OK
        }

        assertEquals( "key1 should use correct value1", "value1", parameters.getParameter( "key1", "value1-1" ) );

        assertEquals( "key2 should use default value2", "value2", parameters.getParameter( "key2", "value2" ) );
    }
View Full Code Here

        {
            final DefaultConfigurationBuilder builder =
                new DefaultConfigurationBuilder();
            final Configuration configuration = builder.build( confInput );

            final Parameters parameters =
                Parameters.fromConfiguration( configuration );

            assertEquals( "key1 should be value1", "value1", parameters.getParameter( "key1" ) );
            assertEquals( "key2 should be value2", "value2", parameters.getParameter( "key2" ) );
            assertEquals( "key3 should be value3", "value3", parameters.getParameter( "key3" ) );
        }
        catch ( final ConfigurationException ce )
        {
            fail( "Converting failed: " + ce.getMessage() );
        }
View Full Code Here

        final Properties properties = new Properties();
        properties.put( "key1", "value1" );
        properties.put( "key2", "value2" );
        properties.put( "key3", "value3" );

        final Parameters parameters = Parameters.fromProperties( properties );

        try
        {
            assertEquals( "key1 should be value1", "value1", parameters.getParameter( "key1" ) );
            assertEquals( "key2 should be value2", "value2", parameters.getParameter( "key2" ) );
            assertEquals( "key3 should be value3", "value3", parameters.getParameter( "key3" ) );
        }
        catch ( final ParameterException pe )
        {
            fail( pe.getMessage() );
        }
View Full Code Here

    public Map getContextInfo()
    throws ProcessingException {
        Map map = (Map)this.authContext.getAttribute( "cachedmap" );
        if (map == null) {
            map = new HashMap(20);
            Parameters pars = this.createParameters(null, null, false).getFirstParameters();
            String[] names = pars.getNames();
            if (names != null) {
                String key;
                String value;
                for(int i=0;i<names.length;i++) {
                    key = names[i];
                    value = pars.getParameter(key, null);
                    if (value != null) map.put(key, value);
                }
            }
            this.authContext.setAttribute("cachedmap", map);
        }
View Full Code Here

                            xslT = (Transformer)selector.select("xslt");
                            transformers.add(xslT);
                            xslT.setup(resolver,
                                       objectModel,
                                       DOMUtil.getValueOfNode(transformations.item(k)),
                                       new Parameters());
                            xslT.setConsumer(nextConsumer);
                            nextConsumer = xslT;
                        }
                        nextConsumer.startDocument();
                    }
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.parameters.Parameters

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.