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 2008/11/14 12:06:00 UTC

svn commit: r713976 [2/3] - in /felix/trunk/ipojo: annotations/src/main/java/org/apache/felix/ipojo/annotations/ composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ composite/src/main/resources/ core/src/main/java/org/apache/feli...

Modified: felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestBothProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestBothProperties.java?rev=713976&r1=713975&r2=713976&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestBothProperties.java (original)
+++ felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestBothProperties.java Fri Nov 14 03:05:57 2008
@@ -29,7 +29,7 @@
 
 public class TestBothProperties extends OSGiTestCase {
     
-    ComponentInstance instance;
+    ComponentInstance instance, instance2;
 
     
     public void setUp() {
@@ -61,12 +61,20 @@
            fail("Cannot create the under-test instance : " + e.getMessage());
         }
         
+        try {
+            instance2 = fact.createComponentInstance(null);
+        } catch(Exception e) {
+           fail("Cannot create the under-test instance2 : " + e.getMessage());
+        }
+        
         
     }
     
     public void tearDown() {
         instance.dispose();
+        instance2.dispose();
         instance = null;
+        instance2 = null;
     }
     
     public void testConfigurationPrimitive() {
@@ -111,7 +119,7 @@
         assertEquals("Check upc", upc, new Integer(1));
         assertEquals("Check upbool", upbool, new Integer(1));
         
-        reconfigure();
+        reconfigure(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -198,7 +206,7 @@
         assertEquals("Check upc", upc, new Integer(1));
         assertEquals("Check upbool", upbool, new Integer(1));
         
-        reconfigureString();
+        reconfigureString(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -301,7 +309,7 @@
         assertEquals("Check upc", upc, new Integer(1));
         assertEquals("Check upbool", upbool, new Integer(1));
         
-        reconfigure();
+        reconfigure(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -420,7 +428,7 @@
         assertEquals("Check upc", upc, new Integer(1));
         assertEquals("Check upbool", upbool, new Integer(1));
         
-        reconfigureString();
+        reconfigureString(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -501,7 +509,7 @@
         assertEquals("Check upString", upString, new Integer(1));
         assertEquals("Check upStrings", upStrings, new Integer(1));
         
-        reconfigure();
+        reconfigure(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -543,7 +551,7 @@
         assertEquals("Check upString", upString, new Integer(1));
         assertEquals("Check upStrings", upStrings, new Integer(1));
         
-        reconfigureString();
+        reconfigureString(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -565,9 +573,8 @@
         assertEquals("2) Check upstrings", upStrings, new Integer(2));
     }
     
-    private void reconfigure() {
+    private void reconfigure(ComponentInstance ci) {
         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"));
@@ -587,12 +594,11 @@
         props2.put("string", "bar");
         props2.put("strings", new String[]{"baz", "bar", "foo"});
         
-        instance.reconfigure(props2);
+        ci.reconfigure(props2);
     }
     
-    private void reconfigureString() {
+    private void reconfigureString(ComponentInstance ci) {
         Properties props2 = new Properties();
-        props2.put("instance.name","under-test");
         props2.put("b", "2");
         props2.put("s", "2");
         props2.put("i", "2");
@@ -612,7 +618,239 @@
         props2.put("string", "bar");
         props2.put("strings", "{baz, bar, foo}");
         
-        instance.reconfigure(props2);
+        ci.reconfigure(props2);
+    }
+
+    public void testConfigurationPrimitiveNoValue() {
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) context.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(instance2);
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) context.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");
+        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(1));
+        assertEquals("2) Check ups", ups, new Integer(1));
+        assertEquals("2) Check upi", upi, new Integer(1));
+        assertEquals("2) Check upl", upl, new Integer(1));
+        assertEquals("2) Check upd", upd, new Integer(1));
+        assertEquals("2) Check upf", upf, new Integer(1));
+        assertEquals("2) Check upc", upc, new Integer(1));
+        //assertEquals("2) Check upbool", upbool, new Integer(1)); // TODO Why 0 ???
+        
+    }
+
+    public void testConfigurationPrimitiveArraysNoValue() {
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) context.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(instance2);
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) context.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");
+        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);
+        assertEquals("2) Check d 1", d[1], 2);
+        assertEquals("2) Check d 2", d[2], 1);
+        assertEquals("2) Check f 0", f[0], 3);
+        assertEquals("2) Check f 1", f[1], 2);
+        assertEquals("2) Check f 2", f[2], 1);
+        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(1));
+        assertEquals("2) Check ups", ups, new Integer(1));
+        assertEquals("2) Check upi", upi, new Integer(1));
+        assertEquals("2) Check upl", upl, new Integer(1));
+        assertEquals("2) Check upd", upd, new Integer(1));
+        assertEquals("2) Check upf", upf, new Integer(1));
+        assertEquals("2) Check upc", upc, new Integer(1));
+        assertEquals("2) Check upbool", upbool, new Integer(1));
+        
+    }
+
+    public void testConfigurationObjNoValue() {
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) context.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(instance2);
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) context.getService(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(1));
+        assertEquals("2) Check upstrings", upStrings, new Integer(1));
     }
 
 }

