Package org.apache.curator.test

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


            client.checkExists().forPath("/");

            server.close();

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

            try
            {
                client.checkExists().forPath("/");
                Assert.fail();
View Full Code Here


            client.checkExists().inBackground().forPath("/hey");

            server.stop();

            client.checkExists().inBackground().forPath("/hey");
            Assert.assertTrue(timing.awaitLatch(latch));
        }
        finally
        {
            Closeables.closeQuietly(client);
        }
View Full Code Here

            };
            queue.getPutListenerContainer().addListener(listener);

            Assert.assertTrue(queue.put("1", timing.milliseconds(), TimeUnit.MILLISECONDS));   // should end up in consumer
            Assert.assertTrue(queue.put("2", timing.milliseconds(), TimeUnit.MILLISECONDS));   // should sit blocking in DistributedQueue
            Assert.assertTrue(timing.awaitLatch(latch));
            timing.sleepABit();
            Assert.assertFalse(queue.put("3", timing.multiple(.5).milliseconds(), TimeUnit.MILLISECONDS));

            semaphore.release(100);
            Assert.assertTrue(queue.put("3", timing.milliseconds(), TimeUnit.MILLISECONDS));
View Full Code Here

            queue = QueueBuilder.builder(client, consumer, new IntSerializer(), "/test").buildPriorityQueue(0);
            queue.start();

            nums.add(Integer.MIN_VALUE);
            queue.put(Integer.MIN_VALUE, Integer.MIN_VALUE)// the queue background thread will be blocking with the first item - make sure it's the lowest value
            Assert.assertTrue(timing.awaitLatch(hasConsumedLatch));

            Random          random = new Random();
            for ( int i = 0; i < 100; ++i )
            {
                int     priority = random.nextInt();
View Full Code Here

            Assert.assertTrue(timing.acquireSemaphore(semaphore));

            timing.sleepABit();

            server = new TestingServer(server.getPort(), server.getTempDirectory());
            Assert.assertTrue(timing.awaitLatch(latch));

            timing.sleepABit();

            Assert.assertNull(client.checkExists().forPath("/test-me"));
        }
View Full Code Here

            Assert.assertTrue(timing.acquireSemaphore(semaphore));

            timing.sleepABit();

            server = new TestingServer(server.getPort(), server.getTempDirectory());
            Assert.assertTrue(timing.awaitLatch(latch));

            timing.sleepABit();

            Assert.assertNull(client.checkExists().forPath("/test-me"));
        }
View Full Code Here

            Assert.assertTrue(timing.acquireSemaphore(semaphore));

            timing.sleepABit();

            server = new TestingServer(server.getPort(), server.getTempDirectory());
            Assert.assertTrue(timing.awaitLatch(latch));

            timing.sleepABit();

            Assert.assertNull(namespaceClient.checkExists().forPath("/test-me"));
        }
View Full Code Here

                    killInstance = iterator.next(); // kill the instance we're not connected to
                }
                cluster.killServer(killInstance);

                Assert.assertEquals(reconnectedLatch.getCount(), 1);
                Assert.assertTrue(timing.awaitLatch(readOnlyLatch));

                Assert.assertEquals(reconnectedLatch.getCount(), 1);
                cluster.restartServer(killInstance);
                Assert.assertTrue(timing.awaitLatch(reconnectedLatch));
            }
View Full Code Here

                Assert.assertEquals(reconnectedLatch.getCount(), 1);
                Assert.assertTrue(timing.awaitLatch(readOnlyLatch));

                Assert.assertEquals(reconnectedLatch.getCount(), 1);
                cluster.restartServer(killInstance);
                Assert.assertTrue(timing.awaitLatch(reconnectedLatch));
            }
            finally
            {
                Closeables.closeQuietly(client);
                Closeables.closeQuietly(cluster);
View Full Code Here

            for ( int i = 0; i < ITERATIONS; ++i )
            {
                queue.put(Integer.toString(i));
            }

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

            Assert.assertTrue(doubleUsed.size() == 0, doubleUsed.toString());
        }
        finally
        {
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.