Package java.beans.beancontext

Examples of java.beans.beancontext.BeanContextChildSupport


    BeanContextChild[] children = new BeanContextChild[5];

    /* Create and add five children */
    for (int a = 0; a < 5; ++a)
      {
  children[a] = new BeanContextChildSupport();
  context.add(children[a]);
  h.check(context.contains(children[a]), "Child " + a + " present.");
      }
    /* Check size */
    h.check(context.size() == 5, "Size of 5 check");
View Full Code Here


    harness.check(bcs2.getBeanContextPeer(), bcs1);
   
    // we can determine that this method actually returns the
    // beanContextChildPeer field as follows...
    boolean pass = true;
    bcs2.beanContextChildPeer = new BeanContextChildSupport();
    try
    {
      bcs2.getBeanContextPeer();
    }
    catch (ClassCastException e)
View Full Code Here

        BeanContextChildSupport support = new MockBeanContextChildSupport();
        support.removePropertyChangeListener("property name", null);
    }

    public void testRemovePropertyChangeListener() {
        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(propName, 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());
        assertEquals(propName, l2.lastEvent.getPropertyName());
        assertSame(oldValue, l2.lastEvent.getOldValue());
        assertSame(newValue, l2.lastEvent.getNewValue());
        assertSame(support, l2.lastEvent.getSource());

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

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

        // remove not-registered listener
        support.removePropertyChangeListener(propName, l1);
    }
View Full Code Here

        // remove not-registered listener
        support.removePropertyChangeListener(propName, l1);
    }

    public void testRemoveVetoableChangeListener_NullParam() {
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        support.removeVetoableChangeListener("property name", null);
    }
View Full Code Here

        BeanContextChildSupport support = new MockBeanContextChildSupport();
        support.removeVetoableChangeListener("property name", null);
    }

    public void testRemoveVetoableChangeListener() 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);

        support.addVetoableChangeListener(propName, l1);
        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());

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

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

        // remove not-registered listener
        support.removeVetoableChangeListener(propName, l1);
    }
View Full Code Here

        support.removeVetoableChangeListener(propName, l1);
    }

    public void testServiceAvailable() {
        // guess the impl is empty
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        support.serviceAvailable(null);

        // Regression for HARMONY-372
        (new java.beans.beancontext.BeanContextChildSupport())
                .serviceAvailable(null);
        (new java.beans.beancontext.BeanContextChildSupport())
View Full Code Here

                .serviceRevoked(null);
    }

    public void testServiceRevoked() {
        // guess the impl is empty
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        support.serviceRevoked(null);
    }
View Full Code Here

        assertTrue(support.rejectedSetBCOnce());
    }

    public void testValidatePendingSetBeanContext() {
        // guess the impl always returns true
        BeanContextChildSupport support = new MockBeanContextChildSupport();
        assertTrue(support.validatePendingSetBeanContext(new MockBeanContext()));
        assertTrue(support.validatePendingSetBeanContext(null));
    }
View Full Code Here

        assertTrue(support.validatePendingSetBeanContext(null));
    }

    public void testSerialization_NoPeer() throws IOException,
            ClassNotFoundException {
        BeanContextChildSupport support = new BeanContextChildSupport();
        MockPropertyChangeListener pcl1 = new MockPropertyChangeListener();
        MockPropertyChangeListenerS pcl2 = new MockPropertyChangeListenerS(
                "id of pcl2");
        MockVetoableChangeListener vcl1 = new MockVetoableChangeListener();
        MockVetoableChangeListenerS vcl2 = new MockVetoableChangeListenerS(
                "id of vcl2");
        support.addPropertyChangeListener("beanContext", pcl1);
        support.addPropertyChangeListener("beanContext", pcl2);
        support.addVetoableChangeListener("beanContext", vcl1);
        support.addVetoableChangeListener("beanContext", vcl2);

        assertEqualsSerially(support,
                (BeanContextChildSupport) SerializationTester
                        .getDeserilizedObject(support));
    }
View Full Code Here

    }

    public void testSerialization_WithNonSerializablePeer() throws IOException,
            ClassNotFoundException {
        MockBeanContextChild peer = new MockBeanContextChild();
        BeanContextChildSupport support = new BeanContextChildSupport(peer);
        MockPropertyChangeListener pcl1 = new MockPropertyChangeListener();
        MockPropertyChangeListenerS pcl2 = new MockPropertyChangeListenerS(
                "id of pcl2");
        MockVetoableChangeListener vcl1 = new MockVetoableChangeListener();
        MockVetoableChangeListenerS vcl2 = new MockVetoableChangeListenerS(
                "id of vcl2");
        support.addPropertyChangeListener("beanContext", pcl1);
        support.addPropertyChangeListener("beanContext", pcl2);
        support.addVetoableChangeListener("beanContext", vcl1);
        support.addVetoableChangeListener("beanContext", vcl2);

        try {
            SerializationTester.getDeserilizedObject(support);
            fail();
        } catch (IOException e) {
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.