felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r615675 [11/21] - in /felix/sandbox/clement/ipojo: ./ annotations/ ant/ arch/ core/ core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ core/src/main/java/org/apache/felix/ipojo/handlers/dependency/ core/src/main/java/org/apac...
Date Sun, 27 Jan 2008 23:21:37 GMT
Added: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/controller/LifeCycleControllerTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/controller/LifeCycleControllerTest.java?rev=615675&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/controller/LifeCycleControllerTest.java (added)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/controller/LifeCycleControllerTest.java Sun Jan 27 15:21:24 2008
@@ -0,0 +1,102 @@
+package org.apache.felix.ipojo.test.scenarios.controller;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class LifeCycleControllerTest extends OSGiTestCase {
+    
+    private ComponentInstance under;
+    private Factory factory;
+ 
+    public void setUp() {
+        factory = Utils.getFactoryByName(context, "lcTest");
+    }
+    
+    public void testOne() {
+        Properties props = new Properties();
+        props.put("conf", "foo");
+        props.put("name", "under");
+        under = Utils.getComponentInstance(context, "lcTest", props);
+        
+        // The conf is correct, the PS must be provided
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+        assertNotNull("Check service availability -1", ref);
+        CheckService cs = (CheckService) context.getService(ref);
+        assertTrue("Check state 1", cs.check());
+        context.ungetService(ref);
+        cs = null;
+        
+        // Reconfigure the instance with a bad configuration
+        props.put("conf", "bar"); // Bar is a bad conf
+        try {
+            factory.reconfigure(props);
+        } catch(Exception e) {
+            fail("The reconfiguration is not unacceptable and seems unacceptable : " + props);
+        }
+        
+        // The instance should now be invalid 
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+        assertNull("Check service availability -2", ref);
+        
+        // Reconfigure the instance with a valid configuration
+        props.put("conf", "foo"); // Bar is a bad conf
+        try {
+            factory.reconfigure(props);
+        } catch(Exception e) {
+            fail("The reconfiguration is not unacceptable and seems unacceptable (2) : " + props);
+        }
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+        assertNotNull("Check service availability -3", ref);
+        cs = (CheckService) context.getService(ref);
+        assertTrue("Check state 2", cs.check());
+        context.ungetService(ref);
+        cs = null;
+        
+        under.dispose();
+    }
+    
+    public void testTwo() {
+        Properties props = new Properties();
+        props.put("conf", "bar");
+        props.put("name", "under");
+        under = Utils.getComponentInstance(context, "lcTest", props);
+        
+        // The conf is incorrect, but the test can appears only when the object is created : the PS must be provided
+        ServiceReference ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+        assertNotNull("Check service availability -1", ref);
+        
+        CheckService cs = (CheckService) context.getService(ref);
+        assertFalse("Check state (false)", cs.check());
+        
+        // As soon as the instance is created, the service has to disappear :
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+        assertNull("Check service availability -2", ref);
+        
+        // Reconfigure the instance with a correct configuration
+        props.put("conf", "foo");
+        try {
+            factory.reconfigure(props);
+        } catch(Exception e) {
+            fail("The reconfiguration is not unacceptable and seems unacceptable : " + props);
+        }
+        
+        ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), "under");
+        assertNotNull("Check service availability -3", ref);
+        cs = (CheckService) context.getService(ref);
+        assertTrue("Check state ", cs.check());
+        context.ungetService(ref);
+        cs = null;
+        
+        under.dispose();
+    }
+    
+    
+
+}

Added: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/controller/LifeCycleControllerTestSuite.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/controller/LifeCycleControllerTestSuite.java?rev=615675&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/controller/LifeCycleControllerTestSuite.java (added)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/controller/LifeCycleControllerTestSuite.java Sun Jan 27 15:21:24 2008
@@ -0,0 +1,18 @@
+package org.apache.felix.ipojo.test.scenarios.controller;
+
+import junit.framework.Test;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
+import org.osgi.framework.BundleContext;
+
+public class LifeCycleControllerTestSuite {
+
+
+    public static Test suite(BundleContext bc) {
+        OSGiTestSuite ots = new OSGiTestSuite("Lifecycle Controller Test Suite", bc);
+        ots.addTestSuite( LifeCycleControllerTest.class);
+        ots.addTestSuite( ImmediateLifeCycleControllerTest.class);
+        return ots;
+    }
+
+}

