use of com.enonic.xp.impl.task.distributed.DescribedTask in project xp by enonic.
the class TaskServiceImplTest method submitTask_DescriptorKey_offload_to_clustered_wait_success.
@Test
void submitTask_DescriptorKey_offload_to_clustered_wait_success() {
final DescriptorKey descriptorKey = DescriptorKey.from("module:my-admin-tool");
final TaskManager clusteredTaskManager = mock(TaskManager.class);
when(taskConfig.distributable_acceptInbound()).thenReturn(false);
taskService.activate(taskConfig);
CompletableFuture.runAsync(() -> taskService.setClusteredTaskManager(clusteredTaskManager), CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS));
final TaskId taskId = taskService.submitTask(SubmitTaskParams.create().descriptorKey(descriptorKey).build());
verify(clusteredTaskManager).submitTask(describedTaskCaptor.capture());
describedTaskCaptor.getValue();
final DescribedTask argument = describedTaskCaptor.getValue();
assertEquals(taskId, argument.getTaskId());
}
Aggregations