Modified: felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestFieldProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestFieldProperties.java?rev=713976&r1=713975&r2=713976&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestFieldProperties.java (original)
+++ felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestFieldProperties.java Fri Nov 14 03:05:57 2008
@@ -21,7 +21,10 @@
 import java.util.Properties;
 
 import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.ConfigurationException;
 import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.MissingHandlerException;
+import org.apache.felix.ipojo.UnacceptableConfiguration;
 import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
 import org.apache.felix.ipojo.test.scenarios.configuration.service.CheckService;
 import org.apache.felix.ipojo.test.scenarios.util.Utils;
@@ -30,6 +33,7 @@
 public class TestFieldProperties extends OSGiTestCase {
     
     ComponentInstance instance;
+    ComponentInstance instance2;
     
     public void setUp() {
         Factory fact = Utils.getFactoryByName(context, "CONFIG-FieldConfigurableCheckService");
@@ -60,12 +64,23 @@
            fail("Cannot create the under-test instance : " + e.getMessage());
         }
         
+        try {
+            instance2 = fact.createComponentInstance(null);
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail("Cannot create the instance : " + e.getMessage());
+
+        }
+
+        
         
     }
     
     public void tearDown() {
         instance.dispose();
+        instance2.dispose();
         instance = null;
+        instance2 = null;
     }
     
     public void testConfigurationPrimitive() {
@@ -92,7 +107,7 @@
         assertEquals("Check c", c, new Character('a'));
         assertEquals("Check bool", bool, new Boolean("true"));
         
-        reconfigure();
+        reconfigure(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -118,6 +133,57 @@
         assertEquals("2) Check bool", bool, new Boolean("false"));
         
     }
+    
+    public void testConfigurationPrimitiveNoValue() {
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) context.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));
+        
+        reconfigure(instance2);
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) context.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");
+        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, 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"));
+        
+    }
 
     public void testConfigurationPrimitiveString() {
         ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
@@ -143,7 +209,7 @@
         assertEquals("Check c", c, new Character('a'));
         assertEquals("Check bool", bool, new Boolean("true"));
         
-        reconfigureString();
+        reconfigureString(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -170,6 +236,57 @@
         
     }
     
+    public void testConfigurationPrimitiveStringNoValue() {
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) context.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));
+        
+        reconfigureString(instance2);
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) context.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");
+        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, 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"));
+        
+    }
+    
     public void testConfigurationPrimitiveArrays() {
         ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -210,7 +327,7 @@
         assertTrue("Check bool 1", bool[0]);
         assertTrue("Check bool 2", bool[0]);
         
-        reconfigure();
+        reconfigure(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -252,6 +369,73 @@
         assertFalse("2) Check bool 2", bool[0]);
         
     }
+    
+    public void testConfigurationPrimitiveArraysNoValue() {
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) context.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);
+   
+        reconfigure(instance2);
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) context.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");
+        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);
+        assertEquals("2) Check d 1", d[1], 2);
+        assertEquals("2) Check d 2", d[2], 1);
+        assertEquals("2) Check f 0", f[0], 3);
+        assertEquals("2) Check f 1", f[1], 2);
+        assertEquals("2) Check f 2", f[2], 1);
+        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]);
+        
+    }
 
     public void testConfigurationPrimitiveArraysString() {
         ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
@@ -293,7 +477,7 @@
         assertTrue("Check bool 1", bool[0]);
         assertTrue("Check bool 2", bool[0]);
         
-        reconfigureString();
+        reconfigureString(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -336,6 +520,73 @@
         
     }
     
+    public void testConfigurationPrimitiveArraysStringNoValue() {
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) context.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);
+        
+        reconfigureString(instance2);
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) context.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");
+        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);
+        assertEquals("2) Check d 1", d[1], 2);
+        assertEquals("2) Check d 2", d[2], 1);
+        assertEquals("2) Check f 0", f[0], 3);
+        assertEquals("2) Check f 1", f[1], 2);
+        assertEquals("2) Check f 2", f[2], 1);
+        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]);
+        
+    }
+    
     public void testConfigurationObj() {
         ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -350,7 +601,7 @@
         assertEquals("Check strings 1", ss[1], "bar");
         assertEquals("Check strings 2", ss[2], "baz");
         
-        reconfigure();
+        reconfigure(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -365,6 +616,34 @@
         assertEquals("2) Check strings 1", ss[1], "bar");
         assertEquals("2) Check strings 2", ss[2], "foo");
     }
+    
+    public void testConfigurationObjNoValue() {
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) context.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);
+        
+        reconfigure(instance2);
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) context.getService(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");
+    }
 
     public void testConfigurationObjString() {
         ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
@@ -380,7 +659,7 @@
         assertEquals("Check strings 1", ss[1], "bar");
         assertEquals("Check strings 2", ss[2], "baz");
         
-        reconfigureString();
+        reconfigureString(instance);
         
         ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance.getInstanceName());
         assertNotNull("Test check service availability", ref);
