Package org.apache.felix.ipojo.test.scenarios.manipulation.service

Examples of org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService


    ref = helper.getServiceReferenceByName(FooService.class.getName(),  compName);
   
    assertNotNull("FS not available", ref);
   
    // Get foo object
    FooService fs = (FooService) getServiceObject(ref);
   
    // Cast to POJO
    Pojo pojo = (Pojo) fs;
   
    // GetComponentInstance
View Full Code Here


     */
    public void testLazyCreation() {
        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available",ref);
        FooService fs = (FooService) getServiceObject(ref);
        assertTrue("Check the FooService invocation", fs.foo());
        assertEquals("Check the creation of 1 object",1((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
    }
View Full Code Here

     */
    public void testLazyCreationSingleton() {
        assertEquals("Check that no objects are created ", 0((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length);
        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sing.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_lazzy_sing.getInstanceName() + " is available",ref);
        FooService fs = (FooService) getServiceObject(ref);
        assertTrue("Check the FooService invocation", fs.foo());
        assertEquals("Check the creation of 1 object",1((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length);
    }
View Full Code Here

     */
    public void testLazyCreationSeveral() {
        assertEquals("Check that no objects are created ", 0((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length);
        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sev.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_lazzy_sev.getInstanceName() + " is available", ref);
        FooService fs = (FooService) getServiceObject(ref);
        FooService fs2 = (FooService) getServiceObject(ref);
        assertTrue("Check the FooService invocation", fs.foo());
        assertTrue("Check the FooService invocation-2", fs2.foo());
        assertEquals("Check the creation of 1 object",1, ((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length);
    }
View Full Code Here

     */
    public void testImmediateCreation() {
        assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);
        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_immediate.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_immediate.getInstanceName() + " is available", ref);
        FooService fs = (FooService) getServiceObject(ref);
        assertTrue("Check the FooService invocation", fs.foo());
        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);
    }
View Full Code Here

     * Check bundle context injection.
     */
    public void testBundleContext() {
        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available",ref);
        FooService fs = (FooService) getServiceObject(ref);
        Properties p = fs.fooProps();
        assertNotNull("Check the bundle context", p.get("context"));
        assertEquals("Check the creation of 1 object",1, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
    }
View Full Code Here

     */
    public void testImmediateSingletonCreation() {
        assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);
        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_immediate_singleton.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_immediate_singleton.getInstanceName() + " is available",ref);
        FooService fs = (FooService) getServiceObject(ref);
        assertTrue("Check the FooService invocation", fs.foo());
        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);
    }
View Full Code Here

     */
    public void testLazyCreationSingletonM() {
        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSingM.getInstanceDescription()).getCreatedObjects().length);
        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_singM.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_lazzy_singM.getInstanceName() + " is available",ref);
        FooService fs = (FooService) getServiceObject(ref);
        FooService fs2 = (FooService) getServiceObject(ref);
        assertTrue("Check the FooService invocation", fs.foo());
        assertTrue("Check the FooService invocation", fs2.foo());
        assertEquals("Check the creation of 1 object",1, ((PrimitiveInstanceDescription) lazzyArchSingM.getInstanceDescription()).getCreatedObjects().length);
    }
View Full Code Here

     */
    public void testLazyCreationSeveralM() {
        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);
        ServiceReference ref= helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sevM.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_lazzy_sevM.getInstanceName() + " is available",ref);
        FooService fs = (FooService) getServiceObject(ref);
        assertTrue("Check the FooService invocation", fs.foo());
        assertEquals("Check the creation of 1 object",1, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);
        FooService fs2 = (FooService) getServiceObject(ref);
        assertTrue("Check the FooService invocation-2", fs2.foo());
        // Only one object as the getService method is called only once (service factory) despite the policy="method".
        assertEquals("Check the creation of 1 object",1, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);
    }
View Full Code Here

    /**
     * Test a custom constructor.
     * Not manipulated.
     */
    public void testCustomConstuctor() {
        FooService fs = new FooProviderType1(0, "foo", getContext());
        Properties props = fs.fooProps();
        assertEquals("Check bar", 0, ((Integer) props.get("bar")).intValue());
        assertEquals("Check foo", "foo", props.get("foo"));
        assertEquals("Check context", getContext(), props.get("context"));
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService

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.