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

Examples of org.apache.felix.ipojo.test.scenarios.configuration.service.CheckService


    }

    public void testConfigurationObj2() {
        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
        assertNotNull("Test check service availability", ref);
        CheckService check = (CheckService) getContext().getService(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(instance2);
       
        ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
        assertNotNull("Test check service availability", ref);
        check = (CheckService) getContext().getService(ref);
        props = check.getProps();
       
        s = (String) props.get("string");
        ss = (String[]) props.get("strings");
               
        assertEquals("2) Check string", s, "bar");
View Full Code Here


    }

    public void testConfigurationObj2String() {
        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
        assertNotNull("Test check service availability", ref);
        CheckService check = (CheckService) getContext().getService(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(instance2);
       
        ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance2.getInstanceName());
        assertNotNull("Test check service availability", ref);
        check = (CheckService) getContext().getService(ref);
        props = check.getProps();
       
        s = (String) props.get("string");
        ss = (String[]) props.get("strings");
               
        assertEquals("2) Check string", s, "bar");
View Full Code Here

    }

    public void testConfigurationPrimitiveNoValue() {
            ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            CheckService check = (CheckService) getContext().getService(ref);
            Properties props = check.getProps();
           
            Byte b = (Byte) props.get("b");
            Short s = (Short) props.get("s");
            Integer i = (Integer) props.get("i");
            Long l = (Long) props.get("l");
            Double d = (Double) props.get("d");
            Float f = (Float) props.get("f");
            Character c = (Character) props.get("c");
            Boolean bool = (Boolean) props.get("bool");
                   
            assertEquals("Check b", b, new Byte("0"));
            assertEquals("Check s", s, new Short("0"));
            assertEquals("Check i", i, new Integer("0"));
            assertEquals("Check l", l, new Long("0"));
            assertEquals("Check d", d, new Double("0"));
            assertEquals("Check f", f, new Float("0"));
            assertEquals("Check c", c, new Character((char) 0));
            assertEquals("Check bool", bool, new Boolean("false"));
           
            Integer upb = (Integer) props.get("upb");
            Integer ups = (Integer) props.get("ups");
            Integer upi = (Integer) props.get("upi");
            Integer upl = (Integer) props.get("upl");
            Integer upd = (Integer) props.get("upd");
            Integer upf = (Integer) props.get("upf");
            Integer upc = (Integer) props.get("upc");
            Integer upbool = (Integer) props.get("upbool");
           
            assertEquals("Check upb", upb, new Integer(0));
            assertEquals("Check ups", ups, new Integer(0));
            assertEquals("Check upi", upi, new Integer(0));
            assertEquals("Check upl", upl, new Integer(0));
            assertEquals("Check upd", upd, new Integer(0));
            assertEquals("Check upf", upf, new Integer(0));
            assertEquals("Check upc", upc, new Integer(0));
            assertEquals("Check upbool", upbool, new Integer(0));
           
            reconfigure(instance3);
           
            ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            check = (CheckService) getContext().getService(ref);
            props = check.getProps();
           
            b = (Byte) props.get("b");
            s = (Short) props.get("s");
            i = (Integer) props.get("i");
            l = (Long) props.get("l");
View Full Code Here

        }

    public void testConfigurationPrimitiveStringNoValue() {
            ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            CheckService check = (CheckService) getContext().getService(ref);
            Properties props = check.getProps();
           
            Byte b = (Byte) props.get("b");
            Short s = (Short) props.get("s");
            Integer i = (Integer) props.get("i");
            Long l = (Long) props.get("l");
            Double d = (Double) props.get("d");
            Float f = (Float) props.get("f");
            Character c = (Character) props.get("c");
            Boolean bool = (Boolean) props.get("bool");
                   
            assertEquals("Check b", b, new Byte("0"));
            assertEquals("Check s", s, new Short("0"));
            assertEquals("Check i", i, new Integer("0"));
            assertEquals("Check l", l, new Long("0"));
            assertEquals("Check d", d, new Double("0"));
            assertEquals("Check f", f, new Float("0"));
            assertEquals("Check c", c, new Character((char) 0));
            assertEquals("Check bool", bool, new Boolean("false"));
           
            Integer upb = (Integer) props.get("upb");
            Integer ups = (Integer) props.get("ups");
            Integer upi = (Integer) props.get("upi");
            Integer upl = (Integer) props.get("upl");
            Integer upd = (Integer) props.get("upd");
            Integer upf = (Integer) props.get("upf");
            Integer upc = (Integer) props.get("upc");
            Integer upbool = (Integer) props.get("upbool");
           
            assertEquals("Check upb", upb, new Integer(0));
            assertEquals("Check ups", ups, new Integer(0));
            assertEquals("Check upi", upi, new Integer(0));
            assertEquals("Check upl", upl, new Integer(0));
            assertEquals("Check upd", upd, new Integer(0));
            assertEquals("Check upf", upf, new Integer(0));
            assertEquals("Check upc", upc, new Integer(0));
            assertEquals("Check upbool", upbool, new Integer(0));
           
            reconfigureString(instance3);
           
            ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            check = (CheckService) getContext().getService(ref);
            props = check.getProps();
           
            b = (Byte) props.get("b");
            s = (Short) props.get("s");
            i = (Integer) props.get("i");
            l = (Long) props.get("l");
View Full Code Here

        }

    public void testConfigurationPrimitiveArraysNoValue() {
            ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            CheckService check = (CheckService) getContext().getService(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");
                   
            assertNull("Check b nullity", b);
            assertNull("Check s nullity", s);
            assertNull("Check i nullity", i);
            assertNull("Check l nullity", l);
            assertNull("Check d nullity", d);
            assertNull("Check f nullity", f);
            assertNull("Check c nullity", c);
            assertNull("Check bool nullity", bool);
           
            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(0));
            assertEquals("Check ups", ups, new Integer(0));
            assertEquals("Check upi", upi, new Integer(0));
            assertEquals("Check upl", upl, new Integer(0));
            assertEquals("Check upd", upd, new Integer(0));
            assertEquals("Check upf", upf, new Integer(0));
            assertEquals("Check upc", upc, new Integer(0));
            assertEquals("Check upbool", upbool, new Integer(0));
           
            reconfigure(instance3);
           
            ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            check = (CheckService) getContext().getService(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

        }

    public void testConfigurationPrimitiveArraysStringNoValue() {
            ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            CheckService check = (CheckService) getContext().getService(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");
           
            assertNull("Check b nullity", b);
            assertNull("Check s nullity", s);
            assertNull("Check i nullity", i);
            assertNull("Check l nullity", l);
            assertNull("Check d nullity", d);
            assertNull("Check f nullity", f);
            assertNull("Check c nullity", c);
            assertNull("Check bool nullity", bool);
           
            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(0));
            assertEquals("Check ups", ups, new Integer(0));
            assertEquals("Check upi", upi, new Integer(0));
            assertEquals("Check upl", upl, new Integer(0));
            assertEquals("Check upd", upd, new Integer(0));
            assertEquals("Check upf", upf, new Integer(0));
            assertEquals("Check upc", upc, new Integer(0));
            assertEquals("Check upbool", upbool, new Integer(0));
           
   
            reconfigureString(instance3);
           
            ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            check = (CheckService) getContext().getService(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

        }

    public void testConfigurationObjNoValue() {
            ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            CheckService check = (CheckService) getContext().getService(ref);
            Properties props = check.getProps();
           
            String s = (String) props.get("string");
            String[] ss = (String[]) props.get("strings");
                   
            assertEquals("Check string", s, null);
            assertEquals("Check strings", ss, null);

           
            Integer upString = (Integer) props.get("upstring");
            Integer upStrings = (Integer) props.get("upstrings");
           
            assertEquals("Check upString", upString, new Integer(0));
            assertEquals("Check upStrings", upStrings, new Integer(0));
           
            reconfigure(instance3);
           
            ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            check = (CheckService) getContext().getService(ref);
            props = check.getProps();
           
            s = (String) props.get("string");
            ss = (String[]) props.get("strings");
                   
            assertEquals("2) Check string", s, "bar");
View Full Code Here

        }

    public void testConfigurationObjStringNoValue() {
            ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            CheckService check = (CheckService) getContext().getService(ref);
            Properties props = check.getProps();
           
            String s = (String) props.get("string");
            String[] ss = (String[]) props.get("strings");
                   
            assertEquals("Check string", s, null);
            assertEquals("Check strings", ss, null);

           
            Integer upString = (Integer) props.get("upstring");
            Integer upStrings = (Integer) props.get("upstrings");
           
            assertEquals("Check upString", upString, new Integer(0));
            assertEquals("Check upStrings", upStrings, new Integer(0));
           
            reconfigureString(instance3);
           
            ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance3.getInstanceName());
            assertNotNull("Test check service availability", ref);
            check = (CheckService) getContext().getService(ref);
            props = check.getProps();
           
            s = (String) props.get("string");
            ss = (String[]) props.get("strings");
                   
            assertEquals("2) Check string", s, "bar");
View Full Code Here

    }
   
    public void testConfigurationPrimitive() {
        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        CheckService check = (CheckService) getContext().getService(ref);
        Properties props = check.getProps();
       
        Byte b = (Byte) props.get("b");
        Short s = (Short) props.get("s");
        Integer i = (Integer) props.get("i");
        Long l = (Long) props.get("l");
        Double d = (Double) props.get("d");
        Float f = (Float) props.get("f");
        Character c = (Character) props.get("c");
        Boolean bool = (Boolean) props.get("bool");
               
        assertEquals("Check b", b, new Byte("1"));
        assertEquals("Check s", s, new Short("1"));
        assertEquals("Check i", i, new Integer("1"));
        assertEquals("Check l", l, new Long("1"));
        assertEquals("Check d", d, new Double("1"));
        assertEquals("Check f", f, new Float("1"));
        assertEquals("Check c", c, new Character('a'));
        assertEquals("Check bool", bool, new Boolean("true"));
       
//        Integer upb = (Integer) props.get("upb");
//        Integer ups = (Integer) props.get("ups");
//        Integer upi = (Integer) props.get("upi");
//        Integer upl = (Integer) props.get("upl");
//        Integer upd = (Integer) props.get("upd");
//        Integer upf = (Integer) props.get("upf");
//        Integer upc = (Integer) props.get("upc");
//        Integer upbool = (Integer) props.get("upbool");
//       
//        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 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        check = (CheckService) getContext().getService(ref);
        props = check.getProps();
       
        b = (Byte) props.get("b");
        s = (Short) props.get("s");
        i = (Integer) props.get("i");
        l = (Long) props.get("l");
View Full Code Here

    }

    public void testConfigurationPrimitiveString() {
        ServiceReference ref = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        CheckService check = (CheckService) getContext().getService(ref);
        Properties props = check.getProps();
       
        Byte b = (Byte) props.get("b");
        Short s = (Short) props.get("s");
        Integer i = (Integer) props.get("i");
        Long l = (Long) props.get("l");
        Double d = (Double) props.get("d");
        Float f = (Float) props.get("f");
        Character c = (Character) props.get("c");
        Boolean bool = (Boolean) props.get("bool");
               
        assertEquals("Check b", b, new Byte("1"));
        assertEquals("Check s", s, new Short("1"));
        assertEquals("Check i", i, new Integer("1"));
        assertEquals("Check l", l, new Long("1"));
        assertEquals("Check d", d, new Double("1"));
        assertEquals("Check f", f, new Float("1"));
        assertEquals("Check c", c, new Character('a'));
        assertEquals("Check bool", bool, new Boolean("true"));
       
//        Integer upb = (Integer) props.get("upb");
//        Integer ups = (Integer) props.get("ups");
//        Integer upi = (Integer) props.get("upi");
//        Integer upl = (Integer) props.get("upl");
//        Integer upd = (Integer) props.get("upd");
//        Integer upf = (Integer) props.get("upf");
//        Integer upc = (Integer) props.get("upc");
//        Integer upbool = (Integer) props.get("upbool");
//       
//        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 = Utils.getServiceReferenceByName(getContext(), CheckService.class.getName(), instance.getInstanceName());
        assertNotNull("Test check service availability", ref);
        check = (CheckService) getContext().getService(ref);
        props = check.getProps();
       
        b = (Byte) props.get("b");
        s = (Short) props.get("s");
        i = (Integer) props.get("i");
        l = (Long) props.get("l");
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.test.scenarios.configuration.service.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.