felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r581148 [1/2] - in /felix/sandbox/clement/Tests/Suite/src/main: java/org/apache/felix/ipojo/test/scenarios/component/ java/org/apache/felix/ipojo/test/scenarios/dependency/ resources/
Date Tue, 02 Oct 2007 07:24:28 GMT
Author: clement
Date: Tue Oct  2 00:24:27 2007
New Revision: 581148

URL: http://svn.apache.org/viewvc?rev=581148&view=rev
Log:
Add tests on instance filter customization and parent class callbacks (for dependency callbacks)

Added:
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckProviderParentClass.java
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckProvider.java
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MultipleFilterCheckSubscriber.java
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/MultipleFilterDependencies.java
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalMultipleFilterDependencies.java
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalSimpleFilterDependencies.java
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/SimpleFilterDependencies.java
Modified:
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckServiceProvider.java
    felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DependencyTestSuite.java
    felix/sandbox/clement/Tests/Suite/src/main/resources/metadata.xml

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckProviderParentClass.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckProviderParentClass.java?rev=581148&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckProviderParentClass.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckProviderParentClass.java Tue Oct  2 00:24:27 2007
@@ -0,0 +1,30 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.test.scenarios.service.FooService;
+import org.osgi.framework.ServiceReference;
+
+public abstract class CheckProviderParentClass {
+    
+    int simpleU = 0;
+    int objectU = 0;
+    int refU = 0;
+    int bothU = 0;
+    
+    
+    public void bothUnbind(FooService o, ServiceReference sr) {
+        if(sr != null && o != null && o instanceof FooService) { bothU++; }
+    }
+    
+    public void refUnbind(ServiceReference sr) {
+        if(sr != null) { refU++; }
+    }
+    
+    public void objectUnbind(FooService o) {
+        if(o != null && o instanceof FooService) { objectU++; }
+    }
+    
+    public void voidUnbind() {
+        simpleU++;
+    }
+
+}

Modified: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckServiceProvider.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckServiceProvider.java?rev=581148&r1=581147&r2=581148&view=diff
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckServiceProvider.java (original)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CheckServiceProvider.java Tue Oct  2 00:24:27 2007
@@ -6,7 +6,7 @@
 import org.apache.felix.ipojo.test.scenarios.service.FooService;
 import org.osgi.framework.ServiceReference;
 
