Package org.apache.harmony.beans.tests.support.beancontext.mock

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


        support.addBeanContextServicesListener(l1);
        childSupport.addBeanContextServicesListener(l2);
        support.records.assertRecord("initialize", null);
        childSupport.records.assertRecord("initialize", null);

        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        boolean result = support.addService(Collection.class, provider);
        assertTrue(result);
        assertEquals(1, support.services().size());
        assertEquals(0, childSupport.services().size());
        Object bcssProvider = support.services().get(Collection.class);
        support.records.assertRecord("createBCSSServiceProvider",
                Collection.class, provider, bcssProvider);
        support.records.assertEndOfRecords();
        BeanContextServiceAvailableEvent evt = (BeanContextServiceAvailableEvent) childSupport.records
                .getArg(0);
        childSupport.records.assertRecord("serviceAvailable", evt, null);
        assertSame(support, evt.getSourceAsBeanContextServices());
        assertSame(Collection.class, evt.getServiceClass());
        childSupport.records.assertEndOfRecords();
        assertSame(support, l1.lastAvailableEvent
                .getSourceAsBeanContextServices());
        assertSame(Collection.class, l1.lastAvailableEvent.getServiceClass());
        assertSame(support, l2.lastAvailableEvent
                .getSourceAsBeanContextServices());
        assertSame(Collection.class, l2.lastAvailableEvent.getServiceClass());
        l1.clearLastEvent();
        l2.clearLastEvent();

        // add exist
        MockBeanContextServiceProvider another = new MockBeanContextServiceProvider();
        result = support.addService(Collection.class, another);
        assertFalse(result);
        support.records.assertEndOfRecords();
        childSupport.records.assertEndOfRecords();
        assertNull(l1.lastAvailableEvent);
View Full Code Here


        support.addBeanContextServicesListener(l1);
        childSupport.addBeanContextServicesListener(l2);
        support.records.assertRecord("initialize", null);
        childSupport.records.assertRecord("initialize", null);

        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        boolean result = support.addService(Collection.class, provider, false);
        assertTrue(result);
        assertEquals(1, support.services().size());
        assertEquals(0, childSupport.services().size());
        Object bcssProvider = support.services().get(Collection.class);
View Full Code Here

    public void testChildJustRemovedHook() throws TooManyListenersException {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextChild child = new MockBeanContextChild();
        support.add(child);
        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);

        MockBeanContextServiceRevokedListener rl = new MockBeanContextServiceRevokedListener();
        Object service = support.getService(child, child, Collection.class,
                null, rl);
View Full Code Here

        MockBeanContextServicesSupport childSupport = new MockBeanContextServicesSupport();
        support.add(childSupport);
        Iterator iter = support.getCurrentServiceClasses();
        assertFalse(iter.hasNext());

        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);
        iter = support.getCurrentServiceClasses();
        assertTrue(iter.hasNext());
        assertSame(Collection.class, iter.next());
        iter.remove();
View Full Code Here

                .getCurrentServiceSelectors(BeanContextServicesSupportTest.class));
    }

    public void testGetCurrentServiceSelectors() {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);

        Iterator iter = support.getCurrentServiceSelectors(Collection.class);
        assertTrue(iter.hasNext());
        assertSame(Integer.class, iter.next());
View Full Code Here

        provider.records.assertEndOfRecords();
    }

    public void testGetService_NullParam() throws TooManyListenersException {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        support.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
View Full Code Here

        }
    }

    public void testGetService_NonChild() throws TooManyListenersException {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        support.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
View Full Code Here

        provider.records.assertEndOfRecords();
    }

    public void testGetService_NoService() throws TooManyListenersException {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        support.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
View Full Code Here

        assertNull(result);
    }

    public void testGetService_ThisContext() throws TooManyListenersException {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        support.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
View Full Code Here

    public void testGetService_ParentContext() throws TooManyListenersException {
        MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
        MockBeanContextServicesSupport childSupport = new MockBeanContextServicesSupport();
        support.add(childSupport);
        MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
        support.addService(Collection.class, provider);
        MockBeanContextChild child = new MockBeanContextChild();
        childSupport.add(child);
        Object requestor = "a requestor";
        Object selector = "a selector";
View Full Code Here

TOP

Related Classes of org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextServiceProvider

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.