felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1629412 - in /felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest: components/ tests/
Date Sat, 04 Oct 2014 16:37:38 GMT
Author: pderop
Date: Sat Oct  4 16:37:37 2014
New Revision: 1629412

URL: http://svn.apache.org/r1629412
Log:
Fixed this test, which was not working fine when using parallel DM.

Modified:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/FactoryConfigurationAdapterAnnotation.java
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/FactoryConfigurationAdapterAnnotationTest.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/FactoryConfigurationAdapterAnnotation.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/FactoryConfigurationAdapterAnnotation.java?rev=1629412&r1=1629411&r2=1629412&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/FactoryConfigurationAdapterAnnotation.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/FactoryConfigurationAdapterAnnotation.java
Sat Oct  4 16:37:37 2014
@@ -26,7 +26,6 @@ import org.apache.felix.dm.annotation.ap
 import org.apache.felix.dm.annotation.api.FactoryConfigurationAdapterService;
 import org.apache.felix.dm.annotation.api.Inject;
 import org.apache.felix.dm.annotation.api.Property;
-import org.apache.felix.dm.annotation.api.Registered;
 import org.apache.felix.dm.annotation.api.ServiceDependency;
 import org.apache.felix.dm.annotation.api.Start;
 import org.apache.felix.dm.annotation.api.Stop;
@@ -35,12 +34,14 @@ import org.osgi.framework.BundleContext;
 
 public class FactoryConfigurationAdapterAnnotation {
     public interface ServiceInterface {
-        public void doService();
     }
 
     @Component
     public static class ServiceClient {
-        @ServiceDependency(changed = "changeServiceProvider")
+        @ServiceDependency(filter="(name=" + ServiceProvider.ENSURE + ")")
+        private volatile Ensure m_sequencer;
+
+        @ServiceDependency(changed = "changeServiceProvider", removed="removedServiceProvider")
         void addServiceProvider(Map props, ServiceInterface si) {
             // props should contain foo=bar, foo2=bar2
             if (!"bar".equals(props.get("foo"))) {
@@ -49,10 +50,11 @@ public class FactoryConfigurationAdapter
             if (!"bar2".equals(props.get("foo2"))) {
                 throw new IllegalArgumentException("configuration does not contain foo2=bar2:
" + props);
             }
-            si.doService();
+            m_sequencer.step(2);
         }
 
         void changeServiceProvider(Map props, ServiceInterface si) {
+            System.out.println("ServiceClient: changeServiceProvider");
             // props should contain foo=bar, foo2=bar2_modified
             if (!"bar".equals(props.get("foo"))) {
                 throw new IllegalArgumentException("configuration does not contain foo=bar:
" + props);
@@ -60,7 +62,12 @@ public class FactoryConfigurationAdapter
             if (!"bar2_modified".equals(props.get("foo2"))) {
                 throw new IllegalArgumentException("configuration does not contain foo2=bar2:
" + props);
             }
-            si.doService();
+            
+            m_sequencer.step(4);
+        }
+        
+        void removedServiceProvider(ServiceInterface si) {
+            m_sequencer.step(5);
         }
     }
 
@@ -96,7 +103,7 @@ public class FactoryConfigurationAdapter
                 if (!"bar2_modified".equals(conf.get("foo2"))) {
                     m_sequencer.throwable(new Exception("configuration does not contain foo=bar"));
                 }
-                m_sequencer.step(4);
+                m_sequencer.step(3);
             } else {
                 // conf should contain foo2=bar2
                 if (!"bar2".equals(conf.get("foo2"))) {
@@ -112,16 +119,6 @@ public class FactoryConfigurationAdapter
             m_sequencer.step(1);
         }
 
-        @Registered
-        void registered() {
-            m_sequencer.step(3);
-        }
-
-        // The ServiceClient is invoking our service
-        public void doService() {
-            m_sequencer.step(); /* 2 or 5 */
-        }
-
         @Stop
         void stop() {
             m_sequencer.step(6);

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/FactoryConfigurationAdapterAnnotationTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/FactoryConfigurationAdapterAnnotationTest.java?rev=1629412&r1=1629411&r2=1629412&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/FactoryConfigurationAdapterAnnotationTest.java
(original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/FactoryConfigurationAdapterAnnotationTest.java
Sat Oct  4 16:37:37 2014
@@ -35,7 +35,7 @@ import org.osgi.service.cm.Configuration
  */
 public class FactoryConfigurationAdapterAnnotationTest extends TestBase {
     
-    private final static int MAXWAIT = 10000;
+    private final static int MAXWAIT = 5000;
 
     public void testFactoryConfigurationAdapterAnnotation() throws Throwable {
         Ensure e = new Ensure();



Mime
View raw message