felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1731615 - in /felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest: components/MethodSignatures.java tests/MethodSignaturesTest.java
Date Mon, 22 Feb 2016 10:24:09 GMT
Author: pderop
Date: Mon Feb 22 10:24:09 2016
New Revision: 1731615

URL: http://svn.apache.org/viewvc?rev=1731615&view=rev
Log:
FELIX-5177: tests must ensure that configurations are removed by CM.

Modified:
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java?rev=1731615&r1=1731614&r2=1731615&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
(original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
Mon Feb 22 10:24:09 2016
@@ -55,18 +55,25 @@ public class MethodSignatures {
 		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 @@ public class MethodSignatures {
 		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
+		@ConfigurationDependency // pid = Consumer.class
 		void updated2(org.apache.felix.dm.Component component, Dictionary<String, Object>
properties) {
-			Assert.assertNotNull(component);
-			m_properties2 = properties;			
+		    if (properties != null) {
+		        Assert.assertNotNull(component);
+		        m_properties2 = properties;
+		    } else {
+		        m_ensure.step();
+		    }
 		}
 		
-		@ConfigurationDependency(pidClass=Consumer.class)
+		@ConfigurationDependency
 		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 @@ public class MethodSignatures {
 			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 @@ public class MethodSignatures {
 			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 @@ public class MethodSignatures {
         
         @Start
         void start() {
-            Thread.dumpStack();
             Assert.assertNotNull(m_properties);
             Assert.assertEquals("bar", m_properties.getFoo());
             m_ensure.step();
         }
+        
+        
+        @Stop
+        void stop() {
+            m_ensure.step();
+        }
     }
 }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java?rev=1731615&r1=1731614&r2=1731615&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java
(original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java
Mon Feb 22 10:24:09 2016
@@ -37,6 +37,8 @@ public class MethodSignaturesTest extend
         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 @@ public class MethodSignaturesTest extend
         ServiceRegistration sr = register(e, MethodSignatures.ENSURE_FACTORYPID);
         e.waitForStep(3, 5000);
         sr.unregister();
+        // make sure configurations are deleted
+        e.waitForStep(6, 5000);
     }
 }



Mime
View raw message