Examples of forWaiting()


Examples of org.apache.curator.test.Timing.forWaiting()

            Assert.assertTrue(timing.awaitLatch(connectedLatch));

            timing.sleepABit();

            Assert.assertTrue(node.waitForInitialCreate(timing.forWaiting().milliseconds(), TimeUnit.MILLISECONDS));
        }
        finally
        {
            Closeables.closeQuietly(client);
        }
View Full Code Here

Examples of org.apache.curator.test.Timing.forWaiting()

                );
            }

            for ( int i = 0; i < 2; ++i )
            {
                service.take().get(timing.forWaiting().milliseconds(), TimeUnit.MILLISECONDS);
            }
        }
        finally
        {
            Closeables.closeQuietly(client);
View Full Code Here

Examples of org.apache.curator.test.Timing.forWaiting()

                );
            }

            for ( int i = 0; i < 2; ++i )
            {
                service.take().get(timing.forWaiting().milliseconds(), TimeUnit.MILLISECONDS);
            }
        }
        finally
        {
            CloseableUtils.closeQuietly(client);
View Full Code Here

Examples of org.apache.curator.test.Timing.forWaiting()

            waitForALeader(latches, timing);

            server.stop();
            Assert.assertTrue(timing.awaitLatch(countDownLatch));

            timing.forWaiting().sleepABit();

            Assert.assertEquals(getLeaders(latches).size(), 0);

            server = new TestingServer(server.getPort(), server.getTempDirectory());
            Assert.assertEquals(waitForALeader(latches, timing).size(), 1); // should reconnect
View Full Code Here

Examples of org.apache.curator.test.Timing.forWaiting()

                    {
                        LeaderLatch latch = new LeaderLatch(client, PATH_NAME);
                        try
                        {
                            latch.start();
                            Assert.assertTrue(latch.await(timing.forWaiting().seconds(), TimeUnit.SECONDS));
                            Assert.assertTrue(thereIsALeader.compareAndSet(false, true));
                            Thread.sleep((int)(10 * Math.random()));
                        }
                        finally
                        {
View Full Code Here

Examples of org.apache.curator.test.Timing.forWaiting()

            queue.put(1L, System.currentTimeMillis() + 1000);
            Thread.sleep(100);
            Assert.assertEquals(consumer.size(), 0);    // delay hasn't been reached

            Long        value = consumer.take(timing.forWaiting().seconds(), TimeUnit.SECONDS);
            Assert.assertEquals(value, Long.valueOf(1));
        }
        finally
        {
            CloseableUtils.closeQuietly(queue);
View Full Code Here

Examples of org.apache.curator.test.Timing.forWaiting()

            }

            long            lastValue = -1;
            for ( int i = 0; i < QTY; ++i )
            {
                Long        value = consumer.take(timing.forWaiting().seconds(), TimeUnit.SECONDS);
                Assert.assertNotNull(value);
                Assert.assertTrue(value >= lastValue);
                lastValue = value;
            }
        }
View Full Code Here

Examples of org.apache.curator.test.Timing.forWaiting()

                        }
                    }
                );
            cache.start(PathChildrenCache.StartMode.POST_INITIALIZED_EVENT);

            PathChildrenCacheEvent event = events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS);
            Assert.assertEquals(event.getType(), PathChildrenCacheEvent.Type.CHILD_ADDED);

            event = events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS);
            Assert.assertEquals(event.getType(), PathChildrenCacheEvent.Type.INITIALIZED);
            Assert.assertEquals(event.getInitialData().size(), 1);
View Full Code Here

Examples of org.apache.curator.test.Timing.forWaiting()

            cache.start(PathChildrenCache.StartMode.POST_INITIALIZED_EVENT);

            PathChildrenCacheEvent event = events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS);
            Assert.assertEquals(event.getType(), PathChildrenCacheEvent.Type.CHILD_ADDED);

            event = events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS);
            Assert.assertEquals(event.getType(), PathChildrenCacheEvent.Type.INITIALIZED);
            Assert.assertEquals(event.getInitialData().size(), 1);
        }
        finally
        {
View Full Code Here

Examples of org.apache.curator.test.Timing.forWaiting()

            for ( int i = 0; i < (factor * threshold); ++i )
            {
                sharder.getQueue().put(Integer.toString(i));
                Thread.sleep(5);
            }
            timing.forWaiting().sleepABit();

            SummaryStatistics       statistics = new SummaryStatistics();
            for ( String path : sharder.getQueuePaths() )
            {
                int numChildren = client.checkExists().forPath(path).getNumChildren();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.