@@ -396,9 +675,36 @@
         assertEquals("2) Check strings 2", ss[2], "foo");
     }
     
-    private void reconfigure() {
+    public void testConfigurationObjStringNoValue() {
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        CheckService check = (CheckService) context.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);
+        
+        reconfigureString(instance2);
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Test check service availability", ref);
+        check = (CheckService) context.getService(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");
+    }
+    
+    private void reconfigure(ComponentInstance ci) {
         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"));
@@ -418,12 +724,11 @@
         props2.put("string", "bar");
         props2.put("strings", new String[]{"baz", "bar", "foo"});
         
-        instance.reconfigure(props2);
+        ci.reconfigure(props2);
     }
     
-    private void reconfigureString() {
+    private void reconfigureString(ComponentInstance ci) {
         Properties props2 = new Properties();
-        props2.put("instance.name","under-test");
         props2.put("b", "2");
         props2.put("s", "2");
         props2.put("i", "2");
@@ -443,7 +748,7 @@
         props2.put("string", "bar");
         props2.put("strings", "{baz, bar, foo}");
         
-        instance.reconfigure(props2);
+        ci.reconfigure(props2);
     }
 
 }

Modified: felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestMethodProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestMethodProperties.java?rev=713976&r1=713975&r2=713976&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestMethodProperties.java (original)
+++ felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestMethodProperties.java Fri Nov 14 03:05:57 2008
@@ -32,6 +32,8 @@
     ComponentInstance instance;
     
     ComponentInstance instance2;
+    
+    ComponentInstance instance3;
 
     public void setUp() {
         Factory fact = Utils.getFactoryByName(context, "CONFIG-MethodConfigurableCheckService");
@@ -90,14 +92,23 @@
            fail("Cannot create the under-test instance 2 : " + e.getMessage());
         }
         
+        try {
+            instance3 = fact.createComponentInstance(null);
+        } catch(Exception e) {
+           e.printStackTrace();
+           fail("Cannot create the under-test instance 3 : " + e.getMessage());
+        }
+        
         
     }
     
     public void tearDown() {
         instance.dispose();
         instance2.dispose();
+        instance3.dispose();
         instance = null;
         instance2 = null;
+        instance3 = null;
     }
     
     public void testConfigurationPrimitive() {
@@ -1140,4 +1151,468 @@
         ci.reconfigure(props2);
     }
 