-public class CheckServiceProvider implements CheckService {
+public class CheckServiceProvider extends CheckProviderParentClass implements CheckService {
     
 	FooService fs;
 	
@@ -14,10 +14,6 @@
 	int objectB = 0;
 	int refB = 0;
 	int bothB = 0;
-	int simpleU = 0;
-	int objectU = 0;
-	int refU = 0;
-	int bothU = 0;
 
 	public boolean check() {
 		return fs.foo();
@@ -47,9 +43,6 @@
 	private void voidBind() {
 		simpleB++;
 	}
-	private void voidUnbind() {
-		simpleU++;
-	}
 	
 	protected void objectBind(FooService o) {
 	    if (o == null) {
@@ -57,22 +50,13 @@
 	    }
 		if(o != null && o instanceof FooService) { objectB++; }
 	}
-	protected void objectUnbind(FooService o) {
-		if(o != null && o instanceof FooService) { objectU++; }
-	}
 	
 	public void refBind(ServiceReference sr) {
 		if(sr != null) { refB++; }
 	}
-	public void refUnbind(ServiceReference sr) {
-		if(sr != null) { refU++; }
-	}
 	
     public void bothBind(FooService o, ServiceReference sr) {
 	    if(sr != null && o != null && o instanceof FooService) { bothB++; }
 	}
-    
-	public void bothUnbind(FooService o, ServiceReference sr) {
-	    if(sr != null && o != null && o instanceof FooService) { bothU++; }
-	}
+
 }

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckProvider.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckProvider.java?rev=581148&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckProvider.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckProvider.java Tue Oct  2 00:24:27 2007
@@ -0,0 +1,77 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.service.FooService;
+
+public class FilterCheckProvider implements CheckService, FooService {
+
+    private String m_toto;
+    
+    private int bind;
+    
+    private int unbind;
+    
+    public FilterCheckProvider(){
+        m_toto = "A";
+    }
+    
+    public boolean check() {
+        if (m_toto=="A"){
+            m_toto="B";
+            return true;
+        }else{
+            m_toto="A";
+            return false;
+        }
+    }
+
+    public Properties getProps() {
+        Properties props = new Properties();
+        props.put("Bind", new Integer(bind-unbind));
+        return null;
+    }
+    
+    private void Bind() {
+        bind++;
+    }
+    private void Unbind() {
+        unbind++;
+    }
+
+    public boolean foo() {
+        return true;
+    }
+
+    public Properties fooProps() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean getBoolean() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public double getDouble() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public int getInt() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public long getLong() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public Boolean getObject() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java?rev=581148&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FilterCheckSubscriber.java Tue Oct  2 00:24:27 2007
@@ -0,0 +1,37 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.Nullable;
+import org.apache.felix.ipojo.test.scenarios.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.service.FooService;
+
+public class FilterCheckSubscriber implements CheckService {
+    
+    private FooService m_foo;
+    
+    private int binded;
+    
+    public FilterCheckSubscriber(){
+    }
+    
+    public boolean check() {
+        m_foo.foo();
+        return true;
+    }
+
+    public Properties getProps() {
+        Properties props = new Properties();
+        props.put("Bind", new Integer(binded));
+        props.put("Nullable", new Boolean(m_foo instanceof Nullable));
+        return props;
+    }
+    
+    private void Bind() {
+        binded++;
+    }
+    private void Unbind() {
+        binded--;
+    }
+
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MultipleFilterCheckSubscriber.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MultipleFilterCheckSubscriber.java?rev=581148&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MultipleFilterCheckSubscriber.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/component/MultipleFilterCheckSubscriber.java Tue Oct  2 00:24:27 2007
@@ -0,0 +1,38 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.service.CheckService;
+import org.apache.felix.ipojo.test.scenarios.service.FooService;
+
+public class MultipleFilterCheckSubscriber implements CheckService {
+    
+    private FooService[] m_foo;
+    
+    private int binded;
+    
+    public MultipleFilterCheckSubscriber(){
+    }
+    
+    public boolean check() {
+        for (int i = 0; i < m_foo.length; i++) {
+            m_foo[i].foo();
+        }
+        return true;
+    }
+
+    public Properties getProps() {
+        Properties props = new Properties();
+        props.put("Bind", new Integer(binded));
+        props.put("Size",  new Integer(m_foo.length));
+        return props;
+    }
+    
+    private void Bind() {
+        binded++;
+    }
+    private void Unbind() {
+        binded--;
+    }
+
+}

Modified: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DependencyTestSuite.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DependencyTestSuite.java?rev=581148&r1=581147&r2=581148&view=diff
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DependencyTestSuite.java (original)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/DependencyTestSuite.java Tue Oct  2 00:24:27 2007
@@ -29,6 +29,10 @@
         list.add(new MethodDelayedOptionalDependencies(context));
         list.add(new MethodDelayedMultipleDependencies(context));
         list.add(new MethodDelayedOptionalMultipleDependencies(context));
+        list.add(new SimpleFilterDependencies(context));
+        list.add(new OptionalSimpleFilterDependencies(context));
+        list.add(new MultipleFilterDependencies(context));
+        list.add(new OptionalMultipleFilterDependencies(context));
 		return list;
 	}
 

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/MultipleFilterDependencies.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/MultipleFilterDependencies.java?rev=581148&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/MultipleFilterDependencies.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/MultipleFilterDependencies.java Tue Oct  2 00:24:27 2007
@@ -0,0 +1,556 @@
+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 MultipleFilterDependencies extends TestCase {
+	
+	ComponentInstance instance1, instance2, instance3;
+	ComponentInstance fooProvider1, fooProvider2;
+	
+	public MultipleFilterDependencies(BundleContext bc) {super(bc); }
+	
+	public void setUp() {
+		try {
+			Properties prov = new Properties();
+			prov.put("name", "FooProvider1");
+			fooProvider1 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+			fooProvider1.stop();
+			
+			prov = new Properties();
+            prov.put("name", "FooProvider2");
+            fooProvider2 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+            fooProvider2.stop();
+		
+			Properties i1 = new Properties();
+			i1.put("name", "Subscriber1");
+			instance1 = Utils.getFactoryByName(context, "MultipleFilterCheckServiceSubscriber").createComponentInstance(i1);
+			
+			Properties i2 = new Properties();
+            i2.put("name", "Subscriber2");
+            Properties ii2 = new Properties();
+            ii2.put("id2", "(toto=A)");
+            i2.put("requires.filters", ii2);
+            instance2 = Utils.getFactoryByName(context, "MultipleFilterCheckServiceSubscriber2").createComponentInstance(i2);
+            
+            Properties i3 = new Properties();
+            i3.put("name", "Subscriber3");
+            Properties ii3 = new Properties();
+            ii3.put("id1", "(toto=A)");
+            i3.put("requires.filters", ii3);
+            instance3 = Utils.getFactoryByName(context, "MultipleFilterCheckServiceSubscriber").createComponentInstance(i3);
+		
+		} catch(Exception e) { 
+		    e.printStackTrace();
+		    fail(e.getMessage()); }
+		
+	}
+	
+	public void tearDown() {
+		instance1.dispose();
+		instance2.dispose();
+		instance3.dispose();
+		fooProvider1.dispose();
+		fooProvider2.dispose();
+		instance1 = null;
+		instance2 = null;
+		instance3 = null;
+		fooProvider1 = null;
+		fooProvider2 = null;
+	}
+	
+	public void testMultipleNotMatch() {
+	    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.INVALID);
+
+        
+		fooProvider1.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		// change the value of the property toto
+		cs.check();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+        ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        fooProvider2.start();
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        CheckService cs2 = (CheckService) context.getService(cs_ref2);
+        // change the value of the property toto
+        cs2.check();
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance invalidity - 7", id.getState() == ComponentInstance.INVALID);
+		
+		
+		fooProvider2.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+		
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 9", id.getState() == ComponentInstance.INVALID);
+		
+        id = null;
+        cs = null;
+        cs2 = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);		
+	}
+	
+	public void testMultipleMatch() {
+	    
+	    fooProvider1.start();
+	    fooProvider2.start();
+	    
+	    ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        CheckService cs2 = (CheckService) context.getService(cs_ref2);
+        // change the value of the property toto
+        cs2.check();
+	    
+        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_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        id = null;
+        cs = null;
+        cs2 = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);      
+    }
+	
+	public void testMultipleNotMatchInstance() {
+        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.INVALID);
+        
+        
+        fooProvider1.start();
+        ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
+        
+        
+        cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+        ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.start();
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        CheckService cs2 = (CheckService) context.getService(cs_ref2);
+        // change the value of the property toto
+        cs2.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        // change the value of the property toto
+        cs2.check();
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 7", id.getState() == ComponentInstance.INVALID);
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 9", id.getState() == ComponentInstance.INVALID);
+        
+        id = null;
+        cs = null;
+        cs2 = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);
+    }
+    
+    public void testMultipleMatchInstance() {
+        
+        fooProvider1.start();
+        fooProvider2.start();
+        instance3.start();
+        
+        ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        
+        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_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
+       
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        id = null;
+        cs = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);        
+    }
+	
+    public void testMultipleNotMatchInstanceWithoutFilter() {
+        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.INVALID);
+        
+        
+        fooProvider1.start();
+        ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 2", id.getState() == ComponentInstance.INVALID);
+        
+        
+        cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+        ServiceReference cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.start();
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        CheckService cs2 = (CheckService) context.getService(cs_ref2);
+        // change the value of the property toto
+        cs2.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        // change the value of the property toto
+        cs2.check();
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 7", id.getState() == ComponentInstance.INVALID);
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 9", id.getState() == ComponentInstance.INVALID);
+        
+        id = null;
+        cs = null;
+        cs2 = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);
+    }
+    
+    public void testMultipleMatchInstanceWithoutFilter() {
+        fooProvider1.start();
+        fooProvider2.start();
+        instance2.start();
+        
+        ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        
+        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_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance invalidity - 3", id.getState() == ComponentInstance.INVALID);
+       
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        id = null;
+        cs = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);        
+    }
+
+}

