Search in sources :

Example 16 with TearDown

use of com.google.common.testing.TearDown in project commons by twitter.

the class PartitionerTest method join.

private Partition join(Partitioner partitioner) throws JoinException, InterruptedException {
    final Partition partition = partitioner.join();
    addTearDown(new TearDown() {

        @Override
        public void tearDown() throws JoinException {
            partition.cancel();
        }
    });
    return partition;
}
Also used : Partition(com.twitter.common.zookeeper.Partitioner.Partition) TearDown(com.google.common.testing.TearDown) JoinException(com.twitter.common.zookeeper.Group.JoinException)

Aggregations

TearDown (com.google.common.testing.TearDown)16 Before (org.junit.Before)6 AsyncIface (com.twitter.common.thrift.ThriftFactoryTest.GoodService.AsyncIface)3 IOException (java.io.IOException)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Test (org.junit.Test)3 InetSocketAddress (java.net.InetSocketAddress)2 ExecutionException (java.util.concurrent.ExecutionException)2 AsyncMethodCallback (org.apache.thrift.async.AsyncMethodCallback)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 ShutdownRegistryImpl (com.twitter.common.application.ShutdownRegistry.ShutdownRegistryImpl)1 ExceptionalCommand (com.twitter.common.base.ExceptionalCommand)1 Temporary (com.twitter.common.io.FileUtils.Temporary)1 Amount (com.twitter.common.quantity.Amount)1 TTimeoutException (com.twitter.common.thrift.TTimeoutException)1 JoinException (com.twitter.common.zookeeper.Group.JoinException)1 Partition (com.twitter.common.zookeeper.Partitioner.Partition)1 EndpointStatus (com.twitter.common.zookeeper.ServerSet.EndpointStatus)1 LeadershipListener (com.twitter.common.zookeeper.SingletonService.LeadershipListener)1 ServiceInstance (com.twitter.thrift.ServiceInstance)1