+    public void testConfigurationPrimitiveNoValue() {
+            ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            CheckService check = (CheckService) context.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(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            check = (CheckService) context.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");
+            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(1));
+            assertEquals("2) Check ups", ups, new Integer(1));
+            assertEquals("2) Check upi", upi, new Integer(1));
+            assertEquals("2) Check upl", upl, new Integer(1));
+            assertEquals("2) Check upd", upd, new Integer(1));
+            assertEquals("2) Check upf", upf, new Integer(1));
+            assertEquals("2) Check upc", upc, new Integer(1));
+            assertEquals("2) Check upbool", upbool, new Integer(1));
+            
+        }
+
+    public void testConfigurationPrimitiveStringNoValue() {
+            ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            CheckService check = (CheckService) context.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(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            check = (CheckService) context.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");
+            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(1));
+            assertEquals("2) Check ups", ups, new Integer(1));
+            assertEquals("2) Check upi", upi, new Integer(1));
+            assertEquals("2) Check upl", upl, new Integer(1));
+            assertEquals("2) Check upd", upd, new Integer(1));
+            assertEquals("2) Check upf", upf, new Integer(1));
+            assertEquals("2) Check upc", upc, new Integer(1));
+            assertEquals("2) Check upbool", upbool, new Integer(1));
+            
+        }
+
+    public void testConfigurationPrimitiveArraysNoValue() {
+            ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            CheckService check = (CheckService) context.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(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            check = (CheckService) context.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");
+            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);
+            assertEquals("2) Check d 1", d[1], 2);
+            assertEquals("2) Check d 2", d[2], 1);
+            assertEquals("2) Check f 0", f[0], 3);
+            assertEquals("2) Check f 1", f[1], 2);
+            assertEquals("2) Check f 2", f[2], 1);
+            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(1));
+            assertEquals("2) Check ups", ups, new Integer(1));
+            assertEquals("2) Check upi", upi, new Integer(1));
+            assertEquals("2) Check upl", upl, new Integer(1));
+            assertEquals("2) Check upd", upd, new Integer(1));
+            assertEquals("2) Check upf", upf, new Integer(1));
+            assertEquals("2) Check upc", upc, new Integer(1));
+            assertEquals("2) Check upbool", upbool, new Integer(1));
+            
+        }
+
+    public void testConfigurationPrimitiveArraysStringNoValue() {
+            ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            CheckService check = (CheckService) context.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(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            check = (CheckService) context.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");
+            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);
+            assertEquals("2) Check d 1", d[1], 2);
+            assertEquals("2) Check d 2", d[2], 1);
+            assertEquals("2) Check f 0", f[0], 3);
+            assertEquals("2) Check f 1", f[1], 2);
+            assertEquals("2) Check f 2", f[2], 1);
+            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(1));
+            assertEquals("2) Check ups", ups, new Integer(1));
+            assertEquals("2) Check upi", upi, new Integer(1));
+            assertEquals("2) Check upl", upl, new Integer(1));
+            assertEquals("2) Check upd", upd, new Integer(1));
+            assertEquals("2) Check upf", upf, new Integer(1));
+            assertEquals("2) Check upc", upc, new Integer(1));
+            assertEquals("2) Check upbool", upbool, new Integer(1));
+            
+        }
+
+    public void testConfigurationObjNoValue() {
+            ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            CheckService check = (CheckService) context.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(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            check = (CheckService) context.getService(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(1));
+            assertEquals("2) Check upStrings", upStrings, new Integer(1));
+        }
+
+    public void testConfigurationObjStringNoValue() {
+            ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            CheckService check = (CheckService) context.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(context, CheckService.class.getName(), instance3.getInstanceName());
+            assertNotNull("Test check service availability", ref);
+            check = (CheckService) context.getService(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(1));
+            assertEquals("2) Check upStrings", upStrings, new Integer(1));
+        }
+
 }

