return fakeStat;
}
}
);
final EnsurePath ensurePath = new EnsurePath("/one/two/three");
ExecutorService service = Executors.newCachedThreadPool();
for ( int i = 0; i < 2; ++i )
{
service.submit
(
new Callable<Void>()
{
@Override
public Void call() throws Exception
{
startedLatch.countDown();
ensurePath.ensure(curator);
finishedLatch.countDown();
return null;
}
}
);
}
Assert.assertTrue(startedLatch.await(10, TimeUnit.SECONDS));
semaphore.release(3);
Assert.assertTrue(finishedLatch.await(10, TimeUnit.SECONDS));
verify(client, times(3)).exists(Mockito.<String>any(), anyBoolean());
ensurePath.ensure(curator);
verifyNoMoreInteractions(client);
ensurePath.ensure(curator);
verifyNoMoreInteractions(client);
}