Propchange: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jan 27 15:21:24 2008
@@ -0,0 +1,6 @@
+target*
+bin*
+.settings*
+.classpath
+.project
+.checkstyle

Added: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/ComponentDesc.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/ComponentDesc.java?rev=615675&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/ComponentDesc.java (added)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/ComponentDesc.java Sun Jan 27 15:21:24 2008
@@ -0,0 +1,318 @@
+package org.apache.felix.ipojo.test.scenarios.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.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.test.scenarios.service.BarService;
+import org.apache.felix.ipojo.test.scenarios.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class ComponentDesc extends OSGiTestCase {
+	
+	ServiceReference sr_fooProvider1;
+	ServiceReference sr_fooProvider2;
+	ServiceReference sr_fooProviderDyn2;
+	ServiceReference sr_fooProvider3;
+	ServiceReference sr_foobarProvider;
+//	ServiceReference sr_simple;
+//	ServiceReference sr_optional;
+//	ServiceReference sr_multiple;
+//	ServiceReference sr_multiple_optional;
+	
+	Factory fooProvider1;
+	Factory fooProvider2;
+	Factory fooProviderDyn2;
+	Factory fooProvider3;
+	Factory foobarProvider;
+//	Factory simple;
+//	Factory optional;
+//	Factory multiple;
+//	Factory multiple_optional;
+	
+	public void setUp() {
+		sr_fooProvider1 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "FooProviderType-1");
+		sr_fooProvider2 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "FooProviderType-2");
+		sr_fooProviderDyn2 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "FooProviderType-Dyn2");
+		sr_fooProvider3 = Utils.getServiceReferenceByName(context, Factory.class.getName(), "FooProviderType-3");
+		sr_foobarProvider = Utils.getServiceReferenceByName(context, Factory.class.getName(), "FooBarProviderType-1");
+//		sr_simple = Utils.getServiceReferenceByName(context, Factory.class.getName(), "SimpleCheckServiceProvider");
+//		sr_optional = Utils.getServiceReferenceByName(context, Factory.class.getName(), "SimpleOptionalCheckServiceProvider");
+//		sr_multiple = Utils.getServiceReferenceByName(context, Factory.class.getName(), "SimpleMultipleCheckServiceProvider");
+//		sr_multiple_optional = Utils.getServiceReferenceByName(context, Factory.class.getName(), "SimpleOptionalMultipleCheckServiceProvider");
+		
+		fooProvider1 = (Factory) context.getService(sr_fooProvider1);
+		fooProvider2 = (Factory) context.getService(sr_fooProvider2);
+		fooProviderDyn2 = (Factory) context.getService(sr_fooProviderDyn2);
+		fooProvider3 = (Factory) context.getService(sr_fooProvider3);
+		foobarProvider = (Factory) context.getService(sr_foobarProvider);
+//		simple = (Factory) context.getService(sr_simple);
+//		optional = (Factory) context.getService(sr_optional);
+//		multiple = (Factory) context.getService(sr_multiple);
+//		multiple_optional = (Factory) context.getService(sr_multiple_optional);
+		
+	}
+	
+	public void tearDown() {
+		fooProvider1 = null;
+		fooProvider2 = null;
+		fooProviderDyn2 = null;
+		fooProvider3 = null;
+		foobarProvider = null;
+//		simple = null;
+//		multiple = null;
+//		optional = null;
+//		multiple_optional = null;
+		
+		context.ungetService(sr_fooProvider1);
+		context.ungetService(sr_fooProvider2);
+		context.ungetService(sr_fooProviderDyn2);
+		context.ungetService(sr_fooProvider3);
+		context.ungetService(sr_foobarProvider);
+//		context.ungetService(sr_simple);
+//		context.ungetService(sr_optional);
+//		context.ungetService(sr_multiple);
+//		context.ungetService(sr_multiple_optional);
+	}
+	
+	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(), "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);
+	}
+	
+	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(), "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);
+	}
+	
+	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(), "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);
+	}
+	
+	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(), "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);
+	}
+	
+	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);
+		assertEquals("Check component.providedServiceSpecifications 1", FooService.class.getName(), specs[1]);
+		assertEquals("Check component.providedServiceSpecifications 2", BarService.class.getName(), specs[0]);
+		
+		PropertyDescription[] pd = (PropertyDescription[]) sr_foobarProvider.getProperty("component.properties");
+		assertEquals("Check component.properties length", pd.length, 0);
+		
+		// Test factory
+		assertEquals("Check factory name", foobarProvider.getName(), "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);
+        assertEquals("Check specs", FooService.class.getName(), specs2[1].getAttribute("specification"));
+        assertEquals("Check specs", BarService.class.getName(), specs2[0].getAttribute("specification"));
+        
+        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);
+
+	}
+	
+	
+	
+
+}

