FELIX-5177: tests must ensure that configurations are removed by CM.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1731615 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java b/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
index 324f1f4..ab5824d 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
@@ -55,18 +55,25 @@
 		ConfigurationAdmin m_cm;
 
 		private Configuration m_conf;
-		
+	      private Configuration m_conf2;
+
 		@Start
 		void start() throws IOException {
 			m_conf = m_cm.getConfiguration(Consumer.class.getName());
 			Hashtable<String, Object> props = new Hashtable<>();
 			props.put("foo", "bar");
 			m_conf.update(props);
+			
+			m_conf2 = m_cm.getConfiguration(ConsumerConfig.class.getName());
+			props = new Hashtable<>();
+			props.put("foo", "bar");
+			m_conf2.update(props);
 		}
 		
 		@Stop
 		void stop() throws IOException {
 			m_conf.delete();
+			m_conf2.delete();
 		}
 	}
 
@@ -89,28 +96,44 @@
 		ConsumerConfig m_config;
         ConsumerConfig m_config2;
 
-		@ConfigurationDependency
+		@ConfigurationDependency // pid=Consumer.class
 		void updated(Dictionary<String, Object> properties) {
-			m_properties = properties;			
+		    if (properties != null) {
+		        m_properties = properties;
+		    } else {
+		         m_ensure.step();
+		    }
+		}
+		
+		@ConfigurationDependency // pid = Consumer.class
+		void updated2(org.apache.felix.dm.Component component, Dictionary<String, Object> properties) {
+		    if (properties != null) {
+		        Assert.assertNotNull(component);
+		        m_properties2 = properties;
+		    } else {
+		        m_ensure.step();
+		    }
 		}
 		
 		@ConfigurationDependency
-		void updated2(org.apache.felix.dm.Component component, Dictionary<String, Object> properties) {
-			Assert.assertNotNull(component);
-			m_properties2 = properties;			
-		}
-		
-		@ConfigurationDependency(pidClass=Consumer.class)
 		void updated3(ConsumerConfig cnf) {
-		    Assert.assertNotNull(cnf);
-		    m_config = cnf;         
+		    if (cnf != null) {
+		        Assert.assertNotNull(cnf);
+		        m_config = cnf;
+		    } else {
+		        m_ensure.step();
+		    }
 		}
 
-		@ConfigurationDependency(pidClass=Consumer.class)
+		@ConfigurationDependency
 		void updated4(org.apache.felix.dm.Component comp, ConsumerConfig cnf) {
-		    Assert.assertNotNull(comp);
-		    Assert.assertNotNull(cnf);
-		    m_config2 = cnf;         
+		    if (cnf != null) {
+		        Assert.assertNotNull(comp);
+		        Assert.assertNotNull(cnf);
+		        m_config2 = cnf;
+		    } else {
+		        m_ensure.step();
+		    }
 		}
 
 		@ServiceDependency(filter="(name=" + ENSURE_SERVICE_DEPENDENCY + ")")
@@ -254,6 +277,11 @@
 			Assert.assertEquals("bar", m_properties.get("foo"));
 			m_ensure.step();
 		}
+        
+        @Stop
+        void stop() {
+            m_ensure.step();
+        }
 	}
 	
 	// This is a factory pid component with an updated callback having the "updated(Component, Dictionary)" signature
@@ -275,6 +303,11 @@
 			Assert.assertEquals("bar", m_properties.get("foo"));
 			m_ensure.step();
 		}
+		
+		@Stop
+		void stop() {
+		    m_ensure.step();
+		}
 	}
 	
 	// This is a factory pid component with an updated callback having the "updated(Config)" signature
@@ -291,10 +324,15 @@
         
         @Start
         void start() {
-            Thread.dumpStack();
             Assert.assertNotNull(m_properties);
             Assert.assertEquals("bar", m_properties.getFoo());
             m_ensure.step();
         }
+        
+        
+        @Stop
+        void stop() {
+            m_ensure.step();
+        }
     }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java b/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java
index cff7189..4779f31 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java
@@ -37,6 +37,8 @@
         ServiceRegistration sr = register(e, MethodSignatures.ENSURE_SERVICE_DEPENDENCY);
         e.waitForStep(10, 5000);
         sr.unregister();
+        // make sure configurations are deleted
+        e.waitForStep(14, 5000);
     }
     
     /**
@@ -47,5 +49,7 @@
         ServiceRegistration sr = register(e, MethodSignatures.ENSURE_FACTORYPID);
         e.waitForStep(3, 5000);
         sr.unregister();
+        // make sure configurations are deleted
+        e.waitForStep(6, 5000);
     }
 }