Package java.beans.beancontext

Examples of java.beans.beancontext.BeanContextServicesSupport$Request


            revokeCalled = true;
        }
    }

    public void testSerialization() throws IOException, ClassNotFoundException {
        BeanContextServicesSupport support = new BeanContextServicesSupport(
                null, Locale.ITALY, true, true);
        support
                .addBeanContextServicesListener(new MockBeanContextServicesListener());
        support
                .addBeanContextServicesListener(new MockBeanContextServicesListenerS(
                        "l2"));
        support
                .addBeanContextServicesListener(new MockBeanContextServicesListenerS(
                        "l3"));
        support
                .addBeanContextServicesListener(new MockBeanContextServicesListener());
        support.addService(Collection.class,
                new MockBeanContextServiceProvider());
        support.addService(List.class,
                new MockBeanContextServiceProviderS("p1"));
        support
                .addService(Set.class,
                        new MockBeanContextServiceProviderS("p2"));
        support.addService(Map.class, new MockBeanContextServiceProvider());

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


    }

  }

  public void test_serviceRevoked_LBeanContextServiceRevokedEvent() {
    BeanContextServicesSupport support = new BeanContextServicesSupport();

    support.add(new MySupport());
    support.addBeanContextServicesListener(new MyListener());
    Class c = Object.class;

    support.addService(c, new MyProvider());

    BeanContextServiceRevokedEvent revokeEvent = new BeanContextServiceRevokedEvent(
        support, c, false);

    support.serviceRevoked(revokeEvent);
        assertEquals(0, serviceRevoked);
        assertEquals(2, serviceAvailable);
       
  }
View Full Code Here

        assertEquals(2, serviceAvailable);
       
  }

  public void test_serviceAvailable_LBeanContextServiceRevokedEvent() {
    BeanContextServicesSupport support = new BeanContextServicesSupport();

    support.add(new MySupport());
    support.addBeanContextServicesListener(new MyListener());
    Class c = Object.class;

    support.addService(c, new MyProvider());

    BeanContextServiceAvailableEvent availableEvent = new BeanContextServiceAvailableEvent(
        support, c);
      support.serviceAvailable(availableEvent);
        assertEquals(0, serviceRevoked);
        assertEquals(2, serviceAvailable);
       
  }
View Full Code Here

  }
 
   
 
     public void testSerialization_Compatibility() throws Exception {
         BeanContextServicesSupport support = new BeanContextServicesSupport(
                 null, Locale.ITALY, true, true);
         support
                 .addBeanContextServicesListener(new MockBeanContextServicesListener());
         support
                 .addBeanContextServicesListener(new MockBeanContextServicesListenerS(
                         "l2"));
         support
                 .addBeanContextServicesListener(new MockBeanContextServicesListenerS(
                         "l3"));
         support
                 .addBeanContextServicesListener(new MockBeanContextServicesListener());
         support.addService(Collection.class,
                 new MockBeanContextServiceProvider());
         support.addService(List.class,
                 new MockBeanContextServiceProviderS("p1"));
         support
                 .addService(Set.class,
                         new MockBeanContextServiceProviderS("p2"));
         support.addService(Map.class, new MockBeanContextServiceProvider());
         SerializationTest.verifyGolden(this, support, new SerializableAssert(){
             public void assertDeserialized(Serializable initial, Serializable deserialized) {
                 assertEqualsSerially((BeanContextServicesSupport) initial,
                         (BeanContextServicesSupport) deserialized);
             }
View Full Code Here

        event.setPropagatedFrom(null);
        assertNull(event.getPropagatedFrom());
    }
   
    public void testSerialization() throws Exception {
        final BeanContextServicesSupport ctx = new BeanContextServicesSupport(
                null, Locale.FRANCE, false, false);
        final BeanContextServicesSupport ctx2 = new BeanContextServicesSupport(
                ctx, Locale.ITALY, true, true);
        BeanContextEvent event = new MockBeanContextEvent(ctx2);
        event.setPropagatedFrom(ctx);
        SerializationTest.verifySelf(event, new SerializableAssert(){
            public void assertDeserialized(Serializable arg0, Serializable arg1) {
View Full Code Here

        }
        assertEquals(count, serServices.size());
    }   

    public void testSerializationComptibility() throws Exception {
        final BeanContextServicesSupport ctx = new BeanContextServicesSupport(
                null, Locale.ITALY, true, true);
        final BeanContextServicesSupport ctx2 = new BeanContextServicesSupport(
                null, Locale.CHINA, true, true);
       
        BeanContextEvent event = new MockBeanContextEvent(ctx);
        event.setPropagatedFrom(ctx2);
        SerializationTest.verifyGolden(this, event, new SerializableAssert(){
View Full Code Here

*/
public class BeanContextServicesSupport2Test extends TestCase {

    public void test() {
        BeanContextServiceProvider bcsp = new BCSP();
        BCSS serviceSupport = new BCSS(new BeanContextServicesSupport());
        assertTrue("Expected first addService to return true", serviceSupport
                .addService(Boolean.TYPE, bcsp, false));
        assertFalse("Expected second addService to return false", serviceSupport
                .addService(Boolean.TYPE, bcsp, false));
    }
View Full Code Here

                "designTime"));
    }


    public void testPropertyChangePropertyChangeEvent() {
        BeanContextServicesSupport s = new BeanContextServicesSupport();
        PropertyChangeSupport p= new PropertyChangeSupport(new Object());

        p.addPropertyChangeListener(s);
        p.firePropertyChange(null, new Object(), new Object());
    }
View Full Code Here

import java.util.Iterator;

public class Test4328406 {
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            BeanContextServices container = new BeanContextServicesSupport();
            BeanContextChild ms1 = new MyService1();
            BeanContextServices ms2 = new MyService2();
            BeanContextChild mb = new MyBean();

            container.add(ms1);
            container.add(ms2);
            ms2.add(mb);

            // exception thrown here
            container.remove(ms2);
        }
    }
View Full Code Here

class MyService2 extends BeanContextServicesSupport implements BeanContextServiceProvider {
    protected void initializeBeanContextResources() {
        super.initializeBeanContextResources();

        BeanContextServicesSupport bcs = (BeanContextServicesSupport) getBeanContext();
        try {
            bcs.getService(this, this, MyService1.class, null, this);
        }
        catch (Exception exception) {
            exception.printStackTrace();
        }
        bcs.addService(this.getClass(), this);
    }
View Full Code Here

TOP

Related Classes of java.beans.beancontext.BeanContextServicesSupport$Request

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.