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

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


    @Test
    public void testConfigurationPrimitiveArrays() {
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref);
        Properties props = check.getProps();

        byte[] b = (byte[]) props.get("bs");
        short[] s = (short[]) props.get("ss");
        int[] i = (int[]) props.get("is");
        long[] l = (long[]) props.get("ls");
        double[] d = (double[]) props.get("ds");
        float[] f = (float[]) props.get("fs");
        char[] c = (char[]) props.get("cs");
        boolean[] bool = (boolean[]) props.get("bools");

        assertEquals("Check b 0", b[0], 1);
        assertEquals("Check b 1", b[1], 2);
        assertEquals("Check b 2", b[2], 3);
        assertEquals("Check s 0", s[0], 1);
        assertEquals("Check s 1", s[1], 2);
        assertEquals("Check s 2", s[2], 3);
        assertEquals("Check i 0", i[0], 1);
        assertEquals("Check i 1", i[1], 2);
        assertEquals("Check i 2", i[2], 3);
        assertEquals("Check l 0", l[0], 1);
        assertEquals("Check l 1", l[1], 2);
        assertEquals("Check l 2", l[2], 3);
        assertEquals("Check d 0", d[0], 1, 0);
        assertEquals("Check d 1", d[1], 2, 0);
        assertEquals("Check d 2", d[2], 3, 0);
        assertEquals("Check f 0", f[0], 1, 0);
        assertEquals("Check f 1", f[1], 2, 0);
        assertEquals("Check f 2", f[2], 3, 0);
        assertEquals("Check c 0", c[0], 'a');
        assertEquals("Check c 1", c[1], 'b');
        assertEquals("Check c 2", c[2], 'c');
        assertTrue("Check bool 0", bool[0]);
        assertTrue("Check bool 1", bool[0]);
        assertTrue("Check bool 2", bool[0]);

//        Integer upb = (Integer) props.get("upbs");
//        Integer ups = (Integer) props.get("upss");
//        Integer upi = (Integer) props.get("upis");
//        Integer upl = (Integer) props.get("upls");
//        Integer upd = (Integer) props.get("upds");
//        Integer upf = (Integer) props.get("upfs");
//        Integer upc = (Integer) props.get("upcs");
//        Integer upbool = (Integer) props.get("upbools");
//       
//        assertEquals("Check upb", upb, new Integer(1));
//        assertEquals("Check ups", ups, new Integer(1));
//        assertEquals("Check upi", upi, new Integer(1));
//        assertEquals("Check upl", upl, new Integer(1));
//        assertEquals("Check upd", upd, new Integer(1));
//        assertEquals("Check upf", upf, new Integer(1));
//        assertEquals("Check upc", upc, new Integer(1));
//        assertEquals("Check upbool", upbool, new Integer(1));

        reconfigure();

        ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        check = (CheckService) osgiHelper.getRawServiceObject(ref);
        props = check.getProps();

        b = (byte[]) props.get("bs");
        s = (short[]) props.get("ss");
        i = (int[]) props.get("is");
        l = (long[]) props.get("ls");
View Full Code Here


    @Test
    public void testConfigurationPrimitiveArraysString() {
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref);
        Properties props = check.getProps();

        byte[] b = (byte[]) props.get("bs");
        short[] s = (short[]) props.get("ss");
        int[] i = (int[]) props.get("is");
        long[] l = (long[]) props.get("ls");
        double[] d = (double[]) props.get("ds");
        float[] f = (float[]) props.get("fs");
        char[] c = (char[]) props.get("cs");
        boolean[] bool = (boolean[]) props.get("bools");

        assertEquals("Check b 0", b[0], 1);
        assertEquals("Check b 1", b[1], 2);
        assertEquals("Check b 2", b[2], 3);
        assertEquals("Check s 0", s[0], 1);
        assertEquals("Check s 1", s[1], 2);
        assertEquals("Check s 2", s[2], 3);
        assertEquals("Check i 0", i[0], 1);
        assertEquals("Check i 1", i[1], 2);
        assertEquals("Check i 2", i[2], 3);
        assertEquals("Check l 0", l[0], 1);
        assertEquals("Check l 1", l[1], 2);
        assertEquals("Check l 2", l[2], 3);
        assertEquals("Check d 0", d[0], 1, 0);
        assertEquals("Check d 1", d[1], 2, 0);
        assertEquals("Check d 2", d[2], 3, 0);
        assertEquals("Check f 0", f[0], 1, 0);
        assertEquals("Check f 1", f[1], 2, 0);
        assertEquals("Check f 2", f[2], 3, 0);
        assertEquals("Check c 0", c[0], 'a');
        assertEquals("Check c 1", c[1], 'b');
        assertEquals("Check c 2", c[2], 'c');
        assertTrue("Check bool 0", bool[0]);
        assertTrue("Check bool 1", bool[0]);
        assertTrue("Check bool 2", bool[0]);

