sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r991119 - /sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java
Date Tue, 31 Aug 2010 08:39:28 GMT
Author: cziegeler
Date: Tue Aug 31 08:39:27 2010
New Revision: 991119

URL: http://svn.apache.org/viewvc?rev=991119&view=rev
Log:
Make sure to wait for jobs to be written into the repo

Modified:
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java?rev=991119&r1=991118&r2=991119&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/JobEventHandlerTest.java
Tue Aug 31 08:39:27 2010
@@ -163,7 +163,7 @@ public class JobEventHandlerTest extends
                             EventUtil.acknowledgeJob(event);
                             cb.block();
                             try {
-                                Thread.sleep(400);
+                                Thread.sleep(500);
                             } catch (InterruptedException e) {
                                 // ignore
                             }
@@ -173,19 +173,12 @@ public class JobEventHandlerTest extends
                     }
                 });
         jeh.handleEvent(getJobEvent(null, "myid", null));
-        // sleep a little to give the job handler time write the job
-        try {
-            Thread.sleep(50);
-        } catch (InterruptedException e) {
-            // ignore
-        }
-
-        assertEquals(1, jeh.getAllJobs("sling/test").size());
         cb.block();
+        assertEquals(1, jeh.getAllJobs("sling/test").size());
         // job is currently sleeping, therefore cancel fails
         assertFalse(jeh.removeJob("sling/test", "myid"));
         try {
-            Thread.sleep(800);
+            Thread.sleep(900);
         } catch (InterruptedException e) {
             // ignore
         }
@@ -208,7 +201,7 @@ public class JobEventHandlerTest extends
                             EventUtil.acknowledgeJob(event);
                             cb.block();
                             try {
-                                Thread.sleep(400);
+                                Thread.sleep(1000);
                             } catch (InterruptedException e) {
                                 // ignore
                             }
@@ -218,14 +211,8 @@ public class JobEventHandlerTest extends
                     }
                 });
         jeh.handleEvent(getJobEvent(null, "myid", null));
-        // sleep a little to give the job handler time write the job
-        try {
-            Thread.sleep(50);
-        } catch (InterruptedException e) {
-            // ignore
-        }
-        assertEquals(1, jeh.getAllJobs("sling/test").size());
         cb.block();
+        assertEquals(1, jeh.getAllJobs("sling/test").size());
         // job is currently sleeping, but force cancel always waits!
         jeh.forceRemoveJob("sling/test", "myid");
         // the job is now removed



Mime
View raw message