Package org.apache.sling.adapter.mock

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


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

    public void testBindBeforeActivate() {
        Bundle bundle = new MockBundle(1L);
        MockServiceReference ref = new MockServiceReference(bundle);
        ref.setProperty(Constants.SERVICE_ID, 1L);
        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
        am.bindAdapterFactory(ref);
View Full Code Here


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

        Bundle bundle = new MockBundle(1L);
        MockServiceReference ref = new MockServiceReference(bundle);
        ref.setProperty(Constants.SERVICE_ID, 1L);
        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
        am.bindAdapterFactory(ref);
View Full Code Here

        am.activate(cc);

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

        Bundle bundle = new MockBundle(1L);
        MockServiceReference ref = new MockServiceReference(bundle);
        ref.setProperty(Constants.SERVICE_ID, 1L);
        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
        am.bindAdapterFactory(ref);
View Full Code Here

        am.activate(cc);

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

        Bundle bundle = new MockBundle(1L);
        MockServiceReference ref = new MockServiceReference(bundle);
        ref.setProperty(Constants.SERVICE_ID, 1L);
        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
        am.bindAdapterFactory(ref);
View Full Code Here

        am.activate(cc);

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

        Bundle bundle = new MockBundle(1L);
        MockServiceReference ref = new MockServiceReference(bundle);
        ref.setProperty(Constants.SERVICE_ID, 1L);
        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
        am.bindAdapterFactory(ref);
View Full Code Here

    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);
        ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
        ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
        am.bindAdapterFactory(ref);
View Full Code Here

TOP

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

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.