Package org.apache.sling.adapter.mock

Examples of org.apache.sling.adapter.mock.MockComponentContext


        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
    }

    public void testInitialized() {
        ComponentContext cc = new MockComponentContext();
        am.activate(cc);

        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
View Full Code Here


        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
        assertNull("AdapterFactory cache must be null", am.getFactoryCache());

        // this should register the factory
        ComponentContext cc = new MockComponentContext();
        am.activate(cc);

        // expect the factory, but cache is empty
        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
        assertEquals("AdapterFactoryDescriptors must contain one entry", 1, am.getFactories().size());
View Full Code Here

        assertEquals("AdapterFactoryDescriptors must contain one entry", 1, am.getFactories().size());
        assertNull("AdapterFactory cache must be null", am.getFactoryCache());
    }

    public void testBindAfterActivate() {
        ComponentContext cc = new MockComponentContext();
        am.activate(cc);

        // no cache and no factories yet
        assertNotNull("AdapterFactoryDescriptors must not be null", am.getFactories());
        assertTrue("AdapterFactoryDescriptors must be empty", am.getFactories().isEmpty());
View Full Code Here

        assertNull(f.get(TestSlingAdaptable2.class.getName()));
    }

    public void testAdaptBase() {

        ComponentContext cc = new MockComponentContext();
        am.activate(cc);

        TestSlingAdaptable data = new TestSlingAdaptable();
        assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
View Full Code Here

        assertTrue(adapter instanceof ITestAdapter);
    }

    public void testAdaptExtended() {

        ComponentContext cc = new MockComponentContext();
        am.activate(cc);

        TestSlingAdaptable2 data = new TestSlingAdaptable2();
        assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
View Full Code Here

        assertTrue(adapter instanceof ITestAdapter);
    }

    public void testAdaptBase2() {

        ComponentContext cc = new MockComponentContext();
        am.activate(cc);

        TestSlingAdaptable data = new TestSlingAdaptable();
        assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
View Full Code Here

        assertTrue(adapter instanceof ITestAdapter);
    }

    public void testAdaptExtended2() {

        ComponentContext cc = new MockComponentContext();
        am.activate(cc);

        Bundle bundle = new MockBundle(1L);
        MockServiceReference ref = new MockServiceReference(bundle);
        ref.setProperty(Constants.SERVICE_ID, 1L);
View Full Code Here

TOP

Related Classes of org.apache.sling.adapter.mock.MockComponentContext

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.