Package org.apache.commons.configuration2.convert

Examples of org.apache.commons.configuration2.convert.DefaultListDelimiterHandler


     */
    @Test
    public void testConvertToHierarchicalDelimiters()
    {
        BaseConfiguration conf = new BaseConfiguration();
        conf.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        conf.addProperty("test.key", "1\\,2\\,3");
        assertEquals("Wrong property value", "1,2,3", conf
                .getString("test.key"));
        HierarchicalConfiguration<?> hc = ConfigurationUtils
                .convertToHierarchical(conf);
View Full Code Here


     */
    @Test
    public void testConvertToHierarchicalMultiValues()
    {
        BaseConfiguration config = new BaseConfiguration();
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        config.addProperty("test", "1,2,3");
        HierarchicalConfiguration<?> hc = ConfigurationUtils
                .convertToHierarchical(config);
        assertEquals("Wrong value 1", 1, hc.getInt("test(0)"));
        assertEquals("Wrong value 2", 2, hc.getInt("test(1)"));
View Full Code Here

    }

    @Test
    public void testSetProperty()
    {
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        config.setProperty("tables.table(0).name", "resources");
        assertEquals("resources", config.getString("tables.table(0).name"));
        config.setProperty("tables.table.name", "tab1,tab2");
        assertEquals("tab1", config.getString("tables.table(0).name"));
        assertEquals("tab2", config.getString("tables.table(1).name"));
View Full Code Here

     * Tests obtaining a configuration with all variables substituted.
     */
    @Test
    public void testInterpolatedConfiguration()
    {
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        AbstractHierarchicalConfiguration<?> c = (AbstractHierarchicalConfiguration<?>) InterpolationTestHelper
                .testInterpolatedConfiguration(config);

        // tests whether the hierarchical structure has been maintained
        checkGetProperty(c);
View Full Code Here

     * Tests whether list handling works correctly when adding properties.
     */
    @Test
    public void testAddPropertyWithListHandling()
    {
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        final String key = "list.delimiter.value";
        config.addProperty(key + ".escaped", "3\\,1415");
        config.addProperty(key + ".elements", "3,1415");
        assertEquals("Wrong escaped property", "3,1415", config.getString(key + ".escaped"));
        assertEquals("Wrong list property", "3", config.getString(key + ".elements"));
View Full Code Here

     * Tests changing the list delimiter handler.
     */
    @Test
    public void testSetListDelimiter()
    {
        cc.setListDelimiterHandler(new DefaultListDelimiterHandler('/'));
        checkSetListDelimiterHandler();
    }
View Full Code Here

     * operation.
     */
    @Test
    public void testSetListDelimiterAfterClear()
    {
        cc.setListDelimiterHandler(new DefaultListDelimiterHandler('/'));
        cc.clear();
        checkSetListDelimiterHandler();
    }
View Full Code Here

        assertEquals("Wrong value of property", "a,b,c", cc
                .getString("test.property"));

        AbstractConfiguration config =
                (AbstractConfiguration) cc.getInMemoryConfiguration();
        DefaultListDelimiterHandler listHandler =
                (DefaultListDelimiterHandler) config.getListDelimiterHandler();
        assertEquals("Wrong list delimiter", '/', listHandler.getDelimiter());
    }
View Full Code Here

    public void testSetListDelimiterInMemoryConfigNonBaseConfig()
    {
        Configuration inMemoryConfig = EasyMock.createMock(Configuration.class);
        EasyMock.replay(inMemoryConfig);
        cc = new CompositeConfiguration(inMemoryConfig);
        cc.setListDelimiterHandler(new DefaultListDelimiterHandler(';'));
    }
View Full Code Here

    @Before
    public void setUp() throws Exception
    {
        config = new BaseConfiguration();
        config.setThrowExceptionOnMissing(true);
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.convert.DefaultListDelimiterHandler

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.