You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2014/10/02 23:52:58 UTC

svn commit: r1629078 - /felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java

Author: pderop
Date: Thu Oct  2 21:52:57 2014
New Revision: 1629078

URL: http://svn.apache.org/r1629078
Log:
Fixed a bug in the test: The client service dependencies must be added after the client has been started.

Modified:
    felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java?rev=1629078&r1=1629077&r2=1629078&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/test/test/ServiceRaceTest.java Thu Oct  2 21:52:57 2014
@@ -130,21 +130,25 @@ public class ServiceRaceTest extends Tes
         };
         client.add(listener);
 
-        // Activate the client service dependencies concurrently.
-        for (int i = 0; i < DEPENDENCIES; i++) {
-            final DependencyImpl dep = dependencies[i];
-            final Event added = new EventImpl(i);
-            m_threadpool.execute(new Runnable() {
-                public void run() {
-                    dep.add(added);
-                }
-            });
-        }
 
         // Start the client (concurrently)
         m_threadpool.execute(new Runnable() {
             public void run() {
                 client.start();
+                
+                // Activate the client service dependencies concurrently.
+                // We *must* do this after having started the component (in a reality, the dependencies can be 
+                // injected only one the tracker has been opened ...
+                for (int i = 0; i < DEPENDENCIES; i++) {
+                    final DependencyImpl dep = dependencies[i];
+                    final Event added = new EventImpl(i);
+                    m_threadpool.execute(new Runnable() {
+                        public void run() {
+                            dep.add(added);
+                        }
+                    });
+                }
+
             }
         });