Examples of SampleServiceInterface


Examples of org.apache.sling.models.it.models.implextend.SampleServiceInterface

    /**
     * Try to adapt to interface, with an different implementation class that has the @Model annotation
     */
    @Test
    public void testImplementsInterfaceModel() {
        SampleServiceInterface model = adapterManager.getAdapter(resource, SampleServiceInterface.class);
        assertNotNull(model);
        assertEquals(ImplementsInterfacePropertyModel.class, model.getClass());
        assertEquals(firstValue + "|" + secondValue + "|" + thirdValue, model.getAllProperties());
    }
View Full Code Here

Examples of org.apache.sling.models.it.models.implextend.SampleServiceInterface

        childNode.setProperty("third", thirdValue);
        session.save();
       
        Resource childResource = resolver.getResource(childNode.getPath());
       
        SampleServiceInterface model = adapterManager.getAdapter(childResource, SampleServiceInterface.class);
        assertNotNull(model);
        assertEquals(ImplementsInterfacePropertyModel2.class, model.getClass());
        assertEquals(firstValue + "|" + secondValue + "|" + thirdValue, model.getAllProperties());
       
        childNode.remove();
        session.save();
    }
View Full Code Here

Examples of org.apache.sling.models.testmodels.classes.implextend.SampleServiceInterface

        // simulate bundle remove for ModelPackageBundleListener
        factory.listener.removedBundle(bundle, bundleEvent, registeredAdapterFactories);
       
        // make sure adaption is not longer possible: implementation class mapping is removed
        Resource res = getMockResourceWithProps();
        SampleServiceInterface model = factory.getAdapter(res, SampleServiceInterface.class);
        assertNull(model);
    }
View Full Code Here

Examples of org.apache.sling.models.testmodels.classes.implextend.SampleServiceInterface

     * Try to adapt to interface, with an different implementation class that has the @Model annotation
     */
    @Test
    public void testImplementsInterfaceModel() {
        Resource res = getMockResourceWithProps();
        SampleServiceInterface model = factory.getAdapter(res, SampleServiceInterface.class);
        assertNotNull(model);
        assertEquals(ImplementsInterfacePropertyModel.class, model.getClass());
        assertEquals("first-value|null|third-value", model.getAllProperties());
        assertTrue(factory.canCreateFromAdaptable(res, SampleServiceInterface.class));
    }
View Full Code Here

Examples of org.apache.sling.models.testmodels.classes.implextend.SampleServiceInterface

    @Test
    public void testImplementsNoPicker() {
        factory.unbindImplementationPicker(firstImplementationPicker, firstImplementationPickerProps);

        Resource res = getMockResourceWithProps();
        SampleServiceInterface model = factory.getAdapter(res, SampleServiceInterface.class);
        assertNull(model);
        assertFalse(factory.isModelClass(res, SampleServiceInterface.class));

        model = factory.getAdapter(res, ImplementsInterfacePropertyModel.class);
        assertNotNull(model);
        assertEquals("first-value|null|third-value", model.getAllProperties());
        assertTrue(factory.canCreateFromAdaptable(res, ImplementsInterfacePropertyModel.class));
    }
View Full Code Here

Examples of org.apache.sling.models.testmodels.classes.implextend.SampleServiceInterface

    @Test
    public void testImplementsInterfaceModelWithPickLastImplementationPicker() {
        factory.bindImplementationPicker(new AdapterImplementationsTest.LastImplementationPicker(), new ServicePropertiesMap(3, 1));

        Resource res = getMockResourceWithProps();
        SampleServiceInterface model = factory.getAdapter(res, SampleServiceInterface.class);
        assertNotNull(model);
        assertEquals(ImplementsInterfacePropertyModel2.class, model.getClass());
        assertEquals("first-value|null|third-value", model.getAllProperties());
        assertTrue(factory.canCreateFromAdaptable(res, SampleServiceInterface.class));
    }
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.