Added: felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestPropertyModifier.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestPropertyModifier.java?rev=713976&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestPropertyModifier.java (added)
+++ felix/trunk/ipojo/tests/core/configuration/src/main/java/org/apache/felix/ipojo/test/scenarios/configuration/TestPropertyModifier.java Fri Nov 14 03:05:57 2008
@@ -0,0 +1,76 @@
+package org.apache.felix.ipojo.test.scenarios.configuration;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.configuration.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.configuration.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class TestPropertyModifier extends OSGiTestCase {
+    
+    public void testPropertyModifier() {
+        ComponentInstance ci = null; 
+        Factory factory =  Utils.getFactoryByName(context, "org.apache.felix.ipojo.test.scenarios.component.PropertyModifier");
+        Properties props = new Properties();
+        props.put("cls", new String[] {FooService.class.getName()});
+        try {
+            ci = factory.createComponentInstance(props);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        } 
+        
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), ci.getInstanceName());
+        assertNotNull("Check ref", ref);
+        
+        // Check the service property
+        // Not exposed here:
+        assertNull("Classes -0", ref.getProperty("classes"));
+        
+        CheckService check = (CheckService) context.getService(ref);
+        assertTrue(check.check());
+        
+        // Property exposed now.
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), ci.getInstanceName());
+        Class[] str = (Class[]) ref.getProperty("classes");
+        assertEquals("Classes size", 1, str.length);
+        assertEquals("Classes[0]", FooService.class.getName(), str[0].getName());
+        
+        Properties p = check.getProps();
+        Class[] str2 = (Class[]) p.get("classes");
+        assertEquals("Classes size -2", 1, str2.length);
+        assertEquals("Classes[0] -2", FooService.class.getName(), str2[0].getName());
+        
+        Properties props2 = new Properties();
+        props2.put("cls", new String[] {FooService.class.getName(), CheckService.class.getName()});
+        try {
+            ci.reconfigure(props2);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        } 
+        
+        // Check the service property
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), ci.getInstanceName());
+        assertNotNull("Check ref", ref);
+        str = (Class[]) ref.getProperty("classes");
+        assertEquals("Classes size -3", 2, str.length);
+        assertEquals("Classes[0] -3", FooService.class.getName(), str[0].getName());
+        assertEquals("Classes[1] -3", CheckService.class.getName(), str[1].getName());
+
+        
+        check = (CheckService) context.getService(ref);
+        p = check.getProps();
+        str2 = (Class[]) p.get("classes");
+        assertEquals("Classes size -4", 2, str2.length);
+        assertEquals("Classes[0] -4", FooService.class.getName(), str2[0].getName());
+        assertEquals("Classes[1] -4", CheckService.class.getName(), str2[1].getName());
+        
+        ci.dispose();
+        context.ungetService(ref);
+        
+    }
+
+}

Modified: felix/trunk/ipojo/tests/core/configuration/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/configuration/src/main/resources/metadata.xml?rev=713976&r1=713975&r2=713976&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/configuration/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/tests/core/configuration/src/main/resources/metadata.xml Fri Nov 14 03:05:57 2008
@@ -13,6 +13,21 @@
 			<property name="intAProp" field="intAProp" value="{1,2, 3}" />
 		</properties>
 	</component>
+	
+	<component
+		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn"
+		name="CONFIG-FooProviderType-ConfNoValue" architecture="true">
+		<provides />
+		<properties propagation="false">
+			<property name="int" field="intProp"/>
+			<property name="boolean" field="boolProp"/>
+			<property name="string" field="strProp"/>
+			<property name="strAProp" field="strAProp"/>
+			<property name="intAProp" field="intAProp"/>
+		</properties>
+	</component>
+	
+	
 	<component
 		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"
 		name="CONFIG-FooProviderType-3" architecture="true">
@@ -223,4 +238,13 @@
 		<property name="empty-map" type="map"/>
 	</instance>
 	
+	<component classname="org.apache.felix.ipojo.test.scenarios.component.PropertyModifier">
+		<provides>
+			<property field="classes"/>
+		</provides>
+		<properties>
+			<property method="setClasses" name="cls"/>
+		</properties>
+	</component>
+	
 </ipojo>

