Examples of DefaultListDelimiterHandler


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

     * handler implementation.
     */
    @Test
    public void testSaveWithDefaultListDelimiterHandler() throws ConfigurationException
    {
        conf.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        saveTestConfig();

        PropertiesConfiguration checkConfig = new PropertiesConfiguration();
        checkConfig.setListDelimiterHandler(conf.getListDelimiterHandler());
        new FileHandler(checkConfig).load(testSavePropertiesFile);
View Full Code Here

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

    public void testChangingListDelimiter() throws Exception
    {
        assertEquals("Wrong initial string", "a^b^c",
                conf.getString("test.other.delimiter"));
        PropertiesConfiguration pc2 = new PropertiesConfiguration();
        pc2.setListDelimiterHandler(new DefaultListDelimiterHandler('^'));
        load(pc2, testProperties);
        assertEquals("Should obtain the first value", "a",
                pc2.getString("test.other.delimiter"));
        assertEquals("Wrong list size", 3, pc2.getList("test.other.delimiter")
                .size());
View Full Code Here

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

                        XMLConfiguration.class);
        ExpressionEngine engine = new XPathExpressionEngine();
        BuilderParameters xmlParams =
                new XMLBuilderParametersImpl().setExpressionEngine(engine)
                        .setListDelimiterHandler(
                                new DefaultListDelimiterHandler(';'));
        MultiFileBuilderParametersImpl params =
                new MultiFileBuilderParametersImpl().setFilePattern(PATTERN)
                        .setManagedBuilderParameters(xmlParams);
        ConfigurationInterpolator ci = createInterpolator();
        params.setInterpolator(ci).setListDelimiterHandler(
                new DefaultListDelimiterHandler('#'));
        builder.configure(params);
        switchToConfig(1);
        XMLConfiguration config = builder.getConfiguration();
        assertSame("Wrong expression engine", engine,
                config.getExpressionEngine());
        DefaultListDelimiterHandler listHandler =
                (DefaultListDelimiterHandler) config.getListDelimiterHandler();
        assertEquals("Wrong list delimiter", ';', listHandler.getDelimiter());
        assertNotSame("Interpolator was copied", ci, config.getInterpolator());
    }
View Full Code Here

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

     */
    private static XMLConfiguration createFromFile(String fileName)
            throws ConfigurationException
    {
        XMLConfiguration config = new XMLConfiguration();
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        load(config, fileName);
        return config;
    }
View Full Code Here

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

     */
    @Test
    public void testInitCopy() throws ConfigurationException
    {
        XMLConfiguration copy = new XMLConfiguration(conf);
        copy.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        assertEquals("value", copy.getProperty("element"));
        assertNull("Document was copied, too", copy.getDocument());

        new FileHandler(copy).save(testSaveConf);
        checkSavedConfig();
View Full Code Here

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

     */
    @Test
    public void testGetListWithDelimiter() throws ConfigurationException
    {
        DatabaseConfiguration config = setUpConfig();
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(';'));
        List<Object> values = config.getList("keyMulti");
        assertEquals("Wrong number of list elements", 3, values.size());
        assertEquals("Wrong list element 0", "a", values.get(0));
        assertEquals("Wrong list element 2", "c", values.get(2));
    }
View Full Code Here

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

     */
    @Test
    public void testAddWithDelimiter() throws ConfigurationException
    {
        DatabaseConfiguration config = setUpConfig();
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(';'));
        config.addProperty("keyList", "1;2;3");
        String[] values = config.getStringArray("keyList");
        assertEquals("Wrong number of property values", 3, values.length);
        assertEquals("Wrong value at index 1", "2", values[1]);
    }
View Full Code Here

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

     */
    @Test
    public void testSetPropertyWithDelimiter() throws ConfigurationException
    {
        DatabaseConfiguration config = helper.setUpMultiConfig();
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(';'));
        config.setProperty("keyList", "1;2;3");
        String[] values = config.getStringArray("keyList");
        assertEquals("Wrong number of property values", 3, values.length);
        assertEquals("Wrong value at index 1", "2", values[1]);
    }
View Full Code Here

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

    @Test
    public void testInterpolateEscape()
    {
        AbstractConfiguration config = new TestConfigurationImpl(
                new PropertiesConfiguration());
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        config
                .addProperty(
                        "mypath",
                        "$${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar\\,$${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cu.jar");
        assertEquals(
View Full Code Here

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

    @Test
    public void testCopyDelimiterHandling()
    {
        BaseConfiguration srcConfig = new BaseConfiguration();
        BaseConfiguration dstConfig = new BaseConfiguration();
        dstConfig.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        srcConfig.setProperty(KEY_PREFIX, "C:\\Temp\\,D:\\Data");
        dstConfig.copy(srcConfig);
        assertEquals("Wrong property value", srcConfig.getString(KEY_PREFIX),
                dstConfig.getString(KEY_PREFIX));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.