felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1137668 - /felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
Date Mon, 20 Jun 2011 15:42:19 GMT
Author: marrs
Date: Mon Jun 20 15:42:19 2011
New Revision: 1137668

URL: http://svn.apache.org/viewvc?rev=1137668&view=rev
Log:
FELIX-2987 Added a test case to this class that shows the problem that was reported.

Modified:
    felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java

Modified: felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java?rev=1137668&r1=1137667&r2=1137668&view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
(original)
+++ felix/trunk/dependencymanager/test/src/test/java/org/apache/felix/dm/test/ConfigurationDependencyTest.java
Mon Jun 20 15:42:19 2011
@@ -72,6 +72,28 @@ public class ConfigurationDependencyTest
         // ensure we executed all steps inside the component instance
         e.step(5);
     }
+    
+    @Test
+    public void testFELIX2987(BundleContext context) {
+        // mimics testComponentWithRequiredConfigurationAndServicePropertyPropagation
+        DependencyManager m = new DependencyManager(context);
+        // helper class that ensures certain steps get executed in sequence
+        Ensure e = new Ensure();
+        // create a service provider and consumer
+        Component s1 = m.createComponent().setImplementation(new ConfigurationConsumer2(e)).setInterface(Runnable.class.getName(),
null).add(m.createConfigurationDependency().setPid("test").setPropagate(true));
+        Component s2 = m.createComponent().setImplementation(new ConfigurationCreator(e)).add(m.createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true));
+        Component s3 = m.createComponent().setImplementation(new ConfiguredServiceConsumer(e)).add(m.createServiceDependency().setService(Runnable.class,
("(testkey=testvalue)")).setRequired(true));
+        m.add(s1);
+        m.add(s2);
+        m.add(s3);
+        e.waitForStep(4, 15000);
+        m.remove(s1);
+        m.remove(s2);
+        m.remove(s3);
+        // ensure we executed all steps inside the component instance
+        e.step(5);
+    }
+
 
     static class ConfigurationCreator {
         private volatile ConfigurationAdmin m_ca;
@@ -94,6 +116,12 @@ public class ConfigurationDependencyTest
             }
         }
     }
+    
+    static class ConfigurationConsumer2 extends ConfigurationConsumer {
+        public ConfigurationConsumer2(Ensure e) {
+            super(e);
+        }
+    }
 
     static class ConfigurationConsumer implements ManagedService, Runnable {
         private final Ensure m_ensure;



Mime
View raw message