Examples of MockBeanContextServicesListener


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

        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        support.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
        MockBeanContextServicesListener l = new MockBeanContextServicesListener();
        support.records.clear();

        Object result = support.getService(child, requestor, Collection.class,
                selector, l);
        assertSame(Collections.EMPTY_SET, result);
View Full Code Here

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

        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        childSupport.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
        MockBeanContextServicesListener l = new MockBeanContextServicesListener();
        support.records.clear();
        childSupport.records.clear();

        Object result = childSupport.getService(child, requestor,
                Collection.class, selector, l);
View Full Code Here

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

        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        childSupport.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
        MockBeanContextServicesListener l = new MockBeanContextServicesListener();
        support.records.clear();
        childSupport.records.clear();

        Object result = childSupport.getService(child, requestor,
                Collection.class, selector, l);
View Full Code Here

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

        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        support.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
        MockBeanContextServicesListener l = new MockBeanContextServicesListener();
        support.records.clear();

        Object service = support.getService(child, requestor, Collection.class,
                selector, l);
        assertSame(Collections.EMPTY_SET, service);
View Full Code Here

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

        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        childSupport.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
        MockBeanContextServicesListener l = new MockBeanContextServicesListener();
        support.records.clear();
        childSupport.records.clear();

        Object service = childSupport.getService(child, requestor,
                Collection.class, selector, l);
View Full Code Here

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

        }
    }

    public void testRemoveBeanContextServicesListener() {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServicesListener l = new MockBeanContextServicesListener();
        assertEquals(0, support.bcsListeners().size());

        support.addBeanContextServicesListener(l);
        assertEquals(1, support.bcsListeners().size());
        assertSame(l, support.bcsListeners().get(0));
View Full Code Here

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

        }
    }

    public void testRevokeService_NonServiceClass() {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServicesListener l1 = new MockBeanContextServicesListener();
        support.addBeanContextServicesListener(l1);
        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);
        support.records.clear();
        provider.records.clear();
View Full Code Here

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

        provider.records.assertEndOfRecords();
    }

    public void testRevokeService_NonWrongProvider() {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServicesListener l1 = new MockBeanContextServicesListener();
        support.addBeanContextServicesListener(l1);
        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);
        support.records.clear();
        provider.records.clear();
View Full Code Here

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