//        Integer upb = (Integer) props.get("upbs");
//        Integer ups = (Integer) props.get("upss");
//        Integer upi = (Integer) props.get("upis");
//        Integer upl = (Integer) props.get("upls");
//        Integer upd = (Integer) props.get("upds");
//        Integer upf = (Integer) props.get("upfs");
//        Integer upc = (Integer) props.get("upcs");
//        Integer upbool = (Integer) props.get("upbools");
//       
//        assertEquals("Check upb", upb, new Integer(1));
//        assertEquals("Check ups", ups, new Integer(1));
//        assertEquals("Check upi", upi, new Integer(1));
//        assertEquals("Check upl", upl, new Integer(1));
//        assertEquals("Check upd", upd, new Integer(1));
//        assertEquals("Check upf", upf, new Integer(1));
//        assertEquals("Check upc", upc, new Integer(1));
//        assertEquals("Check upbool", upbool, new Integer(1));

        reconfigureString();

        ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        check = (CheckService) osgiHelper.getRawServiceObject(ref);
        props = check.getProps();

        b = (byte[]) props.get("bs");
        s = (short[]) props.get("ss");
        i = (int[]) props.get("is");
        l = (long[]) props.get("ls");
View Full Code Here

    @Test
    public void testConfigurationObj() {
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref);
        Properties props = check.getProps();

        String s = (String) props.get("string");
        String[] ss = (String[]) props.get("strings");

        assertEquals("Check string", s, "foo");
        assertEquals("Check strings 0", ss[0], "foo");
        assertEquals("Check strings 1", ss[1], "bar");
        assertEquals("Check strings 2", ss[2], "baz");

//        Integer upString = (Integer) props.get("upstring");
//        Integer upStrings = (Integer) props.get("upstrings");
//       
//        assertEquals("Check upString", upString, new Integer(1));
//        assertEquals("Check upStrings", upStrings, new Integer(1));

        reconfigure();

        ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        check = (CheckService) osgiHelper.getRawServiceObject(ref);
        props = check.getProps();

        s = (String) props.get("string");
        ss = (String[]) props.get("strings");

        assertEquals("2) Check string", s, "bar");
View Full Code Here

    @Test
    public void testConfigurationObjString() {
        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref);
        Properties props = check.getProps();

        String s = (String) props.get("string");
        String[] ss = (String[]) props.get("strings");

        assertEquals("Check string", s, "foo");
        assertEquals("Check strings 0", ss[0], "foo");
        assertEquals("Check strings 1", ss[1], "bar");
        assertEquals("Check strings 2", ss[2], "baz");

//        Integer upString = (Integer) props.get("upstring");
//        Integer upStrings = (Integer) props.get("upstrings");
//       
//        assertEquals("Check upString", upString, new Integer(1));
//        assertEquals("Check upStrings", upStrings, new Integer(1));

        reconfigureString();

        ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        check = (CheckService) osgiHelper.getRawServiceObject(ref);
        props = check.getProps();

        s = (String) props.get("string");
        ss = (String[]) props.get("strings");

        assertEquals("2) Check string", s, "bar");
View Full Code Here

            fail("Cannot instantiate the provider : " + e.getMessage());
        }

        ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
        assertNotNull("Check ref existency", ref);
        CheckService check = (CheckService) sc2.getService(ref);

        assertTrue("Check invocation", check.check());
        client.dispose();
        provider.dispose();
        empty2.dispose();
    }
View Full Code Here

        } catch (Exception e) {
            fail("Cannot instantiate the provider : " + e.getMessage());
        }

        ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
        CheckService check = (CheckService) sc2.getService(ref);

        assertTrue("Check invocation", check.check());

        sc2.ungetService(ref);

        // Check visibility
        assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName()));
View Full Code Here

        } catch (Exception e) {
            fail("Cannot instantiate the provider : " + e.getMessage());
        }

        ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
        CheckService check = (CheckService) sc2.getService(ref);

        assertTrue("Check invocation", check.check());

        sc2.ungetService(ref);

        // Check visibility
        assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName()));
View Full Code Here

        } catch (Exception e) {
            fail("Cannot instantiate the provider : " + e.getMessage());
        }

        ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
        CheckService check = (CheckService) sc2.getService(ref);

        assertTrue("Check invocation", check.check());

        sc2.ungetService(ref);

        // Check visibility
        assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName()));
View Full Code Here

        } catch (Exception e) {
            fail("Cannot instantiate the provider : " + e.getMessage());
        }

        ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
        CheckService check = (CheckService) sc2.getService(ref);

        assertTrue("Check invocation", check.check());

        sc2.ungetService(ref);

        //  Check visibility
        assertNotNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
View Full Code Here

        } catch (Exception e) {
            fail("Cannot instantiate the provider : " + e.getMessage());
        }

        ServiceReference ref = sc2.getServiceReference(CheckService.class.getName());
        CheckService check = (CheckService) sc2.getService(ref);

        assertTrue("Check invocation", check.check());

        sc2.ungetService(ref);

        //  Check visibility
        assertNotNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName()));
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.runtime.core.services.CheckService

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.