curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject git commit: in testSorting(), if the queue put is slow, the consumer would get ahead breaking the test. Instead, wait to consume items until they've all been added
Date Tue, 08 Jul 2014 17:29:38 GMT
Repository: curator
Updated Branches:
  refs/heads/master a74916fb2 -> 599cb9ffb


in testSorting(), if the queue put is slow, the consumer would get ahead breaking the test.
Instead, wait to consume items until they've all been added


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/599cb9ff
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/599cb9ff
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/599cb9ff

Branch: refs/heads/master
Commit: 599cb9ffba81dbd8da0c6d0cfcf0597ab544bf4e
Parents: a74916f
Author: randgalt <randgalt@apache.org>
Authored: Tue Jul 8 12:29:31 2014 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Tue Jul 8 12:29:31 2014 -0500

----------------------------------------------------------------------
 .../recipes/queue/TestDistributedDelayQueue.java | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/599cb9ff/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java
index 3759c34..74cd2ee 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java
@@ -142,14 +142,14 @@ public class TestDistributedDelayQueue extends BaseClassForTests
         final int QTY = 1000;
 
         Timing                          timing = new Timing();
-        DistributedDelayQueue<Long>     queue = null;
+        DistributedDelayQueue<Long>     putQueue = null;
+        DistributedDelayQueue<Long>     getQueue = null;
         CuratorFramework                client = CuratorFrameworkFactory.newClient(server.getConnectString(),
timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
-            BlockingQueueConsumer<Long> consumer = new BlockingQueueConsumer<Long>(Mockito.mock(ConnectionStateListener.class));
-            queue = QueueBuilder.builder(client, consumer, new LongSerializer(), "/test2").putInBackground(false).buildDelayQueue();
-            queue.start();
+            putQueue = QueueBuilder.builder(client, null, new LongSerializer(), "/test2").putInBackground(false).buildDelayQueue();
+            putQueue.start();
             
             Map<Long, Long> data = new HashMap<Long, Long>();
             
@@ -174,8 +174,12 @@ public class TestDistributedDelayQueue extends BaseClassForTests
             //delay and value
             for ( Long key : keys )
             {                
-                queue.put(data.get(key), key);
-            }           
+                putQueue.put(data.get(key), key);
+            }
+
+            BlockingQueueConsumer<Long> consumer = new BlockingQueueConsumer<Long>(Mockito.mock(ConnectionStateListener.class));
+            getQueue = QueueBuilder.builder(client, consumer, new LongSerializer(), "/test2").putInBackground(false).buildDelayQueue();
+            getQueue.start();
 
             long lastValue = -1;
             for ( int i = 0; i < QTY; ++i )
@@ -188,7 +192,8 @@ public class TestDistributedDelayQueue extends BaseClassForTests
         }
         finally
         {
-            CloseableUtils.closeQuietly(queue);
+            CloseableUtils.closeQuietly(putQueue);
+            CloseableUtils.closeQuietly(getQueue);
             CloseableUtils.closeQuietly(client);
         }
     }


Mime
View raw message