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 2007/09/25 17:07:18 UTC

svn commit: r579291 [10/12] - in /felix/sandbox/clement/Tests/Suite: ./ 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/main/java/org/apache/felix/ipoj...

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalDependencies.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalDependencies.java?rev=579291&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalDependencies.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalDependencies.java Tue Sep 25 08:06:53 2007
@@ -0,0 +1,303 @@
+package org.apache.felix.ipojo.test.scenarios.dependency;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.test.scenarios.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import fr.imag.adele.escoffier.utf.framework.TestCase;
+
+public class OptionalDependencies extends TestCase {
+	
+	ComponentInstance instance1, instance2, instance3, instance4;
+	ComponentInstance fooProvider;
+	
+	public OptionalDependencies(BundleContext bc) {super(bc); }
+	
+	public void setUp() {
+		try {
+			Properties prov = new Properties();
+			prov.put("name", "FooProvider");
+			fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+			fooProvider.stop();
+			
+			Properties i1 = new Properties();
+			i1.put("name", "Simple");
+			instance1 = Utils.getFactoryByName(context, "SimpleOptionalCheckServiceProvider").createComponentInstance(i1);
+		
+			Properties i2 = new Properties();
+			i2.put("name", "Void");
+			instance2 = Utils.getFactoryByName(context, "VoidOptionalCheckServiceProvider").createComponentInstance(i2);
+		
+			Properties i3 = new Properties();
+			i3.put("name", "Object");
+			instance3 = Utils.getFactoryByName(context, "ObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+		
+			Properties i4 = new Properties();
+			i4.put("name", "Ref");
+			instance4 = Utils.getFactoryByName(context, "RefOptionalCheckServiceProvider").createComponentInstance(i4);
+		} catch(Exception e) { fail(e.getMessage()); }		
+	}
+	
+	public void tearDown() {
+		instance1.dispose();
+		instance2.dispose();
+		instance3.dispose();
+		instance4.dispose();
+		fooProvider.dispose();
+		instance1 = null;
+		instance2 = null;
+		instance3 = null;
+		instance4 = null;
+		fooProvider = null;
+	}
+	
+	public void testSimple() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		
+		//Check properties
+		assertFalse("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
+		assertEquals("check void bind invocation - 1", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 1", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 1", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 1", ((Integer)props.get("refU")).intValue(), 0);
+		assertNull("Check FS invocation (object) - 1", props.get("object"));
+		assertEquals("Check FS invocation (int) - 1", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		fooProvider.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		
+		assertNotNull("Check CheckService availability", cs_ref);
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		
+		//Check properties
+		assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, a provider is there
+		assertEquals("check void bind invocation - 2", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 2", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 2", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 2", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 2", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 2", ((Integer)props.get("refU")).intValue(), 0);
+		assertNotNull("Check FS invocation (object) - 2", props.get("object"));
+		assertEquals("Check FS invocation (int) - 2", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 2", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 2", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);		
+	}
+	
+	public void testVoid() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
+		assertEquals("check void bind invocation - 1", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 1", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 1", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 1", ((Integer)props.get("refU")).intValue(), 0);
+		assertNull("Check FS invocation (object) - 1", props.get("object"));
+		assertEquals("Check FS invocation (int) - 1", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		fooProvider.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		
+		assertNotNull("Check CheckService availability", cs_ref);
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
+		assertEquals("check void bind invocation -2", ((Integer)props.get("voidB")).intValue(), 1);
+		assertEquals("check void unbind callback invocation -2", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -2", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation -2", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -2", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation -2", ((Integer)props.get("refU")).intValue(), 0);
+		assertNotNull("Check FS invocation (object) - 2", props.get("object"));
+		assertEquals("Check FS invocation (int) - 2", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 2", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 2", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
+		assertEquals("check void bind invocation -3", ((Integer)props.get("voidB")).intValue(), 1);
+		assertEquals("check void unbind callback invocation -3 ("+((Integer)props.get("voidU")) + ")", ((Integer)props.get("voidU")).intValue(), 1);
+		assertEquals("check object bind callback invocation -3", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation -3", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -3", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation -3", ((Integer)props.get("refU")).intValue(), 0);
+		assertNull("Check FS invocation (object) - 3", props.get("object"));
+		assertEquals("Check FS invocation (int) - 3", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 3", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);	
+	}
+	
+	public void testObject() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
+		assertEquals("check void bind invocation -1", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
+		
+		fooProvider.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		
+		assertNotNull("Check CheckService availability", cs_ref);
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
+		assertEquals("check void bind invocation -2", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation -2", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -2 (" + ((Integer)props.get("objectB")).intValue() + ")", ((Integer)props.get("objectB")).intValue(), 1);
+		assertEquals("check object unbind callback invocation -2", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -2", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation -2", ((Integer)props.get("refU")).intValue(), 0);
+		
+		fooProvider.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
+		assertEquals("check void bind invocation -3", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation -3", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -3", ((Integer)props.get("objectB")).intValue(), 1);
+		assertEquals("check object unbind callback invocation -3", ((Integer)props.get("objectU")).intValue(), 1);
+		assertEquals("check ref bind callback invocation -3", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation -3", ((Integer)props.get("refU")).intValue(), 0);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);		
+	}
+	
+	public void testRef() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue()); // False is returned (nullable)
+		assertEquals("check void bind invocation -1", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
+		
+		fooProvider.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		
+		assertNotNull("Check CheckService availability", cs_ref);
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation -2", ((Boolean)props.get("result")).booleanValue());
+		assertEquals("check void bind invocation -2", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation -2", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -2", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation -2", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -2", ((Integer)props.get("refB")).intValue(), 1);
+		assertEquals("check ref unbind callback invocation -2", ((Integer)props.get("refU")).intValue(), 0);
+		
+		fooProvider.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation -3", ((Boolean)props.get("result")).booleanValue());
+		assertEquals("check void bind invocation -3", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation -3", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -3", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation -3", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -3", ((Integer)props.get("refB")).intValue(), 1);
+		assertEquals("check ref unbind callback invocation -3", ((Integer)props.get("refU")).intValue(), 1);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);
+	}
+
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalMultipleDependencies.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalMultipleDependencies.java?rev=579291&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalMultipleDependencies.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalMultipleDependencies.java Tue Sep 25 08:06:53 2007
@@ -0,0 +1,485 @@
+package org.apache.felix.ipojo.test.scenarios.dependency;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.test.scenarios.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import fr.imag.adele.escoffier.utf.framework.TestCase;
+
+public class OptionalMultipleDependencies extends TestCase {
+
+	ComponentInstance instance1, instance2, instance3, instance4;
+	ComponentInstance fooProvider1, fooProvider2;
+	
+	public OptionalMultipleDependencies(BundleContext bc) {super(bc); }
+	
+	public void setUp() {
+		try {
+			Properties prov = new Properties();
+			prov.put("name", "FooProvider1");
+			fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+			fooProvider1.stop();
+		
+			Properties prov2 = new Properties();
+			prov2.put("name", "FooProvider2");
+			fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+			fooProvider2.stop();
+		
+			Properties i1 = new Properties();
+			i1.put("name", "Simple");
+			instance1 = Utils.getFactoryByName(context, "SimpleOptionalMultipleCheckServiceProvider").createComponentInstance(i1);
+		
+			Properties i2 = new Properties();
+			i2.put("name", "Void");
+			instance2 = Utils.getFactoryByName(context, "VoidOptionalMultipleCheckServiceProvider").createComponentInstance(i2);
+		
+			Properties i3 = new Properties();
+			i3.put("name", "Object");
+			instance3 = Utils.getFactoryByName(context, "ObjectOptionalMultipleCheckServiceProvider").createComponentInstance(i3);
+		
+			Properties i4 = new Properties();
+			i4.put("name", "Ref");
+			instance4 = Utils.getFactoryByName(context, "RefOptionalMultipleCheckServiceProvider").createComponentInstance(i4);
+		} catch(Exception e) { fail(e.getMessage()); }
+		
+	}
+	
+	public void tearDown() {
+		instance1.dispose();
+		instance2.dispose();
+		instance3.dispose();
+		instance4.dispose();
+		fooProvider1.dispose();
+		fooProvider2.dispose();
+		instance1 = null;
+		instance2 = null;
+		instance3 = null;
+		instance4 = null;
+		fooProvider1 = null;
+		fooProvider2 = null;
+	}
+	
+	public void testSimple() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
+		assertEquals("check void bind invocation - 0", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 0", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 0", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 0", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 0", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 0", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 0", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 0", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 0", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		fooProvider1.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
+		assertEquals("check void bind invocation - 1", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 1", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 1", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 1", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 1", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider2.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
+		assertEquals("check void bind invocation - 2", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 2", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 2", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 2", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 2", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 2", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 2", ((Integer)props.get("int")).intValue(), 2);
+		assertEquals("Check FS invocation (long) - 2", ((Long)props.get("long")).longValue(), 2);
+		assertEquals("Check FS invocation (double) - 2", ((Double)props.get("double")).doubleValue(), 2.0);
+		
+		fooProvider1.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, it still one provider.
+		assertEquals("check void bind invocation - 3", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 3", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 3", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 3", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 3", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 3", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 3", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 3", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False, no more provider.
+		assertEquals("check void bind invocation - 4", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 4", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 4", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 4", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 4", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 4", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 4", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 4", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 4", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);		
+	}
+	
+	public void testVoid() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
+		assertEquals("check void bind invocation - 0", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 0", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 0", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 0", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 0", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 0", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 0", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 0", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 0", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		fooProvider1.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
+		assertEquals("check void bind invocation - 1", ((Integer)props.get("voidB")).intValue(), 1);
+		assertEquals("check void unbind callback invocation - 1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 1", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 1", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 1", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 1", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider2.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
+		assertEquals("check void bind invocation - 2", ((Integer)props.get("voidB")).intValue(), 2);
+		assertEquals("check void unbind callback invocation - 2", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 2", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 2", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 2", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 2", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 2", ((Integer)props.get("int")).intValue(), 2);
+		assertEquals("Check FS invocation (long) - 2", ((Long)props.get("long")).longValue(), 2);
+		assertEquals("Check FS invocation (double) - 2", ((Double)props.get("double")).doubleValue(), 2.0);
+		
+		fooProvider1.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
+		assertEquals("check void bind invocation - 3", ((Integer)props.get("voidB")).intValue(), 2);
+		assertEquals("check void unbind callback invocation - 3", ((Integer)props.get("voidU")).intValue(), 1);
+		assertEquals("check object bind callback invocation - 3", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 3", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 3", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 3", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 3", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 3", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation - 4", ((Boolean)props.get("result")).booleanValue()); // False : no provider
+		assertEquals("check void bind invocation - 4", ((Integer)props.get("voidB")).intValue(), 2);
+		assertEquals("check void unbind callback invocation - 4", ((Integer)props.get("voidU")).intValue(), 2);
+		assertEquals("check object bind callback invocation - 4", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 4", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 4", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 4", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 4", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 4", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 4", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);	
+	}
+	
+	public void testObject() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
+		assertEquals("check void bind invocation - 0", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 0", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 0", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 0", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 0", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 0", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 0", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 0", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 0", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		fooProvider1.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
+		assertEquals("check void bind invocation - 1", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 1", ((Integer)props.get("objectB")).intValue(), 1);
+		assertEquals("check object unbind callback invocation - 1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 1", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 1", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 1", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider2.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
+		assertEquals("check void bind invocation - 2", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 2", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 2", ((Integer)props.get("objectB")).intValue(), 2);
+		assertEquals("check object unbind callback invocation - 2", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 2", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 2", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 2", ((Integer)props.get("int")).intValue(), 2);
+		assertEquals("Check FS invocation (long) - 2", ((Long)props.get("long")).longValue(), 2);
+		assertEquals("Check FS invocation (double) - 2", ((Double)props.get("double")).doubleValue(), 2.0);
+		
+		fooProvider1.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
+		assertEquals("check void bind invocation - 3", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 3", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 3", ((Integer)props.get("objectB")).intValue(), 2);
+		assertEquals("check object unbind callback invocation - 3", ((Integer)props.get("objectU")).intValue(), 1);
+		assertEquals("check ref bind callback invocation - 3", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 3", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 3", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 3", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
+		assertEquals("check void bind invocation - 0", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 0", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 0", ((Integer)props.get("objectB")).intValue(), 2);
+		assertEquals("check object unbind callback invocation - 0", ((Integer)props.get("objectU")).intValue(), 2);
+		assertEquals("check ref bind callback invocation - 0", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 0", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 0", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 0", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 0", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);		
+	}
+	
+	public void testRef() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
+		assertEquals("check void bind invocation - 0", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 0", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 0", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 0", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 0", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation - 0", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 0", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 0", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 0", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		fooProvider1.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 1", ((Boolean)props.get("result")).booleanValue()); // True, a provider is here
+		assertEquals("check void bind invocation - 1", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 1", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 1", ((Integer)props.get("refB")).intValue(), 1);
+		assertEquals("check ref unbind callback invocation - 1", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 1", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider2.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 2", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
+		assertEquals("check void bind invocation - 2", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 2", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 2", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 2", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 2", ((Integer)props.get("refB")).intValue(), 2);
+		assertEquals("check ref unbind callback invocation - 2", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 2", ((Integer)props.get("int")).intValue(), 2);
+		assertEquals("Check FS invocation (long) - 2", ((Long)props.get("long")).longValue(), 2);
+		assertEquals("Check FS invocation (double) - 2", ((Double)props.get("double")).doubleValue(), 2.0);
+		
+		fooProvider1.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation - 3", ((Boolean)props.get("result")).booleanValue()); // True, two providers are here
+		assertEquals("check void bind invocation - 3", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 3", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 3", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 3", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 3", ((Integer)props.get("refB")).intValue(), 2);
+		assertEquals("check ref unbind callback invocation - 3", ((Integer)props.get("refU")).intValue(), 1);
+		assertEquals("Check FS invocation (int) - 3", ((Integer)props.get("int")).intValue(), 1);
+		assertEquals("Check FS invocation (long) - 3", ((Long)props.get("long")).longValue(), 1);
+		assertEquals("Check FS invocation (double) - 3", ((Double)props.get("double")).doubleValue(), 1.0);
+		
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+		
+		cs = (CheckService) context.getService(cs_ref);
+		props = cs.getProps();
+		//Check properties
+		assertFalse("check CheckService invocation - 0", ((Boolean)props.get("result")).booleanValue()); // False : no provider
+		assertEquals("check void bind invocation - 0", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation - 0", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation - 0", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation - 0", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation - 0", ((Integer)props.get("refB")).intValue(), 2);
+		assertEquals("check ref unbind callback invocation - 0", ((Integer)props.get("refU")).intValue(), 2);
+		assertEquals("Check FS invocation (int) - 0", ((Integer)props.get("int")).intValue(), 0);
+		assertEquals("Check FS invocation (long) - 0", ((Long)props.get("long")).longValue(), 0);
+		assertEquals("Check FS invocation (double) - 0", ((Double)props.get("double")).doubleValue(), 0.0);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);
+	}
+
+	
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/SimpleDependencies.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/SimpleDependencies.java?rev=579291&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/SimpleDependencies.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/SimpleDependencies.java Tue Sep 25 08:06:53 2007
@@ -0,0 +1,211 @@
+package org.apache.felix.ipojo.test.scenarios.dependency;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.ipojo.test.scenarios.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import fr.imag.adele.escoffier.utf.framework.TestCase;
+
+public class SimpleDependencies extends TestCase {
+	
+	ComponentInstance instance1, instance2, instance3, instance4;
+	ComponentInstance fooProvider;
+	
+	public SimpleDependencies(BundleContext bc) {super(bc); }
+	
+	public void setUp() {
+		try {
+			Properties prov = new Properties();
+			prov.put("name", "FooProvider");
+			fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+			fooProvider.stop();
+		
+			Properties i1 = new Properties();
+			i1.put("name", "Simple");
+			instance1 = Utils.getFactoryByName(context, "SimpleCheckServiceProvider").createComponentInstance(i1);
+		
+			Properties i2 = new Properties();
+			i2.put("name", "Void");
+			instance2 = Utils.getFactoryByName(context, "VoidCheckServiceProvider").createComponentInstance(i2);
+		
+			Properties i3 = new Properties();
+			i3.put("name", "Object");
+			instance3 = Utils.getFactoryByName(context, "ObjectCheckServiceProvider").createComponentInstance(i3);
+		
+			Properties i4 = new Properties();
+			i4.put("name", "Ref");
+			instance4 = Utils.getFactoryByName(context, "RefCheckServiceProvider").createComponentInstance(i4);
+		} catch(Exception e) { 
+		    e.printStackTrace();
+		    fail(e.getMessage()); }
+		
+	}
+	
+	public void tearDown() {
+		instance1.dispose();
+		instance2.dispose();
+		instance3.dispose();
+		instance4.dispose();
+		fooProvider.dispose();
+		instance1 = null;
+		instance2 = null;
+		instance3 = null;
+		instance4 = null;
+		fooProvider = null;
+	}
+	
+	public void testSimple() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance1.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
+		
+		fooProvider.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		assertTrue("check CheckService invocation", cs.check());
+		
+		fooProvider.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
+		
+		fooProvider.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		
+		cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		cs = (CheckService) context.getService(cs_ref);
+		assertTrue("check CheckService invocation", cs.check());
+		
+		fooProvider.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);		
+	}
+	
+	public void testVoid() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance2.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
+		
+		fooProvider.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		Object o = context.getService(cs_ref);
+		CheckService cs = (CheckService) o;
+		Properties props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
+		assertEquals("check void bind invocation -1 ("+((Integer)props.get("voidB")).intValue()+")", ((Integer)props.get("voidB")).intValue(), 1);
+		assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
+		
+		fooProvider.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);		
+	}
+	
+	public void testObject() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance3.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
+		
+		fooProvider.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
+		assertEquals("check void bind invocation -1", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 1);
+		assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 0);
+		assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
+		
+		fooProvider.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);		
+	}
+	
+	public void testRef() {
+		ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance4.getInstanceName());
+		assertNotNull("Check architecture availability", arch_ref);
+		InstanceDescription id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 1", id.getState() == ComponentInstance.INVALID);
+		
+		fooProvider.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity", id.getState() == ComponentInstance.VALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance4.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		Properties props = cs.getProps();
+		//Check properties
+		assertTrue("check CheckService invocation -1", ((Boolean)props.get("result")).booleanValue());
+		assertEquals("check void bind invocation -1", ((Integer)props.get("voidB")).intValue(), 0);
+		assertEquals("check void unbind callback invocation -1", ((Integer)props.get("voidU")).intValue(), 0);
+		assertEquals("check object bind callback invocation -1", ((Integer)props.get("objectB")).intValue(), 0);
+		assertEquals("check object unbind callback invocation -1", ((Integer)props.get("objectU")).intValue(), 0);
+		assertEquals("check ref bind callback invocation -1", ((Integer)props.get("refB")).intValue(), 1);
+		assertEquals("check ref unbind callback invocation -1", ((Integer)props.get("refU")).intValue(), 0);
+		
+		fooProvider.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);
+	}
+
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ConfigAdminTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ConfigAdminTest.java?rev=579291&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ConfigAdminTest.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ConfigAdminTest.java Tue Sep 25 08:06:53 2007
@@ -0,0 +1,82 @@
+package org.apache.felix.ipojo.test.scenarios.factory;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+import fr.imag.adele.escoffier.utf.framework.TestCase;
+
+public class ConfigAdminTest extends TestCase {
+	
+	public ConfigAdminTest(BundleContext arg0) {
+		super(arg0);
+	}
+	
+	private ManagedServiceFactory getFactoryByName(String pid) {
+		ServiceReference[] refs;
+		try {
+			refs = context.getServiceReferences(ManagedServiceFactory.class.getName(), "(factory.name="+pid+")");
+			if(refs == null) { return null; }
+			return ((org.osgi.service.cm.ManagedServiceFactory) context.getService(refs[0]));
+		} catch (InvalidSyntaxException e) {
+			System.err.println("Cannot get the factory " + pid + " : " + e.getMessage());
+			return null;
+		}
+	}
+	
+	public void testCreation() {
+		ManagedServiceFactory f = getFactoryByName("FooProviderType-2");
+		
+		Properties  p = new Properties();
+		p.put("int", new Integer(3));
+		p.put("long", new Integer(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 = Utils.getServiceReferenceByName(context, FooService.class.getName(), "ok2");
+			assertNotNull("Check instance creation", ref);
+			f.deleted("ok2");
+			ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "ok2");
+			assertNull("Check instance deletion", ref);
+		} catch (ConfigurationException e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+	
+	public void testUpdate() {
+		ManagedServiceFactory f = getFactoryByName("FooProviderType-2");
+		
+		Properties  p = new Properties();
+		p.put("int", new Integer(3));
+		p.put("long", new Integer(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 = Utils.getServiceReferenceByName(context, FooService.class.getName(), "okkkk");
+			assertNotNull("Check instance creation", ref);
+			p.put("int", new Integer("4"));
+			f.updated("okkkk", p);
+			ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "okkkk");
+			Integer test = (Integer) ref.getProperty("int");
+			assertEquals("Check instance modification", 4, test.intValue());
+			f.deleted("okkkk");
+			ref = Utils.getServiceReferenceByName(context, FooService.class.getName(), "okkkk");
+			assertNull("Check instance deletion", ref);
+		} catch (ConfigurationException e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+	
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/FactoryTestSuite.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/FactoryTestSuite.java?rev=579291&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/FactoryTestSuite.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/FactoryTestSuite.java Tue Sep 25 08:06:53 2007
@@ -0,0 +1,26 @@
+package org.apache.felix.ipojo.test.scenarios.factory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osgi.framework.BundleContext;
+
+import fr.imag.adele.escoffier.utf.framework.TestSuite;
+
+public class FactoryTestSuite extends TestSuite {
+
+	public FactoryTestSuite(BundleContext arg0) {
+		super(arg0);
+	}
+
+	public List suite() {
+		List list = new ArrayList();
+		
+		list.add(new UnacceptableConfigurationTest(context));
+		list.add(new ConfigAdminTest(context));
+		list.add(new ObedienceTest(context));
+		
+		return list;
+	}
+
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ObedienceTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ObedienceTest.java?rev=579291&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ObedienceTest.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/ObedienceTest.java Tue Sep 25 08:06:53 2007
@@ -0,0 +1,54 @@
+package org.apache.felix.ipojo.test.scenarios.factory;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentFactory;
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.test.scenarios.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.BundleContext;
+
+import fr.imag.adele.escoffier.utf.framework.TestCase;
+
+public class ObedienceTest extends TestCase {
+
+	public ObedienceTest(BundleContext arg0) {
+		super(arg0);
+	}
+	
+	public void testObedience1() {
+		assertNull("Check no foo service", context.getServiceReference(FooService.class.getName()));
+		ComponentFactory factory = (ComponentFactory) Utils.getFactoryByName(context, "FooProviderType-1");
+		assertNotNull("Check factory existing", factory);
+		
+		Properties props1 = new Properties();
+		props1.put("name", "foo1");
+		Properties props2 = new Properties();
+		props2.put("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", context.getServiceReference(FooService.class.getName()));
+		assertEquals("Check the number of Foo", Utils.getServiceReferences(context, 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", context.getServiceReference(FooService.class.getName()));
+		
+		factory.start();
+		assertNull("Check no foo service", context.getServiceReference(FooService.class.getName()));
+	}
+
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/UnacceptableConfigurationTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/UnacceptableConfigurationTest.java?rev=579291&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/UnacceptableConfigurationTest.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/factory/UnacceptableConfigurationTest.java Tue Sep 25 08:06:53 2007
@@ -0,0 +1,352 @@
+package org.apache.felix.ipojo.test.scenarios.factory;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.BundleContext;
+
+import fr.imag.adele.escoffier.utf.framework.TestCase;
+
+public class UnacceptableConfigurationTest extends TestCase {
+
+	public UnacceptableConfigurationTest(BundleContext arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+	
+	public void testWithoutName() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-2");
+		
+		Properties  p = new Properties();
+		p.put("int", new Integer(3));
+		p.put("long", new Integer(42));
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		p.put("intAProp", new int[] {1,2});
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) { fail("an acceptable configuration is refused"); }
+		
+	}
+	
+	public void testEmptyConfiguration() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-2");
+		Properties  p = new Properties();
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) { fail("An acceptable configuration is refused"); }
+	}
+	
+	public void testEmptyConfiguration2() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn2");
+		Properties  p = new Properties();
+		p.put("name", "ko");
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) { return; }
+		
+		fail("An unacceptable configuration is accepted");
+	}
+	
+	public void testNull() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-2");
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(null);
+			ci.dispose();
+		} catch(Exception e) { fail("An acceptable configuration is refused"); }
+	}
+	
+	public void testNull2() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn2");
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(null);
+			ci.dispose();
+		} catch(Exception e) { return; }
+		
+		fail("An unacceptable configuration is accepted");
+	}
+	
+	public void testStaticOK() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-2");
+		
+		Properties  p = new Properties();
+		p.put("name", "ok");
+		p.put("int", new Integer(3));
+		p.put("long", new Integer(42));
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		p.put("intAProp", new int[] {1,2});
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+	
+	public void testDynamicOK() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn");
+		
+		Properties  p = new Properties();
+		p.put("name", "ok");
+		p.put("int", new Integer(3));
+		p.put("boolean", new Boolean(true));
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		p.put("intAProp", new int[] {1,2});
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+	
+	public void testDynamicBadType() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn");
+		
+		Properties  p = new Properties();
+		p.put("name", "ok");
+		p.put("int", new Integer(3));
+		p.put("long", new Integer(42));
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		p.put("intAProp", new int[] {1,2});
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+	
+	public void testDynamicComplete() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn2");
+		
+		Properties  p = new Properties();
+		p.put("name", "ok");
+		p.put("int", new Integer(3));
+		p.put("boolean", new Boolean(true));
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		p.put("intAProp", new int[] {1,2});
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+	
+	public void testDynamicJustEnough() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn2");
+		
+		Properties  p = new Properties();
+		p.put("name", "ok");
+		p.put("boolean", new Boolean(true));
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+	
+	public void testDynamicMix() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn2");
+		
+		Properties  p = new Properties();
+		p.put("name", "ok");
+		p.put("boolean", new Boolean(true));
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		p.put("intAProp", new int[] {1,2});
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+	
+	public void testDynamicUncomplete() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn2");
+		
+		Properties  p = new Properties();
+		p.put("name", "ok");
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		p.put("intAProp", new int[] {1,2});
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) { return; }
+		
+		fail("An unacceptable configuration is accepted");
+	}
+	
+	public void testDynamicMore() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn2");
+		
+		Properties  p = new Properties();
+		p.put("name", "ok");
+		p.put("int", new Integer(3));
+		p.put("boolean", new Boolean(true));
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		p.put("intAProp", new int[] {1,2});
+		p.put("tralala", "foo");
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+	
+	public void testDoubleProps() {
+		Factory f = Utils.getFactoryByName(context, "FooProviderType-Dyn2");
+		
+		Properties  p = new Properties();
+		p.put("name", "ok");
+		p.put("int", new Integer(3));
+		p.put("boolean", new Boolean(true));
+		p.put("string", "absdir");
+		p.put("strAProp", new String[] {"a"});
+		p.put("intAProp", new int[] {1,2});
+		p.put("boolean", new Boolean(false));
+		p.put("string", "toto");
+		
+		ComponentInstance ci = null;
+		try {
+			ci = f.createComponentInstance(p);
+			ci.dispose();
+		} catch(Exception e) {
+			fail("An acceptable configuration is rejected : " + e.getMessage());
+		}
+	}
+    
+    public void testUnicity1() {
+        Factory f = Utils.getFactoryByName(context, "FooProviderType-2");
+        
+        ComponentInstance ci1,ci2, ci3 = null;
+        try {
+            ci1 = f.createComponentInstance(null);
+            ci2 = f.createComponentInstance(null);
+            ci3 = f.createComponentInstance(null);
+            assertNotEquals("Check name ci1, ci2", ci1.getInstanceName(), ci2.getInstanceName());
+            assertNotEquals("Check name ci1, ci3", ci1.getInstanceName(), ci3.getInstanceName());
+            assertNotEquals("Check name ci3, ci2", ci3.getInstanceName(), ci2.getInstanceName());
+            ci1.dispose();
+            ci2.dispose();
+            ci3.dispose();
+        } catch(Exception e) { fail("An acceptable configuration is refused"); }
+    }
+    
+    public void testUnicity2() {
+        Factory f = Utils.getFactoryByName(context, "FooProviderType-2");
+        
+        ComponentInstance ci1,ci2, ci3 = null;
+        try {
+            Properties p1 = new Properties();
+            p1.put("name", "name1");
+            ci1 = f.createComponentInstance(p1);
+            Properties p2 = new Properties();
+            p2.put("name", "name2");
+            ci2 = f.createComponentInstance(p2);
+            Properties p3 = new Properties();
+            p3.put("name", "name3");
+            ci3 = f.createComponentInstance(p3);
+            assertNotEquals("Check name ci1, ci2", ci1.getInstanceName(), ci2.getInstanceName());
+            assertNotEquals("Check name ci1, ci3", ci1.getInstanceName(), ci3.getInstanceName());
+            assertNotEquals("Check name ci3, ci2", ci3.getInstanceName(), ci2.getInstanceName());
+            ci1.dispose();
+            ci2.dispose();
+            ci3.dispose();
+        } catch(Exception e) { fail("An acceptable configuration is refused"); }
+    }
+    
+    public void testUnicity3() {
+        Factory f = Utils.getFactoryByName(context, "FooProviderType-2");
+        
+        ComponentInstance ci1 = null,ci2 = null, ci3 = null;
+        try {
+            Properties p1 = new Properties();
+            p1.put("name", "name1");
+            ci1 = f.createComponentInstance(p1);
+            Properties p2 = new Properties();
+            p2.put("name", "name1");
+            ci2 = f.createComponentInstance(p2);
+            assertNotEquals("Check name ci1, ci2", ci1.getInstanceName(), ci2.getInstanceName());
+            assertNotEquals("Check name ci1, ci3", ci1.getInstanceName(), ci3.getInstanceName());
+            assertNotEquals("Check name ci3, ci2", ci3.getInstanceName(), ci3.getInstanceName());
+            ci1.dispose();
+            ci2.dispose();
+            ci3.dispose();
+        } catch(Exception e) { 
+            ci1.dispose();
+            return; }
+          
+          fail("An unacceptable configuration is acceptable");
+    }
+    
+    public void testUnicity4() {
+        Factory f = Utils.getFactoryByName(context, "FooProviderType-2");
+        Factory f2 = Utils.getFactoryByName(context, "FooProviderType-1");
+        
+        ComponentInstance ci1 = null,ci2 = null, ci3 = null;
+        try {
+            Properties p1 = new Properties();
+            p1.put("name", "name1");
+            ci1 = f.createComponentInstance(p1);
+            Properties p2 = new Properties();
+            p2.put("name", "name1");
+            ci2 = f2.createComponentInstance(p2);
+            System.err.println("==== " + ci1.getInstanceName() + " === " + ci2.getInstanceName());
+            assertNotEquals("Check name ci1, ci2", ci1.getInstanceName(), ci2.getInstanceName());
+            assertNotEquals("Check name ci1, ci3", ci1.getInstanceName(), ci3.getInstanceName());
+            assertNotEquals("Check name ci3, ci2", ci3.getInstanceName(), ci3.getInstanceName());
+            ci1.dispose();
+            ci2.dispose();
+            ci3.dispose();
+        } catch(Exception e) { 
+            ci1.dispose();
+            return; }
+          
+          fail("An unacceptable configuration is acceptable");
+    }
+	
+
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/handler/ExternalHandlerTestSuite.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/handler/ExternalHandlerTestSuite.java?rev=579291&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/handler/ExternalHandlerTestSuite.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/handler/ExternalHandlerTestSuite.java Tue Sep 25 08:06:53 2007
@@ -0,0 +1,22 @@
+package org.apache.felix.ipojo.test.scenarios.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osgi.framework.BundleContext;
+
+import fr.imag.adele.escoffier.utf.framework.TestSuite;
+
+public class ExternalHandlerTestSuite extends TestSuite {
+
+	public ExternalHandlerTestSuite(BundleContext arg0) {
+		super(arg0);
+	}
+
+	public List suite() {
+		List l = new ArrayList();
+		l.add(new HandlerTest(context));
+		return l;
+	}
+
+}