Package java.beans.beancontext

Examples of java.beans.beancontext.BeanContextChildSupport


        assertNull(l2.lastEvent);
    }

    public void testAddVetoableChangeListener_NullParam()
            throws PropertyVetoException {
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        support.addVetoableChangeListener(null,
                new MockVetoableChangeListener());
        support.addVetoableChangeListener("property name", null);
        support.fireVetoableChange("property name", "old value", "new value");
    }
View Full Code Here


        support.addVetoableChangeListener("property name", null);
        support.fireVetoableChange("property name", "old value", "new value");
    }

    public void testAddVetoableChangeListener() throws PropertyVetoException {
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        MockVetoableChangeListener l1 = new MockVetoableChangeListener();
        MockVetoableChangeListener l2 = new MockVetoableChangeListener();
        String propName = "property name";
        Object oldValue = new Integer(1);
        Object newValue = new Integer(5);

        l1.clearLastEvent();
        l2.clearLastEvent();
        support.fireVetoableChange(propName, oldValue, newValue);
        assertNull(l1.lastEvent);
        assertNull(l2.lastEvent);

        support.addVetoableChangeListener(propName, l1);
        l1.clearLastEvent();
        l2.clearLastEvent();
        support.fireVetoableChange(propName, oldValue, newValue);
        assertEquals(propName, l1.lastEvent.getPropertyName());
        assertSame(oldValue, l1.lastEvent.getOldValue());
        assertSame(newValue, l1.lastEvent.getNewValue());
        assertSame(support, l1.lastEvent.getSource());
        assertNull(l2.lastEvent);

        support.addVetoableChangeListener(propName, l2);
        l1.clearLastEvent();
        l2.clearLastEvent();
        support.fireVetoableChange(propName, oldValue, newValue);
        assertEquals(propName, l1.lastEvent.getPropertyName());
        assertSame(oldValue, l1.lastEvent.getOldValue());
        assertSame(newValue, l1.lastEvent.getNewValue());
        assertSame(support, l1.lastEvent.getSource());
        assertEquals(propName, l2.lastEvent.getPropertyName());
        assertSame(oldValue, l2.lastEvent.getOldValue());
        assertSame(newValue, l2.lastEvent.getNewValue());
        assertSame(support, l2.lastEvent.getSource());

        l1.clearLastEvent();
        l2.clearLastEvent();
        support.fireVetoableChange("xxx", oldValue, newValue);
        assertNull(l1.lastEvent);
        assertNull(l2.lastEvent);
    }
View Full Code Here

    /*
     * Class under test for void BeanContextChildSupport()
     */
    public void testBeanContextChildSupport() {
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        assertSame(support, support.getBeanContextChildPeer());
        assertSame(support, support.beanContextChildPeer);
    }
View Full Code Here

     * Class under test for void
     * BeanContextChildSupport(java.beans.beancontext.BeanContextChild)
     */
    public void testBeanContextChildSupportBeanContextChild() {
        BeanContextChild c = new MockBeanContextChild();
        BeanContextChildSupport support = new MockBeanContextChildSupport(c);
        assertSame(c, support.getBeanContextChildPeer());
        assertSame(c, support.beanContextChildPeer);
    }
View Full Code Here

        assertSame(c, support.getBeanContextChildPeer());
        assertSame(c, support.beanContextChildPeer);
    }

    public void testFirePropertyChange_NullParam() {
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        support.firePropertyChange(null, "a", "b");
    }
View Full Code Here

        BeanContextChildSupport support = new MockBeanContextChildSupport();
        support.firePropertyChange(null, "a", "b");
    }

    public void testFirePropertyChange() {
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        MockPropertyChangeListener l1 = new MockPropertyChangeListener();
        MockPropertyChangeListener l2 = new MockPropertyChangeListener();
        String propName = "property name";
        Object oldValue = new Integer(1);
        Object newValue = new Integer(5);

        support.addPropertyChangeListener(propName, l1);
        support.addPropertyChangeListener("xxx", l2);
        l1.clearLastEvent();
        l2.clearLastEvent();
        support.firePropertyChange(propName, oldValue, newValue);
        assertEquals(propName, l1.lastEvent.getPropertyName());
        assertSame(oldValue, l1.lastEvent.getOldValue());
        assertSame(newValue, l1.lastEvent.getNewValue());
        assertSame(support, l1.lastEvent.getSource());
        assertNull(l2.lastEvent);
View Full Code Here

        assertSame(support, l1.lastEvent.getSource());
        assertNull(l2.lastEvent);
    }

    public void testFirePropertyChange_OldEqualsNew() {
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        MockPropertyChangeListener l1 = new MockPropertyChangeListener();
        MockPropertyChangeListener l2 = new MockPropertyChangeListener();
        String propName = "property name";
        Object oldValue = new Integer(1);
        Object newValue = new Integer(1);

        support.addPropertyChangeListener(propName, l1);
        support.addPropertyChangeListener("xxx", l2);
        l1.clearLastEvent();
        l2.clearLastEvent();
        support.firePropertyChange(propName, oldValue, newValue);
        assertNull(l1.lastEvent);
        assertNull(l2.lastEvent);
    }
View Full Code Here

        assertNull(l1.lastEvent);
        assertNull(l2.lastEvent);
    }

    public void testFirePropertyChange_OldEqualsNew_IsNull() {
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        MockPropertyChangeListener l1 = new MockPropertyChangeListener();
        MockPropertyChangeListener l2 = new MockPropertyChangeListener();
        String propName = "property name";
        Object oldValue = null;
        Object newValue = null;

        support.addPropertyChangeListener(propName, l1);
        support.addPropertyChangeListener("xxx", l2);
        l1.clearLastEvent();
        l2.clearLastEvent();
        support.firePropertyChange(propName, oldValue, newValue);
        assertEquals(propName, l1.lastEvent.getPropertyName());
        assertNull(l1.lastEvent.getOldValue());
        assertNull(l1.lastEvent.getNewValue());
        assertSame(support, l1.lastEvent.getSource());
        assertNull(l2.lastEvent);
View Full Code Here

            public void childrenRemoved(BeanContextMembershipEvent bcme) {}
        };

        // add listener
        context.addBeanContextMembershipListener(listener);
        context.add(new BeanContextChildSupport());
        assertEquals(1, k[0]);
       
        // add the same listener onse again
        context.addBeanContextMembershipListener(listener);
        context.add(new BeanContextChildSupport());
        assertEquals(2, k[0]);
    }
View Full Code Here

        // Regression for HARMONY-1393
        class TestBeanException extends BeanContextChildSupport implements
                BeanContextProxy {
            private static final long serialVersionUID = -8544245159647566063L;
            private final BeanContextChildSupport childSupport = new BeanContextChildSupport();

            public BeanContextChild getBeanContextProxy() {
                return childSupport;
            }
        }
View Full Code Here

TOP

Related Classes of java.beans.beancontext.BeanContextChildSupport

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.