Examples of ConfigurationEvent


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

     * Tests if a clear event is correctly processed.
     */
    public void testEventClearConfig() throws ConfigurationException
    {
        fillLayout();
        ConfigurationEvent event = new ConfigurationEvent(this,
                AbstractConfiguration.EVENT_CLEAR, null, null, false);
        layout.configurationChanged(event);
        assertTrue("Keys not empty", layout.getKeys().isEmpty());
        assertNull("Header comment was not reset", layout.getHeaderComment());
    }
View Full Code Here

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

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

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

     * Tests if a reload update is correctly processed.
     */
    public void testEventReload()
    {
        fillLayout();
        ConfigurationEvent event = new ConfigurationEvent(this,
                AbstractFileConfiguration.EVENT_RELOAD, null, null, true);
        layout.configurationChanged(event);
        assertTrue("Keys not empty", layout.getKeys().isEmpty());
        assertNull("Header comment was not reset", layout.getHeaderComment());
    }
View Full Code Here

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

     * ignored.
     */
    public void testEventReloadAfter()
    {
        fillLayout();
        ConfigurationEvent event = new ConfigurationEvent(this,
                AbstractFileConfiguration.EVENT_RELOAD, null, null, false);
        layout.configurationChanged(event);
        assertFalse("Keys are empty", layout.getKeys().isEmpty());
        assertNotNull("Header comment was reset", layout.getHeaderComment());
    }
View Full Code Here

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

            Configuration src, int eventType)
    {
        Map events = new HashMap();
        for (Iterator it = l.events.iterator(); it.hasNext();)
        {
            ConfigurationEvent e = (ConfigurationEvent) it.next();
            assertEquals("Wrong event type", eventType, e.getType());
            assertTrue("Unknown property: " + e.getPropertyName(), src
                    .containsKey(e.getPropertyName()));
            assertEquals("Wrong property value for " + e.getPropertyName(), e
                    .getPropertyValue(), src.getProperty(e.getPropertyName()));
            if (!e.isBeforeUpdate())
            {
                assertTrue("After event without before event", events
                        .containsKey(e.getPropertyName()));
            }
            else
            {
                events.put(e.getPropertyName(), e);
            }
        }

        for (Iterator it = src.getKeys(); it.hasNext();)
        {
View Full Code Here

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

         * @param before the expected before flag
         */
        public void checkEvent(int type, String propName, Object propValue,
                boolean before)
        {
            ConfigurationEvent e = nextEvent(type);
            assertEquals("Wrong property name", propName, e.getPropertyName());
            assertEquals("Wrong property value", propValue, e
                    .getPropertyValue());
            assertEquals("Wrong before flag", before, e.isBeforeUpdate());
        }
View Full Code Here

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

         * @return the event object
         */
        public ConfigurationEvent nextEvent(int expectedType)
        {
            assertFalse("Too few events received", events.isEmpty());
            ConfigurationEvent e = (ConfigurationEvent) events.removeFirst();
            assertEquals("Wrong event source", config, e.getSource());
            assertEquals("Wrong event type", expectedType, e.getType());
            return e;
        }
View Full Code Here

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

         */
        public void skipToLast(int type)
        {
            while (events.size() > 1)
            {
                ConfigurationEvent e = (ConfigurationEvent) events
                        .removeFirst();
                assertTrue("Found end event in details", type != e.getType());
            }
        }
View Full Code Here

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

     * Tests whether an invalidate event is fired only after a change. This test
     * is related to CONFIGURATION-315.
     */
    public void testInvalidateAfterChange()
    {
        ConfigurationEvent event = new ConfigurationEvent(config, 0, null,
                null, true);
        config.configurationChanged(event);
        assertEquals("Invalidate event fired", 0, listener.invalidateEvents);
        event = new ConfigurationEvent(config, 0, null, null, false);
        config.configurationChanged(event);
        assertEquals("No invalidate event fired", 1, listener.invalidateEvents);
    }
View Full Code Here

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

     * test is related to CONFIGURATION-315.
     */
    @Test
    public void testInvalidateEventBeforeAndAfterChange()
    {
        ConfigurationEvent event =
                new ConfigurationEvent(config, ConfigurationEvent.ANY, null, null, true);
        config.onEvent(event);
        assertEquals("No invalidate event fired", 1, listener.invalidateEvents);
        event = new ConfigurationEvent(config, ConfigurationEvent.ANY, null, null, false);
        config.onEvent(event);
        assertEquals("Another invalidate event fired", 1,
                listener.invalidateEvents);
    }
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.