Package org.apache.felix.ipojo.runtime.core.services

Examples of org.apache.felix.ipojo.runtime.core.services.CheckService.check()


    @Test
    public void testSeveralConstructor() {
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName());
        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
        assertTrue("Check assignation", cs.check());
        String name = (String) cs.getProps().get("name");
        assertEquals("Check message", "hello world", name);
        //assertNull("Check message", name);
    }
View Full Code Here


    @Test
    public void testNoEmptyConstructor() {
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci2.getInstanceName());
        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
        assertFalse("Check assignation", cs.check());
        String name = (String) cs.getProps().get("name");
        assertEquals("Check message", "NULL", name);
    }

    @Test
View Full Code Here

    @Test
    public void testNoEmptyConstructorWithAParentClass() {
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci3.getInstanceName());
        CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
        assertTrue("Check assignation", cs.check()); // super set name to "hello"
        String name = (String) cs.getProps().get("name");
        assertEquals("Check message", "hello", name);
    }

}
View Full Code Here

    public void testTypedList() {
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), checker.getInstanceName());
        CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
        assertNotNull("Checker availability", check);
        // Check without providers
        assertFalse("Empty list", check.check());

        // Start the first provider
        foo1.start();
        assertTrue("List with one element", check.check());
        Properties props = check.getProps();
View Full Code Here

        // Check without providers
        assertFalse("Empty list", check.check());

        // Start the first provider
        foo1.start();
        assertTrue("List with one element", check.check());
        Properties props = check.getProps();
        List<FooService> list = (List<FooService>) props.get("list");
        assertEquals("Check size - 1", 1, list.size());

        // Start the second provider
View Full Code Here

        List<FooService> list = (List<FooService>) props.get("list");
        assertEquals("Check size - 1", 1, list.size());

        // Start the second provider
        foo2.start();
        assertTrue("List with two element", check.check());
        props = check.getProps();
        list = (List<FooService>) props.get("list");
        assertEquals("Check size - 2", 2, list.size());

        // Stop the first one
View Full Code Here

        list = (List<FooService>) props.get("list");
        assertEquals("Check size - 2", 2, list.size());

        // Stop the first one
        foo1.stop();
        assertTrue("List with one element (2)", check.check());
        props = check.getProps();
        list = (List<FooService>) props.get("list");
        assertEquals("Check size - 3", 1, list.size());
    }
View Full Code Here

        assertEquals(0, unregistrations);
        assertEquals(0, updates);
        assertEquals(0, total);

        // Unregister the service and check.
        assertFalse(check.check());
        assertEquals(0, registrations);
        assertEquals(1, unregistrations);
        assertEquals(0, updates);
        assertEquals(1, total);
View Full Code Here

        assertEquals(1, unregistrations);
        assertEquals(0, updates);
        assertEquals(1, total);

        // Register the service and check.
        assertTrue(check.check());
        assertEquals(1, registrations);
        assertEquals(1, unregistrations);
        assertEquals(0, updates);
        assertEquals(2, total);
View Full Code Here

        assertEquals(1, unregistrations);
        assertEquals(1, updates);
        assertEquals(3, total);

        // One more time, just to be sure...
        assertFalse(check.check()); // Unregister
        assertEquals(1, registrations);
        assertEquals(2, unregistrations);
        assertEquals(1, updates);
        assertEquals(4, total);
        assertTrue(check.check()); // Register
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.