felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1729676 - in /felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest: components/MethodSignatures.java tests/MethodSignaturesTest.java
Date Wed, 10 Feb 2016 17:37:51 GMT
Author: pderop
Date: Wed Feb 10 17:37:51 2016
New Revision: 1729676

URL: http://svn.apache.org/viewvc?rev=1729676&view=rev
Log:
FELIX-5177: added test case for the support of configuration proxy used with the @FactoryConfigurationAdapterService
annotation.

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=1729676&r1=1729675&r2=1729676&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
Wed Feb 10 17:37:51 2016
@@ -193,6 +193,10 @@ public class MethodSignatures {
 		}
 	}
 	
+	public interface Config {
+	    String getFoo();
+	}	   
+
     // This component configures the FactoryPidComponent / FactoryPidComponent2 components.
 	@Component
 	public static class FactoryPidConfigurator {
@@ -204,6 +208,7 @@ public class MethodSignatures {
 
 		private Configuration m_conf1;
 		private Configuration m_conf2;
+        private Configuration m_conf3;
 
 		@Start
 		void start() throws IOException {
@@ -216,12 +221,18 @@ public class MethodSignatures {
 			props = new Hashtable<>();
 			props.put("foo", "bar");
 			m_conf2.update(props);
+			
+			m_conf3 = m_cm.createFactoryConfiguration(Config.class.getName());
+			props = new Hashtable<>();
+			props.put("foo", "bar");
+			m_conf3.update(props);
 		}
 		
 		@Stop
 		void stop() throws IOException {
 			m_conf1.delete();
 			m_conf2.delete();
+			m_conf3.delete();
 		}
 	}
 
@@ -265,4 +276,25 @@ public class MethodSignatures {
 			m_ensure.step();
 		}
 	}
+	
+	// This is a factory pid component with an updated callback having the "updated(Config)"
signature
+    @FactoryConfigurationAdapterService(factoryPidClass=Config.class)
+    public static class FactoryPidComponent3 {
+        Config m_properties;
+        
+        void updated(Config properties) {
+            m_properties = properties;
+        }
+        
+        @ServiceDependency(filter="(name=" + ENSURE_FACTORYPID + ")")
+        Ensure m_ensure;
+        
+        @Start
+        void start() {
+            Thread.dumpStack();
+            Assert.assertNotNull(m_properties);
+            Assert.assertEquals("bar", m_properties.getFoo());
+            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=1729676&r1=1729675&r2=1729676&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
Wed Feb 10 17:37:51 2016
@@ -45,7 +45,7 @@ public class MethodSignaturesTest extend
     public void testFactoryPidUpdatedSignature1() {
         Ensure e = new Ensure();
         ServiceRegistration sr = register(e, MethodSignatures.ENSURE_FACTORYPID);
-        e.waitForStep(2, 5000);
+        e.waitForStep(3, 5000);
         sr.unregister();
     }
 }



Mime
View raw message