Examples of FooService


Examples of example.scannable.FooService

  @Test
  public void testFooService() throws Exception {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(getConfigLocations(), getClass());

    FooService fooService = (FooService) ctx.getBean("fooServiceImpl");
    ServiceInvocationCounter serviceInvocationCounter = (ServiceInvocationCounter) ctx.getBean("serviceInvocationCounter");

    assertEquals(0, serviceInvocationCounter.getCount());

    assertTrue(fooService.isInitCalled());
    assertEquals(1, serviceInvocationCounter.getCount());

    String value = fooService.foo(1);
    assertEquals("bar", value);
    assertEquals(2, serviceInvocationCounter.getCount());

    fooService.foo(1);
    assertEquals(3, serviceInvocationCounter.getCount());
  }
View Full Code Here

Examples of org.apache.cxf.systest.jaxb.shareclasses.service.foo.FooService

        callFoo(fooName);

    }
   
    private void callFoo(final NameElement nameElement) {
        FooService fooClient = createGetterService(FooService.class);
        assertEquals(fooClient.getName(nameElement), "Alice");
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handler.temporal.services.FooService

        //Use a local variable to avoid to wait at each access.
        Collection col = fs;
        if (col  != null) {
            Iterator it = col.iterator(); // Get the cached copy
            while (it != null && it.hasNext()) {
                FooService svc =  (FooService) it.next();
                result = result && svc.foo();
            }
        }       
        return result;
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handler.temporal.services.FooService

    }

    public Properties getProps() {
        Iterator it = fs.iterator();
        if (it.hasNext()) {
            FooService svc = (FooService) it.next();
            return svc.fooProps();
        }
        return null;
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handler.temporal.services.FooService

        //Use a local variable to avoid to wait at each access.
        Collection col = fs;
        if (col  != null) {
            Iterator it = col.iterator();
            while (it.hasNext()) {
                FooService svc =  (FooService) it.next();
                result = result && svc.foo();
            }
        }       
        return result;
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handler.temporal.services.FooService

    }

    public Properties getProps() {
        Iterator it = fs.iterator();
        if (it.hasNext()) {
            FooService svc = (FooService) it.next();
            return svc.fooProps();
        }
        return null;
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handler.whiteboard.services.FooService

        Properties p1 = new Properties();
        p1.put("foo", "foo");
        ComponentInstance prov1 = provFactory.createComponentInstance(p1);
        ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov1.getInstanceName());
        FooService fs1 = (FooService) osgiHelper.getServiceObject(ref1);

        map = obs.getObservations();
        assertEquals("Check list #1", ((List) map.get("list")).size(), 1);

        Properties p2 = new Properties();
        p2.put("foo", "foo");
        ComponentInstance prov2 = provFactory.createComponentInstance(p2);
        ServiceReference ref2 = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov2.getInstanceName());
        FooService fs2 = (FooService) osgiHelper.getServiceObject(ref2);

        map = obs.getObservations();
        assertEquals("Check list #2", ((List) map.get("list")).size(), 2);

        fs1.foo();

        map = obs.getObservations();
        assertEquals("(1) Check list #1", ((List) map.get("list")).size(), 1);

        fs2.foo();

        map = obs.getObservations();
        assertEquals("(2) Check list #0", ((List) map.get("list")).size(), 0);

        fs2.foo();

        map = obs.getObservations();
        assertEquals("(3) Check list #1", ((List) map.get("list")).size(), 1);

        fs1.foo();
View Full Code Here

Examples of org.apache.felix.ipojo.runtime.core.services.FooService

        ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), compName);

        assertNotNull("FS not available", ref);

        // Get foo object
        FooService fs = (FooService) osgiHelper.getServiceObject(ref);

        // Cast to POJO
        Pojo pojo = (Pojo) fs;
        Field im = fs.getClass().getDeclaredField("__IM");
        assertNotNull(im);
        im.setAccessible(true);
        assertNotNull(im.get(fs));

        Method method = fs.getClass().getMethod("getComponentInstance");
        assertNotNull(method);

        // GetComponentInstance
        ComponentInstance instance = pojo.getComponentInstance();
        assertNotNull(instance);
View Full Code Here

Examples of org.apache.felix.ipojo.runtime.core.services.FooService

    @Test
    public void testLazyCreation() {
        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref);
        FooService fs = (FooService) osgiHelper.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

Examples of org.apache.felix.ipojo.runtime.core.services.FooService

    @Test
    public void testLazyCreationSingleton() {
        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length);
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sing.getInstanceName());
        assertNotNull("Check that a FooService from " + ci_lazzy_sing.getInstanceName() + " is available", ref);
        FooService fs = (FooService) osgiHelper.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
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.