Added: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/CoreTestSuite.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/CoreTestSuite.java?rev=615675&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/CoreTestSuite.java (added)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/CoreTestSuite.java Sun Jan 27 15:21:24 2008
@@ -0,0 +1,19 @@
+package org.apache.felix.ipojo.test.scenarios.core;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
+import org.osgi.framework.BundleContext;
+
+public class CoreTestSuite extends TestSuite {
+	
+	
+	public static Test suite(BundleContext bc) {
+		OSGiTestSuite ots = new OSGiTestSuite("Contre Test Suite", bc);
+		ots.addTestSuite(POJOCreation.class);
+		ots.addTestSuite(ComponentDesc.class);
+		return ots;
+	}
+
+}

Added: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/POJOCreation.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/POJOCreation.java?rev=615675&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/POJOCreation.java (added)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/core/POJOCreation.java Sun Jan 27 15:21:24 2008
@@ -0,0 +1,94 @@
+package org.apache.felix.ipojo.test.scenarios.core;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.service.FooService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+public class POJOCreation extends OSGiTestCase {
+	
+	private ComponentInstance ci_lazzy;
+	private ComponentInstance ci_immediate;
+	
+	private Architecture lazzyArch;
+	private Architecture immeArch;
+	
+	private ServiceReference lazzyRef;
+	private ServiceReference immRef;	
+	
+	public void setUp() {
+		String factName = "FooProviderType-1";
+		String compName = "FooProvider-1";
+		
+		Properties p = new Properties();
+		p.put("name", compName);
+		ci_lazzy = Utils.getComponentInstance(context, factName ,p);
+		
+		String factName2 = "ImmediateFooProviderType";
+		String compName2 = "FooProvider-2";
+		
+		Properties p2 = new Properties();
+		p2.put("name", compName2);
+		ci_immediate = Utils.getComponentInstance(context, factName2, p2);
+		
+		lazzyRef = Utils.getServiceReference(context, Architecture.class.getName(), "(instance.name="+compName+")");
+		immRef =   Utils.getServiceReference(context, Architecture.class.getName(), "(instance.name="+compName2+")");
+		
+		lazzyArch = (Architecture) context.getService(lazzyRef);
+		immeArch = (Architecture) context.getService(immRef);
+	}
+	
+	public void tearDown() {
+		context.ungetService(lazzyRef);
+		context.ungetService(immRef);
+		lazzyArch = null;
+		immeArch = null;
+		ci_lazzy.dispose();
+		ci_immediate.dispose();
+	}
+	
+	public void testLazyCreation() {
+		assertEquals("Check that no objects are created ", 0, lazzyArch.getInstanceDescription().getCreatedObjects().length);
+		ServiceReference[] refs = null;
+		try {
+			refs = context.getServiceReferences(FooService.class.getName(), "(instance.name="+ci_lazzy.getInstanceName()+")");
+		} catch (InvalidSyntaxException e) { e.printStackTrace(); }
+		assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available",refs);
+		FooService fs = (FooService) context.getService(refs[0]);
+		assertTrue("Check the FooService invocation", fs.foo());
+		assertEquals("Check the creation of 1 object",1, lazzyArch.getInstanceDescription().getCreatedObjects().length);
+		context.ungetService(refs[0]);
+	}
+	
+	public void testImmediateCreation() {
+		assertEquals("Check that one object is created ", 1, immeArch.getInstanceDescription().getCreatedObjects().length);
+		ServiceReference[] refs = null;
+		try {
+			refs = context.getServiceReferences(FooService.class.getName(), "(instance.name="+ci_immediate.getInstanceName()+")");
+		} catch (InvalidSyntaxException e) { e.printStackTrace(); }
+		assertNotNull("Check that a FooService from " + ci_immediate.getInstanceName() + " is available",refs);
+		FooService fs = (FooService) context.getService(refs[0]);
+		assertTrue("Check the FooService invocation", fs.foo());
+		assertEquals("Check the creation of 1 object", 1, immeArch.getInstanceDescription().getCreatedObjects().length);
+		context.ungetService(refs[0]);
+	}
+    
+    public void testBundleContext() {
+        ServiceReference[] refs = null;
+        try {
+            refs = context.getServiceReferences(FooService.class.getName(), "(instance.name="+ci_lazzy.getInstanceName()+")");
+        } catch (InvalidSyntaxException e) { e.printStackTrace(); }
+        assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available",refs);
+        FooService fs = (FooService) context.getService(refs[0]);
+        Properties p = fs.fooProps();
+        assertNotNull("Check the bundle context", p.get("context"));
+        assertEquals("Check the creation of 1 object",1, lazzyArch.getInstanceDescription().getCreatedObjects().length);
+        context.ungetService(refs[0]);
+    }
+
+}

