You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2013/02/13 17:26:24 UTC

svn commit: r1445708 [8/9] - in /felix/trunk/ipojo/runtime/core-it: ./ src/ src/it/ src/it/ipojo-core-annotations-test/ src/it/ipojo-core-annotations-test/src/ src/it/ipojo-core-annotations-test/src/main/ src/it/ipojo-core-annotations-test/src/main/jav...

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java Wed Feb 13 16:26:18 2013
@@ -0,0 +1,265 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+
+public class TestSimpleProperties extends Common {
+
+
+    ComponentInstance fooProvider1;
+    ComponentInstance fooProvider2;
+    ComponentInstance fooProvider3;
+
+
+
+    @Before
+    public void setUp() {
+        osgiHelper = new OSGiHelper(bc);
+        ipojoHelper = new IPOJOHelper(bc);
+        String type = "CONFIG-FooProviderType-Conf";
+
+        Hashtable<String, String> p1 = new Hashtable<String, String>();
+        p1.put("instance.name", "FooProvider-1");
+        fooProvider1 = ipojoHelper.createComponentInstance(type, p1);
+
+        Properties p2 = new Properties();
+        p2.put("instance.name", "FooProvider-2");
+        p2.put("int", new Integer(4));
+        p2.put("boolean", new Boolean(false));
+        p2.put("string", new String("bar"));
+        p2.put("strAProp", new String[]{"bar", "foo"});
+        p2.put("intAProp", new int[]{1, 2, 3});
+        fooProvider2 = ipojoHelper.createComponentInstance(bc.getBundle(), type, p2);
+
+        Hashtable<String, String> p3 = new Hashtable<String, String>();
+        p3.put("instance.name", "FooProvider-3");
+        fooProvider3 = ipojoHelper.createComponentInstance("CONFIG-FooProviderType-ConfNoValue", p3);
+    }
+
+    @After
+    public void tearDown() {
+        fooProvider1.dispose();
+        fooProvider2.dispose();
+        fooProvider3.dispose();
+        fooProvider1 = null;
+        fooProvider2 = null;
+        fooProvider3 = null;
+    }
+
+    @Test
+    public void testComponentTypeConfiguration() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check FooService availability", ref);
+        FooService fs = (FooService) osgiHelper.getContext().getService(ref);
+        Properties toCheck = fs.fooProps();
+
+        Integer intProp = (Integer) toCheck.get("intProp");
+        Boolean boolProp = (Boolean) toCheck.get("boolProp");
+        String strProp = (String) toCheck.get("strProp");
+        String[] strAProp = (String[]) toCheck.get("strAProp");
+        int[] intAProp = (int[]) toCheck.get("intAProp");
+
+        assertEquals("Check intProp equality (1)", intProp, new Integer(2));
+        assertEquals("Check longProp equality (1)", boolProp, new Boolean(false));
+        assertEquals("Check strProp equality (1)", strProp, new String("foo"));
+        assertNotNull("Check strAProp not nullity (1)", strAProp);
+        String[] v = new String[]{"foo", "bar"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality (1) : " + strAProp[i] + " != " + v[i]);
+            }
+        }
+        assertNotNull("Check intAProp not nullity", intAProp);
+        int[] v2 = new int[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality (1) : " + intAProp[i] + " != " + v2[i]);
+            }
+        }
+
+        // change the field value
+        assertTrue("Invoke the fs service", fs.foo());
+        toCheck = fs.fooProps();
+
+
+        //	Re-check the property (change)
+        intProp = (Integer) toCheck.get("intProp");
+        boolProp = (Boolean) toCheck.get("boolProp");
+        strProp = (String) toCheck.get("strProp");
+        strAProp = (String[]) toCheck.get("strAProp");
+        intAProp = (int[]) toCheck.get("intAProp");
+
+        assertEquals("Check intProp equality (2) (" + intProp + ")", intProp, new Integer(3));
+        assertEquals("Check longProp equality (2)", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality (2)", strProp, new String("bar"));
+        assertNotNull("Check strAProp not nullity (2)", strAProp);
+        v = new String[]{"foo", "bar", "baz"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality (2)");
+            }
+        }
+        assertNotNull("Check intAProp not nullity (2)", intAProp);
+        v2 = new int[]{3, 2, 1};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality (2) : " + intAProp[i] + " != " + v2[i]);
+            }
+        }
+
+        fs = null;
+        osgiHelper.getContext().ungetService(ref);
+    }
+
+
+    @Test
+    public void testInstanceConfiguration() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-2");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        FooService fs = (FooService) osgiHelper.getContext().getService(sr);
+        Properties toCheck = fs.fooProps();
+
+        // Check service properties
+        Integer intProp = (Integer) toCheck.get("intProp");
+        Boolean boolProp = (Boolean) toCheck.get("boolProp");
+        String strProp = (String) toCheck.get("strProp");
+        String[] strAProp = (String[]) toCheck.get("strAProp");
+        int[] intAProp = (int[]) toCheck.get("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(4));
+        assertEquals("Check longProp equality", boolProp, new Boolean(false));
+        assertEquals("Check strProp equality", strProp, new String("bar"));
+        assertNotNull("Check strAProp not nullity", strAProp);
+        String[] v = new String[]{"bar", "foo"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNotNull("Check intAProp not nullity", intAProp);
+        int[] v2 = new int[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+
+        assertTrue("invoke fs", fs.foo());
+        toCheck = fs.fooProps();
+
+        // Re-check the property (change)
+        intProp = (Integer) toCheck.get("intProp");
+        boolProp = (Boolean) toCheck.get("boolProp");
+        strProp = (String) toCheck.get("strProp");
+        strAProp = (String[]) toCheck.get("strAProp");
+        intAProp = (int[]) toCheck.get("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(3));
+        assertEquals("Check longProp equality", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality", strProp, new String("foo"));
+        assertNotNull("Check strAProp not nullity", strAProp);
+        v = new String[]{"foo", "bar", "baz"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNotNull("Check intAProp not nullity", intAProp);
+        v2 = new int[]{3, 2, 1};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        fs = null;
+        osgiHelper.getContext().ungetService(sr);
+    }
+
+    @Test
+    public void testNoValue() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        FooService fs = (FooService) osgiHelper.getContext().getService(sr);
+        Properties toCheck = fs.fooProps();
+
+        // Check service properties
+        Integer intProp = (Integer) toCheck.get("intProp");
+        Boolean boolProp = (Boolean) toCheck.get("boolProp");
+        String strProp = (String) toCheck.get("strProp");
+        String[] strAProp = (String[]) toCheck.get("strAProp");
+        int[] intAProp = (int[]) toCheck.get("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(0));
+        assertEquals("Check longProp equality", boolProp, new Boolean(false));
+        assertEquals("Check strProp equality", strProp, null);
+        assertNull("Check strAProp nullity", strAProp);
+        assertNull("Check intAProp  nullity", intAProp);
+
+        assertTrue("invoke fs", fs.foo());
+        toCheck = fs.fooProps();
+
+        // Re-check the property (change)
+        intProp = (Integer) toCheck.get("intProp");
+        boolProp = (Boolean) toCheck.get("boolProp");
+        strProp = (String) toCheck.get("strProp");
+        strAProp = (String[]) toCheck.get("strAProp");
+        intAProp = (int[]) toCheck.get("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(3));
+        assertEquals("Check longProp equality", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality", strProp, new String("bar"));
+        assertNotNull("Check strAProp not nullity", strAProp);
+        String[] v = new String[]{"foo", "bar", "baz"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNotNull("Check intAProp not nullity", intAProp);
+        int[] v2 = new int[]{3, 2, 1};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        fs = null;
+        osgiHelper.getContext().ungetService(sr);
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java Wed Feb 13 16:26:18 2013
@@ -0,0 +1,638 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Properties;
+
+import static org.junit.Assert.*;
+
+
+public class TestSuperMethodProperties extends Common {
+
+
+
+    ComponentInstance instance;
+
+
+
+    @Before
+    public void setUp() {
+        osgiHelper = new OSGiHelper(bc);
+        ipojoHelper = new IPOJOHelper(bc);
+        Factory fact = ipojoHelper.getFactory("CONFIG-ParentMethodConfigurableCheckService");
+        Properties props = new Properties();
+        props.put("instance.name", "under-test");
+        props.put("b", "1");
+        props.put("s", "1");
+        props.put("i", "1");
+        props.put("l", "1");
+        props.put("d", "1");
+        props.put("f", "1");
+        props.put("c", "a");
+        props.put("bool", "true");
+        props.put("bs", "{1,2,3}");
+        props.put("ss", "{1,2,3}");
+        props.put("is", "{1,2,3}");
+        props.put("ls", "{1,2,3}");
+        props.put("ds", "{1,2,3}");
+        props.put("fs", "{1,2,3}");
+        props.put("cs", "{a,b,c}");
+        props.put("bools", "{true,true,true}");
+        props.put("string", "foo");
+        props.put("strings", "{foo, bar, baz}");
+
+        try {
+            instance = fact.createComponentInstance(props);
+        } catch (Exception e) {
+            fail("Cannot create the under-test instance : " + e.getMessage());
+        }
+
+
+    }
+
+    @After
+    public void tearDown() {
+
+        instance.dispose();
+        instance = null;
+    }
+
+    @Test
+    public void testConfigurationPrimitive() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) osgiHelper.getServiceObject(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 = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) osgiHelper.getServiceObject(ref);
+        props = check.getProps();
+
+        b = (Byte) props.get("b");
+        s = (Short) props.get("s");
+        i = (Integer) props.get("i");
+        l = (Long) props.get("l");
+        d = (Double) props.get("d");
+        f = (Float) props.get("f");
+        c = (Character) props.get("c");
+        bool = (Boolean) props.get("bool");
+
+        assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+        assertEquals("2) Check s", s, new Short("2"));
+        assertEquals("2) Check i", i, new Integer("2"));
+        assertEquals("2) Check l", l, new Long("2"));
+        assertEquals("2) Check d", d, new Double("2"));
+        assertEquals("2) Check f", f, new Float("2"));
+        assertEquals("2) Check c", c, new Character('b'));
+        assertEquals("2) Check bool", bool, new Boolean("false"));
+
+//        upb = (Integer) props.get("upb");
+//        ups = (Integer) props.get("ups");
+//        upi = (Integer) props.get("upi");
+//        upl = (Integer) props.get("upl");
+//        upd = (Integer) props.get("upd");
+//        upf = (Integer) props.get("upf");
+//        upc = (Integer) props.get("upc");
+//        upbool = (Integer) props.get("upbool");
+//        
+//        assertEquals("2) Check upb", upb, new Integer(2));
+//        assertEquals("2) Check ups", ups, new Integer(2));
+//        assertEquals("2) Check upi", upi, new Integer(2));
+//        assertEquals("2) Check upl", upl, new Integer(2));
+//        assertEquals("2) Check upd", upd, new Integer(2));
+//        assertEquals("2) Check upf", upf, new Integer(2));
+//        assertEquals("2) Check upc", upc, new Integer(2));
+//        assertEquals("2) Check upbool", upbool, new Integer(2));
+
+    }
+
+    @Test
+    public void testConfigurationPrimitiveString() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) osgiHelper.getServiceObject(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 = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) osgiHelper.getServiceObject(ref);
+        props = check.getProps();
+
+        b = (Byte) props.get("b");
+        s = (Short) props.get("s");
+        i = (Integer) props.get("i");
+        l = (Long) props.get("l");
+        d = (Double) props.get("d");
+        f = (Float) props.get("f");
+        c = (Character) props.get("c");
+        bool = (Boolean) props.get("bool");
+
+        assertEquals("2) Check b (" + b + ")", b, new Byte("2"));
+        assertEquals("2) Check s", s, new Short("2"));
+        assertEquals("2) Check i", i, new Integer("2"));
+        assertEquals("2) Check l", l, new Long("2"));
+        assertEquals("2) Check d", d, new Double("2"));
+        assertEquals("2) Check f", f, new Float("2"));
+        assertEquals("2) Check c", c, new Character('b'));
+        assertEquals("2) Check bool", bool, new Boolean("false"));
+
+//        upb = (Integer) props.get("upb");
+//        ups = (Integer) props.get("ups");
+//        upi = (Integer) props.get("upi");
+//        upl = (Integer) props.get("upl");
+//        upd = (Integer) props.get("upd");
+//        upf = (Integer) props.get("upf");
+//        upc = (Integer) props.get("upc");
+//        upbool = (Integer) props.get("upbool");
+//        
+//        assertEquals("2) Check upb", upb, new Integer(2));
+//        assertEquals("2) Check ups", ups, new Integer(2));
+//        assertEquals("2) Check upi", upi, new Integer(2));
+//        assertEquals("2) Check upl", upl, new Integer(2));
+//        assertEquals("2) Check upd", upd, new Integer(2));
+//        assertEquals("2) Check upf", upf, new Integer(2));
+//        assertEquals("2) Check upc", upc, new Integer(2));
+//        assertEquals("2) Check upbool", upbool, new Integer(2));
+
+    }
+
+    @Test
+    public void testConfigurationPrimitiveArrays() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) osgiHelper.getServiceObject(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.getServiceObject(ref);
+        props = check.getProps();
+
+        b = (byte[]) props.get("bs");
+        s = (short[]) props.get("ss");
+        i = (int[]) props.get("is");
+        l = (long[]) props.get("ls");
+        d = (double[]) props.get("ds");
+        f = (float[]) props.get("fs");
+        c = (char[]) props.get("cs");
+        bool = (boolean[]) props.get("bools");
+
+        assertEquals("2) Check b 0", b[0], 3);
+        assertEquals("2) Check b 1", b[1], 2);
+        assertEquals("2) Check b 2", b[2], 1);
+        assertEquals("2) Check s 0", s[0], 3);
+        assertEquals("2) Check s 1", s[1], 2);
+        assertEquals("2) Check s 2", s[2], 1);
+        assertEquals("2) Check i 0", i[0], 3);
+        assertEquals("2) Check i 1", i[1], 2);
+        assertEquals("2) Check i 2", i[2], 1);
+        assertEquals("2) Check l 0", l[0], 3);
+        assertEquals("2) Check l 1", l[1], 2);
+        assertEquals("2) Check l 2", l[2], 1);
+        assertEquals("2) Check d 0", d[0], 3, 0);
+        assertEquals("2) Check d 1", d[1], 2, 0);
+        assertEquals("2) Check d 2", d[2], 1, 0);
+        assertEquals("2) Check f 0", f[0], 3, 0);
+        assertEquals("2) Check f 1", f[1], 2, 0);
+        assertEquals("2) Check f 2", f[2], 1, 0);
+        assertEquals("2) Check c 0", c[0], 'c');
+        assertEquals("2) Check c 1", c[1], 'b');
+        assertEquals("2) Check c 2", c[2], 'a');
+        assertFalse("2) Check bool 0", bool[0]);
+        assertFalse("2) Check bool 1", bool[0]);
+        assertFalse("2) Check bool 2", bool[0]);
+
+//        upb = (Integer) props.get("upbs");
+//        ups = (Integer) props.get("upss");
+//        upi = (Integer) props.get("upis");
+//        upl = (Integer) props.get("upls");
+//        upd = (Integer) props.get("upds");
+//        upf = (Integer) props.get("upfs");
+//        upc = (Integer) props.get("upcs");
+//        upbool = (Integer) props.get("upbools");
+//        
+//        assertEquals("2) Check upb", upb, new Integer(2));
+//        assertEquals("2) Check ups", ups, new Integer(2));
+//        assertEquals("2) Check upi", upi, new Integer(2));
+//        assertEquals("2) Check upl", upl, new Integer(2));
+//        assertEquals("2) Check upd", upd, new Integer(2));
+//        assertEquals("2) Check upf", upf, new Integer(2));
+//        assertEquals("2) Check upc", upc, new Integer(2));
+//        assertEquals("2) Check upbool", upbool, new Integer(2));
+
+    }
+
+    @Test
+    public void testConfigurationPrimitiveArraysString() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) osgiHelper.getServiceObject(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.getServiceObject(ref);
+        props = check.getProps();
+
+        b = (byte[]) props.get("bs");
+        s = (short[]) props.get("ss");
+        i = (int[]) props.get("is");
+        l = (long[]) props.get("ls");
+        d = (double[]) props.get("ds");
+        f = (float[]) props.get("fs");
+        c = (char[]) props.get("cs");
+        bool = (boolean[]) props.get("bools");
+
+        assertEquals("2) Check b 0", b[0], 3);
+        assertEquals("2) Check b 1", b[1], 2);
+        assertEquals("2) Check b 2", b[2], 1);
+        assertEquals("2) Check s 0", s[0], 3);
+        assertEquals("2) Check s 1", s[1], 2);
+        assertEquals("2) Check s 2", s[2], 1);
+        assertEquals("2) Check i 0", i[0], 3);
+        assertEquals("2) Check i 1", i[1], 2);
+        assertEquals("2) Check i 2", i[2], 1);
+        assertEquals("2) Check l 0", l[0], 3);
+        assertEquals("2) Check l 1", l[1], 2);
+        assertEquals("2) Check l 2", l[2], 1);
+        assertEquals("2) Check d 0", d[0], 3, 0);
+        assertEquals("2) Check d 1", d[1], 2, 0);
+        assertEquals("2) Check d 2", d[2], 1, 0);
+        assertEquals("2) Check f 0", f[0], 3, 0);
+        assertEquals("2) Check f 1", f[1], 2, 0);
+        assertEquals("2) Check f 2", f[2], 1, 0);
+        assertEquals("2) Check c 0", c[0], 'c');
+        assertEquals("2) Check c 1", c[1], 'b');
+        assertEquals("2) Check c 2", c[2], 'a');
+        assertFalse("2) Check bool 0", bool[0]);
+        assertFalse("2) Check bool 1", bool[0]);
+        assertFalse("2) Check bool 2", bool[0]);
+
+//        upb = (Integer) props.get("upbs");
+//        ups = (Integer) props.get("upss");
+//        upi = (Integer) props.get("upis");
+//        upl = (Integer) props.get("upls");
+//        upd = (Integer) props.get("upds");
+//        upf = (Integer) props.get("upfs");
+//        upc = (Integer) props.get("upcs");
+//        upbool = (Integer) props.get("upbools");
+//        
+//        assertEquals("2) Check upb", upb, new Integer(2));
+//        assertEquals("2) Check ups", ups, new Integer(2));
+//        assertEquals("2) Check upi", upi, new Integer(2));
+//        assertEquals("2) Check upl", upl, new Integer(2));
+//        assertEquals("2) Check upd", upd, new Integer(2));
+//        assertEquals("2) Check upf", upf, new Integer(2));
+//        assertEquals("2) Check upc", upc, new Integer(2));
+//        assertEquals("2) Check upbool", upbool, new Integer(2));
+
+    }
+
+    @Test
+    public void testConfigurationObj() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) osgiHelper.getServiceObject(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.getServiceObject(ref);
+        props = check.getProps();
+
+        s = (String) props.get("string");
+        ss = (String[]) props.get("strings");
+
+        assertEquals("2) Check string", s, "bar");
+        assertEquals("2) Check strings 0", ss[0], "baz");
+        assertEquals("2) Check strings 1", ss[1], "bar");
+        assertEquals("2) Check strings 2", ss[2], "foo");
+
+//        upString = (Integer) props.get("upstring");
+//        upStrings = (Integer) props.get("upstrings");
+//        
+//        assertEquals("2) Check upString", upString, new Integer(2));
+//        assertEquals("2) Check upStrings", upStrings, new Integer(2));
+    }
+
+    @Test
+    public void testConfigurationObjString() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) osgiHelper.getServiceObject(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.getServiceObject(ref);
+        props = check.getProps();
+
+        s = (String) props.get("string");
+        ss = (String[]) props.get("strings");
+
+        assertEquals("2) Check string", s, "bar");
+        assertEquals("2) Check strings 0", ss[0], "baz");
+        assertEquals("2) Check strings 1", ss[1], "bar");
+        assertEquals("2) Check strings 2", ss[2], "foo");
+
+//        upString = (Integer) props.get("upstring");
+//        upStrings = (Integer) props.get("upstrings");
+//        
+//        assertEquals("2) Check upString", upString, new Integer(2));
+//        assertEquals("2) Check upStrings", upStrings, new Integer(2));
+    }
+
+    private void reconfigure() {
+        Properties props2 = new Properties();
+        props2.put("instance.name", "under-test");
+        props2.put("b", new Byte("2"));
+        props2.put("s", new Short("2"));
+        props2.put("i", new Integer("2"));
+        props2.put("l", new Long("2"));
+        props2.put("d", new Double("2"));
+        props2.put("f", new Float("2"));
+        props2.put("c", new Character('b'));
+        props2.put("bool", new Boolean(false));
+        props2.put("bs", new byte[]{(byte) 3, (byte) 2, (byte) 1});
+        props2.put("ss", new short[]{(short) 3, (short) 2, (short) 1});
+        props2.put("is", new int[]{3, 2, 1});
+        props2.put("ls", new long[]{3, 2, 1});
+        props2.put("ds", new double[]{3, 2, 1});
+        props2.put("fs", new float[]{3, 2, 1});
+        props2.put("cs", new char[]{'c', 'b', 'a'});
+        props2.put("bools", new boolean[]{false, false, false});
+        props2.put("string", "bar");
+        props2.put("strings", new String[]{"baz", "bar", "foo"});
+
+        instance.reconfigure(props2);
+    }
+
+    private void reconfigureString() {
+        Properties props2 = new Properties();
+        props2.put("instance.name", "under-test");
+        props2.put("b", "2");
+        props2.put("s", "2");
+        props2.put("i", "2");
+        props2.put("l", "2");
+        props2.put("d", "2");
+        props2.put("f", "2");
+        props2.put("c", "b");
+        props2.put("bool", "false");
+        props2.put("bs", "{3, 2,1}");
+        props2.put("ss", "{3, 2,1}");
+        props2.put("is", "{3, 2,1}");
+        props2.put("ls", "{3, 2,1}");
+        props2.put("ds", "{3, 2,1}");
+        props2.put("fs", "{3, 2,1}");
+        props2.put("cs", "{c, b , a}");
+        props2.put("bools", "{false,false,false}");
+        props2.put("string", "bar");
+        props2.put("strings", "{baz, bar, foo}");
+
+        instance.reconfigure(props2);
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java Wed Feb 13 16:26:18 2013
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static org.junit.Assert.*;
+
+
+public class TestUpdatedMethod extends Common {
+
+
+
+    ComponentInstance fooProvider1;
+    ComponentInstance fooProvider2;
+    ComponentInstance fooProvider3;
+
+
+
+    @Before
+    public void setUp() {
+        osgiHelper = new OSGiHelper(bc);
+        ipojoHelper = new IPOJOHelper(bc);
+        String type = "CONFIG-FooProviderType-ConfUpdated";
+
+        Hashtable<String, String> p1 = new Hashtable<String, String>();
+        p1.put("instance.name", "FooProvider-1");
+        fooProvider1 = ipojoHelper.createComponentInstance(type, p1);
+
+        Properties p2 = new Properties();
+        p2.put("instance.name", "FooProvider-2");
+        p2.put("int", new Integer(4));
+        p2.put("boolean", new Boolean(false));
+        p2.put("string", new String("bar"));
+        p2.put("strAProp", new String[]{"bar", "foo"});
+        p2.put("intAProp", new int[]{1, 2, 3});
+        fooProvider2 = ipojoHelper.createComponentInstance(bc.getBundle(), type, p2);
+
+        Hashtable<String, String> p3 = new Hashtable<String, String>();
+        p3.put("instance.name", "FooProvider-3");
+        fooProvider3 = ipojoHelper.createComponentInstance("CONFIG-FooProviderType-ConfNoValueUpdated", p3);
+    }
+
+    @After
+    public void tearDown() {
+
+        fooProvider1.dispose();
+        fooProvider2.dispose();
+        fooProvider3.dispose();
+        fooProvider1 = null;
+        fooProvider2 = null;
+        fooProvider3 = null;
+    }
+
+    @Test
+    public void testComponentTypeConfiguration() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check FooService availability", ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        Properties toCheck = fs.fooProps();
+
+        Integer intProp = (Integer) toCheck.get("intProp");
+        Boolean boolProp = (Boolean) toCheck.get("boolProp");
+        String strProp = (String) toCheck.get("strProp");
+        String[] strAProp = (String[]) toCheck.get("strAProp");
+        int[] intAProp = (int[]) toCheck.get("intAProp");
+
+        // Check updated
+        Integer updated = (Integer) toCheck.get("updated");
+        Dictionary dict = (Dictionary) toCheck.get("lastupdated");
+
+        assertEquals("Check intProp equality (1)", intProp, new Integer(2));
+        assertEquals("Check longProp equality (1)", boolProp, new Boolean(false));
+        assertEquals("Check strProp equality (1)", strProp, new String("foo"));
+        assertNotNull("Check strAProp not nullity (1)", strAProp);
+        String[] v = new String[]{"foo", "bar"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality (1) : " + strAProp[i] + " != " + v[i]);
+            }
+        }
+        assertNotNull("Check intAProp not nullity", intAProp);
+        int[] v2 = new int[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality (1) : " + intAProp[i] + " != " + v2[i]);
+            }
+        }
+
+        assertEquals("updated count ", 1, updated.intValue());
+        assertEquals("Last updated", 5, dict.size());
+
+        // change the field value
+        assertTrue("Invoke the fs service", fs.foo());
+        toCheck = fs.fooProps();
+
+
+        //	Re-check the property (change)
+        intProp = (Integer) toCheck.get("intProp");
+        boolProp = (Boolean) toCheck.get("boolProp");
+        strProp = (String) toCheck.get("strProp");
+        strAProp = (String[]) toCheck.get("strAProp");
+        intAProp = (int[]) toCheck.get("intAProp");
+
+        // Check updated
+        updated = (Integer) toCheck.get("updated");
+        dict = (Dictionary) toCheck.get("lastupdated");
+
+        assertEquals("Check intProp equality (2) (" + intProp + ")", intProp, new Integer(3));
+        assertEquals("Check longProp equality (2)", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality (2)", strProp, new String("bar"));
+        assertNotNull("Check strAProp not nullity (2)", strAProp);
+        v = new String[]{"foo", "bar", "baz"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality (2)");
+            }
+        }
+        assertNotNull("Check intAProp not nullity (2)", intAProp);
+        v2 = new int[]{3, 2, 1};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality (2) : " + intAProp[i] + " != " + v2[i]);
+            }
+        }
+
+        // This does not reconfigure...
+        assertEquals("updated count -2 ", 1, updated.intValue());
+        assertEquals("Last update - 2", 5, dict.size());
+
+        fs = null;
+    }
+
+    @Test
+    public void testNoValue() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        FooService fs = (FooService) osgiHelper.getServiceObject(sr);
+        Properties toCheck = fs.fooProps();
+
+        // Check service properties
+        Integer intProp = (Integer) toCheck.get("intProp");
+        Boolean boolProp = (Boolean) toCheck.get("boolProp");
+        String strProp = (String) toCheck.get("strProp");
+        String[] strAProp = (String[]) toCheck.get("strAProp");
+        int[] intAProp = (int[]) toCheck.get("intAProp");
+
+        // Check updated
+        Integer updated = (Integer) toCheck.get("updated");
+        Dictionary dict = (Dictionary) toCheck.get("lastupdated");
+
+        assertEquals("Check intProp equality", intProp, new Integer(0));
+        assertEquals("Check longProp equality", boolProp, new Boolean(false));
+        assertEquals("Check strProp equality", strProp, null);
+        assertNull("Check strAProp nullity", strAProp);
+        assertNull("Check intAProp  nullity", intAProp);
+
+        assertEquals("updated count ", 1, updated.intValue());
+        assertEquals("Last update", 0, dict.size());
+
+        assertTrue("invoke fs", fs.foo());
+        toCheck = fs.fooProps();
+
+        // Re-check the property (change)
+        intProp = (Integer) toCheck.get("intProp");
+        boolProp = (Boolean) toCheck.get("boolProp");
+        strProp = (String) toCheck.get("strProp");
+        strAProp = (String[]) toCheck.get("strAProp");
+        intAProp = (int[]) toCheck.get("intAProp");
+
+        updated = (Integer) toCheck.get("updated");
+        dict = (Dictionary) toCheck.get("lastupdated");
+
+        assertEquals("Check intProp equality", intProp, new Integer(3));
+        assertEquals("Check longProp equality", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality", strProp, new String("bar"));
+        assertNotNull("Check strAProp not nullity", strAProp);
+        String[] v = new String[]{"foo", "bar", "baz"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNotNull("Check intAProp not nullity", intAProp);
+        int[] v2 = new int[]{3, 2, 1};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        fs = null;
+    }
+
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java Wed Feb 13 16:26:18 2013
@@ -0,0 +1,349 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedService;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static junit.framework.Assert.*;
+
+
+public class TestUpdatedMethodAndManagedService extends Common {
+
+
+
+    /**
+     * Instance where the ManagedServicePID is provided by the component type.
+     */
+    ComponentInstance instance1;
+    /**
+     * Instance where the ManagedServicePID is provided by the instance.
+     */
+    ComponentInstance instance2;
+
+    /**
+     * Instance without configuration.
+     */
+    ComponentInstance instance3;
+
+
+
+    @Before
+    public void setUp() {
+        osgiHelper = new OSGiHelper(bc);
+        ipojoHelper = new IPOJOHelper(bc);
+        String type = "CONFIG-FooProviderType-4Updated";
+        Hashtable<String, String> p = new Hashtable<String, String>();
+        p.put("instance.name", "instance");
+        p.put("foo", "foo");
+        p.put("bar", "2");
+        p.put("baz", "baz");
+        instance1 = ipojoHelper.createComponentInstance(type, p);
+        assertEquals("instance1 created", ComponentInstance.VALID, instance1.getState());
+
+        type = "CONFIG-FooProviderType-3Updated";
+        Hashtable<String, String> p1 = new Hashtable<String, String>();
+        p1.put("instance.name", "instance-2");
+        p1.put("foo", "foo");
+        p1.put("bar", "2");
+        p1.put("baz", "baz");
+        p1.put("managed.service.pid", "instance");
+        instance2 = ipojoHelper.createComponentInstance(type, p1);
+
+        type = "CONFIG-FooProviderType-3Updated";
+        Hashtable<String, String> p2 = new Hashtable<String, String>();
+        p2.put("instance.name", "instance-3");
+        p2.put("managed.service.pid", "instance-3");
+        instance3 = ipojoHelper.createComponentInstance(type, p2);
+    }
+
+
+    @After
+    public void tearDown() {
+
+        instance1.dispose();
+        instance2.dispose();
+        instance3.dispose();
+        instance1 = null;
+        instance2 = null;
+        instance3 = null;
+    }
+
+    @Test
+    public void testStaticInstance1() {
+        ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check FS availability", fooRef);
+        String fooP = (String) fooRef.getProperty("foo");
+        Integer barP = (Integer) fooRef.getProperty("bar");
+        String bazP = (String) fooRef.getProperty("baz");
+        assertEquals("Check foo equality -1", fooP, "foo");
+        assertEquals("Check bar equality -1", barP, new Integer(2));
+        assertEquals("Check baz equality -1", bazP, "baz");
+
+        ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(),
+                "FooProvider-3");
+        assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+        // Configuration of baz
+        Properties conf = new Properties();
+        conf.put("baz", "zab");
+        conf.put("bar", new Integer(2));
+        conf.put("foo", "foo");
+        ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        // Re-check props
+        fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+        fooP = (String) fooRef.getProperty("foo");
+        barP = (Integer) fooRef.getProperty("bar");
+        bazP = (String) fooRef.getProperty("baz");
+        assertEquals("Check foo equality -2", fooP, "foo");
+        assertEquals("Check bar equality -2", barP, new Integer(2));
+        assertEquals("Check baz equality -2", bazP, "zab");
+
+        // Get Service
+        FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+        Integer updated = (Integer) fs.fooProps().get("updated");
+        Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated", 1, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+
+    }
+
+    @Test
+    public void testStaticInstance2() {
+        ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check FS availability", fooRef);
+        String fooP = (String) fooRef.getProperty("foo");
+        Integer barP = (Integer) fooRef.getProperty("bar");
+        String bazP = (String) fooRef.getProperty("baz");
+        assertEquals("Check foo equality -1", fooP, "foo");
+        assertEquals("Check bar equality -1", barP, new Integer(2));
+        assertEquals("Check baz equality -1", bazP, "baz");
+
+        ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(),
+                "instance");
+        assertNotNull("Check ManagedService availability", msRef);
+
+
+        // Configuration of baz
+        Properties conf = new Properties();
+        conf.put("baz", "zab");
+        conf.put("bar", new Integer(2));
+        conf.put("foo", "foo");
+        ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        // Recheck props
+        fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+        fooP = (String) fooRef.getProperty("foo");
+        barP = (Integer) fooRef.getProperty("bar");
+        bazP = (String) fooRef.getProperty("baz");
+        assertEquals("Check foo equality -2", fooP, "foo");
+        assertEquals("Check bar equality -2", barP, new Integer(2));
+        assertEquals("Check baz equality -2", bazP, "zab");
+
+        // Get Service
+        FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+        Integer updated = (Integer) fs.fooProps().get("updated");
+        Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated", 1, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+
+        conf.put("baz", "zab2");
+        conf.put("foo", "oof2");
+        conf.put("bar", new Integer(0));
+        ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        updated = (Integer) fs.fooProps().get("updated");
+        dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated -2", 2, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+    }
+
+    @Test
+    public void testDynamicInstance1() {
+        ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check FS availability", fooRef);
+
+        String fooP = (String) fooRef.getProperty("foo");
+        Integer barP = (Integer) fooRef.getProperty("bar");
+        String bazP = (String) fooRef.getProperty("baz");
+
+        assertEquals("Check foo equality", fooP, "foo");
+        assertEquals("Check bar equality", barP, new Integer(2));
+        assertEquals("Check baz equality", bazP, "baz");
+
+        ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(),
+                "FooProvider-3");
+        assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+        // Configuration of baz
+        Properties conf = new Properties();
+        conf.put("baz", "zab");
+        conf.put("foo", "oof");
+        conf.put("bar", new Integer(0));
+        ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        // Re-check props
+        fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName());
+        fooP = (String) fooRef.getProperty("foo");
+        barP = (Integer) fooRef.getProperty("bar");
+        bazP = (String) fooRef.getProperty("baz");
+
+        assertEquals("Check foo equality", fooP, "oof");
+        assertEquals("Check bar equality", barP, new Integer(0));
+        assertEquals("Check baz equality", bazP, "zab");
+
+        // Check field value
+        FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+        Properties p = fs.fooProps();
+        fooP = (String) p.get("foo");
+        barP = (Integer) p.get("bar");
+
+        assertEquals("Check foo field equality", fooP, "oof");
+        assertEquals("Check bar field equality", barP, new Integer(0));
+
+        Integer updated = (Integer) fs.fooProps().get("updated");
+        Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated -1", 1, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+
+        conf.put("baz", "zab2");
+        conf.put("foo", "oof2");
+        conf.put("bar", new Integer(0));
+        ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        updated = (Integer) fs.fooProps().get("updated");
+        dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated -2", 2, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+    }
+
+    @Test
+    public void testDynamicInstance2() {
+        ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check FS availability", fooRef);
+
+        String fooP = (String) fooRef.getProperty("foo");
+        Integer barP = (Integer) fooRef.getProperty("bar");
+        String bazP = (String) fooRef.getProperty("baz");
+
+        assertEquals("Check foo equality", fooP, "foo");
+        assertEquals("Check bar equality", barP, new Integer(2));
+        assertEquals("Check baz equality", bazP, "baz");
+
+        ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance");
+        assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+        // Configuration of baz
+        Properties conf = new Properties();
+        conf.put("baz", "zab");
+        conf.put("foo", "oof");
+        conf.put("bar", new Integer(0));
+        ManagedService ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        // Recheck props
+        fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+        fooP = (String) fooRef.getProperty("foo");
+        barP = (Integer) fooRef.getProperty("bar");
+        bazP = (String) fooRef.getProperty("baz");
+
+        assertEquals("Check foo equality", fooP, "oof");
+        assertEquals("Check bar equality", barP, new Integer(0));
+        assertEquals("Check baz equality", bazP, "zab");
+
+        // Check field value
+        FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+        Properties p = fs.fooProps();
+        fooP = (String) p.get("foo");
+        barP = (Integer) p.get("bar");
+
+        assertEquals("Check foo field equality", fooP, "oof");
+        assertEquals("Check bar field equality", barP, new Integer(0));
+
+        Integer updated = (Integer) fs.fooProps().get("updated");
+        Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated", 1, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+
+        conf.put("baz", "zab2");
+        conf.put("foo", "oof2");
+        conf.put("bar", new Integer(0));
+        ms = (ManagedService) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        updated = (Integer) fs.fooProps().get("updated");
+        dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated -2", 2, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+
+    }
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedServiceFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedServiceFactory.java?rev=1445708&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedServiceFactory.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedServiceFactory.java Wed Feb 13 16:26:18 2013
@@ -0,0 +1,330 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import static junit.framework.Assert.*;
+
+
+public class TestUpdatedMethodAndManagedServiceFactory extends Common {
+
+
+
+    ComponentInstance instance, instance2;
+
+
+
+    @Before
+    public void setUp() {
+        osgiHelper = new OSGiHelper(bc);
+        ipojoHelper = new IPOJOHelper(bc);
+        String type = "CONFIG-FooProviderType-3Updated";
+
+        Hashtable<String, String> p1 = new Hashtable<String, String>();
+        p1.put("instance.name", "instance");
+        p1.put("foo", "foo");
+        p1.put("bar", "2");
+        p1.put("baz", "baz");
+        instance = ipojoHelper.createComponentInstance(type, p1);
+
+        Hashtable<String, String> p2 = new Hashtable<String, String>();
+        p2.put("instance.name", "instance2");
+
+        instance2 = ipojoHelper.createComponentInstance(type, p2);
+    }
+
+    @After
+    public void tearDown() {
+
+        instance.dispose();
+        instance2.dispose();
+        instance2 = null;
+        instance = null;
+    }
+
+    @Test
+    public void testStatic() {
+
+        ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+        assertNotNull("Check FS availability", fooRef);
+        String fooP = (String) fooRef.getProperty("foo");
+        Integer barP = (Integer) fooRef.getProperty("bar");
+        String bazP = (String) fooRef.getProperty("baz");
+        assertEquals("Check foo equality -1", fooP, "foo");
+        assertEquals("Check bar equality -1", barP, new Integer(2));
+        assertEquals("Check baz equality -1", bazP, "baz");
+
+        ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+        assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+
+        // Configuration of baz
+        Properties conf = new Properties();
+        conf.put("baz", "zab");
+        conf.put("bar", new Integer(2));
+        conf.put("foo", "foo");
+        ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(instance.getInstanceName(), conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        // Recheck props
+        fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+        fooP = (String) fooRef.getProperty("foo");
+        barP = (Integer) fooRef.getProperty("bar");
+        bazP = (String) fooRef.getProperty("baz");
+        assertEquals("Check foo equality -2", fooP, "foo");
+        assertEquals("Check bar equality -2", barP, new Integer(2));
+        assertEquals("Check baz equality -2", bazP, "zab");
+
+        // Get Service
+        FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+        Integer updated = (Integer) fs.fooProps().get("updated");
+        Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated", 1, updated.intValue());
+        System.out.println("Dictionary : " + dict);
+        assertEquals("Check last updated", 3, dict.size()); // foo bar and baz as a service prooperties.
+    }
+
+    @Test
+    public void testStaticNoValue() {
+        ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check FS availability", fooRef);
+        Object fooP = fooRef.getProperty("foo");
+        Object barP = fooRef.getProperty("bar");
+        Object bazP = fooRef.getProperty("baz");
+        assertEquals("Check foo equality -1", fooP, null);
+        assertEquals("Check bar equality -1", barP, null);
+        assertEquals("Check baz equality -1", bazP, null);
+
+        ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+        assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+
+        // Configuration of baz
+        Properties conf = new Properties();
+        conf.put("baz", "zab");
+        conf.put("bar", new Integer(2));
+        conf.put("foo", "foo");
+        ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(instance2.getInstanceName(), conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        // Recheck props
+        fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+        fooP = (String) fooRef.getProperty("foo");
+        barP = (Integer) fooRef.getProperty("bar");
+        bazP = (String) fooRef.getProperty("baz");
+        assertEquals("Check foo equality -2", fooP, "foo");
+        assertEquals("Check bar equality -2", barP, new Integer(2));
+        assertEquals("Check baz equality -2", bazP, "zab");
+
+        // Get Service
+        FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+        Integer updated = (Integer) fs.fooProps().get("updated");
+        Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated", 1, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+    }
+
+    @Test
+    public void testDynamic() {
+        ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+        assertNotNull("Check FS availability", fooRef);
+
+        String fooP = (String) fooRef.getProperty("foo");
+        Integer barP = (Integer) fooRef.getProperty("bar");
+        String bazP = (String) fooRef.getProperty("baz");
+
+        assertEquals("Check foo equality", fooP, "foo");
+        assertEquals("Check bar equality", barP, new Integer(2));
+        assertEquals("Check baz equality", bazP, "baz");
+
+        ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+        assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+        // Configuration of baz
+        Properties conf = new Properties();
+        conf.put("baz", "zab");
+        conf.put("foo", "oof");
+        conf.put("bar", new Integer(0));
+        ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(instance.getInstanceName(), conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        // Recheck props
+        fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+        fooP = (String) fooRef.getProperty("foo");
+        barP = (Integer) fooRef.getProperty("bar");
+        bazP = (String) fooRef.getProperty("baz");
+
+        assertEquals("Check foo equality", fooP, "oof");
+        assertEquals("Check bar equality", barP, new Integer(0));
+        assertEquals("Check baz equality", bazP, "zab");
+
+        // Check field value
+        FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+        Properties p = fs.fooProps();
+        fooP = (String) p.get("foo");
+        barP = (Integer) p.get("bar");
+
+        assertEquals("Check foo field equality", fooP, "oof");
+        assertEquals("Check bar field equality", barP, new Integer(0));
+
+        Integer updated = (Integer) fs.fooProps().get("updated");
+        Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated", 1, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+    }
+
+    @Test
+    public void testDynamicNoValue() {
+        ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check FS availability", fooRef);
+
+        Object fooP = fooRef.getProperty("foo");
+        Object barP = fooRef.getProperty("bar");
+        Object bazP = fooRef.getProperty("baz");
+        assertEquals("Check foo equality -1", fooP, null);
+        assertEquals("Check bar equality -1", barP, null);
+        assertEquals("Check baz equality -1", bazP, null);
+
+        ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance2.getFactory().getName());
+        assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+        // Configuration of baz
+        Properties conf = new Properties();
+        conf.put("baz", "zab");
+        conf.put("foo", "oof");
+        conf.put("bar", new Integer(0));
+        ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(instance2.getInstanceName(), conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        // Recheck props
+        fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName());
+        fooP = (String) fooRef.getProperty("foo");
+        barP = (Integer) fooRef.getProperty("bar");
+        bazP = (String) fooRef.getProperty("baz");
+
+        assertEquals("Check foo equality", fooP, "oof");
+        assertEquals("Check bar equality", barP, new Integer(0));
+        assertEquals("Check baz equality", bazP, "zab");
+
+        // Check field value
+        FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+        Properties p = fs.fooProps();
+        fooP = (String) p.get("foo");
+        barP = (Integer) p.get("bar");
+
+        assertEquals("Check foo field equality", fooP, "oof");
+        assertEquals("Check bar field equality", barP, new Integer(0));
+
+        Integer updated = (Integer) fs.fooProps().get("updated");
+        Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated", 1, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+
+    }
+
+
+    @Test
+    public void testDynamicString() {
+        ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+        assertNotNull("Check FS availability", fooRef);
+
+        String fooP = (String) fooRef.getProperty("foo");
+        Integer barP = (Integer) fooRef.getProperty("bar");
+        String bazP = (String) fooRef.getProperty("baz");
+
+        assertEquals("Check foo equality", fooP, "foo");
+        assertEquals("Check bar equality", barP, new Integer(2));
+        assertEquals("Check baz equality", bazP, "baz");
+
+        ServiceReference msRef = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), instance.getFactory().getName());
+        assertNotNull("Check ManagedServiceFactory availability", msRef);
+
+        // Configuration of baz
+        Properties conf = new Properties();
+        conf.put("baz", "zab");
+        conf.put("foo", "oof");
+        conf.put("bar", "0");
+        ManagedServiceFactory ms = (ManagedServiceFactory) osgiHelper.getServiceObject(msRef);
+        try {
+            ms.updated(instance.getInstanceName(), conf);
+        } catch (ConfigurationException e) {
+            fail("Configuration Exception : " + e);
+        }
+
+        // Recheck props
+        fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName());
+        fooP = (String) fooRef.getProperty("foo");
+        barP = (Integer) fooRef.getProperty("bar");
+        bazP = (String) fooRef.getProperty("baz");
+
+        assertEquals("Check foo equality", fooP, "oof");
+        assertEquals("Check bar equality", barP, new Integer(0));
+        assertEquals("Check baz equality", bazP, "zab");
+
+        // Check field value
+        FooService fs = (FooService) osgiHelper.getServiceObject(fooRef);
+        Properties p = fs.fooProps();
+        fooP = (String) p.get("foo");
+        barP = (Integer) p.get("bar");
+
+        assertEquals("Check foo field equality", fooP, "oof");
+        assertEquals("Check bar field equality", barP, new Integer(0));
+
+        Integer updated = (Integer) fs.fooProps().get("updated");
+        Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated");
+
+        assertEquals("Check updated", 1, updated.intValue());
+        assertEquals("Check last updated", 3, dict.size());
+    }
+
+}