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/21 21:52:27 UTC

svn commit: r1448797 [3/4] - in /felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/felix/ src/main/java/org/apache/felix/ip...

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicPropsReconfiguration.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicPropsReconfiguration.java?rev=1448797&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicPropsReconfiguration.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicPropsReconfiguration.java Thu Feb 21 20:52:25 2013
@@ -0,0 +1,770 @@
+/* 
+ * 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.FooService;
+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 java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+public class TestDynamicPropsReconfiguration extends Common {
+    ComponentInstance fooProvider3, fooProvider4;
+
+
+    @Before
+    public void setUp() {
+        String type2 = "PS-FooProviderType-Dyn2";
+        Properties p3 = new Properties();
+        p3.put("instance.name", "FooProvider-3");
+        p3.put("int", new Integer(0));
+        p3.put("boolean", new Boolean(true));
+        p3.put("string", new String(""));
+        p3.put("strAProp", new String[0]);
+        p3.put("intAProp", new int[0]);
+        fooProvider3 = ipojoHelper.createComponentInstance(type2, p3);
+
+        fooProvider4 = ipojoHelper.createComponentInstance(type2, "FooProvider-4");
+    }
+
+    @Test
+    public void testFactoryReconf() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        Integer intProp = (Integer) sr.getProperty("int");
+        Boolean boolProp = (Boolean) sr.getProperty("boolean");
+        String strProp = (String) sr.getProperty("string");
+        String[] strAProp = (String[]) sr.getProperty("strAProp");
+        int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(0));
+        assertEquals("Check longProp equality", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality", strProp, new String(""));
+        assertNotNull("Check strAProp not nullity", strAProp);
+        String[] v = new String[0];
+        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[0];
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        // Reconfiguration
+        ServiceReference fact_ref = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "PS-FooProviderType-Dyn2");
+        Factory fact = (Factory) osgiHelper.getServiceObject(fact_ref);
+        Properties p3 = new Properties();
+        p3.put("instance.name", "FooProvider-3");
+        p3.put("int", new Integer(1));
+        p3.put("boolean", new Boolean(true));
+        p3.put("string", new String("foo"));
+        p3.put("strAProp", new String[]{"foo", "bar", "baz"});
+        p3.put("intAProp", new int[]{1, 2, 3});
+        try {
+            fact.reconfigure(p3);
+        } catch (Exception e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        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[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        // Invoke
+        FooService fs = (FooService) osgiHelper.getServiceObject(sr);
+        assertTrue("invoke fs", fs.foo());
+
+        // Re-check the property (change)
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(2));
+        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"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNull("Check intAProp hidding (no value)", intAProp);
+
+        //	Reconfiguration
+        fact_ref = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "PS-FooProviderType-Dyn2");
+        fact = (Factory) osgiHelper.getServiceObject(fact_ref);
+        p3 = new Properties();
+        p3.put("instance.name", "FooProvider-3");
+        p3.put("int", new Integer(1));
+        p3.put("boolean", new Boolean(true));
+        p3.put("string", new String("foo"));
+        p3.put("strAProp", new String[]{"foo", "bar", "baz"});
+        p3.put("intAProp", new int[]{1, 2, 3});
+        try {
+            fact.reconfigure(p3);
+        } catch (Exception e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        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[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        fact = null;
+        fs = null;
+    }
+
+    @Test
+    public void testFactoryReconfString() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        Integer intProp = (Integer) sr.getProperty("int");
+        Boolean boolProp = (Boolean) sr.getProperty("boolean");
+        String strProp = (String) sr.getProperty("string");
+        String[] strAProp = (String[]) sr.getProperty("strAProp");
+        int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(0));
+        assertEquals("Check longProp equality", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality", strProp, new String(""));
+        assertNotNull("Check strAProp not nullity", strAProp);
+        String[] v = new String[0];
+        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[0];
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        // Reconfiguration
+        ServiceReference fact_ref = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "PS-FooProviderType-Dyn2");
+        Factory fact = (Factory) osgiHelper.getServiceObject(fact_ref);
+        Properties p3 = new Properties();
+        p3.put("instance.name", "FooProvider-3");
+        p3.put("int", "1");
+        p3.put("boolean", "true");
+        p3.put("string", "foo");
+        p3.put("strAProp", "{foo, bar, baz}");
+        p3.put("intAProp", "{1, 2, 3}");
+        try {
+            fact.reconfigure(p3);
+        } catch (Exception e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        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[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        // Invoke
+        FooService fs = (FooService) osgiHelper.getServiceObject(sr);
+        assertTrue("invoke fs", fs.foo());
+
+        // Re-check the property (change)
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(2));
+        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"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNull("Check intAProp hidding (no value)", intAProp);
+
+        //	Reconfiguration
+        fact_ref = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "PS-FooProviderType-Dyn2");
+        fact = (Factory) osgiHelper.getServiceObject(fact_ref);
+        p3 = new Properties();
+        p3.put("instance.name", "FooProvider-3");
+        p3.put("int", "1");
+        p3.put("boolean", "true");
+        p3.put("string", "foo");
+        p3.put("strAProp", "{foo, bar, baz}");
+        p3.put("intAProp", "{ 1, 2, 3}");
+        try {
+            fact.reconfigure(p3);
+        } catch (Exception e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        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[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        fact = null;
+        fs = null;
+    }
+
+    @Test
+    public void testMSFReconf() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        Integer intProp = (Integer) sr.getProperty("int");
+        Boolean boolProp = (Boolean) sr.getProperty("boolean");
+        String strProp = (String) sr.getProperty("string");
+        String[] strAProp = (String[]) sr.getProperty("strAProp");
+        int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(0));
+        assertEquals("Check longProp equality", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality", strProp, new String(""));
+        assertNotNull("Check strAProp not nullity", strAProp);
+        String[] v = new String[0];
+        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[0];
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        // Reconfiguration
+        ServiceReference fact_ref = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), "PS-FooProviderType-Dyn2");
+        ManagedServiceFactory fact = (ManagedServiceFactory) osgiHelper.getServiceObject(fact_ref);
+        Properties p3 = new Properties();
+        p3.put("int", new Integer(1));
+        p3.put("boolean", new Boolean(true));
+        p3.put("string", new String("foo"));
+        p3.put("strAProp", new String[]{"foo", "bar", "baz"});
+        p3.put("intAProp", new int[]{1, 2, 3});
+        try {
+            fact.updated("FooProvider-3", p3);
+        } catch (ConfigurationException e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        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[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        // Invoke
+        FooService fs = (FooService) osgiHelper.getServiceObject(sr);
+        assertTrue("invoke fs", fs.foo());
+
+        // Re-check the property (change)
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(2));
+        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"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNull("Check intAProp hidding (no value)", intAProp);
+
+        //	Reconfiguration
+        fact_ref = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), "PS-FooProviderType-Dyn2");
+        fact = (ManagedServiceFactory) osgiHelper.getServiceObject(fact_ref);
+        p3 = new Properties();
+        p3.put("int", new Integer(1));
+        p3.put("boolean", new Boolean(true));
+        p3.put("string", new String("foo"));
+        p3.put("strAProp", new String[]{"foo", "bar", "baz"});
+        p3.put("intAProp", new int[]{1, 2, 3});
+        try {
+            fact.updated("FooProvider-3", p3);
+        } catch (ConfigurationException e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        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[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        fact = null;
+        fs = null;
+    }
+
+    @Test
+    public void testMSFReconfString() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        Integer intProp = (Integer) sr.getProperty("int");
+        Boolean boolProp = (Boolean) sr.getProperty("boolean");
+        String strProp = (String) sr.getProperty("string");
+        String[] strAProp = (String[]) sr.getProperty("strAProp");
+        int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(0));
+        assertEquals("Check longProp equality", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality", strProp, new String(""));
+        assertNotNull("Check strAProp not nullity", strAProp);
+        String[] v = new String[0];
+        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[0];
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        // Reconfiguration
+        ServiceReference fact_ref = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), "PS-FooProviderType-Dyn2");
+        ManagedServiceFactory fact = (ManagedServiceFactory) osgiHelper.getServiceObject(fact_ref);
+        Properties p3 = new Properties();
+        p3.put("int", "1");
+        p3.put("boolean", "true");
+        p3.put("string", "foo");
+        p3.put("strAProp", "{foo, bar, baz}");
+        p3.put("intAProp", "{ 1, 2, 3}");
+        try {
+            fact.updated("FooProvider-3", p3);
+        } catch (ConfigurationException e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        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[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        // Invoke
+        FooService fs = (FooService) osgiHelper.getServiceObject(sr);
+        assertTrue("invoke fs", fs.foo());
+
+        // Re-check the property (change)
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(2));
+        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"};
+        for (int i = 0; i < strAProp.length; i++) {
+            if (!strAProp[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNull("Check intAProp hidding (no value)", intAProp);
+
+        //	Reconfiguration
+        fact_ref = ipojoHelper.getServiceReferenceByName(ManagedServiceFactory.class.getName(), "PS-FooProviderType-Dyn2");
+        fact = (ManagedServiceFactory) osgiHelper.getServiceObject(fact_ref);
+        p3 = new Properties();
+        p3.put("int", "1");
+        p3.put("boolean", "true");
+        p3.put("string", "foo");
+        p3.put("strAProp", "{foo, bar, baz}");
+        p3.put("intAProp", "{ 1, 2, 3}");
+        try {
+            fact.updated("FooProvider-3", p3);
+        } catch (ConfigurationException e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        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[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        fact = null;
+        fs = null;
+    }
+
+    @Test
+    public void testFactoryReconfNoValue() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-4");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        Integer intProp = (Integer) sr.getProperty("int");
+        Object boolProp = sr.getProperty("boolean");
+        Object strProp = sr.getProperty("string");
+        Object strAProp = sr.getProperty("strAProp");
+        int[] intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(4));
+        assertEquals("Check longProp equality", boolProp, null);
+        assertEquals("Check strProp equality", strProp, null);
+        assertNull("Check strAProp nullity", strAProp);
+
+        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");
+            }
+        }
+
+        // Reconfiguration
+        ServiceReference fact_ref = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "PS-FooProviderType-Dyn2");
+        Factory fact = (Factory) osgiHelper.getServiceObject(fact_ref);
+        Properties p3 = new Properties();
+        p3.put("instance.name", "FooProvider-4");
+        p3.put("int", new Integer(1));
+        p3.put("boolean", new Boolean(true));
+        p3.put("string", new String("foo"));
+        p3.put("strAProp", new String[]{"foo", "bar", "baz"});
+        p3.put("intAProp", new int[]{1, 2, 3});
+        try {
+            fact.reconfigure(p3);
+        } catch (Exception e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-4");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        assertEquals("Check longProp equality", boolProp, new Boolean(true));
+        assertEquals("Check strProp equality", strProp, new String("foo"));
+        assertNotNull("Check strAProp not nullity", strAProp);
+        String[] v = new String[]{"foo", "bar", "baz"};
+        for (int i = 0; i < ((String[]) strAProp).length; i++) {
+            if (!((String[]) strAProp)[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNotNull("Check intAProp not nullity", intAProp);
+        v2 = new int[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        // Invoke
+        FooService fs = (FooService) osgiHelper.getServiceObject(sr);
+        assertTrue("invoke fs", fs.foo());
+
+        // Re-check the property (change)
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(2));
+        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"};
+        for (int i = 0; i < ((String[]) strAProp).length; i++) {
+            if (!((String[]) strAProp)[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNull("Check intAProp hidding (no value)", intAProp);
+
+        //	Reconfiguration
+        fact_ref = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "PS-FooProviderType-Dyn2");
+        fact = (Factory) osgiHelper.getServiceObject(fact_ref);
+        p3 = new Properties();
+        p3.put("instance.name", "FooProvider-3");
+        p3.put("int", new Integer(1));
+        p3.put("boolean", new Boolean(true));
+        p3.put("string", new String("foo"));
+        p3.put("strAProp", new String[]{"foo", "bar", "baz"});
+        p3.put("intAProp", new int[]{1, 2, 3});
+        try {
+            fact.reconfigure(p3);
+        } catch (Exception e) {
+            fail("Unable to reconfigure the instance with : " + p3);
+        }
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality", intProp, new Integer(1));
+        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 < ((String[]) strAProp).length; i++) {
+            if (!((String[]) strAProp)[i].equals(v[i])) {
+                fail("Check the strAProp Equality");
+            }
+        }
+        assertNotNull("Check intAProp not nullity", intAProp);
+        v2 = new int[]{1, 2, 3};
+        for (int i = 0; i < intAProp.length; i++) {
+            if (intAProp[i] != v2[i]) {
+                fail("Check the intAProp Equality");
+            }
+        }
+
+        fact = null;
+        fs = null;
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExposition.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExposition.java?rev=1448797&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExposition.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExposition.java Thu Feb 21 20:52:25 2013
@@ -0,0 +1,168 @@
+/* 
+ * 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.BarService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import static org.junit.Assert.*;
+
+public class TestExposition extends Common {
+
+    private ComponentInstance fooProviderSimple;
+    private ComponentInstance fooProviderItf;
+    private ComponentInstance fooBarProvider;
+    private ComponentInstance fooBarProvider2;
+    private ComponentInstance fooBarProvider3;
+
+    @Before
+    public void setUp() {
+        fooProviderSimple = ipojoHelper.createComponentInstance("PS-FooProviderType-1", "fooProviderSimple");
+
+        fooProviderItf = ipojoHelper.createComponentInstance("PS-FooProviderType-itf", "fooProviderItf");
+
+        fooBarProvider = ipojoHelper.createComponentInstance("PS-FooBarProviderType-1", "fooProviderItfs");
+
+        fooBarProvider2 = ipojoHelper.createComponentInstance("PS-FooBarProviderType-2", "fooProviderItfs2");
+
+        fooBarProvider3 = ipojoHelper.createComponentInstance("PS-FooBarProviderType-3", "fooProviderItfs3");
+
+        assertNotNull("Check the instance creation of fooProviderSimple", fooProviderSimple);
+        assertNotNull("Check the instance creation of fooProviderItf", fooProviderItf);
+        assertNotNull("Check the instance creation of fooProviderItfs", fooBarProvider);
+        assertNotNull("Check the instance creation of fooProviderItfs2", fooBarProvider2);
+        assertNotNull("Check the instance creation of fooProviderItfs3", fooBarProvider3);
+
+    }
+
+
+    @Test
+    public void testSimpleExposition() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProviderSimple.getInstanceName());
+        assertNotNull("Check the availability of the FS from " + fooProviderSimple.getInstanceName(), ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check fs invocation", fs.foo());
+        fs = null;
+        fooProviderSimple.stop();
+        ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProviderSimple.getInstanceName());
+        assertNull("Check the absence of the FS from " + fooProviderSimple.getInstanceName(), ref);
+
+    }
+
+    @Test
+    public void testItfExposition() {
+        ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProviderItf.getInstanceName());
+        assertNotNull("Check the availability of the FS from " + fooProviderItf.getInstanceName(), ref);
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("Check fs invocation", fs.foo());
+        fs = null;
+        fooProviderItf.stop();
+
+        ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProviderItf.getInstanceName());
+        assertNull("Check the absence of the FS from " + fooProviderItf.getInstanceName(), ref);
+    }
+
+    @Test
+    public void testItfsExposition() {
+        ServiceReference refFoo = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooBarProvider.getInstanceName());
+        assertNotNull("Check the availability of the FS from " + fooBarProvider.getInstanceName(), refFoo);
+        ServiceReference refBar = ipojoHelper.getServiceReferenceByName(BarService.class.getName(), fooBarProvider.getInstanceName());
+        assertNotNull("Check the availability of the BS from " + fooBarProvider.getInstanceName(), refBar);
+
+        assertSame("Check service reference equality", refFoo, refBar);
+
+        FooService fs = (FooService) osgiHelper.getServiceObject(refFoo);
+        assertTrue("Check fs invocation", fs.foo());
+        fs = null;
+
+        BarService bs = (BarService) osgiHelper.getServiceObject(refBar);
+        assertTrue("Check bs invocation", bs.bar());
+        bs = null;
+
+        fooBarProvider.stop();
+
+        refFoo = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooBarProvider.getInstanceName());
+        refBar = ipojoHelper.getServiceReferenceByName(BarService.class.getName(), fooBarProvider.getInstanceName());
+        assertNull("Check the absence of the FS from " + fooBarProvider.getInstanceName(), refFoo);
+        assertNull("Check the absence of the BS from " + fooBarProvider.getInstanceName(), refBar);
+    }
+
+    @Test
+    public void testItfsExposition2() {
+        ServiceReference refFoo = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooBarProvider2.getInstanceName());
+        assertNotNull("Check the availability of the FS from " + fooBarProvider2.getInstanceName(), refFoo);
+        ServiceReference refBar = ipojoHelper.getServiceReferenceByName(BarService.class.getName(), fooBarProvider2.getInstanceName());
+        assertNotNull("Check the availability of the BS from " + fooBarProvider2.getInstanceName(), refBar);
+
+        assertSame("Check service reference equality", refFoo, refBar);
+
+        FooService fs = (FooService) osgiHelper.getServiceObject(refFoo);
+        assertTrue("Check fs invocation", fs.foo());
+        fs = null;
+
+        BarService bs = (BarService) osgiHelper.getServiceObject(refBar);
+        assertTrue("Check bs invocation", bs.bar());
+        bs = null;
+
+        fooBarProvider2.stop();
+
+        refFoo = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooBarProvider2.getInstanceName());
+        refBar = ipojoHelper.getServiceReferenceByName(BarService.class.getName(), fooBarProvider2.getInstanceName());
+        assertNull("Check the absence of the FS from " + fooBarProvider.getInstanceName(), refFoo);
+        assertNull("Check the absence of the BS from " + fooBarProvider.getInstanceName(), refBar);
+    }
+
+    @Test
+    public void testItfsExposition3() {
+        ServiceReference refFoo = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooBarProvider3.getInstanceName());
+        assertNotNull("Check the availability of the FS from " + fooBarProvider3.getInstanceName(), refFoo);
+        ServiceReference refBar = ipojoHelper.getServiceReferenceByName(BarService.class.getName(), fooBarProvider3.getInstanceName());
+        assertNotNull("Check the availability of the BS from " + fooBarProvider3.getInstanceName(), refBar);
+
+        assertNotSame("Check service reference inequality", refFoo, refBar);
+
+        FooService fs = (FooService) osgiHelper.getServiceObject(refFoo);
+        assertTrue("Check fs invocation", fs.foo());
+        fs = null;
+
+        BarService bs = (BarService) osgiHelper.getServiceObject(refBar);
+        assertTrue("Check bs invocation", bs.bar());
+        bs = null;
+
+        // Check properties
+        String baz1 = (String) refFoo.getProperty("baz");
+        String baz2 = (String) refBar.getProperty("baz");
+
+        assertEquals("Check Baz Property 1", baz1, "foo");
+        assertEquals("Check Baz Property 2", baz2, "bar");
+
+        fooBarProvider3.stop();
+
+        refFoo = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooBarProvider3.getInstanceName());
+        refBar = ipojoHelper.getServiceReferenceByName(BarService.class.getName(), fooBarProvider3.getInstanceName());
+        assertNull("Check the absence of the FS from " + fooBarProvider.getInstanceName(), refFoo);
+        assertNull("Check the absence of the BS from " + fooBarProvider.getInstanceName(), refBar);
+    }
+
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInheritedClasses.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInheritedClasses.java?rev=1448797&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInheritedClasses.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInheritedClasses.java Thu Feb 21 20:52:25 2013
@@ -0,0 +1,204 @@
+/* 
+ * 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.*;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class TestInheritedClasses extends Common {
+
+    private Factory pi1, pi11, pi12, pi2, pi21, pi3;
+
+    @Before
+    public void setUp() {
+        pi1 = ipojoHelper.getFactory("PS-PI1");
+        pi11 = ipojoHelper.getFactory("PS-PI1-1");
+        pi12 = ipojoHelper.getFactory("PS-PI1-2");
+
+        pi2 = ipojoHelper.getFactory("PS-PI2");
+        pi21 = ipojoHelper.getFactory("PS-PI2-1");
+
+        pi3 = ipojoHelper.getFactory("PS-PI3");
+    }
+
+    private boolean contains(String[] arr, String txt) {
+        for (int i = 0; i < arr.length; i++) {
+            if (arr[i].equals(txt)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Test
+    public void testPI1Factory() {
+        String[] specs = pi1.getComponentDescription().getprovidedServiceSpecification();
+        assertEquals("Check provides count", specs.length, 4);
+        assertTrue("Check Child", contains(specs, ChildInterface.class.getName()));
+        assertTrue("Check Parent1", contains(specs, ParentInterface1.class.getName()));
+        assertTrue("Check Parent2", contains(specs, ParentInterface2.class.getName()));
+        assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+    }
+
+    @Test
+    public void testPI11Factory() {
+        String[] specs = pi11.getComponentDescription().getprovidedServiceSpecification();
+        assertEquals("Check provides count", specs.length, 1);
+        assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+    }
+
+    @Test
+    public void testPI12Factory() {
+        String[] specs = pi12.getComponentDescription().getprovidedServiceSpecification();
+        assertEquals("Check provides count", specs.length, 2);
+        assertTrue("Check Parent2", contains(specs, ParentInterface2.class.getName()));
+        assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+    }
+
+    @Test
+    public void testPI2Factory() {
+        String[] specs = pi2.getComponentDescription().getprovidedServiceSpecification();
+        assertEquals("Check provides count (" + specs.length + ")", specs.length, 4);
+        assertTrue("Check Child", contains(specs, ChildInterface.class.getName()));
+        assertTrue("Check Parent1", contains(specs, ParentInterface1.class.getName()));
+        assertTrue("Check Parent2", contains(specs, ParentInterface2.class.getName()));
+        assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+    }
+
+    @Test
+    public void testPI21Factory() {
+        String[] specs = pi21.getComponentDescription().getprovidedServiceSpecification();
+        assertEquals("Check provides count", specs.length, 1);
+        assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+    }
+
+    @Test
+    public void testPI3Factory() {
+        String[] specs = pi3.getComponentDescription().getprovidedServiceSpecification();
+        assertEquals("Check provides count", specs.length, 5);
+        assertTrue("Check Child", contains(specs, ChildInterface.class.getName()));
+        assertTrue("Check Parent1", contains(specs, ParentInterface1.class.getName()));
+        assertTrue("Check Parent2", contains(specs, ParentInterface2.class.getName()));
+        assertTrue("Check ParentParent", contains(specs, ParentParentInterface.class.getName()));
+        assertTrue("Check FS", contains(specs, FooService.class.getName()));
+    }
+
+    @Test
+    public void testIP1() {
+        ComponentInstance ci = ipojoHelper.createComponentInstance(pi1.getName(), "ci");
+
+        ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(ChildInterface.class.getName(), "ci");
+        assertNotNull("Check Child", ref1);
+
+        ServiceReference ref2 = ipojoHelper.getServiceReferenceByName(ParentInterface1.class.getName(), "ci");
+        assertNotNull("Check Parent1", ref2);
+
+        ServiceReference ref3 = ipojoHelper.getServiceReferenceByName(ParentInterface2.class.getName(), "ci");
+        assertNotNull("Check Parent2", ref3);
+
+        ServiceReference ref4 = ipojoHelper.getServiceReferenceByName(ParentParentInterface.class.getName(), "ci");
+        assertNotNull("Check PP", ref4);
+
+        ci.dispose();
+    }
+
+    @Test
+    public void testIP11() {
+        ComponentInstance ci = ipojoHelper.createComponentInstance(pi11.getName(), "ci");
+
+        ServiceReference ref4 = ipojoHelper.getServiceReferenceByName(ParentParentInterface.class.getName(), "ci");
+        assertNotNull("Check PP", ref4);
+
+        ci.dispose();
+    }
+
+    @Test
+    public void testIP12() {
+        ComponentInstance ci = ipojoHelper.createComponentInstance(pi12.getName(), "ci");
+
+        ServiceReference ref3 = ipojoHelper.getServiceReferenceByName(ParentInterface2.class.getName(), "ci");
+        assertNotNull("Check Parent2", ref3);
+
+        ServiceReference ref4 = ipojoHelper.getServiceReferenceByName(ParentParentInterface.class.getName(), "ci");
+        assertNotNull("Check PP", ref4);
+
+        ci.dispose();
+    }
+
+    @Test
+    public void testIP2() {
+        ComponentInstance ci = ipojoHelper.createComponentInstance(pi2.getName(), "ci");
+
+        ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(ChildInterface.class.getName(), "ci");
+        assertNotNull("Check Child", ref1);
+
+        ServiceReference ref2 = ipojoHelper.getServiceReferenceByName(ParentInterface1.class.getName(), "ci");
+        assertNotNull("Check Parent1", ref2);
+
+        ServiceReference ref3 = ipojoHelper.getServiceReferenceByName(ParentInterface2.class.getName(), "ci");
+        assertNotNull("Check Parent2", ref3);
+
+        ServiceReference ref4 = ipojoHelper.getServiceReferenceByName(ParentParentInterface.class.getName(), "ci");
+        assertNotNull("Check PP", ref4);
+
+        ci.dispose();
+    }
+
+    @Test
+    public void testIP21() {
+        ComponentInstance ci = ipojoHelper.createComponentInstance(pi21.getName(), "ci");
+
+        ServiceReference ref4 = ipojoHelper.getServiceReferenceByName(ParentParentInterface.class.getName(), "ci");
+        assertNotNull("Check PP", ref4);
+
+        ci.dispose();
+    }
+
+    @Test
+    public void testIP3() {
+        ComponentInstance ci = ipojoHelper.createComponentInstance(pi3.getName(), "ci");
+
+        ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(ChildInterface.class.getName(), "ci");
+        assertNotNull("Check Child", ref1);
+
+        ServiceReference ref2 = ipojoHelper.getServiceReferenceByName(ParentInterface1.class.getName(), "ci");
+        assertNotNull("Check Parent1", ref2);
+
+        ServiceReference ref3 = ipojoHelper.getServiceReferenceByName(ParentInterface2.class.getName(), "ci");
+        assertNotNull("Check Parent2", ref3);
+
+        ServiceReference ref4 = ipojoHelper.getServiceReferenceByName(ParentParentInterface.class.getName(), "ci");
+        assertNotNull("Check PP", ref4);
+
+        ServiceReference ref5 = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "ci");
+        assertNotNull("Check FS", ref5);
+
+        ci.dispose();
+    }
+
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNullCheck.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNullCheck.java?rev=1448797&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNullCheck.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNullCheck.java Thu Feb 21 20:52:25 2013
@@ -0,0 +1,77 @@
+/* 
+ * 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.Factory;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class TestNullCheck extends Common {
+
+    @Test
+    public void testNull() {
+
+        String factName = "PS-Null";
+        String compName = "NullCheck";
+        ServiceReference ref = null;
+
+        // Check that no Foo Service are available
+        ref = osgiHelper.getServiceReference(FooService.class.getName());
+        assertNull("FS already available", ref);
+
+        // Get the factory to create a component instance
+        Factory fact = ipojoHelper.getFactory(factName);
+        assertNotNull("Cannot find the factory FooProvider-1", fact);
+
+        // Don't give any configuration so, properties are null.
+        ipojoHelper.createComponentInstance(factName, compName);
+
+        // Get a FooService provider
+        ref = osgiHelper.getServiceReference(FooService.class.getName(), "(" + "instance.name" + "=" + compName + ")");
+
+        assertNotNull("FS not available", ref);
+
+        // Check service properties
+        assertNull(ref.getProperty("prop1"));
+        assertNotNull(ref.getProperty("prop2"));
+
+        // Test foo invocation
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("FooService invocation failed", fs.foo());
+
+        ref = osgiHelper.getServiceReference(FooService.class.getName(), "(" + "instance.name" + "=" + compName + ")");
+        // Check service properties
+        assertNotNull(ref.getProperty("prop1"));
+        assertNull(ref.getProperty("prop2"));
+
+        ipojoHelper.dispose();
+
+        // Check that there is no more FooService
+        ref = osgiHelper.getServiceReference(FooService.class.getName(), null);
+
+        assertNull("FS available, but component instance stopped", ref);
+
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestOSGiProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestOSGiProperties.java?rev=1448797&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestOSGiProperties.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestOSGiProperties.java Thu Feb 21 20:52:25 2013
@@ -0,0 +1,85 @@
+/* 
+ * 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.Factory;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+public class TestOSGiProperties extends Common {
+
+    @Test
+    public void testOSGiProperties() {
+        String factName = "PS-FooProviderType-1";
+        String compName = "FooProvider-1";
+        ServiceReference ref = null;
+
+        // Check that no Foo Service are available
+        ref = osgiHelper.getServiceReference(FooService.class.getName());
+
+        assertNull("FS already available", ref);
+
+        // Get the factory to create a component instance
+        Factory fact = ipojoHelper.getFactory(factName);
+        assertNotNull("Cannot find the factory FooProvider-1", fact);
+
+        Dictionary conf = new Properties();
+        conf.put(Constants.SERVICE_DESCRIPTION, "description");
+        conf.put(Constants.SERVICE_RANKING, "10");
+        conf.put(Constants.SERVICE_VENDOR, "ASF");
+        conf.put(Constants.SERVICE_PID, "my.pid");
+
+        ipojoHelper.createComponentInstance(factName, compName, conf);
+
+        // Get a FooService provider
+        ref = osgiHelper.getServiceReference(FooService.class.getName(), "(" + "instance.name" + "=" + compName + ")");
+
+        assertNotNull("FS not available", ref);
+
+        // Check properties
+        assertEquals("description", ref.getProperty(Constants.SERVICE_DESCRIPTION));
+        assertEquals(new Integer(10), ref.getProperty(Constants.SERVICE_RANKING));
+        assertEquals("ASF", ref.getProperty(Constants.SERVICE_VENDOR));
+        assertEquals("my.pid", ref.getProperty(Constants.SERVICE_PID));
+
+
+        // Test foo invocation
+        FooService fs = (FooService) osgiHelper.getServiceObject(ref);
+        assertTrue("FooService invocation failed", fs.foo());
+
+        ipojoHelper.dispose();
+
+
+        // Check that there is no more FooService
+        ref = osgiHelper.getServiceReference(FooService.class.getName(), null);
+
+
+        assertNull("FS available, but component instance stopped", ref);
+
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java?rev=1448797&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java Thu Feb 21 20:52:25 2013
@@ -0,0 +1,147 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+public class TestPropertiesInAnonymousClass extends Common {
+
+    @Before
+    public void setUp() {
+        String type = "PS-FooProviderTypeAnonymous-Dyn";
+        ipojoHelper.createComponentInstance(type, "FooProviderAno-1");
+
+    }
+
+
+    @Test
+    public void testRunnable() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProviderAno-1");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        Integer intProp = (Integer) sr.getProperty("int");
+        Boolean boolProp = (Boolean) sr.getProperty("boolean");
+        String strProp = (String) sr.getProperty("string");
+        String[] strAProp = (String[]) sr.getProperty("strAProp");
+        int[] intAProp = (int[]) sr.getProperty("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)");
+            }
+        }
+        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)");
+            }
+        }
+
+        // Invoke
+        FooService fs = (FooService) osgiHelper.getServiceObject(sr);
+        assertTrue("invoke fs", fs.foo());
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProviderAno-1");
+        // Re-check the property (change)
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality (2)", 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)");
+            }
+        }
+
+        fs = null;
+    }
+
+    @Test
+    public void testSwingWorker() {
+        ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProviderAno-1");
+        assertNotNull("Check the availability of the FS service", sr);
+
+        // Check service properties
+        Integer intProp = (Integer) sr.getProperty("int");
+        Boolean boolProp = (Boolean) sr.getProperty("boolean");
+        String strProp = (String) sr.getProperty("string");
+        String[] strAProp = (String[]) sr.getProperty("strAProp");
+        int[] intAProp = (int[]) sr.getProperty("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)");
+            }
+        }
+        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)");
+            }
+        }
+
+        // Invoke
+        FooService fs = (FooService) osgiHelper.getServiceObject(sr);
+        assertTrue("invoke fs", fs.getBoolean());
+
+        sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProviderAno-1");
+        // Re-check the property (change)
+        intProp = (Integer) sr.getProperty("int");
+        boolProp = (Boolean) sr.getProperty("boolean");
+        strProp = (String) sr.getProperty("string");
+        strAProp = (String[]) sr.getProperty("strAProp");
+        intAProp = (int[]) sr.getProperty("intAProp");
+
+        assertEquals("Check intProp equality (2)", 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)");
+            }
+        }
+
+        fs = null;
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestProvidedServiceArchitecture.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestProvidedServiceArchitecture.java?rev=1448797&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestProvidedServiceArchitecture.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestProvidedServiceArchitecture.java Thu Feb 21 20:52:25 2013
@@ -0,0 +1,232 @@
+/* 
+ * 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.Factory;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.architecture.HandlerDescription;
+import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceDescription;
+import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandlerDescription;
+import org.apache.felix.ipojo.runtime.core.services.BarService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TestProvidedServiceArchitecture extends Common {
+
+    @Test
+    public void testExposition() {
+        String factName = "PS-FooProviderType-1";
+        String compName = "FooProvider-1";
+
+        // Get the factory to create a component instance
+        Factory fact = ipojoHelper.getFactory(factName);
+        assertNotNull("Cannot find the factory FooProvider-1", fact);
+
+        ipojoHelper.createComponentInstance(factName, compName);
+
+        ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), compName);
+        assertNotNull("Architecture not available", arch_ref);
+
+        Architecture arch = (Architecture) osgiHelper.getServiceObject(arch_ref);
+        InstanceDescription id = arch.getInstanceDescription();
+
+        assertEquals("Check component instance name (" + id.getName() + ")", id.getName(), compName);
+        assertEquals("Check component type implementation class", id.getComponentDescription().getClassName(), "org.apache.felix.ipojo.runtime.core.components.FooProviderType1");
+
+        HandlerDescription[] handlers = id.getHandlers();
+        assertEquals("Number of handlers", handlers.length, 2);
+
+        //Look for the ProvidedService Handler
+        ProvidedServiceHandlerDescription pshd = null;
+        pshd = (ProvidedServiceHandlerDescription) id.getHandlerDescription("org.apache.felix.ipojo:provides");
+
+//		for(int i = 0; i < handlers.length; i++) {
+//			if(handlers[i].getHandlerName().equals("org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler")) {
+//				pshd = (ProvidedServiceHandlerDescription) handlers[i];
+//			}
+//		}
+//		
+        assertNotNull("Check ProvidedServiceHandlerDescription", pshd);
+        ProvidedServiceDescription[] ps = pshd.getProvidedServices();
+
+        assertEquals("Check ProvidedService number", ps.length, 1);
+        assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecifications().length, 1);
+        assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecifications()[0], FooService.class.getName());
+        assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
+        Properties prop = ps[0].getProperties();
+        assertNotNull("Check Props", prop);
+        assertEquals("Check service properties number", prop.size(), 2);
+        assertEquals("Check instance.name property", prop.getProperty("instance.name"), compName);
+        assertEquals("Check factory.name property", prop.getProperty("factory.name"), factName);
+    }
+
+    @Test
+    public void testProps() {
+        String factName = "PS-FooProviderType-3";
+        String compName = "FooProvider";
+
+        // Get the factory to create a component instance
+        Factory fact = ipojoHelper.getFactory(factName);
+        assertNotNull("Cannot find the factory FooProvider", fact);
+
+        Properties props = new Properties();
+        props.put("instance.name", compName);
+        props.put("foo", "foo");
+        props.put("bar", "2");
+        props.put("baz", "baz");
+        ipojoHelper.createComponentInstance(factName, props);
+
+        ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), compName);
+        assertNotNull("Architecture not available", arch_ref);
+
+        Architecture arch = (Architecture) osgiHelper.getServiceObject(arch_ref);
+        InstanceDescription id = arch.getInstanceDescription();
+
+        assertEquals("Check component instance name (" + id.getName() + ")", id.getName(), compName);
+        assertEquals("Check component type implementation class", id.getComponentDescription().getClassName(), "org.apache.felix.ipojo.runtime.core.components.FooProviderType1");
+
+        HandlerDescription[] handlers = id.getHandlers();
+        assertEquals("Number of handlers", handlers.length, 3);
+
+        //Look for the ProvidedService Handler
+        ProvidedServiceHandlerDescription pshd = null;
+        pshd = (ProvidedServiceHandlerDescription) id.getHandlerDescription("org.apache.felix.ipojo:provides");
+
+
+        assertNotNull("Check ProvidedServiceHandlerDescription", pshd);
+        ProvidedServiceDescription[] ps = pshd.getProvidedServices();
+
+        assertEquals("Check ProvidedService number", ps.length, 1);
+        assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecifications().length, 1);
+        assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecifications()[0], FooService.class.getName());
+        assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
+
+        Properties prop = ps[0].getProperties();
+        assertNotNull("Check Props", prop);
+        assertEquals("Check service properties number (#" + prop + "?=5)", prop.size(), 5);
+        assertEquals("Check instance.name property", prop.getProperty("instance.name"), compName);
+        assertEquals("Check factory.name property", prop.getProperty("factory.name"), factName);
+        assertEquals("Check foo property", prop.get("foo"), "foo");
+        assertEquals("Check bar property", prop.get("bar"), new Integer(2));
+        assertEquals("Check baz property", prop.get("baz"), "baz");
+
+    }
+
+    @Test
+    public void testDoubleProviding() {
+        String factName = "PS-FooBarProviderType-1";
+        String compName = "FooProvider";
+
+        // Get the factory to create a component instance
+        Factory fact = ipojoHelper.getFactory(factName);
+        assertNotNull("Cannot find the factory FooProvider", fact);
+
+        ipojoHelper.createComponentInstance(factName, compName);
+
+        ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), compName);
+        assertNotNull("Architecture not available", arch_ref);
+
+        Architecture arch = (Architecture) osgiHelper.getServiceObject(arch_ref);
+        InstanceDescription id = arch.getInstanceDescription();
+
+        assertEquals("Check component instance name (" + id.getName() + ")", id.getName(), compName);
+        assertEquals("Check component type implementation class", id.getComponentDescription().getClassName(), "org.apache.felix.ipojo.runtime.core.components.FooBarProviderType1");
+
+        HandlerDescription[] handlers = id.getHandlers();
+        assertEquals("Number of handlers", handlers.length, 2);
+
+        //Look for the ProvidedService Handler
+        ProvidedServiceHandlerDescription pshd = null;
+        pshd = (ProvidedServiceHandlerDescription) id.getHandlerDescription("org.apache.felix.ipojo:provides");
+
+//		for(int i = 0; i < handlers.length; i++) {
+//			if(handlers[i].getHandlerName().equals("org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler")) {
+//				pshd = (ProvidedServiceHandlerDescription) handlers[i];
+//			}
+//		}
+
+        assertNotNull("Check ProvidedServiceHandlerDescription", pshd);
+        ProvidedServiceDescription[] ps = pshd.getProvidedServices();
+
+        assertEquals("Check ProvidedService number", ps.length, 1);
+        assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecifications().length, 2);
+        assertContains("Check provided service specs - 2", ps[0].getServiceSpecifications(), FooService.class.getName());
+        ;
+        assertContains("Check provided service specs - 2", ps[0].getServiceSpecifications(), BarService.class.getName());
+        assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
+
+    }
+
+    @Test
+    public void testPropsNoValue() {
+        String factName = "PS-FooProviderType-3";
+        String compName = "FooProvider";
+
+        // Get the factory to create a component instance
+        Factory fact = ipojoHelper.getFactory(factName);
+        assertNotNull("Cannot find the factory FooProvider", fact);
+
+        ipojoHelper.createComponentInstance(factName, compName);
+
+        ServiceReference arch_ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), compName);
+        assertNotNull("Architecture not available", arch_ref);
+
+        Architecture arch = (Architecture) osgiHelper.getServiceObject(arch_ref);
+        InstanceDescription id = arch.getInstanceDescription();
+
+        assertEquals("Check component instance name (" + id.getName() + ")", id.getName(), compName);
+        assertEquals("Check component type implementation class", id.getComponentDescription().getClassName(), "org.apache.felix.ipojo.runtime.core.components.FooProviderType1");
+
+        HandlerDescription[] handlers = id.getHandlers();
+        assertEquals("Number of handlers", handlers.length, 3);
+
+        //Look for the ProvidedService Handler
+        ProvidedServiceHandlerDescription pshd = null;
+        pshd = (ProvidedServiceHandlerDescription) id.getHandlerDescription("org.apache.felix.ipojo:provides");
+
+//    	for(int i = 0; i < handlers.length; i++) {
+//    		if(handlers[i].getHandlerName().equals("org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler")) {
+//    			pshd = (ProvidedServiceHandlerDescription) handlers[i];
+//    		}
+//    	}
+
+        assertNotNull("Check ProvidedServiceHandlerDescription", pshd);
+        ProvidedServiceDescription[] ps = pshd.getProvidedServices();
+
+        assertEquals("Check ProvidedService number", ps.length, 1);
+        assertEquals("Check Provided Service Specs - 1", ps[0].getServiceSpecifications().length, 1);
+        assertEquals("Check Provided Service Specs - 2", ps[0].getServiceSpecifications()[0], FooService.class.getName());
+        assertEquals("Check Provided Service availability", ps[0].getState(), ProvidedServiceDescription.REGISTERED);
+
+        Properties prop = ps[0].getProperties();
+        assertNotNull("Check Props", prop);
+        assertEquals("Check service properties number (#" + prop + "?=5)", prop.size(), 2);
+        assertEquals("Check instance.name property", prop.getProperty("instance.name"), compName);
+        assertEquals("Check factory.name property", prop.getProperty("factory.name"), factName);
+
+    }
+
+}