diff --git a/ipojo/tests/core/configadmin/pom.xml b/ipojo/tests/core/configadmin/pom.xml
new file mode 100644
index 0000000..5acb536
--- /dev/null
+++ b/ipojo/tests/core/configadmin/pom.xml
@@ -0,0 +1,101 @@
+<!--
+	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.
+-->
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<packaging>bundle</packaging>
+	<name>iPOJO Configuration Admin Management Test Suite</name>
+	<artifactId>tests.core.configadmin</artifactId>
+	<groupId>ipojo.tests</groupId>
+	<version>0.9.0-SNAPSHOT</version>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo.metadata</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.osgi.core</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+		</dependency>
+		<dependency>
+			<groupId>ipojo.examples</groupId>
+			<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<version>1.4.2</version>
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Export-Package>
+							org.apache.felix.ipojo.test.scenarios.configadmin.service
+						</Export-Package>
+						<Bundle-SymbolicName>
+							${pom.artifactId}
+						</Bundle-SymbolicName>
+						<Private-Package>
+							org.apache.felix.ipojo.test*
+						</Private-Package>
+						<Test-Suite>
+							org.apache.felix.ipojo.test.scenarios.configadmin.ConfigurationTestSuite						</Test-Suite>
+					</instructions>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-ipojo-plugin</artifactId>
+				<version>0.9.0-SNAPSHOT</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>ipojo-bundle</goal>
+						</goals>
+						<configuration>
+							<ignoreAnnotations>true</ignoreAnnotations>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.4</source>
+					<target>1.4</target>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ConfigurableFooProvider.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ConfigurableFooProvider.java
new file mode 100644
index 0000000..e4bfcb4
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ConfigurableFooProvider.java
@@ -0,0 +1,53 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.configadmin.service.FooService;
+
+public class ConfigurableFooProvider implements FooService {
+    
+    private String message; // Configurable property
+    private int invokeCount = 0;
+    
+    public void setMessage(String message) {
+        System.out.println("Set message to " + message);
+        this.message = message;
+        invokeCount++;
+    }
+
+    public boolean foo() {
+        return true;
+    }
+
+    public Properties fooProps() {
+        Properties props = new Properties();
+        if (message == null) {
+            props.put("message", "NULL");
+        } else {
+            props.put("message", message);
+        }
+        props.put("count", new Integer(invokeCount));
+        return props;
+    }
+
+    public boolean getBoolean() {
+        return false;
+    }
+
+    public double getDouble() {
+        return invokeCount;
+    }
+
+    public int getInt() {
+        return invokeCount;
+    }
+
+    public long getLong() {
+        return invokeCount;
+    }
+
+    public Boolean getObject() {
+        return null;
+    }
+
+}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ConfigurationTestSuite.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ConfigurationTestSuite.java
new file mode 100644
index 0000000..20850e3
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ConfigurationTestSuite.java
@@ -0,0 +1,37 @@
+/* 
+ * 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.test.scenarios.configadmin;
+
+import junit.framework.Test;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
+import org.osgi.framework.BundleContext;
+
+public class ConfigurationTestSuite {
+
+	public static Test suite(BundleContext bc) {
+		OSGiTestSuite ots = new OSGiTestSuite("Configuration Admin Test Suite", bc);
+		ots.addTestSuite(ManagedServiceFactoryTestForServices.class);
+	      ots.addTestSuite(ManagedServiceFactoryTestForImmediate.class);
+	      ots.addTestSuite(ManagedServiceTestForImmediate.class);
+	      ots.addTestSuite(ManagedServiceTestForService.class);
+		return ots;
+	}
+
+}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForImmediate.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForImmediate.java
new file mode 100644
index 0000000..62518fb
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForImmediate.java
@@ -0,0 +1,337 @@
+package org.apache.felix.ipojo.test.scenarios.configadmin;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentFactory;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.configadmin.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+public class ManagedServiceFactoryTestForImmediate extends OSGiTestCase {
+    
+    private ComponentFactory factory;
+    private ConfigurationAdmin admin;
+    
+    public void setUp() {
+        factory = (ComponentFactory) Utils.getFactoryByName(context, "CA-ImmConfigurableProvider");
+        admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+        assertNotNull("Check configuration admin availability", admin);
+        try {
+            Configuration[] configurations = admin.listConfigurations("(service.factoryPid=CA-ImmConfigurableProvider)");
+            for (int i = 0; configurations != null && i < configurations.length; i++) {
+                configurations[i].delete();
+            }
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (InvalidSyntaxException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+    
+    public void tearDown() {
+        try {
+            Configuration[] configurations = admin.listConfigurations("(service.factoryPid=CA-ImmConfigurableProvider)");
+            for (int i = 0; configurations != null && i < configurations.length; i++) {
+                configurations[i].delete();
+            }
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (InvalidSyntaxException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        admin = null;
+
+        
+    }
+    
+    public void testCreationAndReconfiguration() {
+        Configuration configuration = null;
+        try {
+            configuration = admin.createFactoryConfiguration("CA-ImmConfigurableProvider", null);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        Dictionary props = configuration.getProperties();
+        if(props == null) {
+            props = new Properties();
+        }
+        props.put("message", "message");
+        
+        try {
+            configuration.update(props);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+        String pid = configuration.getPid();
+        System.out.println("PID : " + pid);
+        
+        //  The instance should be created, wait for the architecture service
+        Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message", mes);
+        assertEquals("Assert count", 1, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        props.put("message", "message2");
+        try {
+            configuration.update(props);
+            // Update the configuration ...
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message2", mes);
+        assertEquals("Assert count", 2, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        try {
+            configuration.delete();
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        assertNull("Check unavailability", ref);
+    }
+    
+    public void testCreationAndReconfiguration2() {
+        //The reconfiguration happens before the service invocation
+        Configuration configuration = null;
+        try {
+            configuration = admin.createFactoryConfiguration("CA-ImmConfigurableProvider", null);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        Dictionary props = configuration.getProperties();
+        if(props == null) {
+            props = new Properties();
+        }
+        props.put("message", "message");
+        
+        try {
+            configuration.update(props);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+        String pid = configuration.getPid();
+        System.out.println("PID : " + pid);
+        
+        //  The instance should be created, wait for the architecture service
+        Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        props.put("message", "message2");
+        try {
+            configuration.update(props);
+            // Update the configuration ...
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check object -2", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        //Invoke
+        FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message2", mes);
+        assertEquals("Assert count", 2, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+                
+        try {
+            configuration.delete();
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        assertNull("Check unavailability", ref);
+    }
+    
+    public void testDelayedCreationAndReconfiguration() {
+        factory.stop();
+        Configuration configuration = null;
+        try {
+            configuration = admin.createFactoryConfiguration("CA-ImmConfigurableProvider", null);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        Dictionary props = configuration.getProperties();
+        if(props == null) {
+            props = new Properties();
+        }
+        props.put("message", "message");
+        
+        try {
+            configuration.update(props);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+        String pid = configuration.getPid();
+        System.out.println("PID : " + pid);
+        
+        assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+        
+        factory.start();
+        
+        
+        //  The instance should be created, wait for the architecture service
+        Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message", mes);
+        assertEquals("Assert count", 1, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        props.put("message", "message2");
+        try {
+            configuration.update(props);
+            // Update the configuration ...
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message2", mes);
+        //assertEquals("Assert count", 2, count);
+        // This test was removed as the result can be 3. 
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        try {
+            configuration.delete();
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        assertNull("Check unavailability", ref);
+    }
+    
+    public void testDelayedCreationAndReconfiguration2() {
+        factory.stop();
+        //The reconfiguration happens before the service invocation
+        Configuration configuration = null;
+        try {
+            configuration = admin.createFactoryConfiguration("CA-ImmConfigurableProvider", null);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        Dictionary props = configuration.getProperties();
+        if(props == null) {
+            props = new Properties();
+        }
+        props.put("message", "message");
+        
+        try {
+            configuration.update(props);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+        String pid = configuration.getPid();
+        System.out.println("PID : " + pid);
+        
+        assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+        
+        factory.start();
+        
+        
+        //  The instance should be created, wait for the architecture service
+        Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        props.put("message", "message2");
+        try {
+            configuration.update(props);
+            // Update the configuration ...
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check object -1", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        //Invoke
+        FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message2", mes);
+        //assertEquals("Assert count", 2, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+                
+        try {
+            configuration.delete();
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        assertNull("Check unavailability", ref);
+    }
+    
+    
+
+}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java
new file mode 100644
index 0000000..9567492
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceFactoryTestForServices.java
@@ -0,0 +1,340 @@
+package org.apache.felix.ipojo.test.scenarios.configadmin;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentFactory;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.configadmin.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+public class ManagedServiceFactoryTestForServices extends OSGiTestCase {
+    
+    private ComponentFactory factory;
+    private ConfigurationAdmin admin;
+    
+    public void setUp() {
+        factory = (ComponentFactory) Utils.getFactoryByName(context, "CA-ConfigurableProvider");
+        admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+        assertNotNull("Check configuration admin availability", admin);
+        try {
+            Configuration[] configurations = admin.listConfigurations("(service.factoryPid=CA-ConfigurableProvider)");
+            for (int i = 0; configurations != null && i < configurations.length; i++) {
+                configurations[i].delete();
+            }
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (InvalidSyntaxException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+    
+    public void tearDown() {
+        try {
+            Configuration[] configurations = admin.listConfigurations("(service.factoryPid=CA-ConfigurableProvider)");
+            for (int i = 0; configurations != null && i < configurations.length; i++) {
+                configurations[i].delete();
+            }
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (InvalidSyntaxException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        admin = null;
+
+        
+    }
+    
+    public void testCreationAndReconfiguration() {
+        Configuration configuration = null;
+        try {
+            configuration = admin.createFactoryConfiguration("CA-ConfigurableProvider", null);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        Dictionary props = configuration.getProperties();
+        if(props == null) {
+            props = new Properties();
+        }
+        props.put("message", "message");
+        
+        try {
+            configuration.update(props);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+        String pid = configuration.getPid();
+        System.out.println("PID : " + pid);
+        
+        //  The instance should be created, wait for the architecture service
+        Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message", mes);
+        assertEquals("Assert count", 1, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        props.put("message", "message2");
+        try {
+            configuration.update(props);
+            // Update the configuration ...
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message2", mes);
+        assertEquals("Assert count", 2, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        try {
+            configuration.delete();
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        assertNull("Check unavailability", ref);
+    }
+    
+    public void testCreationAndReconfiguration2() {
+        //The reconfiguration happens before the service invocation
+        Configuration configuration = null;
+        try {
+            configuration = admin.createFactoryConfiguration("CA-ConfigurableProvider", null);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        Dictionary props = configuration.getProperties();
+        if(props == null) {
+            props = new Properties();
+        }
+        props.put("message", "message");
+        
+        try {
+            configuration.update(props);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+        String pid = configuration.getPid();
+        System.out.println("PID : " + pid);
+        
+        //  The instance should be created, wait for the architecture service
+        Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        props.put("message", "message2");
+        try {
+            configuration.update(props);
+            // Update the configuration ...
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check no object -2", 0, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        //Invoke
+        FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message2", mes);
+        assertEquals("Assert count", 1, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+                
+        try {
+            configuration.delete();
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        assertNull("Check unavailability", ref);
+    }
+    
+    public void testDelayedCreationAndReconfiguration() {
+        factory.stop();
+        Configuration configuration = null;
+        try {
+            configuration = admin.createFactoryConfiguration("CA-ConfigurableProvider", null);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        Dictionary props = configuration.getProperties();
+        if(props == null) {
+            props = new Properties();
+        }
+        props.put("message", "message");
+        
+        try {
+            configuration.update(props);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+        String pid = configuration.getPid();
+        System.out.println("PID : " + pid);
+        
+        assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+        
+        factory.start();
+        
+        
+        //  The instance should be created, wait for the architecture service
+        Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message", mes);
+        assertEquals("Assert count", 1, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        System.out.println("===");
+        
+        props.put("message", "message2");
+        try {
+            configuration.update(props);
+            // Update the configuration ...
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        System.out.println("===");
+        
+        fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message2", mes);
+       // assertEquals("Assert count", 2, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        try {
+            configuration.delete();
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        assertNull("Check unavailability", ref);
+    }
+    
+    public void testDelayedCreationAndReconfiguration2() {
+        factory.stop();
+        //The reconfiguration happens before the service invocation
+        Configuration configuration = null;
+        try {
+            configuration = admin.createFactoryConfiguration("CA-ConfigurableProvider", null);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        Dictionary props = configuration.getProperties();
+        if(props == null) {
+            props = new Properties();
+        }
+        props.put("message", "message");
+        
+        try {
+            configuration.update(props);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+        String pid = configuration.getPid();
+        System.out.println("PID : " + pid);
+        
+        assertNull("check no instance", Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")"));
+        
+        factory.start();
+        
+        
+        //  The instance should be created, wait for the architecture service
+        Utils.waitForService(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        Architecture architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check no object", 0, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        props.put("message", "message2");
+        try {
+            configuration.update(props);
+            // Update the configuration ...
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Check no object -2", 0, architecture.getInstanceDescription().getCreatedObjects().length);
+        
+        //Invoke
+        FooService fs = (FooService) Utils.getServiceObject(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        architecture = (Architecture) Utils.getServiceObject(context, Architecture.class.getName(), "(architecture.instance="+pid+")");
+        
+        assertEquals("Assert Message", "message2", mes);
+        assertEquals("Assert count", 1, count);
+        assertEquals("Check 1 object", 1, architecture.getInstanceDescription().getCreatedObjects().length);
+                
+        try {
+            configuration.delete();
+            Thread.sleep(10);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReference(context, FooService.class.getName(), "(instance.name=" + pid + ")");
+        assertNull("Check unavailability", ref);
+    }
+    
+    
+
+}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java
new file mode 100644
index 0000000..c906f7b
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForImmediate.java
@@ -0,0 +1,349 @@
+package org.apache.felix.ipojo.test.scenarios.configadmin;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentFactory;
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.configadmin.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+public class ManagedServiceTestForImmediate extends OSGiTestCase {
+    
+    private String factNameImm = "CA-ImmConfigurableProvider";
+    private String msp = "foo";
+
+    private ComponentFactory factImm;
+    
+    private ConfigurationAdmin admin;
+    
+    
+    public void setUp() {
+        factImm = (ComponentFactory) Utils.getFactoryByName(context, factNameImm);
+        admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+        assertNotNull("Check configuration admin availability", admin);
+        cleanConfigurationAdmin();
+    }
+    
+    public void tearDown() {
+        cleanConfigurationAdmin();
+        admin = null;
+    }
+    
+    private void cleanConfigurationAdmin() {
+        try {
+            Configuration[] configurations = admin.listConfigurations("(service.pid=" + msp + ")");
+            for (int i = 0; configurations != null && i < configurations.length; i++) {
+                configurations[i].delete();
+            }
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (InvalidSyntaxException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+    
+    public void testFactoryCreationAndReconfiguration() {
+        Properties props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        ComponentInstance instance  = null;
+        try {
+            instance =  factImm.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        FooService fs = (FooService) context.getService(ref);
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message", mes);
+        assertEquals("Check count", 1, count);
+        
+        //Update
+        Configuration configuration;
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message2");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        fs = (FooService) context.getService(ref);
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message2", mes);
+        assertEquals("Check count", 2, count);
+        
+        instance.dispose();
+        
+    }
+    
+    public void testMSFCreationAndReconfiguration() {
+        Configuration conf = null;
+        try {
+            conf = admin.createFactoryConfiguration(factNameImm);
+            Dictionary props = conf.getProperties();
+            if (props == null) {
+                props = new Properties();
+            }
+            props.put("managed.service.pid", msp);
+            props.put("message", "message");
+            conf.update(props);
+            Thread.sleep(100); // Wait for the creation.
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        
+        Architecture arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+        
+        ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+        assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+        FooService fs = (FooService) context.getService(ref);
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message", mes);
+        assertEquals("Check count", 1, count);
+        
+        //Update
+        Configuration configuration;
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message2");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+        ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+        assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+
+        arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+        fs = (FooService) context.getService(ref);
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message2", mes);
+        assertEquals("Check count", 2, count);
+        
+        try {
+            conf.delete();
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+    }
+    
+    public void testCreationAndReconfiguration2() {
+        // The configuration exists before the instance creation.
+        
+      //Update
+        Configuration configuration;
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message2");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        Properties props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        ComponentInstance instance  = null;
+        try {
+            instance =  factImm.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        FooService fs = (FooService) context.getService(ref);
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message2", mes); // Already reconfigured.
+        assertEquals("Check count", 1, count);
+        
+        instance.dispose();
+        
+        //Reconfiguration
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message3");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        // Recreation of the instance.
+        props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        instance  = null;
+        try {
+            instance =  factImm.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        fs = (FooService) context.getService(ref);
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message3", mes); // Already reconfigured.
+        assertEquals("Check count", 1, count);
+        
+        instance.dispose();
+        
+        
+    }
+
+    public void testCreationAndReconfiguration3() {
+        // The configuration exists before the instance creation.
+        
+      //Update
+        Configuration configuration;
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message2");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        Properties props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        ComponentInstance instance  = null;
+        try {
+            instance =  factImm.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        FooService fs = (FooService) context.getService(ref);
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message2", mes); // Already reconfigured.
+        assertEquals("Check count", 1, count);
+        
+        //Reconfiguration
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message3");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        instance.dispose();
+        
+        // Recreation of the instance.
+        props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        instance  = null;
+        try {
+            instance =  factImm.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        fs = (FooService) context.getService(ref);
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message3", mes); // Already reconfigured.
+        assertEquals("Check count", 1, count);
+        
+        instance.dispose();
+        
+        
+    }
+   
+    
+    
+
+}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java
new file mode 100644
index 0000000..81d57ce
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/ManagedServiceTestForService.java
@@ -0,0 +1,349 @@
+package org.apache.felix.ipojo.test.scenarios.configadmin;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentFactory;
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.configadmin.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+public class ManagedServiceTestForService extends OSGiTestCase {
+    
+    private String factNameSvc = "CA-ConfigurableProvider";
+    private String msp = "foo";
+
+    private ComponentFactory factSvc;
+    
+    private ConfigurationAdmin admin;
+    
+    
+    public void setUp() {
+        factSvc = (ComponentFactory) Utils.getFactoryByName(context, factNameSvc);
+        admin = (ConfigurationAdmin) Utils.getServiceObject(context, ConfigurationAdmin.class.getName(), null);
+        assertNotNull("Check configuration admin availability", admin);
+        cleanConfigurationAdmin();
+    }
+    
+    public void tearDown() {
+        cleanConfigurationAdmin();
+        admin = null;
+    }
+    
+    private void cleanConfigurationAdmin() {
+        try {
+            Configuration[] configurations = admin.listConfigurations("(service.pid=" + msp + ")");
+            for (int i = 0; configurations != null && i < configurations.length; i++) {
+                configurations[i].delete();
+            }
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (InvalidSyntaxException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+    
+    public void testFactoryCreationAndReconfiguration() {
+        Properties props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        ComponentInstance instance  = null;
+        try {
+            instance =  factSvc.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        FooService fs = (FooService) context.getService(ref);
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message", mes);
+        assertEquals("Check count", 1, count);
+        
+        //Update
+        Configuration configuration;
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message2");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        fs = (FooService) context.getService(ref);
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message2", mes);
+        assertEquals("Check count", 2, count);
+        
+        instance.dispose();
+        
+    }
+    
+    public void testMSFCreationAndReconfiguration() {
+        Configuration conf = null;
+        try {
+            conf = admin.createFactoryConfiguration(factNameSvc);
+            Dictionary props = conf.getProperties();
+            if (props == null) {
+                props = new Properties();
+            }
+            props.put("managed.service.pid", msp);
+            props.put("message", "message");
+            conf.update(props);
+            Thread.sleep(100); // Wait for the creation.
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        
+        Architecture arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+        
+        ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+        assertEquals("Check no object", 0, arch.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+        FooService fs = (FooService) context.getService(ref);
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message", mes);
+        assertEquals("Check count", 1, count);
+        
+        //Update
+        Configuration configuration;
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message2");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+        ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), conf.getPid());
+        assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+
+        arch = (Architecture) Utils.getServiceObject(context, org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")");
+        fs = (FooService) context.getService(ref);
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, arch.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message2", mes);
+        assertEquals("Check count", 2, count);
+        
+        try {
+            conf.delete();
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        
+    }
+    
+    public void testCreationAndReconfiguration2() {
+        // The configuration exists before the instance creation.
+        
+      //Update
+        Configuration configuration;
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message2");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        Properties props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        ComponentInstance instance  = null;
+        try {
+            instance =  factSvc.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        FooService fs = (FooService) context.getService(ref);
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message2", mes); // Already reconfigured.
+        assertEquals("Check count", 1, count);
+        
+        instance.dispose();
+        
+        //Reconfiguration
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message3");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        // Recreation of the instance.
+        props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        instance  = null;
+        try {
+            instance =  factSvc.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        fs = (FooService) context.getService(ref);
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message3", mes); // Already reconfigured.
+        assertEquals("Check count", 1, count);
+        
+        instance.dispose();
+        
+        
+    }
+
+    public void testCreationAndReconfiguration3() {
+        // The configuration exists before the instance creation.
+        
+      //Update
+        Configuration configuration;
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message2");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        Properties props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        ComponentInstance instance  = null;
+        try {
+            instance =  factSvc.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ServiceReference ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        FooService fs = (FooService) context.getService(ref);
+        Properties p = fs.fooProps();
+        String mes = p.getProperty("message");
+        int count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message2", mes); // Already reconfigured.
+        assertEquals("Check count", 1, count);
+        
+        //Reconfiguration
+        try {
+            configuration = admin.getConfiguration(msp);
+            Dictionary prc = configuration.getProperties();
+            if (prc == null) {
+                prc = new Properties();
+            }
+            prc.put("message", "message3");
+            configuration.update(prc);
+            Thread.sleep(5);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+        
+        instance.dispose();
+        
+        // Recreation of the instance.
+        props = new Properties();
+        props.put("managed.service.pid", msp);
+        props.put("message", "message");
+        instance  = null;
+        try {
+            instance =  factSvc.createComponentInstance(props);
+        } catch (Exception e) {
+           fail(e.getMessage());
+        }
+        
+        ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), instance.getInstanceName());
+        assertEquals("Check no object", 0, instance.getInstanceDescription().getCreatedObjects().length);
+        assertNotNull("FS availability", ref);
+        
+        fs = (FooService) context.getService(ref);
+        p = fs.fooProps();
+        mes = p.getProperty("message");
+        count = ((Integer) p.get("count")).intValue();
+        assertEquals("Check 1 object", 1, instance.getInstanceDescription().getCreatedObjects().length);
+        assertEquals("Check message", "message3", mes); // Already reconfigured.
+        assertEquals("Check count", 1, count);
+        
+        instance.dispose();
+        
+        
+    }
+   
+    
+    
+
+}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/service/CheckService.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/service/CheckService.java
new file mode 100644
index 0000000..6b9cfa0
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/service/CheckService.java
@@ -0,0 +1,31 @@
+/* 
+ * 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.test.scenarios.configadmin.service;
+
+import java.util.Properties;
+
+public interface CheckService {
+    
+    public static final String foo = "foo";
+	
+	public boolean check();
+	
+	public Properties getProps();
+
+}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/service/FooService.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/service/FooService.java
new file mode 100644
index 0000000..94abc61
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/configadmin/service/FooService.java
@@ -0,0 +1,39 @@
+/* 
+ * 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.test.scenarios.configadmin.service;
+
+import java.util.Properties;
+
+public interface FooService {
+
+	boolean foo();
+	
+	Properties fooProps();
+	
+	Boolean getObject();
+	
+	boolean getBoolean();
+	
+	int getInt();
+	
+	long getLong();
+	
+	double getDouble();
+	
+}
diff --git a/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
new file mode 100644
index 0000000..df20679
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/java/org/apache/felix/ipojo/test/scenarios/util/Utils.java
@@ -0,0 +1,346 @@
+/* 
+ * 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.test.scenarios.util;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.Handler;
+import org.apache.felix.ipojo.HandlerManagerFactory;
+import org.apache.felix.ipojo.ServiceContext;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+public class Utils {
+
+    public static Factory getFactoryByName(BundleContext bc, String factoryName) {
+        ServiceReference[] refs;
+        try {
+            refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
+            if (refs == null) {
+                System.err.println("Cannot get the factory " + factoryName);
+                return null;
+            }
+            return ((Factory) bc.getService(refs[0]));
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    public static HandlerManagerFactory getHandlerFactoryByName(BundleContext bc, String factoryName) {
+        ServiceReference[] refs;
+        try {
+            refs = bc.getServiceReferences(Factory.class.getName(), "(" + Handler.HANDLER_NAME_PROPERTY + "=" + factoryName + ")");
+            if (refs == null) {
+                System.err.println("Cannot get the factory " + factoryName);
+                return null;
+            }
+            return (HandlerManagerFactory) bc.getService(refs[0]);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    public static ComponentInstance getComponentInstance(BundleContext bc, String factoryName, Dictionary configuration) {
+        Factory fact = getFactoryByName(bc, factoryName);
+
+        if (fact == null) {
+            System.err.println("Factory " + factoryName + " not found");
+            return null;
+        }
+
+        // if(fact.isAcceptable(configuration)) {
+        try {
+            return fact.createComponentInstance(configuration);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Cannot create the instance from " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+        // }
+        // else {
+        // System.err.println("Configuration not accepted by : " + factoryName);
+        // return null;
+        // }
+    }
+
+    public static ComponentInstance getComponentInstanceByName(BundleContext bc, String factoryName, String name) {
+        Factory fact = getFactoryByName(bc, factoryName);
+
+        if (fact == null) {
+            System.err.println("Factory " + factoryName + " not found");
+            return null;
+        }
+
+        try {
+            Properties props = new Properties();
+            props.put("instance.name",name);
+            return fact.createComponentInstance(props);
+        } catch (Exception e) {
+            System.err.println("Cannot create the instance from " + factoryName + " : " + e.getMessage());
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static ServiceReference[] getServiceReferences(BundleContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return new ServiceReference[0];
+        } else {
+            return refs;
+        }
+    }
+
+    public static ServiceReference getServiceReference(BundleContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+
+    public static ServiceReference getServiceReferenceByName(BundleContext bc, String itf, String name) {
+        ServiceReference[] refs = null;
+        String filter = null;
+        if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
+            filter = "(" + "factory.name" + "=" + name + ")";
+        } else {
+            filter = "(" + "instance.name" + "=" + name + ")";
+        }
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+    
+    public static ServiceReference getServiceReferenceByPID(BundleContext bc, String itf, String pid) {
+        ServiceReference[] refs = null;
+        String filter = "(" + "service.pid" + "=" + pid + ")";
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else if (refs.length == 1) {
+            return refs[0];
+        } else {
+            Assert.fail("A service lookup by PID returned several providers (" + refs.length + ")" + " for " + itf + " with " + pid);
+            return null;
+        }
+    }
+
+    public static Object getServiceObject(BundleContext bc, String itf, String filter) {
+        ServiceReference ref = getServiceReference(bc, itf, filter);
+        if (ref != null) {
+            return bc.getService(ref);
+        } else {
+            return null;
+        }
+    }
+
+    public static Object[] getServiceObjects(BundleContext bc, String itf, String filter) {
+        ServiceReference[] refs = getServiceReferences(bc, itf, filter);
+        if (refs != null) {
+            Object[] list = new Object[refs.length];
+            for (int i = 0; i < refs.length; i++) {
+                list[i] = bc.getService(refs[i]);
+            }
+            return list;
+        } else {
+            return new Object[0];
+        }
+    }
+
+//    public static ServiceContext getServiceContext(ComponentInstance ci) {
+//        if (ci instanceof CompositeManager) {
+//            return ((CompositeManager) ci).getServiceContext();
+//        } else {
+//            throw new RuntimeException("Cannot get the service context form an non composite instance");
+//        }
+//    }
+
+    public static Factory getFactoryByName(ServiceContext bc, String factoryName) {
+        ServiceReference[] refs;
+        try {
+            refs = bc.getServiceReferences(Factory.class.getName(), "(factory.name=" + factoryName + ")");
+            if (refs == null) { return null; }
+            return ((Factory) bc.getService(refs[0]));
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Cannot get the factory " + factoryName + " : " + e.getMessage());
+            return null;
+        }
+    }
+
+    public static ComponentInstance getComponentInstance(ServiceContext bc, String factoryName, Dictionary configuration) {
+        Factory fact = getFactoryByName(bc, factoryName);
+
+        if (fact == null) { return null; }
+
+        if (fact.isAcceptable(configuration)) {
+            try {
+                return fact.createComponentInstance(configuration);
+            } catch (Exception e) {
+                System.err.println(e.getMessage());
+                e.printStackTrace();
+                return null;
+            }
+        } else {
+            System.err.println("Configuration not accepted by : " + factoryName);
+            return null;
+        }
+    }
+
+    public static ServiceReference[] getServiceReferences(ServiceContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return new ServiceReference[0];
+        } else {
+            return refs;
+        }
+    }
+
+    public static ServiceReference getServiceReference(ServiceContext bc, String itf, String filter) {
+        ServiceReference[] refs = null;
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+
+    public static ServiceReference getServiceReferenceByName(ServiceContext bc, String itf, String name) {
+        ServiceReference[] refs = null;
+        String filter = null;
+        if (itf.equals(Factory.class.getName()) || itf.equals(ManagedServiceFactory.class.getName())) {
+            filter = "(" + "factory.name" + "=" + name + ")";
+        } else {
+            filter = "(" + "instance.name" + "=" + name + ")";
+        }
+        try {
+            refs = bc.getServiceReferences(itf, filter);
+        } catch (InvalidSyntaxException e) {
+            System.err.println("Invalid Filter : " + filter);
+        }
+        if (refs == null) {
+            return null;
+        } else {
+            return refs[0];
+        }
+    }
+
+    public static Object getServiceObject(ServiceContext bc, String itf, String filter) {
+        ServiceReference ref = getServiceReference(bc, itf, filter);
+        if (ref != null) {
+            return bc.getService(ref);
+        } else {
+            return null;
+        }
+    }
+
+    public static Object[] getServiceObjects(ServiceContext bc, String itf, String filter) {
+        ServiceReference[] refs = getServiceReferences(bc, itf, filter);
+        if (refs != null) {
+            Object[] list = new Object[refs.length];
+            for (int i = 0; i < refs.length; i++) {
+                list[i] = bc.getService(refs[i]);
+            }
+            return list;
+        } else {
+            return new Object[0];
+        }
+    }
+    
+    public static boolean contains(String string, String[] array) {
+        for (int i = 0; array != null && i < array.length; i++) {
+            if (array[i] != null  && array[i].equals(string)) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    public static boolean contains(int value, int[] array) {
+        for (int i = 0; array != null && i < array.length; i++) {
+            if (array[i] == value) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    public static void waitForService(BundleContext context, String itf, String filter) {
+        ServiceReference[] refs = getServiceReferences(context, itf, filter);
+        int count = 0;
+        if (refs.length != 0) {
+            return;
+        } else {
+            while(refs.length == 0) {
+                try {
+                    Thread.sleep(5);
+                } catch (InterruptedException e) {
+                    // Interrupted
+                }
+                count++;
+                if (count == 10) {
+                    throw new RuntimeException("Timeout ... no services match with " + filter);
+                }
+                refs = getServiceReferences(context, itf, filter);
+            }
+        }
+    }
+
+}
diff --git a/ipojo/tests/core/configadmin/src/main/resources/metadata.xml b/ipojo/tests/core/configadmin/src/main/resources/metadata.xml
new file mode 100644
index 0000000..98a5e78
--- /dev/null
+++ b/ipojo/tests/core/configadmin/src/main/resources/metadata.xml
@@ -0,0 +1,21 @@
+<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="org.apache.felix.ipojo http://people.apache.org/~clement/ipojo/schemas/core.xsd" xmlns="org.apache.felix.ipojo">
+		<component classname="org.apache.felix.ipojo.test.scenarios.component.ConfigurableFooProvider" 
+			name="CA-ConfigurableProvider">
+			<provides></provides>
+			<properties>
+				<property name="message" method="setMessage"/>
+			</properties>
+		</component>
+		<component classname="org.apache.felix.ipojo.test.scenarios.component.ConfigurableFooProvider" 
+			immediate="true"
+			name="CA-ImmConfigurableProvider">
+			<provides></provides>
+			<properties>
+				<property name="message" method="setMessage"/>
+			</properties>
+		</component>
+		
+		
+			
+</ipojo>
diff --git a/ipojo/tests/pom.xml b/ipojo/tests/pom.xml
index 0d8079b..8c3ea45 100644
--- a/ipojo/tests/pom.xml
+++ b/ipojo/tests/pom.xml
@@ -43,6 +43,7 @@
 	<module>handler/temporal</module>
 	<module>handler/whiteboard</module>
 	<module>handler/eventadmin</module>
+	<module>core/configadmin</module>
    </modules>
    
    <profiles>
