aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cummi...@apache.org
Subject svn commit: r1374444 - in /aries/trunk/blueprint: blueprint-bundle/pom.xml blueprint-itests/pom.xml blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java
Date Fri, 17 Aug 2012 21:25:07 GMT
Author: cumminsh
Date: Fri Aug 17 21:25:06 2012
New Revision: 1374444

URL: http://svn.apache.org/viewvc?rev=1374444&view=rev
Log:
[ARIES-905] Wait for asynchronous events to catch up before making assertions in test.

Modified:
    aries/trunk/blueprint/blueprint-bundle/pom.xml
    aries/trunk/blueprint/blueprint-itests/pom.xml
    aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java

Modified: aries/trunk/blueprint/blueprint-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-bundle/pom.xml?rev=1374444&r1=1374443&r2=1374444&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-bundle/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-bundle/pom.xml Fri Aug 17 21:25:06 2012
@@ -117,7 +117,7 @@
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.core</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

Modified: aries/trunk/blueprint/blueprint-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/pom.xml?rev=1374444&r1=1374443&r2=1374444&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/pom.xml (original)
+++ aries/trunk/blueprint/blueprint-itests/pom.xml Fri Aug 17 21:25:06 2012
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.aries</groupId>
         <artifactId>java5-parent</artifactId>
-        <version>1.0.0</version>
+        <version>1.0.1-SNAPSHOT</version>
         <relativePath />
     </parent>
 
@@ -60,43 +60,43 @@
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint</artifactId>
             <scope>test</scope>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.jexl.evaluator</artifactId>
             <scope>test</scope>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries</groupId>
             <artifactId>org.apache.aries.util</artifactId>
             <scope>test</scope>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.sample</artifactId>
             <scope>test</scope>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.testbundlea</artifactId>
             <scope>test</scope>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.testbundleb</artifactId>
             <scope>test</scope>
-            <version>1.0.0-SNAPSHOT</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.testsupport</groupId>
             <artifactId>org.apache.aries.testsupport.unit</artifactId>
             <scope>test</scope>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
@@ -167,39 +167,39 @@
         <dependency>
             <groupId>org.apache.aries.proxy</groupId>
             <artifactId>org.apache.aries.proxy</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.quiesce</groupId>
             <artifactId>org.apache.aries.quiesce.api</artifactId>
             <type>bundle</type>
             <scope>provided</scope>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.testquiescebundle</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <type>bundle</type>
             <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.api</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.core</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <type>bundle</type>
             <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint.cm</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <type>bundle</type>
             <scope>compile</scope>
         </dependency>
@@ -207,7 +207,7 @@
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>blueprint-parser</artifactId>
             <scope>provided</scope>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
@@ -287,3 +287,4 @@
     </profiles>
 
 </project>
+

Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java?rev=1374444&r1=1374443&r2=1374444&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java
(original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/TestReferences.java
Fri Aug 17 21:25:06 2012
@@ -71,6 +71,8 @@ public class TestReferences extends Abst
                 return "Hello " + msg + "!";
             }
         }, null);
+        waitForAsynchronousHandling();
+
         assertNotNull(listener.getA());
         assertNotNull(listener.getReference());
         assertEquals("Hello world!", a.hello("world"));
@@ -83,16 +85,21 @@ public class TestReferences extends Abst
             }
         }, props);
 
+        waitForAsynchronousHandling();
+
         assertNotNull(listener.getA());
         assertNotNull(listener.getReference());
         assertEquals("Hello world!", a.hello("world"));
 
         reg1.unregister();
+        waitForAsynchronousHandling();
         assertNotNull(listener.getA());
         assertNotNull(listener.getReference());
         assertEquals("Good morning world!", a.hello("world"));
 
         reg2.unregister();
+        waitForAsynchronousHandling();
+
         assertNull(listener.getA());
         assertNull(listener.getReference());
         try {
@@ -121,6 +128,8 @@ public class TestReferences extends Abst
                 return "Hello " + msg + "!";
             }
         }, null);
+    
+        waitForAsynchronousHandling();
         assertNotNull(listener.getA());
         assertNotNull(listener.getReference());
         assertEquals(1, refs.size());
@@ -138,13 +147,17 @@ public class TestReferences extends Abst
       Runnable refRunnable = (Runnable) blueprintContainer.getComponentInstance("refWithDefault");
       DefaultRunnable defaultRunnable = (DefaultRunnable) blueprintContainer.getComponentInstance("defaultRunnable");
       refRunnable.run();
+      waitForAsynchronousHandling();
+      Thread.sleep(2000);
       
       assertEquals("The default runnable was not called", 1, defaultRunnable.getCount());
       
       Runnable mockService = Skeleton.newMock(Runnable.class);
       
       ServiceRegistration reg = bundleContext.registerService(Runnable.class.getName(), mockService,
null);
-      
+      waitForAsynchronousHandling();
+      Thread.sleep(2000);
+
       refRunnable.run();
       
       assertEquals("The default runnable was called when a service was bound", 1, defaultRunnable.getCount());
@@ -152,7 +165,9 @@ public class TestReferences extends Abst
       Skeleton.getSkeleton(mockService).assertCalled(new MethodCall(Runnable.class, "run"));
       
       reg.unregister();
-      
+      waitForAsynchronousHandling();
+      Thread.sleep(2000);
+
       refRunnable.run();
       
       assertEquals("The default runnable was not called", 2, defaultRunnable.getCount());
@@ -187,7 +202,13 @@ public class TestReferences extends Abst
       return null;
     }
 
-    @org.ops4j.pax.exam.junit.Configuration
+    private void waitForAsynchronousHandling() throws InterruptedException {
+      // Since service events are handled asynchronously in AbstractServiceReferenceRecipe,
pause
+       Thread.sleep(200);
+      
+   }
+
+   @org.ops4j.pax.exam.junit.Configuration
     public static Option[] configuration() {
         return testOptions(
                 paxLogging("INFO"),



Mime
View raw message