use of io.crate.execution.jobs.kill.KillAllRequest in project crate by crate.
the class KillPlanTest method testKillTaskCallsBroadcastOnTransportKillAllNodeAction.
@Test
public void testKillTaskCallsBroadcastOnTransportKillAllNodeAction() {
AtomicInteger broadcastCalls = new AtomicInteger(0);
AtomicInteger nodeOperationCalls = new AtomicInteger(0);
TransportKillAllNodeAction killAllNodeAction = new TransportKillAllNodeAction(new TasksService(clusterService, new JobsLogs(() -> false)), clusterService, mock(TransportService.class)) {
@Override
public void broadcast(KillAllRequest request, ActionListener<Long> listener) {
broadcastCalls.incrementAndGet();
}
@Override
public CompletableFuture<KillResponse> nodeOperation(KillAllRequest request) {
nodeOperationCalls.incrementAndGet();
return super.nodeOperation(request);
}
};
KillPlan killPlan = new KillPlan(null);
killPlan.execute(null, "dummy-user", killAllNodeAction, mock(TransportKillJobsNodeAction.class), new TestingRowConsumer());
assertThat(broadcastCalls.get(), is(1));
assertThat(nodeOperationCalls.get(), is(0));
}
Aggregations