Examples of XPathExpressionEngine


Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

    /**
     * Tests changing the expression engine.
     */
    public void testSetExpressionEngine()
    {
        parent.setExpressionEngine(new XPathExpressionEngine());
        setUpSubnodeConfig();
        assertEquals("Wrong field name", TABLE_FIELDS[0][1], config
                .getString("fields/field[2]/name"));
        Set keys = new HashSet();
        CollectionUtils.addAll(keys, config.getKeys());
View Full Code Here

Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

     * changed for the parent.
     */
    public void testParentChangeDetatchException()
    {
        config = parent.configurationAt("tables.table(1)", true);
        parent.setExpressionEngine(new XPathExpressionEngine());
        assertEquals("Wrong name of table", TABLE_NAMES[1], config
                .getString("name"));
        assertNull("Sub config was not detached", config.getSubnodeKey());
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

        assertEquals("a\\,b\\,c", conf2.getString("split.list4[@values]"));
        assertEquals("a,b,c", conf2.getString("split.list1"));
        assertEquals(0, conf2.getMaxIndex("split.list1"));
        assertEquals("a\\,b\\,c", conf2.getString("split.list2"));
        conf2 = new XMLConfiguration();
        conf2.setExpressionEngine(new XPathExpressionEngine());
        conf2.setDelimiterParsingDisabled(true);
        conf2.setFile(new File(testProperties));
        conf2.load();

        assertEquals("a,b,c", conf2.getString("split/list3/@values"));
View Full Code Here

Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

     * is disabled
     */
    @Test
    public void testSaveWithDelimiterParsingDisabled() throws ConfigurationException {
        XMLConfiguration conf = new XMLConfiguration();
        conf.setExpressionEngine(new XPathExpressionEngine());
        conf.setDelimiterParsingDisabled(true);
        conf.setAttributeSplittingDisabled(true);
        conf.setFile(new File(testProperties));
        conf.load();

        assertEquals("a,b,c", conf.getString("split/list3/@values"));
        assertEquals(0, conf.getMaxIndex("split/list3/@values"));
        assertEquals("a\\,b\\,c", conf.getString("split/list4/@values"));
        assertEquals("a,b,c", conf.getString("split/list1"));
        assertEquals(0, conf.getMaxIndex("split/list1"));
        assertEquals("a\\,b\\,c", conf.getString("split/list2"));
        // save the configuration
        conf.save(testSaveConf.getAbsolutePath());

        // read the configuration and compare the properties
        XMLConfiguration checkConfig = new XMLConfiguration();
        checkConfig.setFileName(testSaveConf.getAbsolutePath());
        checkSavedConfig(checkConfig);
        XMLConfiguration config = new XMLConfiguration();
        config.setFileName(testFile2);
        //config.setExpressionEngine(new XPathExpressionEngine());
        config.setDelimiterParsingDisabled(true);
        config.setAttributeSplittingDisabled(true);
        config.load();
        config.setProperty("Employee[@attr1]", "3,2,1");
        assertEquals("3,2,1", config.getString("Employee[@attr1]"));
        config.save(testSaveFile.getAbsolutePath());
        config = new XMLConfiguration();
        config.setFileName(testSaveFile.getAbsolutePath());
        //config.setExpressionEngine(new XPathExpressionEngine());
        config.setDelimiterParsingDisabled(true);
        config.setAttributeSplittingDisabled(true);
        config.load();
        config.setProperty("Employee[@attr1]", "1,2,3");
        assertEquals("1,2,3", config.getString("Employee[@attr1]"));
        config.setProperty("Employee[@attr2]", "one, two, three");
        assertEquals("one, two, three", config.getString("Employee[@attr2]"));
        config.setProperty("Employee.text", "a,b,d");
        assertEquals("a,b,d", config.getString("Employee.text"));
        config.setProperty("Employee.Salary", "100,000");
        assertEquals("100,000", config.getString("Employee.Salary"));
        config.save(testSaveFile.getAbsolutePath());
        checkConfig = new XMLConfiguration();
        checkConfig.setFileName(testSaveFile.getAbsolutePath());
        checkConfig.setExpressionEngine(new XPathExpressionEngine());
        checkConfig.setDelimiterParsingDisabled(true);
        checkConfig.setAttributeSplittingDisabled(true);
        checkConfig.load();
        assertEquals("1,2,3", checkConfig.getString("Employee/@attr1"));
        assertEquals("one, two, three", checkConfig.getString("Employee/@attr2"));
View Full Code Here

Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

     * Tests accessing properties when the XPATH expression engine is set.
     */
    @Test
    public void testXPathExpressionEngine()
    {
        conf.setExpressionEngine(new XPathExpressionEngine());
        assertEquals("Wrong attribute value", "foo\"bar", conf
                .getString("test[1]/entity/@name"));
        conf.clear();
        assertNull(conf.getString("test[1]/entity/@name"));
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

      pluginConfig = new XMLConfiguration("config/plugin.xml");
    } catch (ConfigurationException e1) {
      LOG.info("Plugin configuration file config/plugin.xml is missing");
      e1.printStackTrace();
    }
    pluginConfig.setExpressionEngine(new XPathExpressionEngine());
    Options options = new Options();
    options.addOption(
        "b",
        "bench",
        true,
View Full Code Here

Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

    /**
     * Tests accessing properties when the XPATH expression engine is set.
     */
    public void testXPathExpressionEngine()
    {
        conf.setExpressionEngine(new XPathExpressionEngine());
        assertEquals("Wrong attribute value", "foo\"bar", conf
                .getString("test[1]/entity/@name"));
        conf.clear();
        assertNull(conf.getString("test[1]/entity/@name"));
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

    /**
     * Tests changing the expression engine.
     */
    public void testSetExpressionEngine()
    {
        parent.setExpressionEngine(new XPathExpressionEngine());
        setUpSubnodeConfig();
        assertEquals("Wrong field name", TABLE_FIELDS[0][1], config
                .getString("fields/field[2]/name"));
        Set keys = new HashSet();
        CollectionUtils.addAll(keys, config.getKeys());
View Full Code Here

Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

    /**
     * Tests accessing properties when the XPATH expression engine is set.
     */
    public void testXPathExpressionEngine()
    {
        conf.setExpressionEngine(new XPathExpressionEngine());
        assertEquals("Wrong attribute value", "foo\"bar", conf
                .getString("test[1]/entity/@name"));
        conf.clear();
        assertNull(conf.getString("test[1]/entity/@name"));
    }
View Full Code Here

Examples of org.apache.commons.configuration.tree.xpath.XPathExpressionEngine

        xml.setReloadingStrategy(new FileRandomReloadingStrategy());
        config.addConfiguration(xml);
        final XMLConfiguration xml2 = new XMLConfiguration("configB.xml");
        xml2.setReloadingStrategy(new FileRandomReloadingStrategy());
        config.addConfiguration(xml2);
        config.setExpressionEngine(new XPathExpressionEngine());

        assertEquals(config.getString("/property[@name='config']/@value"), "100");

        Thread testThreads[] = new Thread[threadCount];
        int failures[] = new int[threadCount];
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.