Package org.apache.commons.configuration.tree

Examples of org.apache.commons.configuration.tree.DefaultExpressionEngine


    public void testConvertToHierarchicalEngine()
    {
        Configuration conf = new BaseConfiguration();
        conf.addProperty("test(a)", Boolean.TRUE);
        conf.addProperty("test(b)", Boolean.FALSE);
        DefaultExpressionEngine engine = new DefaultExpressionEngine();
        engine.setIndexStart("[");
        engine.setIndexEnd("]");
        HierarchicalConfiguration hc = ConfigurationUtils
                .convertToHierarchical(conf, engine);
        assertTrue("Wrong value for test(a)", hc.getBoolean("test(a)"));
        assertFalse("Wrong value for test(b)", hc.getBoolean("test(b)"));
    }
View Full Code Here


     */
    @Test
    public void testConvertHierarchicalToHierarchicalEngine()
    {
        HierarchicalConfiguration hc = new HierarchicalConfiguration();
        ExpressionEngine engine = new DefaultExpressionEngine();
        assertSame("Created new configuration", hc, ConfigurationUtils
                .convertToHierarchical(hc, engine));
        assertSame("Engine was not set", engine, hc.getExpressionEngine());
    }
View Full Code Here

     */
    @Test
    public void testConvertHierarchicalToHierarchicalNullEngine()
    {
        HierarchicalConfiguration hc = new HierarchicalConfiguration();
        ExpressionEngine engine = new DefaultExpressionEngine();
        hc.setExpressionEngine(engine);
        assertSame("Created new configuration", hc, ConfigurationUtils
                .convertToHierarchical(hc, null));
        assertSame("Expression engine was changed", engine, hc
                .getExpressionEngine());
View Full Code Here

    public void testConversionExpressionEngine()
    {
        PropertiesConfiguration child = new PropertiesConfiguration();
        child.addProperty("test(a)", "1,2,3");
        config.addConfiguration(child);
        DefaultExpressionEngine engineQuery = new DefaultExpressionEngine();
        engineQuery.setIndexStart("<");
        engineQuery.setIndexEnd(">");
        config.setExpressionEngine(engineQuery);
        DefaultExpressionEngine engineConvert = new DefaultExpressionEngine();
        engineConvert.setIndexStart("[");
        engineConvert.setIndexEnd("]");
        config.setConversionExpressionEngine(engineConvert);
        assertEquals("Wrong property 1", "1", config.getString("test(a)<0>"));
        assertEquals("Wrong property 2", "2", config.getString("test(a)<1>"));
        assertEquals("Wrong property 3", "3", config.getString("test(a)<2>"));
    }
View Full Code Here

    public void testConversionExpressionEngine()
    {
        PropertiesConfiguration child = new PropertiesConfiguration();
        child.addProperty("test(a)", "1,2,3");
        config.addConfiguration(child);
        DefaultExpressionEngine engineQuery = new DefaultExpressionEngine();
        engineQuery.setIndexStart("<");
        engineQuery.setIndexEnd(">");
        config.setExpressionEngine(engineQuery);
        DefaultExpressionEngine engineConvert = new DefaultExpressionEngine();
        engineConvert.setIndexStart("[");
        engineConvert.setIndexEnd("]");
        config.setConversionExpressionEngine(engineConvert);
        assertEquals("Wrong property 1", "1", config.getString("test(a)<0>"));
        assertEquals("Wrong property 2", "2", config.getString("test(a)<1>"));
        assertEquals("Wrong property 3", "3", config.getString("test(a)<2>"));
    }
View Full Code Here

        }
    }

    private ExpressionEngine createAlternativeExpressionEngine()
    {
        DefaultExpressionEngine engine = new DefaultExpressionEngine();
        engine.setPropertyDelimiter("/");
        engine.setIndexStart("[");
        engine.setIndexEnd("]");
        return engine;
    }
View Full Code Here

    public void testConvertToHierarchicalEngine()
    {
        Configuration conf = new BaseConfiguration();
        conf.addProperty("test(a)", Boolean.TRUE);
        conf.addProperty("test(b)", Boolean.FALSE);
        DefaultExpressionEngine engine = new DefaultExpressionEngine();
        engine.setIndexStart("[");
        engine.setIndexEnd("]");
        HierarchicalConfiguration hc = ConfigurationUtils
                .convertToHierarchical(conf, engine);
        assertTrue("Wrong value for test(a)", hc.getBoolean("test(a)"));
        assertFalse("Wrong value for test(b)", hc.getBoolean("test(b)"));
    }
View Full Code Here

     * expression engine. The new engine should be set.
     */
    public void testConvertHierarchicalToHierarchicalEngine()
    {
        HierarchicalConfiguration hc = new HierarchicalConfiguration();
        ExpressionEngine engine = new DefaultExpressionEngine();
        assertSame("Created new configuration", hc, ConfigurationUtils
                .convertToHierarchical(hc, engine));
        assertSame("Engine was not set", engine, hc.getExpressionEngine());
    }
View Full Code Here

     * configuration should not be touched.
     */
    public void testConvertHierarchicalToHierarchicalNullEngine()
    {
        HierarchicalConfiguration hc = new HierarchicalConfiguration();
        ExpressionEngine engine = new DefaultExpressionEngine();
        hc.setExpressionEngine(engine);
        assertSame("Created new configuration", hc, ConfigurationUtils
                .convertToHierarchical(hc, null));
        assertSame("Expression engine was changed", engine, hc
                .getExpressionEngine());
View Full Code Here

                .contains("tables/table/fields/field/name"));
    }

    private ExpressionEngine createAlternativeExpressionEngine()
    {
        DefaultExpressionEngine engine = new DefaultExpressionEngine();
        engine.setPropertyDelimiter("/");
        engine.setIndexStart("[");
        engine.setIndexEnd("]");
        return engine;
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.tree.DefaultExpressionEngine

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.