Propchange: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jan 27 15:21:24 2008
@@ -0,0 +1,6 @@
+target*
+bin*
+.settings*
+.classpath
+.project
+.checkstyle

Added: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DelayedMultipleDependencies.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DelayedMultipleDependencies.java?rev=615675&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DelayedMultipleDependencies.java (added)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DelayedMultipleDependencies.java Sun Jan 27 15:21:24 2008
@@ -0,0 +1,350 @@
+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.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class DelayedMultipleDependencies extends OSGiTestCase {
+
+	ComponentInstance instance1, instance2, instance3, instance4, instance5;
+	ComponentInstance fooProvider1, fooProvider2;
+	
+	public void setUp() {
+		try {
+			Properties i1 = new Properties();
+			i1.put("name", "Simple");
+			instance1 = Utils.getFactoryByName(context, "SimpleMultipleCheckServiceProvider").createComponentInstance(i1);
+			instance1.stop();
+		
+			Properties i2 = new Properties();
+			i2.put("name", "Void");
+			instance2 = Utils.getFactoryByName(context, "VoidMultipleCheckServiceProvider").createComponentInstance(i2);
+			instance2.stop();
+		
+			Properties i3 = new Properties();
+			i3.put("name", "Object");
+			instance3 = Utils.getFactoryByName(context, "ObjectMultipleCheckServiceProvider").createComponentInstance(i3);
+			instance3.stop();
+		
+			Properties i4 = new Properties();
+			i4.put("name", "Ref");
+			instance4 = Utils.getFactoryByName(context, "RefMultipleCheckServiceProvider").createComponentInstance(i4);
+			instance4.stop();
+			
+	         Properties i5 = new Properties();
+	            i5.put("name", "Both");
+	            instance5 = Utils.getFactoryByName(context, "BothMultipleCheckServiceProvider").createComponentInstance(i5);
+	            instance5.stop();
+		
+			Properties prov = new Properties();
+			prov.put("name", "FooProvider1");
+			fooProvider1 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+		
+			Properties prov2 = new Properties();
+			prov2.put("name", "FooProvider2");
+			fooProvider2 = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov2);
+		} catch(Exception e) { fail(e.getMessage()); }
+	}
+	
+	public void tearDown() {
+		instance1.dispose();
+		instance2.dispose();
+		instance3.dispose();
+		instance4.dispose();
+		instance5.dispose();
+		fooProvider1.dispose();
+		fooProvider2.dispose();
+		instance1 = null;
+		instance2 = null;
+		instance3 = null;
+		instance4 = null;
+		instance5 = null;
+		fooProvider1 = null;
+		fooProvider2 = null;
+	}
+	
+	public void testSimple() {
+		instance1.start();
+		
+		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.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
+		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(), 2);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 2);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 2.0, 0);
+		
+		fooProvider2.stop();
+		
+		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 - 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(), 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, 0);
+		
+		fooProvider1.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.INVALID);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);
+		
+		instance1.stop();
+	}
+	
+	public void testVoid() {
+		instance2.start();
+		
+		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
+		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(), 2);
+		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(), 2);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 2);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 2.0, 0);
+		
+		fooProvider1.stop();
+		
+		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 - 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, 0);
+		
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.INVALID);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);	
+		instance2.stop();
+	}
+	
+	public void testObject() {
+		instance3.start();
+		
+		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);
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", 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()); // 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(), 2);
+		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(), 2);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 2);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 2.0, 0);
+		
+		fooProvider1.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
+		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, 0);
+		
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.INVALID);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		context.ungetService(cs_ref);
+		instance3.stop();
+	}
+	
+	public void testRef() {
+		instance4.start();
+		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
+		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(), 2);
+		assertEquals("check ref unbind callback invocation - 1", ((Integer)props.get("refU")).intValue(), 0);
+		assertEquals("Check FS invocation (int) - 1", ((Integer)props.get("int")).intValue(), 2);
+		assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 2);
+		assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 2.0, 0);
+		
+		fooProvider1.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
+		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, 0);
+		
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
+		
+		id = null;
+		cs = null;
+		context.ungetService(arch_ref);
+		instance4.stop();
+		context.ungetService(cs_ref);
+	}
+	
+	public void testBoth() {
+        instance5.start();
+        ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.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(), instance5.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()); // 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 both bind callback invocation - 1", ((Integer)props.get("bothB")).intValue(), 2);
+        assertEquals("check both unbind callback invocation - 1", ((Integer)props.get("bothU")).intValue(), 0);
+        assertEquals("Check FS invocation (int) - 1", ((Integer)props.get("int")).intValue(), 2);
+        assertEquals("Check FS invocation (long) - 1", ((Long)props.get("long")).longValue(), 2);
+        assertEquals("Check FS invocation (double) - 1", ((Double)props.get("double")).doubleValue(), 2.0, 0);
+        
+        fooProvider1.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
+        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 both bind callback invocation - 3", ((Integer)props.get("bothB")).intValue(), 2);
+        assertEquals("check both unbind callback invocation - 3", ((Integer)props.get("bothU")).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, 0);
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.INVALID);
+        
+        id = null;
+        cs = null;
+        context.ungetService(arch_ref);
+        instance5.stop();
+        context.ungetService(cs_ref);
+    }
+
+	
+}