Added: felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalMultipleFilterDependencies.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalMultipleFilterDependencies.java?rev=581148&view=auto
==============================================================================
--- felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalMultipleFilterDependencies.java (added)
+++ felix/sandbox/clement/Tests/Suite/src/main/java/org/apache/felix/ipojo/test/scenarios/dependency/OptionalMultipleFilterDependencies.java Tue Oct  2 00:24:27 2007
@@ -0,0 +1,578 @@
+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 OptionalMultipleFilterDependencies extends TestCase {
+	
+	ComponentInstance instance1, instance2, instance3;
+	ComponentInstance fooProvider1, fooProvider2;
+	
+	public OptionalMultipleFilterDependencies(BundleContext bc) {super(bc); }
+	
+	public void setUp() {
+		try {
+			Properties prov = new Properties();
+			prov.put("name", "FooProvider1");
+			fooProvider1 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+			fooProvider1.stop();
+			
+			prov = new Properties();
+            prov.put("name", "FooProvider2");
+            fooProvider2 = Utils.getFactoryByName(context, "SimpleFilterCheckServiceProvider").createComponentInstance(prov);
+            fooProvider2.stop();
+		
+			Properties i1 = new Properties();
+			i1.put("name", "Subscriber1");
+			instance1 = Utils.getFactoryByName(context, "OptionalMultipleFilterCheckServiceSubscriber").createComponentInstance(i1);
+			
+			Properties i2 = new Properties();
+            i2.put("name", "Subscriber2");
+            Properties ii2 = new Properties();
+            ii2.put("id2", "(toto=A)");
+            i2.put("requires.filters", ii2);
+            instance2 = Utils.getFactoryByName(context, "OptionalMultipleFilterCheckServiceSubscriber2").createComponentInstance(i2);
+            
+            Properties i3 = new Properties();
+            i3.put("name", "Subscriber3");
+            Properties ii3 = new Properties();
+            ii3.put("id1", "(toto=A)");
+            i3.put("requires.filters", ii3);
+            instance3 = Utils.getFactoryByName(context, "OptionalMultipleFilterCheckServiceSubscriber").createComponentInstance(i3);
+		
+		} catch(Exception e) { 
+		    e.printStackTrace();
+		    fail(e.getMessage()); }
+		
+	}
+	
+	public void tearDown() {
+		instance1.dispose();
+		instance2.dispose();
+		instance3.dispose();
+		fooProvider1.dispose();
+		fooProvider2.dispose();
+		instance1 = null;
+		instance2 = null;
+		instance3 = null;
+		fooProvider1 = null;
+		fooProvider2 = null;
+	}
+	
+	public void testMultipleNotMatch() {
+	    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_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+		fooProvider1.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+		assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+		
+		ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+		assertNotNull("Check CheckService availability", cs_ref);
+		CheckService cs = (CheckService) context.getService(cs_ref);
+		// change the value of the property toto
+		cs.check();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        fooProvider2.start();
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        CheckService cs2 = (CheckService) context.getService(cs_ref2);
+        // change the value of the property toto
+        cs2.check();
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+		assertTrue("Check instance validity - 7", id.getState() == ComponentInstance.VALID);
+		assertTrue("Check service Binding - 7", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+		assertTrue("Check Array size - 7", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+		
+		fooProvider2.start();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+		
+		fooProvider2.stop();
+		
+		id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 9", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 9", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 9", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+		
+        id = null;
+        cs = null;
+        cs2 = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);		
+	}
+	
+	public void testMultipleMatch() {
+	    
+	    fooProvider1.start();
+	    fooProvider2.start();
+	    
+	    ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        CheckService cs2 = (CheckService) context.getService(cs_ref2);
+        // change the value of the property toto
+        cs2.check();
+	    
+        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_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        id = null;
+        cs = null;
+        cs2 = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);      
+    }
+	
+	public void testMultipleNotMatchInstance() {
+        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_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        fooProvider1.start();
+        ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        fooProvider2.start();
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        CheckService cs2 = (CheckService) context.getService(cs_ref2);
+        // change the value of the property toto
+        cs2.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        // change the value of the property toto
+        cs2.check();
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 7", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 7", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 7", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 9", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 9", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 9", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        id = null;
+        cs = null;
+        cs2 = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);
+    }
+    
+    public void testMultipleMatchInstance() {
+        
+        fooProvider1.start();
+        fooProvider2.start();
+        instance3.start();
+        
+        ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        
+        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_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance3.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        id = null;
+        cs = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);        
+    }
+	
+    public void testMultipleNotMatchInstanceWithoutFilter() {
+        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_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        fooProvider1.start();
+        ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        cs = (CheckService) context.getService(cs_ref);
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        fooProvider2.start();
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        CheckService cs2 = (CheckService) context.getService(cs_ref2);
+        // change the value of the property toto
+        cs2.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        cs_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        
+        // change the value of the property toto
+        cs2.check();
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 6", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 6", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 6", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 7", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 7", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 7", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 8", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 8", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 8", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 9", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service Binding - 9", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 9", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        id = null;
+        cs = null;
+        cs2 = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);   
+    }
+    
+    public void testMultipleMatchInstanceWithoutFilter() {
+
+        
+        fooProvider1.start();
+        fooProvider2.start();
+        instance2.start();
+        
+        ServiceReference cs_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider1.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref);
+        CheckService cs = (CheckService) context.getService(cs_ref);
+        
+        ServiceReference cs_ref2 = Utils.getServiceReferenceByName(context, CheckService.class.getName(), fooProvider2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_ref2);
+        
+        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_instance_ref = Utils.getServiceReferenceByName(context, CheckService.class.getName(), instance2.getInstanceName());
+        assertNotNull("Check CheckService availability", cs_instance_ref);
+        CheckService cs_instance = (CheckService) context.getService(cs_instance_ref);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 1", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 1", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        // change the value of the property toto
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 2", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 2", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 2", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        fooProvider2.stop();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 3", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 3", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(0)));
+        assertTrue("Check Array size - 3", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(0)));
+        
+        fooProvider2.start();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 4", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 4", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(1)));
+        assertTrue("Check Array size - 4", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(1)));
+        
+        cs.check();
+        
+        id = ((Architecture) context.getService(arch_ref)).getInstanceDescription();
+        assertTrue("Check instance validity - 5", id.getState() == ComponentInstance.VALID);
+        assertTrue("Check service invocation", cs_instance.check());
+        assertTrue("Check service Binding - 5", ((Integer)cs_instance.getProps().get("Bind")).equals(new Integer(2)));
+        assertTrue("Check Array size - 5", ((Integer)cs_instance.getProps().get("Size")).equals(new Integer(2)));
+        
+        id = null;
+        cs = null;
+        cs_instance = null;
+        context.ungetService(cs_instance_ref);
+        context.ungetService(arch_ref);
+        context.ungetService(cs_ref);
+        context.ungetService(cs_ref2);      
+    }
+
+}



Mime
View raw message