use of com.hazelcast.scheduledexecutor.impl.DelegatingScheduledFutureStripper in project hazelcast by hazelcast.
the class DelegatingScheduledFutureStripperTest method get_unsupported.
@Test(expected = UnsupportedOperationException.class)
public void get_unsupported() throws ExecutionException, InterruptedException, TimeoutException {
ScheduledFuture future = scheduler.schedule(new SimpleCallableTestTask(), 0, TimeUnit.SECONDS);
new DelegatingScheduledFutureStripper(future).get(1, TimeUnit.SECONDS);
}
use of com.hazelcast.scheduledexecutor.impl.DelegatingScheduledFutureStripper in project hazelcast by hazelcast.
the class DelegatingScheduledFutureStripperTest method get.
@Test
public void get() throws ExecutionException, InterruptedException {
ScheduledFuture original = taskScheduler.schedule(new SimpleCallableTestTask(), 0, TimeUnit.SECONDS);
ScheduledFuture stripper = new DelegatingScheduledFutureStripper(original);
assertTrue(original.get() instanceof Future);
assertEquals(5, stripper.get());
}
use of com.hazelcast.scheduledexecutor.impl.DelegatingScheduledFutureStripper in project hazelcast by hazelcast.
the class DelegatingScheduledFutureStripperTest method equals.
@Test
public void equals() {
ScheduledFuture original = taskScheduler.schedule(new SimpleCallableTestTask(), 0, TimeUnit.SECONDS);
ScheduledFuture joker = taskScheduler.schedule(new SimpleCallableTestTask(), 1, TimeUnit.SECONDS);
ScheduledFuture testA = new DelegatingScheduledFutureStripper(original);
ScheduledFuture testB = new DelegatingScheduledFutureStripper(original);
ScheduledFuture testC = new DelegatingScheduledFutureStripper(joker);
assertTrue(testA.equals(testA));
assertTrue(testA.equals(testB));
assertFalse(testA.equals(null));
assertFalse(testA.equals(testC));
}
use of com.hazelcast.scheduledexecutor.impl.DelegatingScheduledFutureStripper in project hazelcast by hazelcast.
the class DelegatingScheduledFutureStripperTest method cancel.
@Test
public void cancel() throws ExecutionException, InterruptedException {
ScheduledFuture outter = mock(ScheduledFuture.class);
ScheduledFuture inner = mock(ScheduledFuture.class);
when(outter.get()).thenReturn(inner);
new DelegatingScheduledFutureStripper(outter).cancel(true);
verify(inner).cancel(eq(true));
}
use of com.hazelcast.scheduledexecutor.impl.DelegatingScheduledFutureStripper in project hazelcast by hazelcast.
the class DelegatingScheduledFutureStripperTest method cancel_twice.
@Test
public void cancel_twice() throws ExecutionException, InterruptedException, TimeoutException {
ScheduledFuture original = taskScheduler.schedule(new SimpleCallableTestTask(), 10, TimeUnit.SECONDS);
ScheduledFuture stripper = new DelegatingScheduledFutureStripper(original);
stripper.cancel(true);
stripper.cancel(true);
}
Aggregations