Examples of EventListenerTestImpl


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

     */
    @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

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

    public void testEventSourceSupportBuilder() throws ConfigurationException
    {
        BasicConfigurationBuilder<PropertiesConfiguration> builder =
                new BasicConfigurationBuilder<PropertiesConfiguration>(
                        PropertiesConfiguration.class);
        EventListener<ConfigurationEvent> l1 = new EventListenerTestImpl(null);
        EventListener<ConfigurationEvent> l2 = new EventListenerTestImpl(null);
        BuilderConfigurationWrapperFactory factory =
                new BuilderConfigurationWrapperFactory(
                        EventSourceSupport.BUILDER);
        EventSource src =
                (EventSource) factory.createBuilderConfigurationWrapper(
View Full Code Here

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

    {
        BaseHierarchicalConfiguration conf =
                new BaseHierarchicalConfiguration();
        ConfigurationBuilder<BaseHierarchicalConfiguration> builder =
                createBuilderMock(conf);
        EventListenerTestImpl listener = new EventListenerTestImpl(null);
        builder.addEventListener(ConfigurationEvent.ANY, listener);
        EasyMock.replay(builder);

        BuilderConfigurationWrapperFactory factory =
                new BuilderConfigurationWrapperFactory(EventSourceSupport.BUILDER);
View Full Code Here

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

     * method.
     */
    @Test
    public void testEventListenerConfiguration() throws ConfigurationException
    {
        EventListenerTestImpl listener1 = new EventListenerTestImpl(null);
        EventListenerRegistrationData<ConfigurationErrorEvent> regData =
                new EventListenerRegistrationData<ConfigurationErrorEvent>(
                        ConfigurationErrorEvent.WRITE,
                        new ErrorListenerTestImpl(null));
        BasicConfigurationBuilder<PropertiesConfiguration> builder =
View Full Code Here

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

     */
    @Test
    public void testRemoveConfigurationListenersOnReset()
            throws ConfigurationException
    {
        EventListenerTestImpl listener = new EventListenerTestImpl(null);
        BasicConfigurationBuilder<PropertiesConfiguration> builder =
                new BasicConfigurationBuilder<PropertiesConfiguration>(
                        PropertiesConfiguration.class)
                        .configure(new EventListenerParameters()
                                .addEventListener(ConfigurationEvent.ANY,
                                        listener));
        PropertiesConfiguration config = builder.getConfiguration();
        builder.resetResult();
        config.addProperty("foo", "bar");
        listener.done();
    }
View Full Code Here

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

     * Tests whether an event listener with its type can be added.
     */
    @Test
    public void testAddEventListener()
    {
        EventListenerTestImpl listener = new EventListenerTestImpl(null);
        EventListenerParameters parameters = new EventListenerParameters();
        assertSame("Wrong result", parameters, parameters.addEventListener(
                ConfigurationEvent.ADD_PROPERTY, listener));
        assertEquals("Wrong number of registrations", 1, parameters
                .getListeners().getRegistrations().size());
View Full Code Here

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

    public void testAddEventListenerRegistration()
    {
        EventListenerRegistrationData<ConfigurationEvent> reg =
                new EventListenerRegistrationData<ConfigurationEvent>(
                        ConfigurationEvent.SET_PROPERTY,
                        new EventListenerTestImpl(null));
        EventListenerParameters parameters = new EventListenerParameters();
        assertSame("Wrong result", parameters, parameters.addEventListener(reg));
        assertEquals("Wrong number of registrations", 1, parameters
                .getListeners().getRegistrations().size());
        assertEquals("Wrong registration", reg, parameters.getListeners()
View Full Code Here

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

     * configuration is cloned. They should not be registered at the clone.
     */
    @Test
    public void testCloneWithEventListeners()
    {
        EventListener<ConfigurationEvent> l = new EventListenerTestImpl(null);
        config.addEventListener(ConfigurationEvent.ANY, l);
        AbstractHierarchicalConfiguration<?> copy =
                (AbstractHierarchicalConfiguration<?>) config.clone();
        assertFalse("Event listener registered at clone", copy
                .getEventListeners(ConfigurationEvent.ANY).contains(l));
View Full Code Here

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

     * Ensures that event listeners are not cloned.
     */
    @Test
    public void testCloneEventListener()
    {
        cc.addEventListener(ConfigurationEvent.ANY, new EventListenerTestImpl(null));
        CompositeConfiguration cc2 = (CompositeConfiguration) cc.clone();
        assertTrue("Listeners have been cloned", cc2
                .getEventListeners(ConfigurationEvent.ANY).isEmpty());
    }
View Full Code Here

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

     * Tests whether add property events are triggered.
     */
    @Test
    public void testEventAddProperty()
    {
        EventListenerTestImpl listener = new EventListenerTestImpl(cc);
        cc.addEventListener(ConfigurationEvent.ANY, listener);
        cc.addProperty("test", "value");
        listener.checkEvent(ConfigurationEvent.ADD_PROPERTY, "test", "value", true);
        listener.checkEvent(ConfigurationEvent.ADD_PROPERTY, "test", "value", false);
        listener.done();
    }
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.