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

svn commit: r1447488 [1/2] - in /felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-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/ipojo/ src/m...

Author: clement
Date: Mon Feb 18 20:52:38 2013
New Revision: 1447488

URL: http://svn.apache.org/r1447488
Log:
FELIX-3903

Migrate the core factory test to pax exam 3

Added:
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/   (with props)
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/pom.xml
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ReconfigurableSimpleType.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleType.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/resources/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/resources/metadata.xml
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComponentDesc.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigAdmin.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFactoryProperties.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestObedience.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestReconfiguration.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUnacceptableConfiguration.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/resources/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/resources/exam.properties

Propchange: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 18 20:52:38 2013
@@ -0,0 +1,2 @@
+ipojo-core-factory-test.iml
+.idea

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/pom.xml?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/pom.xml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/pom.xml Mon Feb 18 20:52:38 2013
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <parent>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.ipojo.runtime.core-it</artifactId>
+        <version>1.9.0-SNAPSHOT</version>
+        <relativePath>../../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>ipojo-core-factory-test</artifactId>
+
+    <name>${project.artifactId}</name>
+
+</project>
\ No newline at end of file

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,51 @@
+/* 
+ * 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.components;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.osgi.framework.ServiceReference;
+
+public abstract class CheckProviderParentClass {
+    
+    int simpleU = 0;
+    int objectU = 0;
+    int refU = 0;
+    int bothU = 0;
+    
+    
+    public void bothUnbind(FooService o, ServiceReference sr) {
+        if(sr != null && o != null && o instanceof FooService) { bothU++; }
+    }
+    
+    public void refUnbind(ServiceReference sr) {
+        if(sr != null) { refU++; }
+    }
+    
+    public void objectUnbind(FooService o) {
+        if(o != null && o instanceof FooService) { objectU++; }
+        else {
+            System.err.println("Unbind null : " + o);
+        }
+    }
+    
+    public void voidUnbind() {
+        simpleU++;
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,83 @@
+/* 
+ * 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.components;
+
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+public class CheckServiceProvider extends CheckProviderParentClass implements CheckService {
+    
+	FooService fs;
+	
+	int simpleB = 0;
+	int objectB = 0;
+	int refB = 0;
+	int bothB = 0;
+
+	public boolean check() {
+		return fs.foo();
+	}
+
+	public Properties getProps() {
+		Properties props = new Properties();
+		props.put("voidB", new Integer(simpleB));
+		props.put("objectB", new Integer(objectB));
+		props.put("refB", new Integer(refB));
+		props.put("bothB", new Integer(bothB));
+		props.put("voidU", new Integer(simpleU));
+		props.put("objectU", new Integer(objectU));
+		props.put("refU", new Integer(refU));
+		props.put("bothU", new Integer(bothU));
+		if (fs != null) {
+		    props.put("result", new Boolean(fs.foo()));
+		    props.put("boolean", new Boolean(fs.getBoolean()));
+		    props.put("int", new Integer(fs.getInt()));
+		    props.put("long", new Long(fs.getLong()));
+		    props.put("double", new Double(fs.getDouble()));
+		    if(fs.getObject() != null) { props.put("object", fs.getObject()); }
+		}
+        props.put("static", CheckService.foo);
+        props.put("class", CheckService.class.getName());
+		return props;
+	}
+	
+	private void voidBind() {
+		simpleB++;
+	}
+	
+	protected void objectBind(FooService o) {
+	    if (o == null) {
+	        System.err.println("Bind receive null !!! ");
+	        return;
+	    }
+		if(o != null && o instanceof FooService) { objectB++; }
+	}
+	
+	public void refBind(ServiceReference sr) {
+		if(sr != null) { refB++; }
+	}
+	
+    public void bothBind(FooService o, ServiceReference sr) {
+	    if(sr != null && o != null && o instanceof FooService) { bothB++; }
+	}
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,54 @@
+/* 
+ * 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.components;
+
+import org.apache.felix.ipojo.runtime.core.services.BarService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+
+import java.util.Properties;
+
+public class FooBarProviderType1 implements FooService, BarService {
+
+	public boolean foo() {
+		return true;
+	}
+
+	public Properties fooProps() {
+		return new Properties();
+	}
+
+	public boolean bar() {
+		return true;
+	}
+
+	public Properties getProps() {
+		return new Properties();
+	}
+
+	public boolean getBoolean() { return true; }
+
+	public double getDouble() { return 1.0; }
+
+	public int getInt() { return 1; }
+
+	public long getLong() { return 1; }
+
+	public Boolean getObject() { return new Boolean(true); }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,117 @@
+/* 
+ * 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.components;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.osgi.framework.BundleContext;
+
+import java.util.Properties;
+
+public class FooProviderType1 implements FooService {
+	
+	private int m_bar;
+	private String m_foo;
+    
+    private BundleContext m_context;
+    
+    private static FooProviderType1 singleton;
+    private static int count = 0;
+    
+    private static FooProviderType1 singleton(BundleContext bc) {
+        if (singleton == null) {
+            count++;
+            singleton = new FooProviderType1(bc);
+        }
+        return singleton;
+    }
+    
+    public static FooProviderType1 several(BundleContext bc) {
+        count++;
+        return new FooProviderType1(bc);
+    }
+        
+    public FooProviderType1(BundleContext bc) {
+        if (bc ==null) {
+            throw new RuntimeException("Injected bundle context null");
+        }
+        m_context = bc;
+    }
+
+	public boolean foo() {
+		return true;
+	}
+
+	public Properties fooProps() {
+		Properties p = new Properties();
+		p.put("bar", new Integer(m_bar));
+        if(m_foo != null) {
+            p.put("foo", m_foo);
+        }
+        p.put("context", m_context);
+        
+        p.put("count", new Integer(count));
+		return p;
+	}
+    
+	public void testException() throws Exception {
+        String a = "foobarbaz";
+	    throw new Exception("foo"+a);
+    }
+    
+    public void testTry() {
+            String a = "foo";
+            a.charAt(0);
+    }
+    
+    public void testTry2(String s) {
+            String a = "foo";
+            a.charAt(0);
+    }
+    
+    private void nexttry(String  s) {
+        try {
+            s += "foo";
+        } catch(RuntimeException e) {
+            
+        }
+    }
+    
+	public boolean getBoolean() { return true; }
+
+	public double getDouble() { return 1.0; }
+
+	public int getInt() { return 1; }
+
+	public long getLong() { return 1; }
+
+	public Boolean getObject() { return new Boolean(true); }
+	
+	/**
+	 * Custom constructor.
+	 * @param bar
+	 * @param foo
+	 * @param bc
+	 */
+	public FooProviderType1(int bar, String foo, BundleContext bc) {
+	    m_bar = bar;
+	    m_foo = foo;
+	    m_context = bc;
+	}
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,64 @@
+/* 
+ * 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.components;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+
+import java.util.Properties;
+
+
+public class FooProviderTypeDyn implements FooService {
+	
+	private int intProp;	
+	private String strProp;
+	private String[] strAProp;
+	private int[] intAProp;
+	private boolean boolProp;
+
+	public boolean foo() {
+		intProp = 3;
+		boolProp = true;
+		if(strProp.equals("foo")) { strProp = "bar"; }
+		else { strProp = "foo"; }
+		strAProp = new String[] {"foo", "bar", "baz"};
+		intAProp = new int[] {3, 2, 1};
+		return true;
+	}
+
+	public Properties fooProps() {
+		Properties p = new Properties();
+		p.put("intProp", new Integer(intProp));
+		p.put("boolProp", new Boolean(boolProp));
+		p.put("strProp", strProp);
+		p.put("strAProp", strAProp);
+		p.put("intAProp", intAProp);
+		return p;
+	}
+	
+	public boolean getBoolean() { return true; }
+
+	public double getDouble() { return 1.0; }
+
+	public int getInt() { return 1; }
+
+	public long getLong() { return 1; }
+
+	public Boolean getObject() { return new Boolean(true); }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,58 @@
+/* 
+ * 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.components;
+
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+
+import java.util.Properties;
+
+public class FooProviderTypeDyn2 implements FooService {
+	
+	private int intProp = 2;
+	private boolean boolProp = true;
+	private String strProp = "foo";
+	private String[] strAProp = new String[] {"foo", "bar"};
+	private int[] intAProp = new int[] {1, 2, 3};
+
+	public boolean foo() {
+		intAProp = null;
+		return true;
+	}
+
+	public Properties fooProps() {
+		Properties p = new Properties();
+		p.put("intProp", new Integer(intProp));
+		p.put("boolProp", new Boolean(boolProp));
+		p.put("strProp", strProp);
+		p.put("strAProp", strAProp);
+		p.put("intAProp", intAProp);
+		return p;
+	}
+	
+	public boolean getBoolean() { return true; }
+
+	public double getDouble() { return 1.0; }
+
+	public int getInt() { return 1; }
+
+	public long getLong() { return 1; }
+
+	public Boolean getObject() { return new Boolean(true); }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ReconfigurableSimpleType.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ReconfigurableSimpleType.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ReconfigurableSimpleType.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ReconfigurableSimpleType.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,44 @@
+package org.apache.felix.ipojo.runtime.core.components;
+
+public class ReconfigurableSimpleType {
+
+
+	private String prop; // Property.
+
+	private String x; // Property.
+
+	boolean controller;
+
+	public void start () {
+		if (prop == null || prop.equals("KO")) {
+			throw new IllegalStateException("Bad Configuration : " + prop);
+		}
+
+		if (x == null) {
+			throw new IllegalStateException("x is null");
+		}
+
+		System.out.println("OK !!!!");
+	}
+
+	public void setX(String v) {
+		x = v;
+	}
+
+	public void setProp(String p) {
+		prop = p;
+		if (prop == null || prop.equals("KO")) {
+			controller = false;
+		} else {
+			controller = true;
+			System.out.println("OK !!!!");
+		}
+	}
+
+	public void setController(boolean p) {
+		if (p) {
+			System.out.println("OK !!!!");
+		}
+	}
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleType.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleType.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleType.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleType.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.runtime.core.components;
+
+public class SimpleType {
+    
+    private boolean m_controller;
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,29 @@
+/* 
+ * 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.services;
+
+import java.util.Properties;
+
+public interface BarService {
+	
+	public boolean bar();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java Mon Feb 18 20:52:38 2013
@@ -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.runtime.core.services;
+
+import java.util.Properties;
+
+public interface CheckService {
+    
+    public static final String foo = "foo";
+	
+	public boolean check();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java Mon Feb 18 20:52:38 2013
@@ -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.runtime.core.services;
+
+import java.util.Properties;
+
+public interface FooService {
+
+	boolean foo();
+	
+	Properties fooProps();
+	
+	Boolean getObject();
+	
+	boolean getBoolean();
+	
+	int getInt();
+	
+	long getLong();
+	
+	double getDouble();
+	
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/resources/metadata.xml?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/resources/metadata.xml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/main/resources/metadata.xml Mon Feb 18 20:52:38 2013
@@ -0,0 +1,155 @@
+<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<!-- Simple provider  -->
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+		name="Factories-FooProviderType-1" architecture="true">
+		<provides />
+	</component>
+
+	<!-- Provider providing 2 services -->
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooBarProviderType1"
+		name="Factories-FooBarProviderType-1" architecture="true">
+		<provides />
+	</component>
+
+	<!-- Provider with dynamic property -->
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderTypeDyn"
+		name="Factories-FooProviderType-Dyn" architecture="true">
+		<provides>
+			<property name="int" field="intProp" value="2" mandatory="true"/>
+			<property name="boolean" field="boolProp" value="false" mandatory="true"/>
+			<property name="string" field="strProp" value="foo" mandatory="true"/>
+			<property name="strAProp" field="strAProp"
+				value="{foo, bar}" mandatory="true"/>
+			<property name="intAProp" field="intAProp" value="{ 1,2,3}" mandatory="true"/>
+		</provides>
+	</component>
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderTypeDyn"
+		name="Factories-FooProviderType-Dynopt" architecture="true">
+		<provides>
+			<property name="int" field="intProp" value="2"/>
+			<property name="boolean" field="boolProp" value="false"/>
+			<property name="string" field="strProp" value="foo"/>
+			<property name="strAProp" field="strAProp"
+				value="{foo, bar}"/>
+			<property name="intAProp" field="intAProp" value="{ 1,2,3}"/>
+		</provides>
+	</component>
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+		name="Factories-FooProviderType-2" architecture="true">
+		<provides>
+			<property name="int" type="int" value="2" mandatory="true" />
+			<property name="long" type="long" value="40" mandatory="true"/>
+			<property name="string" type="java.lang.String" value="foo" mandatory="true"/>
+			<property name="strAProp" type="java.lang.String[]"
+				value="{foo, bar}" mandatory="true" />
+			<property name="intAProp" type="int[]" value="{1,2,3}" mandatory="true"/>
+		</provides>
+	</component>
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+		name="Factories-FooProviderType-2opt" architecture="true">
+		<provides>
+			<property name="int" type="int" value="2"/>
+			<property name="long" type="long" value="40"/>
+			<property name="string" type="java.lang.String" value="foo"/>
+			<property name="strAProp" type="java.lang.String[]"
+				value="{foo, bar}" />
+			<property name="intAProp" type="int[]" value="{1,2,3}"/>
+		</provides>
+	</component>
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderTypeDyn2"
+		name="Factories-FooProviderType-Dyn2" architecture="true">
+		<provides>
+			<property name="int" field="intProp" value="4" mandatory="true"/>
+			<property name="boolean" field="boolProp" mandatory="true"/>
+			<property name="string" field="strProp" mandatory="true"/>
+			<property name="strAProp" field="strAProp" mandatory="true"/>
+			<property name="intAProp" field="intAProp"
+				value="{1, 2,3 }" mandatory="true"/>
+		</provides>
+	</component>
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderTypeDyn2"
+		name="Factories-FooProviderType-Dyn2opt" architecture="true">
+		<provides>
+			<property name="int" field="intProp" value="4" />
+			<property name="boolean" field="boolProp"/>
+			<property name="string" field="strProp"/>
+			<property name="strAProp" field="strAProp"/>
+			<property name="intAProp" field="intAProp"
+				value="{1, 2,3 }"/>
+		</provides>
+	</component>
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+		name="Factories-FooProviderType-3" architecture="true">
+		<provides>
+			<property name="foo" field="m_foo" mandatory="true"/>
+			<property name="bar" field="m_bar" mandatory="true"/>
+			<property name="baz" type="java.lang.String" mandatory="true"/>
+		</provides>
+		<properties propagation="true">
+			<property name="foo" field="m_foo" mandatory="true"/>
+			<property name="bar" field="m_bar" mandatory="true"/>
+		</properties>
+	</component>
+
+	<component
+		classname="org.apache.felix.ipojo.runtime.core.components.FooProviderType1"
+		name="Factories-FooProviderType-3opt" architecture="true">
+		<provides>
+			<property name="foo" field="m_foo"/>
+			<property name="bar" field="m_bar"/>
+			<property name="baz" type="java.lang.String"/>
+		</provides>
+		<properties propagation="true">
+			<property name="foo" field="m_foo"/>
+			<property name="bar" field="m_bar"/>
+		</properties>
+	</component>
+
+	<!-- type & instance used to check instance lifecycle against factory validation & invalidation -->
+	<component classname="org.apache.felix.ipojo.runtime.core.components.SimpleType" architecture="true">
+		<controller field="m_controller"/>
+	</component>
+	<instance component="org.apache.felix.ipojo.runtime.core.components.SimpleType" name="SimpleInstance"/>
+
+	<!-- check that instance state is recomputed after reconfiguration -->
+	<component classname="org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType" architecture="true">
+		<properties>
+			<property name="prop" field="prop"/>
+			<property name="x" method="setX" value="x"/>
+		</properties>
+		<callback transition="validate" method="start"/>
+	</component>
+	<component classname="org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType"
+		name="org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType2"
+		architecture="true" immediate="true">
+		<properties>
+			<property name="prop" method="setProp"/>
+			<property name="x" method="setX" value="x"/>
+		</properties>
+		<controller field="controller"/>
+	</component>
+	<component classname="org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType"
+		name="org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType3"
+		architecture="true" immediate="true">
+		<properties>
+			<property name="controller" method="setController" field="controller"/>
+			<property name="x" method="setX" value="x"/>
+		</properties>
+		<controller field="controller"/>
+	</component>
+</ipojo>

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,157 @@
+package org.apache.felix.ipojo.runtime.core;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.apache.felix.ipojo.runtime.core.components.*;
+import org.apache.felix.ipojo.runtime.core.services.CheckService;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.options.CompositeOption;
+import org.ops4j.pax.exam.options.DefaultCompositeOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.tinybundles.core.TinyBundle;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static junit.framework.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.*;
+
+/**
+ * Bootstrap the test from this project
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class Common {
+
+    @Inject
+    BundleContext bc;
+
+    OSGiHelper osgiHelper;
+    IPOJOHelper ipojoHelper;
+
+    @Configuration
+    public Option[] config() throws MalformedURLException {
+        Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+        root.setLevel(Level.INFO);
+
+        return options(
+                ipojoBundles(),
+                junitBundles(),
+                testedBundle(),
+                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
+        );
+    }
+
+    @Before
+    public void commonSetUp() {
+        osgiHelper = new OSGiHelper(bc);
+        ipojoHelper = new IPOJOHelper(bc);
+
+        // Dump OSGi Framework information
+        String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
+        if (vendor == null) {
+            vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
+        }
+        String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
+        System.out.println("OSGi Framework : " + vendor + " - " + version);
+    }
+
+    @After
+    public void commonTearDown() {
+        ipojoHelper.dispose();
+        osgiHelper.dispose();
+    }
+
+    public CompositeOption ipojoBundles() {
+        return new DefaultCompositeOption(
+                mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
+                mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
+                // harmcrest-all
+                //mavenBundle("de.twentyeleven.skysail", "org.hamcrest.hamcrest-all-osgi").versionAsInProject(),
+                // configuration admin
+                mavenBundle("org.apache.felix",  "org.apache.felix.configadmin").versionAsInProject()
+        );
+    }
+
+    public Option testedBundle() throws MalformedURLException {
+        File out = new File("target/tested/bundle.jar");
+
+        TinyBundle tested = TinyBundles.bundle();
+
+        // We look inside target/classes to find the class and resources
+        File classes = new File("target/classes");
+        Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
+        List<File> services = new ArrayList<File>();
+        for (File file : files) {
+            if (file.isDirectory()) {
+                // By convention we export of .services and .service package
+                if (file.getName().endsWith("services")  || file.getName().endsWith("service")) {
+                    services.add(file);
+                }
+            } else {
+                // We need to compute the path
+                String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
+                tested.add(path, file.toURI().toURL());
+                System.out.println(file.getName() + " added to " + path);
+            }
+        }
+
+        String export = "";
+        for (File file : services) {
+            if (export.length() > 0) { export += ", "; }
+            String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
+            String packageName = path.replace('/', '.');
+            export += packageName;
+        }
+
+        System.out.println("Exported packages : " + export);
+
+        InputStream inputStream = tested
+                .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
+                .set(Constants.IMPORT_PACKAGE, "*")
+                .set(Constants.EXPORT_PACKAGE, export)
+                .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
+
+        try {
+            org.apache.commons.io.FileUtils.copyInputStreamToFile(inputStream, out);
+            return bundle(out.toURI().toURL().toExternalForm());
+        } catch (MalformedURLException e) {
+            throw new RuntimeException("Cannot compute the url of the manipulated bundle");
+        } catch (IOException e) {
+            throw new RuntimeException("Cannot write of the manipulated bundle");
+        }
+    }
+
+    public void assertContains(String s, String[] arrays, String object) {
+        for (String suspect : arrays) {
+            if (object.equals(suspect)) {
+                return;
+            }
+        }
+        fail("Assertion failed : " + s);
+    }
+
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComponentDesc.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComponentDesc.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComponentDesc.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComponentDesc.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,345 @@
+/* 
+ * 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.ComponentTypeDescription;
+import org.apache.felix.ipojo.architecture.PropertyDescription;
+import org.apache.felix.ipojo.metadata.Element;
+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 java.util.Arrays;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.*;
+
+/**
+ * Check component type description.
+ */
+public class TestComponentDesc extends Common {
+	
+	ServiceReference sr_fooProvider1;
+	ServiceReference sr_fooProvider2;
+	ServiceReference sr_fooProviderDyn2;
+	ServiceReference sr_fooProvider3;
+	ServiceReference sr_foobarProvider;
+	
+	Factory fooProvider1;
+	Factory fooProvider2;
+	Factory fooProviderDyn2;
+	Factory fooProvider3;
+	Factory foobarProvider;
+	
+    @Before
+	public void setUp() {
+
+        sr_fooProvider1 = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooProviderType-1");
+        sr_fooProvider2 = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooProviderType-2");
+        sr_fooProviderDyn2 = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooProviderType-Dyn2");
+        sr_fooProvider3 = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooProviderType-3");
+        sr_foobarProvider = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooBarProviderType-1");
+
+		fooProvider1 = ipojoHelper.getFactory("Factories-FooProviderType-1");
+		fooProvider2 = ipojoHelper.getFactory("Factories-FooProviderType-2");
+		fooProviderDyn2 = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2");
+		fooProvider3 = ipojoHelper.getFactory("Factories-FooProviderType-3");
+		foobarProvider = ipojoHelper.getFactory("Factories-FooBarProviderType-1");
+	}
+	
+	/**
+	 * Check simple providing.
+	 */
+    @Test
+	public void testFooProvider1() {
+		// Test SR properties
+//		String impl = (String) sr_fooProvider1.getProperty("component.class");
+//		assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooProviderType1");
+		
+		String[] specs = (String[]) sr_fooProvider1.getProperty("component.providedServiceSpecifications");
+		assertEquals("Check component.providedServiceSpecifications length", specs.length, 1);
+		assertEquals("Check component.providedServiceSpecifications", FooService.class.getName(), specs[0]);
+		
+		PropertyDescription[] pd = (PropertyDescription[]) sr_fooProvider1.getProperty("component.properties");
+		assertEquals("Check component.properties length", pd.length, 0);
+		
+		// Test factory
+		assertEquals("Check factory name", fooProvider1.getName(), "Factories-FooProviderType-1");
+		Element cd = fooProvider1.getDescription();
+		
+//		assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl);
+		
+		Element[] specs2 = cd.getElements("provides");
+		assertEquals("Check specs length", specs2.length, 1);
+		assertEquals("Check specs", FooService.class.getName(), specs2[0].getAttribute("specification"));
+		
+		Element[] pd2 = cd.getElements("property");
+		assertNull("Check props null", pd2);
+		
+		// Check Description equality
+		ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProvider1.getProperty("component.description");
+		assertNotNull("check description equality", desc);
+	}
+	
+	/**
+	 * Check component properties.
+	 */
+    @Test
+	public void testFooProvider2() {
+		// Test SR properties
+//		String impl = (String) sr_fooProvider2.getProperty("component.class");
+//		assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooProviderType1");
+		
+		String[] specs = (String[]) sr_fooProvider2.getProperty("component.providedServiceSpecifications");
+		assertEquals("Check component.providedServiceSpecifications length", specs.length, 1);
+		assertEquals("Check component.providedServiceSpecifications", FooService.class.getName(), specs[0]);
+		
+		PropertyDescription[] pd = (PropertyDescription[]) sr_fooProvider2.getProperty("component.properties");
+		assertEquals("Check component.properties length", pd.length, 5);
+		
+		assertEquals("Check component.properties name [" + 0 + "]", "int", pd[0].getName());
+		assertEquals("Check component.properties type [" + 0 + "]", "int", pd[0].getType());
+		assertEquals("Check component.properties value [" + 0 + "]", "2", pd[0].getValue());
+		
+		assertEquals("Check component.properties name [" + 1 + "]", "long", pd[1].getName());
+		assertEquals("Check component.properties type [" + 1 + "]", "long", pd[1].getType());
+		assertEquals("Check component.properties value [" + 1 + "]", "40", pd[1].getValue());
+		
+		assertEquals("Check component.properties name [" + 2 + "]", "string", pd[2].getName());
+		assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd[2].getType());
+		assertEquals("Check component.properties value [" + 2 + "]", "foo", pd[2].getValue());
+		
+		assertEquals("Check component.properties name [" + 3 + "]", "strAProp", pd[3].getName());
+		assertEquals("Check component.properties type [" + 3 + "]", "java.lang.String[]", pd[3].getType());
+		
+		assertEquals("Check component.properties name [" + 4 + "]", "intAProp", pd[4].getName());
+		assertEquals("Check component.properties type [" + 4 + "]", "int[]", pd[4].getType());
+		
+		// Test factory
+		assertEquals("Check factory name", fooProvider2.getName(), "Factories-FooProviderType-2");
+		Element cd = fooProvider2.getDescription();
+        
+//        assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl);
+		
+        Element[] specs2 = cd.getElements("provides");
+        assertEquals("Check specs length", specs2.length, 1);
+        assertEquals("Check specs", FooService.class.getName(), specs2[0].getAttribute("specification"));
+		
+        Element[] pd2 = cd.getElements("property");
+		assertEquals("Check props length", pd2.length, 5);
+		
+		assertEquals("Check component.properties name [" + 0 + "]", "int", pd2[0].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 0 + "]", "int", pd2[0].getAttribute("type"));
+		assertEquals("Check component.properties value [" + 0 + "]", "2", pd2[0].getAttribute("value"));
+		
+		assertEquals("Check component.properties name [" + 1 + "]", "long", pd2[1].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 1 + "]", "long", pd2[1].getAttribute("type"));
+		assertEquals("Check component.properties value [" + 1 + "]", "40", pd2[1].getAttribute("value"));
+		
+		assertEquals("Check component.properties name [" + 2 + "]", "string", pd2[2].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd2[2].getAttribute("type"));
+		assertEquals("Check component.properties value [" + 2 + "]", "foo", pd2[2].getAttribute("value"));
+		
+		assertEquals("Check component.properties name [" + 3 + "]", "strAProp", pd2[3].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 3 + "]", "java.lang.String[]", pd2[3].getAttribute("type"));
+		
+		assertEquals("Check component.properties name [" + 4 + "]", "intAProp", pd2[4].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 4 + "]", "int[]", pd2[4].getAttribute("type"));
+		
+		// Check Description equality
+		ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProvider2.getProperty("component.description");
+        assertNotNull("check description equality", desc);
+
+        // Check that we have the complete metadata
+        assertNotNull(fooProvider2.getComponentMetadata());
+	}
+	
+	/**
+	 * Check component properties (dynamic).
+	 */
+    @Test
+	public void testFooProviderDyn2() {
+		// Test SR properties
+//		String impl = (String) sr_fooProviderDyn2.getProperty("component.class");
+//		assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn2");
+		
+		String[] specs = (String[]) sr_fooProviderDyn2.getProperty("component.providedServiceSpecifications");
+		assertEquals("Check component.providedServiceSpecifications length", specs.length, 1);
+		assertEquals("Check component.providedServiceSpecifications", FooService.class.getName(), specs[0]);
+		
+		PropertyDescription[] pd = (PropertyDescription[]) sr_fooProviderDyn2.getProperty("component.properties");
+		assertEquals("Check component.properties length", pd.length, 5);
+		
+		assertEquals("Check component.properties name [" + 0 + "]", "int", pd[0].getName());
+		assertEquals("Check component.properties type [" + 0 + "]", "int", pd[0].getType());
+		assertEquals("Check component.properties value [" + 0 + "]", "4", pd[0].getValue());
+		
+		assertEquals("Check component.properties name [" + 1 + "]", "boolean", pd[1].getName());
+		assertEquals("Check component.properties type [" + 1 + "]", "boolean", pd[1].getType());
+		
+		assertEquals("Check component.properties name [" + 2 + "]", "string", pd[2].getName());
+		assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd[2].getType());
+		
+		assertEquals("Check component.properties name [" + 3 + "]", "strAProp", pd[3].getName());
+		assertEquals("Check component.properties type [" + 3 + "]", "java.lang.String[]", pd[3].getType());
+		
+		assertEquals("Check component.properties name [" + 4 + "]", "intAProp", pd[4].getName());
+		assertEquals("Check component.properties type [" + 4 + "]", "int[]", pd[4].getType());
+		
+		// Test factory
+		assertEquals("Check factory name", fooProviderDyn2.getName(), "Factories-FooProviderType-Dyn2");
+		Element cd = fooProviderDyn2.getDescription();
+		
+//        assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl);
+        
+        Element[] specs2 = cd.getElements("provides");
+        assertEquals("Check specs length", specs2.length, 1);
+        assertEquals("Check specs", FooService.class.getName(), specs2[0].getAttribute("specification"));
+        
+        Element[] pd2 = cd.getElements("property");
+        assertEquals("Check props length", pd2.length, 5);
+		
+		assertEquals("Check component.properties name [" + 0 + "]", "int", pd2[0].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 0 + "]", "int", pd2[0].getAttribute("type"));
+		assertEquals("Check component.properties value [" + 0 + "]", "4", pd2[0].getAttribute("value"));
+		
+		assertEquals("Check component.properties name [" + 1 + "]", "boolean", pd2[1].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 1 + "]", "boolean", pd2[1].getAttribute("type"));
+		
+		assertEquals("Check component.properties name [" + 2 + "]", "string", pd2[2].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd2[2].getAttribute("type"));
+		
+		assertEquals("Check component.properties name [" + 3 + "]", "strAProp", pd2[3].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 3 + "]", "java.lang.String[]", pd2[3].getAttribute("type"));
+		
+		assertEquals("Check component.properties name [" + 4 + "]", "intAProp", pd2[4].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 4 + "]", "int[]", pd2[4].getAttribute("type"));
+		
+		// Check Description equality
+		ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProviderDyn2.getProperty("component.description");
+		assertNotNull("check description equality", desc);
+
+        // Check that we have the complete metadata
+        assertNotNull(fooProvider2.getComponentMetadata());
+	}
+	
+	/**
+	 * Check component properties.
+	 */
+    @Test
+	public void testFooProvider3() {
+		// Test SR properties
+//		String impl = (String) sr_fooProvider3.getProperty("component.class");
+//		assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooProviderType1");
+		
+		String[] specs = (String[]) sr_fooProvider3.getProperty("component.providedServiceSpecifications");
+		assertEquals("Check component.providedServiceSpecifications length", specs.length, 1);
+		assertEquals("Check component.providedServiceSpecifications", FooService.class.getName(), specs[0]);
+		
+		PropertyDescription[] pd = (PropertyDescription[]) sr_fooProvider3.getProperty("component.properties");
+		assertEquals("Check component.properties length (" + pd.length +")", pd.length, 3);
+		
+		assertEquals("Check component.properties name [" + 0 + "]", "foo", pd[0].getName());
+		
+		assertEquals("Check component.properties name [" + 1 + "]", "bar", pd[1].getName());
+		
+		assertEquals("Check component.properties name [" + 2 + "]", "baz", pd[2].getName());
+		assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd[2].getType());
+		
+		// Test factory
+		assertEquals("Check factory name", fooProvider3.getName(), "Factories-FooProviderType-3");
+		Element cd = fooProvider3.getDescription();
+        
+//		assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl);
+        
+        Element[] specs2 = cd.getElements("provides");
+        assertEquals("Check specs length", specs2.length, 1);
+        assertEquals("Check specs", FooService.class.getName(), specs2[0].getAttribute("specification"));
+        
+        Element[] pd2 = cd.getElements("property");
+        assertEquals("Check props length", pd2.length, 3);
+		
+		assertEquals("Check component.properties name [" + 0 + "]", "foo", pd2[0].getAttribute("name"));
+		
+		assertEquals("Check component.properties name [" + 1 + "]", "bar", pd2[1].getAttribute("name"));
+		
+		assertEquals("Check component.properties name [" + 2 + "]", "baz", pd2[2].getAttribute("name"));
+		assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd2[2].getAttribute("type"));
+		
+		// Check Description equality
+		ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProvider3.getProperty("component.description");
+		assertNotNull("check description equality", desc);
+	}
+	
+	/**
+	 * Test two services provider.
+	 */
+    @Test
+	public void testFooBar() {
+		//	Test SR properties
+//		String impl = (String) sr_foobarProvider.getProperty("component.class");
+//		assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1");
+		
+		String[] specs = (String[]) sr_foobarProvider.getProperty("component.providedServiceSpecifications");
+		assertEquals("Check component.providedServiceSpecifications length", specs.length, 2);
+
+        assertContains("Check component.providedServiceSpecifications 1", specs, FooService.class.getName());
+        assertContains("Check component.providedServiceSpecifications 2", specs, BarService.class.getName());
+		
+		PropertyDescription[] pd = (PropertyDescription[]) sr_foobarProvider.getProperty("component.properties");
+		assertEquals("Check component.properties length", pd.length, 0);
+		
+		// Test factory
+		assertEquals("Check factory name", foobarProvider.getName(), "Factories-FooBarProviderType-1");
+		Element cd = foobarProvider.getDescription();
+		
+//        assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl);
+		
+        Element[] specs2 = cd.getElements("provides");
+        assertEquals("Check specs length", specs2.length, 2);
+        assertTrue("Check specs", containsSpecification(FooService.class.getName(), specs2));
+        assertTrue("Check specs", containsSpecification(BarService.class.getName(), specs2));
+        
+        Element[] pd2 = cd.getElements("property");
+        assertNull("Check props null", pd2);
+		
+		// Check Description equality
+        ComponentTypeDescription desc = (ComponentTypeDescription) sr_foobarProvider.getProperty("component.description");
+		assertNotNull("check description equality", desc);
+
+        // Check that we have the complete metadata
+        assertNotNull(foobarProvider.getComponentMetadata());
+	}
+	
+	private boolean containsSpecification(String value, Element[] array) {
+	    for (int i = 0; array != null && i < array.length; i++) {
+            if (array[i] != null && array[i].containsAttribute("specification") && array[i].getAttribute("specification").equals(value)) {
+                return true;
+            }
+        }
+        return false;
+	}
+	
+	
+	
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigAdmin.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigAdmin.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigAdmin.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigAdmin.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,162 @@
+/* 
+ * 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.runtime.core.services.FooService;
+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 org.junit.Assert.*;
+
+/**
+ * Check configuration admin reconfiguration.
+ */
+public class TestConfigAdmin extends Common {
+
+    private ManagedServiceFactory getFactoryByName(String pid) {
+        ServiceReference[] refs;
+
+        refs = osgiHelper.getServiceReferences(ManagedServiceFactory.class.getName(), "(service.pid=" + pid + ")");
+        if (refs == null) {
+            return null;
+        }
+
+        return ((ManagedServiceFactory) osgiHelper.getServiceObject((refs[0])));
+    }
+
+    /**
+     * Check creation.
+     */
+    @Test
+    public void testCreation() {
+        ManagedServiceFactory f = getFactoryByName("Factories-FooProviderType-2");
+
+        Properties p = new Properties();
+        p.put("int", 3);
+        p.put("long", (long) 42);
+        p.put("string", "absdir");
+        p.put("strAProp", new String[]{"a"});
+        p.put("intAProp", new int[]{1, 2});
+
+        try {
+            f.updated("ok2", p);
+            ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "ok2");
+            assertNotNull("Check instance creation", ref);
+            f.deleted("ok2");
+            ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "ok2");
+            assertNull("Check instance deletion", ref);
+        } catch (ConfigurationException e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+    }
+
+    /**
+     * Check creation (push String).
+     */
+    @Test
+    public void testCreationString() {
+        ManagedServiceFactory f = getFactoryByName("Factories-FooProviderType-2");
+
+        Properties p = new Properties();
+        p.put("int", "3");
+        p.put("long", "42");
+        p.put("string", "absdir");
+        p.put("strAProp", "{a}");
+        p.put("intAProp", "{1,2}");
+
+        try {
+            f.updated("ok2", p);
+            ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "ok2");
+            assertNotNull("Check instance creation", ref);
+            f.deleted("ok2");
+            ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "ok2");
+            assertNull("Check instance deletion", ref);
+        } catch (ConfigurationException e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+    }
+
+    /**
+     * Check update and delete.
+     */
+    @Test
+    public void testUpdate() {
+        ManagedServiceFactory f = getFactoryByName("Factories-FooProviderType-2");
+
+        Properties p = new Properties();
+        p.put("int", 3);
+        p.put("long", (long) 42);
+        p.put("string", "absdir");
+        p.put("strAProp", new String[]{"a"});
+        p.put("intAProp", new int[]{1, 2});
+
+        try {
+            f.updated("okkkk", p);
+            ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "okkkk");
+            assertNotNull("Check instance creation", ref);
+            p.put("int", new Integer("4"));
+            f.updated("okkkk", p);
+            ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "okkkk");
+            Integer test = (Integer) ref.getProperty("int");
+            assertEquals("Check instance modification", 4, test.intValue());
+            f.deleted("okkkk");
+            ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "okkkk");
+            assertNull("Check instance deletion", ref);
+        } catch (ConfigurationException e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+    }
+
+    /**
+     * Check update and delete.
+     * (Push String).
+     */
+    @Test
+    public void testUpdateString() {
+        ManagedServiceFactory f = getFactoryByName("Factories-FooProviderType-2");
+
+        Properties p = new Properties();
+        p.put("int", "3");
+        p.put("long", "42");
+        p.put("string", "absdir");
+        p.put("strAProp", "{a}");
+        p.put("intAProp", "{1,2}");
+
+        try {
+            f.updated("okkkk", p);
+            ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "okkkk");
+            assertNotNull("Check instance creation", ref);
+            p.put("int", new Integer("4"));
+            f.updated("okkkk", p);
+            ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "okkkk");
+            Integer test = (Integer) ref.getProperty("int");
+            assertEquals("Check instance modification", 4, test.intValue());
+            f.deleted("okkkk");
+            ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "okkkk");
+            assertNull("Check instance deletion", ref);
+        } catch (ConfigurationException e) {
+            fail("An acceptable configuration is rejected : " + e.getMessage());
+        }
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFactoryProperties.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFactoryProperties.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFactoryProperties.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFactoryProperties.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,86 @@
+/* 
+ * 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.PropertyDescription;
+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 static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class TestFactoryProperties extends Common {
+
+    @Test
+    public void testSimpleExposition() {
+        ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "Factories-FooProviderType-1");
+        assertNotNull("The factory is available", ref1);
+        String[] spec = (String[]) ref1.getProperty("component.providedServiceSpecifications");
+        assertEquals("Check array length", spec.length, 1);
+        assertEquals("Check spec", spec[0], FooService.class.getName());
+    }
+
+    @Test
+    public void testDoubleExposition() {
+        ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "Factories-FooBarProviderType-1");
+        assertNotNull("The factory is available", ref1);
+        String[] spec = (String[]) ref1.getProperty("component.providedServiceSpecifications");
+        assertEquals("Check array length", spec.length, 2);
+        assertContains("Check spec 1", spec, FooService.class.getName());
+        assertContains("Check spec 2", spec, BarService.class.getName());
+    }
+
+    @Test
+    public void testProps() {
+        ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "Factories-FooProviderType-Dyn2");
+        assertNotNull("The factory is available", ref1);
+        PropertyDescription[] pd = (PropertyDescription[]) ref1.getProperty("component.properties");
+        assertEquals("Check property list size", pd.length, 5);
+
+        //P0
+        assertEquals("0) Check name", "int", pd[0].getName());
+        assertEquals("0) Check type", "int", pd[0].getType());
+        assertEquals("0) Check value", "4", pd[0].getValue());
+
+        //P1
+        assertEquals("1) Check name", "boolean", pd[1].getName());
+        assertEquals("1) Check type", "boolean", pd[1].getType());
+        assertNull("1) Check value", pd[1].getValue());
+
+        //P2
+        assertEquals("2) Check name", "string", pd[2].getName());
+        assertEquals("2) Check type", String.class.getName(), pd[2].getType());
+        assertNull("2) Check value", pd[2].getValue());
+
+        //P3
+        assertEquals("3) Check name", "strAProp", pd[3].getName());
+        assertEquals("3) Check type", "java.lang.String[]", pd[3].getType());
+        assertNull("3) Check value", pd[3].getValue());
+
+        //P4
+        assertEquals("4) Check name", "intAProp", pd[4].getName());
+        assertEquals("4) Check type", "int[]", pd[4].getType());
+    }
+
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestObedience.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestObedience.java?rev=1447488&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestObedience.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestObedience.java Mon Feb 18 20:52:38 2013
@@ -0,0 +1,119 @@
+/* 
+ * 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.ComponentFactory;
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.HandlerManagerFactory;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.runtime.core.services.FooService;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+import static org.junit.Assert.*;
+
+/**
+ * Check that instances are disposed when the factory is stopped.
+ */
+public class TestObedience extends Common {
+
+    @Test
+    public void testObedience() {
+        assertNull("Check no foo service", osgiHelper.getServiceReference(FooService.class.getName()));
+        ComponentFactory factory = (ComponentFactory) ipojoHelper.getFactory("Factories-FooProviderType-1");
+        assertNotNull("Check factory existing", factory);
+
+        Properties props1 = new Properties();
+        props1.put("instance.name", "foo1");
+        Properties props2 = new Properties();
+        props2.put("instance.name", "foo2");
+
+        ComponentInstance ci1 = null, ci2 = null;
+        try {
+            ci1 = factory.createComponentInstance(props1);
+            ci2 = factory.createComponentInstance(props2);
+        } catch (Exception e) {
+            fail("Cannot instantiate foo providers : " + e.getMessage());
+        }
+
+        assertTrue("Check foo1 validity", ci1.getState() == ComponentInstance.VALID);
+        assertTrue("Check foo2 validity", ci2.getState() == ComponentInstance.VALID);
+
+        assertNotNull("Check foo service", osgiHelper.getServiceReference(FooService.class.getName()));
+        assertEquals("Check the number of Foo", osgiHelper.getServiceReferences(FooService.class.getName(), null).length, 2);
+
+        factory.stop();
+
+        assertTrue("Check foo1 invalidity (" + ci1.getState() + ")", ci1.getState() == ComponentInstance.DISPOSED);
+        assertTrue("Check foo2 invalidity (" + ci1.getState() + ")", ci2.getState() == ComponentInstance.DISPOSED);
+
+        assertNull("Check no foo service", osgiHelper.getServiceReference(FooService.class.getName()));
+
+        factory.start();
+        assertNull("Check no foo service", osgiHelper.getServiceReference(FooService.class.getName()));
+    }
+
+    @Test
+    public void testDisposeAfterFactoryInvalidation() {
+        ComponentFactory cf = (ComponentFactory) ipojoHelper.getFactory("org.apache.felix.ipojo.runtime.core.components.SimpleType");
+        assertNotNull("Check factory availability -1", cf);
+        assertEquals("Check factory state -1", Factory.VALID, cf.getState());
+
+        ServiceReference ref_arch = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "SimpleInstance");
+        assertNotNull("Check Architecture availability -1", ref_arch);
+
+        HandlerManagerFactory hf = (HandlerManagerFactory) ipojoHelper.getHandlerFactory("controller");
+        assertNotNull("Check handler availability -1", hf);
+        assertEquals("Check handler state -1", Factory.VALID, hf.getState());
+
+        // Stop the handler
+        hf.stop();
+        HandlerManagerFactory hf2 = (HandlerManagerFactory) ipojoHelper.getHandlerFactory("controller");
+        assertNull("Check handler availability -2", hf2);
+
+        // Check the factory invalidity
+        cf = (ComponentFactory) ipojoHelper.getFactory("org.apache.felix.ipojo.runtime.core.components.SimpleType");
+        assertNotNull("Check factory availability -2", cf);
+        assertEquals("Check factory state -2", Factory.INVALID, cf.getState());
+
+        // Check the instance disparition
+        ref_arch = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "SimpleInstance");
+        assertNull("Check Architecture availability -1", ref_arch);
+
+        // Restart the handler
+        hf.start();
+        hf2 = (HandlerManagerFactory) ipojoHelper.getHandlerFactory("controller");
+        assertNotNull("Check handler availability -3", hf2);
+
+        // Check the factory state
+        cf = (ComponentFactory) ipojoHelper.getFactory("org.apache.felix.ipojo.runtime.core.components.SimpleType");
+        assertNotNull("Check factory availability -3", cf);
+        assertEquals("Check factory state -3", Factory.VALID, cf.getState());
+
+
+        // Check the instance re-creation
+        ref_arch = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "SimpleInstance");
+        assertNotNull("Check Architecture availability -3", ref_arch);
+
+    }
+
+}