Modified: felix/trunk/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/UnacceptableConfigurationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/UnacceptableConfigurationTest.java?rev=713976&r1=713975&r2=713976&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/UnacceptableConfigurationTest.java (original)
+++ felix/trunk/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/UnacceptableConfigurationTest.java Fri Nov 14 03:05:57 2008
@@ -52,6 +52,27 @@
 	}
 	
 	/**
+     * Configuration without the name property.
+     */
+    public void testWithoutNameOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2opt");
+        
+        Properties  p = new Properties();
+        p.put("int", new Integer(3));
+        p.put("long", new Long(42));
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) { fail("an acceptable configuration is refused : " + e.getMessage()); }
+        
+    }
+	
+	/**
 	 * Empty configuration.
 	 */
 	public void testEmptyConfiguration() {
@@ -66,6 +87,20 @@
 	}
 	
 	/**
+     * Empty configuration.
+     */
+    public void testEmptyConfigurationOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2opt");
+        Properties  p = new Properties();
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) { fail("An acceptable configuration is refused"); }
+    }
+	
+	/**
 	 * Empty configuration (just the name).
 	 */
 	public void testEmptyConfiguration2() {
@@ -82,6 +117,23 @@
 	}
 	
 	/**
+     * Empty configuration (just the name).
+     */
+    public void testEmptyConfiguration2opt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+        Properties  p = new Properties();
+        p.put("instance.name","ko");
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) { 
+            fail("An acceptable configuration is refused");
+        }
+        
+    }
+	
+	/**
 	 * Null configuration (accept).
 	 */
 	public void testNull() {
@@ -95,6 +147,19 @@
 	}
 	
 	/**
+     * Null configuration (accept).
+     */
+    public void testNullOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2opt");
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(null);
+            ci.dispose();
+        } catch(Exception e) { fail("An acceptable configuration is refused"); }
+    }
+	
+	/**
 	 * Null configuration (fail).
 	 */
 	public void testNull2() {
@@ -110,6 +175,23 @@
 	}
 	
 	/**
+     * Null configuration (success).
+     */
+    public void testNull2Opt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(null);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is refused");
+        }
+        
+        
+    }
+	
+	/**
 	 * Check static properties.
 	 */
 	public void testStaticOK() {
@@ -133,6 +215,29 @@
 	}
 	
 	/**
+     * Check static properties.
+     */
+    public void testStaticOKopt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2opt");
+        
+        Properties  p = new Properties();
+        p.put("instance.name","ok");
+        p.put("int", new Integer(3));
+        p.put("long", new Long(42));
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+    }
+	
+	/**
 	 * Check dynamic properties.
 	 */
 	public void testDynamicOK() {
@@ -156,6 +261,46 @@
 		}
 	}
 	
+	
+	/**
+     * Check dynamic properties.
+     */
+    public void testDynamicOKopt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dynopt");
+        
+        Properties  p = new Properties();
+        p.put("instance.name","ok");
+        p.put("int", new Integer(3));
+        p.put("boolean", new Boolean(true));
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            e.printStackTrace();
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+        
+        p = new Properties();
+        p.put("instance.name","ok");
+        p.put("boolean", new Boolean(true));
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            e.printStackTrace();
+            fail("An acceptable configuration is rejected (2) : " + e.getMessage());
+        }
+    }
+    
 	/**
 	 * Check inconsistent types.
 	 */
@@ -180,6 +325,43 @@
 	}
 	
 	/**
+     * Check inconsistent types.
+     */
+    public void testDynamicBadTypeOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dynopt");
+        
+        Properties  p = new Properties();
+        p.put("instance.name","ok");
+        p.put("int", new Integer(3));
+        p.put("long", new Long(42));
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+        
+        p = new Properties();
+        p.put("instance.name","ok");
+        p.put("int", new Integer(3));
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected (2) : " + e.getMessage());
+        }
+    }
+	
+	/**
 	 * Check good configuration (with overriding).
 	 */
 	public void testDynamicComplete() {
@@ -203,6 +385,44 @@
 	}
 	
 	/**
+     * Check good configuration (with overriding).
+     */
+    public void testDynamicCompleteOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+        
+        Properties  p = new Properties();
+        p.put("instance.name","ok");
+        p.put("int", new Integer(3));
+        p.put("boolean", new Boolean(true));
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+        
+        
+        p = new Properties();
+        p.put("instance.name","ok");
+        p.put("int", new Integer(3));
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected (2) : " + e.getMessage());
+        }
+    }
+	
+	/**
 	 * Check good configuration.
 	 */
 	public void testDynamicJustEnough() {
@@ -224,6 +444,40 @@
 	}
 	
 	/**
+     * Check good configuration.
+     */
+    public void testDynamicJustEnoughOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+        
+        Properties  p = new Properties();
+        p.put("instance.name","ok");
+        p.put("boolean", new Boolean(true));
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+        
+        p = new Properties();
+        p.put("instance.name","ok");
+        p.put("boolean", new Boolean(true));
+        p.put("strAProp", new String[] {"a"});
+        
+        ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+    }
+	
+	/**
 	 * Check good configuration.
 	 */
 	public void testDynamicMix() {
@@ -246,6 +500,42 @@
 	}
 	
 	/**
+     * Check good configuration.
+     */
+    public void testDynamicMixOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+        
+        Properties  p = new Properties();
+        p.put("instance.name","ok");
+        p.put("boolean", new Boolean(true));
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+        
+        p = new Properties();
+        p.put("instance.name","ok");
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+    }
+	
+	/**
 	 * Check uncomplete configuration.
 	 */
 	public void testDynamicUncomplete() {
@@ -267,6 +557,27 @@
 	}
 	
 	/**
+     * Check uncomplete configuration.
+     */
+    public void testDynamicUncompleteOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+        
+        Properties  p = new Properties();
+        p.put("instance.name","ok");
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) { fail("An acceptable configuration is refused"); }
+        
+        
+    }
+	
+	/**
 	 * Check good configuration (more properties).
 	 */
 	public void testDynamicMore() {
@@ -291,6 +602,30 @@
 	}
 	
 	/**
+     * Check good configuration (more properties).
+     */
+    public void testDynamicMoreOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+        
+        Properties  p = new Properties();
+        p.put("instance.name","ok");
+        p.put("int", new Integer(3));
+        p.put("boolean", new Boolean(true));
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        p.put("tralala", "foo");
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+    }
+	
+	/**
 	 * Check properties affecting services and component.
 	 */
 	public void testDoubleProps() {
@@ -314,6 +649,31 @@
 			fail("An acceptable configuration is rejected : " + e.getMessage());
 		}
 	}