Added: felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DelayedOptionalDependencies.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DelayedOptionalDependencies.java?rev=615675&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DelayedOptionalDependencies.java (added)
+++ felix/sandbox/clement/ipojo/tests/tests.core/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DelayedOptionalDependencies.java Sun Jan 27 15:21:24 2008
@@ -0,0 +1,335 @@
+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.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class DelayedOptionalDependencies extends OSGiTestCase {
+
+    ComponentInstance instance1, instance2, instance3, instance4, instance5;
+
+    ComponentInstance fooProvider;
+
+    public void setUp() {
+        try {
+            Properties prov = new Properties();
+            prov.put("name", "FooProvider");
+            fooProvider = Utils.getFactoryByName(context, "FooProviderType-1").createComponentInstance(prov);
+
+            Properties i1 = new Properties();
+            i1.put("name", "Simple");
+            instance1 = Utils.getFactoryByName(context, "SimpleOptionalCheckServiceProvider").createComponentInstance(i1);
+            instance1.stop();
+
+            Properties i2 = new Properties();
+            i2.put("name", "Void");
+            instance2 = Utils.getFactoryByName(context, "VoidOptionalCheckServiceProvider").createComponentInstance(i2);
+            instance2.stop();
+
+            Properties i3 = new Properties();
+            i3.put("name", "Object");
+            instance3 = Utils.getFactoryByName(context, "ObjectOptionalCheckServiceProvider").createComponentInstance(i3);
+            instance3.stop();
+
+            Properties i4 = new Properties();
+            i4.put("name", "Ref");
+            instance4 = Utils.getFactoryByName(context, "RefOptionalCheckServiceProvider").createComponentInstance(i4);
+            instance4.stop();
+
+            Properties i5 = new Properties();
+            i5.put("name", "Both");
+            instance5 = Utils.getFactoryByName(context, "BothOptionalCheckServiceProvider").createComponentInstance(i5);
+            instance5.stop();
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+
+    }
+
+    public void tearDown() {
+        instance1.dispose();
+        instance2.dispose();
+        instance3.dispose();
+        instance4.dispose();
+        instance5.dispose();
+        fooProvider.dispose();
+        instance1 = null;
+        instance2 = null;
+        instance3 = null;
+        instance4 = null;
+        instance5 = null;
+        fooProvider = null;
+    }
+
+    public void testSimple() {
+        instance1.start();
+
+        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
+        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(), 0);
+        assertEquals("check ref unbind callback invocation - 1", ((Integer) props.get("refU")).intValue(), 0);
+        assertEquals("check both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 0);
+        assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+        assertNotNull("Check FS invocation (object) - 1", props.get("object"));
+        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);
+
+        fooProvider.stop();
+
+        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
+        assertFalse("check CheckService invocation - 2", ((Boolean) props.get("result")).booleanValue()); // True, a provider is 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 both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 0);
+        assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 0);
+        assertNull("Check FS invocation (object) - 2", props.get("object"));
+        assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 0);
+        assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 0);
+        assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 0.0);
+
+        id = null;
+        cs = null;
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+
+        instance1.stop();
+    }
+
+    public void testVoid() {
+        instance2.start();
+        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
+        assertTrue("check CheckService invocation - 1", ((Boolean) props.get("result")).booleanValue());
+        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 both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 0);
+        assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+        assertNotNull("Check FS invocation (object) - 1", props.get("object"));
+        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);
+
+        fooProvider.stop();
+
+        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
+        assertFalse("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(), 1);
+        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 both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 0);
+        assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 0);
+        assertNull("Check FS invocation (object) - 2", props.get("object"));
+        assertEquals("Check FS invocation (int) - 2", ((Integer) props.get("int")).intValue(), 0);
+        assertEquals("Check FS invocation (long) - 2", ((Long) props.get("long")).longValue(), 0);
+        assertEquals("Check FS invocation (double) - 2", ((Double) props.get("double")).doubleValue(), 0.0);
+
+        id = null;
+        cs = null;
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+
+        instance2.stop();
+    }
+
+    public void testObject() {
+        instance3.start();
+        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
+        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);
+        assertEquals("check both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 0);
+        assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+
+        fooProvider.stop();
+
+        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
+        assertFalse("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(), 1);
+        assertEquals("check object unbind callback invocation -2", ((Integer) props.get("objectU")).intValue(), 1);
+        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 both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 0);
+        assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 0);
+
+        id = null;
+        cs = null;
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+
+        instance3.stop();
+    }
+
+    public void testRef() {
+        instance4.start();
+
+        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
+        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);
+        assertEquals("check both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 0);
+        assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+
+        fooProvider.stop();
+
+        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
+        assertFalse("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(), 1);
+        assertEquals("check both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 0);
+        assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 0);
+
+        id = null;
+        cs = null;
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+
+        instance4.stop();
+    }
+
+    public void testBoth() {
+        instance5.start();
+
+        ServiceReference arch_ref = Utils.getServiceReferenceByName(context, Architecture.class.getName(), instance5.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(), instance5.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(), 0);
+        assertEquals("check ref unbind callback invocation -1", ((Integer) props.get("refU")).intValue(), 0);
+        assertEquals("check both bind callback invocation - 1", ((Integer) props.get("bothB")).intValue(), 1);
+        assertEquals("check both unbind callback invocation - 1", ((Integer) props.get("bothU")).intValue(), 0);
+
+        fooProvider.stop();
+
+        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
+        assertFalse("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(), 0);
+        assertEquals("check ref unbind callback invocation -2", ((Integer) props.get("refU")).intValue(), 0);
+        assertEquals("check both bind callback invocation - 2", ((Integer) props.get("bothB")).intValue(), 1);
+        assertEquals("check both unbind callback invocation - 2", ((Integer) props.get("bothU")).intValue(), 1);
+
+        id = null;
+        cs = null;
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+
+        instance4.stop();
+    }
+
+}



Mime
View raw message