Package org.apache.curator.test

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


            connectionString.set(cluster.getConnectString());
            timing.forWaiting().sleepABit();

            Assert.assertTrue(timing.acquireSemaphore(acquiredSemaphore));
            timing.forWaiting().sleepABit();
            Assert.assertEquals(1, acquireCount.get());
        }
        finally
        {
            executorService.shutdown();
View Full Code Here


                );
                completionService.submit(semaphoreClient);
                semaphoreClients.add(semaphoreClient);
            }

            timing.forWaiting().sleepABit();

            Assert.assertNotNull(SemaphoreClient.getActiveClient());

            final CountDownLatch    latch = new CountDownLatch(1);
            CuratorFramework        client = CuratorFrameworkFactory.newClient(cluster.getConnectString(), timing.session(), timing.connection(), new ExponentialBackoffRetry(100, 3));
View Full Code Here

                Thread.sleep(2 * OPERATION_TIME_MS);
                if ( thisOpCount == opCount.get() )
                {
                    break// checking that the op count isn't increasing
                }
                Assert.assertTrue((System.currentTimeMillis() - startTicks) < timing.forWaiting().milliseconds());
            }

            int     thisOpCount = opCount.get();

            Iterator<InstanceSpec> iterator = cluster.getInstances().iterator();
View Full Code Here

            int     thisOpCount = opCount.get();

            Iterator<InstanceSpec> iterator = cluster.getInstances().iterator();
            cluster = new TestingCluster(iterator.next(), iterator.next());
            cluster.start();
            timing.forWaiting().sleepABit();

            startTicks = System.currentTimeMillis();
            for(;;)
            {
                Thread.sleep(2 * OPERATION_TIME_MS);
 
View Full Code Here

                Thread.sleep(2 * OPERATION_TIME_MS);
                if ( opCount.get() > thisOpCount )
                {
                    break// checking that semaphore has started working again
                }
                Assert.assertTrue((System.currentTimeMillis() - startTicks) < timing.forWaiting().milliseconds());
            }
        }
        finally
        {
            for ( SemaphoreClient semaphoreClient : semaphoreClients )
View Full Code Here

            }

            reaper = new ChildReaper(client, "/test", Reaper.Mode.REAP_UNTIL_DELETE, 1);
            reaper.start();

            timing.forWaiting().sleepABit();

            Stat    stat = client.checkExists().forPath("/test");
            Assert.assertEquals(stat.getNumChildren(), nonEmptyNodes);
        }
        finally
View Full Code Here

            }

            reaper = new ChildReaper(client, "/test", Reaper.Mode.REAP_UNTIL_DELETE, 1);
            reaper.start();

            timing.forWaiting().sleepABit();

            Stat    stat = client.checkExists().forPath("/test");
            Assert.assertEquals(stat.getNumChildren(), 0);
        }
        finally
View Full Code Here

            }

            reaper = new ChildReaper(client, "/test", Reaper.Mode.REAP_UNTIL_DELETE, 1);
            reaper.start();

            timing.forWaiting().sleepABit();

            Stat    stat = client.checkExists().forPath("/test");
            Assert.assertEquals(stat.getNumChildren(), 0);

            stat = client.usingNamespace(null).checkExists().forPath("/foo/test");
View Full Code Here

                );
            }

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

            reaper.start();
            reaper.addPath("/one/two/three");

            long        start = System.currentTimeMillis();
            boolean     emptyCountIsCorrect = false;
            while ( ((System.currentTimeMillis() - start) < timing.forWaiting().milliseconds()) && !emptyCountIsCorrect )   // need to loop as the Holder can go in/out of the Reaper's DelayQueue
            {
                for ( Reaper.PathHolder holder : holders )
                {
                    if ( holder.path.endsWith("/one/two/three") )
                    {
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.