Examples of MockBeanContextServicesListener


Examples of org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextServicesListener

    public void testRevokeService_ParentContext()
            throws TooManyListenersException {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServicesSupport childSupport = new MockBeanContextServicesSupport();
        support.add(childSupport);
        MockBeanContextServicesListener l1 = new MockBeanContextServicesListener();
        MockBeanContextServicesListener l2 = new MockBeanContextServicesListener();
        support.addBeanContextServicesListener(l1);
        childSupport.addBeanContextServicesListener(l2);
        support.records.assertRecord("initialize", null);
        childSupport.records.assertRecord("initialize", null);

        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        childSupport.add(child);
        String requestor = "requestor";
        String selector = "selector";
        MockBeanContextServiceRevokedListener rl = new MockBeanContextServiceRevokedListener();
        Object service = childSupport.getService(child, requestor,
                Collection.class, selector, rl);
        assertNotNull(service);

        support.records.clear();
        childSupport.records.clear();
        provider.records.clear();
        l1.clearLastEvent();
        l2.clearLastEvent();

        support.revokeService(Collection.class, provider, false);
        assertEquals(0, support.services().size());

        support.records.assertEndOfRecords();
        childSupport.records.assertEndOfRecords();
        provider.records.assertEndOfRecords();
        assertSame(support, l1.lastRevokedEvent
                .getSourceAsBeanContextServices());
        assertSame(Collection.class, l1.lastRevokedEvent.getServiceClass());
        assertFalse(l1.lastRevokedEvent.isCurrentServiceInvalidNow());
        assertNull(l2.lastRevokedEvent);
        assertSame(childSupport, rl.lastEvent.getSourceAsBeanContextServices());
        assertSame(Collection.class, rl.lastEvent.getServiceClass());
        assertFalse(rl.lastEvent.isCurrentServiceInvalidNow());

        support.records.clear();
        childSupport.records.clear();
        provider.records.clear();
        l1.clearLastEvent();
        l2.clearLastEvent();
        rl.clearLastEvent();

        childSupport.releaseService(child, requestor, service);

        support.records.assertEndOfRecords();
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextServicesListener

    public void testRevokeService_ChildContext()
            throws TooManyListenersException {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServicesSupport childSupport = new MockBeanContextServicesSupport();
        support.add(childSupport);
        MockBeanContextServicesListener l1 = new MockBeanContextServicesListener();
        MockBeanContextServicesListener l2 = new MockBeanContextServicesListener();
        support.addBeanContextServicesListener(l1);
        childSupport.addBeanContextServicesListener(l2);
        support.records.assertRecord("initialize", null);
        childSupport.records.assertRecord("initialize", null);

        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        childSupport.addService(Collection.class, provider);
        MockBeanContextServices child = new MockBeanContextServices();
        childSupport.add(child);
        String requestor = "requestor";
        String selector = "selector";
        MockBeanContextServiceRevokedListener rl = new MockBeanContextServiceRevokedListener();
        Object service = childSupport.getService(child, requestor,
                Collection.class, selector, rl);
        assertNotNull(service);

        support.records.clear();
        childSupport.records.clear();
        provider.records.clear();
        l1.clearLastEvent();
        l2.clearLastEvent();

        childSupport.revokeService(Collection.class, provider, true);
        assertTrue(support.services().size() == 0);

        support.records.assertEndOfRecords();
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextServicesListener

    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
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextServicesListener

 
     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
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.