Search in sources :

Example 6 with Lock

use of org.apache.heron.spi.statemgr.Lock in project heron by twitter.

the class UpdateTopologyManagerTest method mockLock.

private static Lock mockLock(boolean available) throws InterruptedException {
    Lock lock = mock(Lock.class);
    when(lock.tryLock(any(Long.class), any(TimeUnit.class))).thenReturn(available);
    return lock;
}
Also used : TimeUnit(java.util.concurrent.TimeUnit) Lock(org.apache.heron.spi.statemgr.Lock)

Aggregations

Lock (org.apache.heron.spi.statemgr.Lock)6 Test (org.junit.Test)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 TimeUnit (java.util.concurrent.TimeUnit)2 SchedulerStateManagerAdaptor (org.apache.heron.spi.statemgr.SchedulerStateManagerAdaptor)2 Matchers.anyString (org.mockito.Matchers.anyString)2 Path (java.nio.file.Path)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1 HashSet (java.util.HashSet)1 PackingPlans (org.apache.heron.proto.system.PackingPlans)1 PackingPlan (org.apache.heron.spi.packing.PackingPlan)1 Resource (org.apache.heron.spi.packing.Resource)1 IScalable (org.apache.heron.spi.scheduler.IScalable)1