use of com.enonic.xp.impl.scheduler.distributed.SchedulableTask in project xp by enonic.
the class SchedulerExecutorServiceImplTest method localSchedule.
@Test
void localSchedule() throws Exception {
setLocal();
final SchedulableTask task = mockTask("task1");
service.schedule(task, 1, TimeUnit.SECONDS);
assertEquals(1, service.getAllFutures().size());
assertTrue(service.getAllFutures().contains(task.getName()));
assertTrue(service.get(task.getName()).isPresent());
}
use of com.enonic.xp.impl.scheduler.distributed.SchedulableTask in project xp by enonic.
the class SchedulerExecutorServiceImplTest method mockTask.
private SchedulableTask mockTask(final String name) {
final SchedulableTask task = mock(SchedulableTask.class);
when(task.getName()).thenReturn(name);
return task;
}
use of com.enonic.xp.impl.scheduler.distributed.SchedulableTask in project xp by enonic.
the class SchedulerExecutorServiceImplTest method clusterUnset.
@Test
public void clusterUnset() throws Exception {
setCluster(0);
final SchedulableTask task = mockTask("task1");
service.unsetClusteredScheduler(clusteredScheduler);
assertThrows(RuntimeException.class, () -> service.schedule(task, 1, TimeUnit.MILLISECONDS));
}
Aggregations