+	
+	/**
+     * Check properties affecting services and component.
+     */
+    public void testDoublePropsOpt() {
+        Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-Dyn2opt");
+        
+        Properties  p = new Properties();
+        p.put("instance.name","ok");
+        p.put("int", new Integer(3));
+        p.put("boolean", new Boolean(true));
+        p.put("string", "absdir");
+        p.put("strAProp", new String[] {"a"});
+        p.put("intAProp", new int[] {1,2});
+        p.put("boolean", new Boolean(false));
+        p.put("string", "toto");
+        
+        ComponentInstance ci = null;
+        try {
+            ci = f.createComponentInstance(p);
+            ci.dispose();
+        } catch(Exception e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+    }
     
     /**
      * Check instance name unicity.
@@ -367,7 +727,7 @@
     public void testUnicity3() {
         Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
         
-        ComponentInstance ci1 = null,ci2 = null, ci3 = null;
+        ComponentInstance ci1 = null,ci2 = null;
         try {
             Properties p1 = new Properties();
             p1.put("instance.name","name1");
@@ -376,11 +736,8 @@
             p2.put("instance.name","name1");
             ci2 = f.createComponentInstance(p2);
             assertNotEquals("Check name ci1, ci2", ci1.getInstanceName(), ci2.getInstanceName());
-            assertNotEquals("Check name ci1, ci3", ci1.getInstanceName(), ci3.getInstanceName());
-            assertNotEquals("Check name ci3, ci2", ci3.getInstanceName(), ci3.getInstanceName());
             ci1.dispose();
             ci2.dispose();
-            ci3.dispose();
         } catch(Exception e) { 
             ci1.dispose();
             return; }
@@ -395,7 +752,7 @@
         Factory f = Utils.getFactoryByName(context, "Factories-FooProviderType-2");
         Factory f2 = Utils.getFactoryByName(context, "Factories-FooProviderType-1");
         
-        ComponentInstance ci1 = null,ci2 = null, ci3 = null;
+        ComponentInstance ci1 = null,ci2 = null;
         try {
             Properties p1 = new Properties();
             p1.put("instance.name","name1");
@@ -403,13 +760,9 @@
             Properties p2 = new Properties();
             p2.put("instance.name","name1");
             ci2 = f2.createComponentInstance(p2);
-            System.err.println("==== " + ci1.getInstanceName() + " === " + ci2.getInstanceName());
             assertNotEquals("Check name ci1, ci2", ci1.getInstanceName(), ci2.getInstanceName());
-            assertNotEquals("Check name ci1, ci3", ci1.getInstanceName(), ci3.getInstanceName());
-            assertNotEquals("Check name ci3, ci2", ci3.getInstanceName(), ci3.getInstanceName());
             ci1.dispose();
             ci2.dispose();
-            ci3.dispose();
         } catch(Exception e) { 
             ci1.dispose();
             return; }