Package org.apache.commons.configuration2.event

Examples of org.apache.commons.configuration2.event.ConfigurationEvent


     * Tests if a property delete event is correctly processed.
     */
    @Test
    public void testEventDelete()
    {
        ConfigurationEvent event = new ConfigurationEvent(this,
                ConfigurationEvent.ADD_PROPERTY, TEST_KEY, TEST_VALUE,
                false);
        layout.onEvent(event);
        event = new ConfigurationEvent(this,
                ConfigurationEvent.CLEAR_PROPERTY, TEST_KEY, null,
                false);
        layout.onEvent(event);
        assertFalse("Property still existing", layout.getKeys().contains(
                TEST_KEY));
View Full Code Here


     */
    @Test
    public void testEventClearConfig() throws Exception
    {
        fillLayout();
        ConfigurationEvent event = new ConfigurationEvent(this,
                ConfigurationEvent.CLEAR, null, null, false);
        layout.onEvent(event);
        assertTrue("Keys not empty", layout.getKeys().isEmpty());
        assertNull("Header comment was not reset", layout.getHeaderComment());
    }
View Full Code Here

     * Tests if a before update event is correctly ignored.
     */
    @Test
    public void testEventAddBefore()
    {
        ConfigurationEvent event = new ConfigurationEvent(this,
                ConfigurationEvent.ADD_PROPERTY, TEST_KEY, TEST_VALUE,
                true);
        layout.onEvent(event);
        assertFalse("Property already stored", layout.getKeys().contains(
                TEST_KEY));
View Full Code Here

     *
     * @param before flag whether the event is before the update
     */
    private void fireChangeEvent(boolean before)
    {
        listener.onEvent(new ConfigurationEvent(this,
                ConfigurationEvent.ADD_PROPERTY, "someProperty",
                "someValue", before));
    }
View Full Code Here

        conf = new PotentialErrorJNDIConfiguration(ctx);

        nonStringTestHolder = new NonStringTestHolder();
        nonStringTestHolder.setConfiguration(conf);

        listener = new ErrorListenerTestImpl(conf);
        conf.addEventListener(ConfigurationErrorEvent.ANY, listener);
    }
View Full Code Here

     */
    @Test
    public void testCloneModify()
    {
        MapConfiguration config = (MapConfiguration) getConfiguration();
        config.addEventListener(ConfigurationEvent.ANY, new EventListenerTestImpl(config));
        MapConfiguration copy = (MapConfiguration) config.clone();
        assertTrue("Event listeners were copied", copy
                .getEventListeners(ConfigurationEvent.ANY).isEmpty());

        config.addProperty("cloneTest", Boolean.TRUE);
View Full Code Here

        {
            transformer.transform(source, result);
        }
        catch (TransformerException tex)
        {
            throw new ConfigurationException(tex);
        }
    }
View Full Code Here

        {
            return factory.newTransformer();
        }
        catch (TransformerConfigurationException tex)
        {
            throw new ConfigurationException(tex);
        }
    }
View Full Code Here

        {
            return factory.newDocumentBuilder();
        }
        catch (ParserConfigurationException pcex)
        {
            throw new ConfigurationException(pcex);
        }
    }
View Full Code Here

            }
        }

        if (url == null)
        {
            throw new ConfigurationException("Cannot resolve include file "
                    + fileName);
        }

        FileHandler fh = new FileHandler(this);
        fh.load(url);
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.event.ConfigurationEvent

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.