Search in sources :

Example 1 with TransportJobAction

use of io.crate.execution.jobs.transport.TransportJobAction in project crate by crate.

the class RemoteCollectorTest method prepare.

@Before
public void prepare() {
    MockitoAnnotations.initMocks(this);
    UUID jobId = UUID.randomUUID();
    RoutedCollectPhase collectPhase = new RoutedCollectPhase(jobId, 0, "remoteCollect", new Routing(Map.of("remoteNode", Map.of("dummyTable", IntArrayList.from(1)))), RowGranularity.DOC, Collections.singletonList(createReference("name", DataTypes.STRING)), Collections.emptyList(), WhereClause.MATCH_ALL.queryOrFallback(), DistributionInfo.DEFAULT_BROADCAST);
    transportJobAction = mock(TransportJobAction.class);
    TasksService tasksService = new TasksService(clusterService, new JobsLogs(() -> true));
    numBroadcastCalls = new AtomicInteger(0);
    transportKillJobsNodeAction = new TransportKillJobsNodeAction(tasksService, clusterService, mock(TransportService.class)) {

        @Override
        public void broadcast(KillJobsRequest request, ActionListener<Long> listener) {
            numBroadcastCalls.incrementAndGet();
        }
    };
    consumer = new TestingRowConsumer();
    remoteCollector = new RemoteCollector(jobId, new SessionSettings("dummyUser", SearchPath.createSearchPathFrom("dummySchema")), "localNode", "remoteNode", transportJobAction, transportKillJobsNodeAction, Runnable::run, tasksService, RamAccounting.NO_ACCOUNTING, consumer, collectPhase);
}
Also used : TransportJobAction(io.crate.execution.jobs.transport.TransportJobAction) TransportKillJobsNodeAction(io.crate.execution.jobs.kill.TransportKillJobsNodeAction) Routing(io.crate.metadata.Routing) TasksService(io.crate.execution.jobs.TasksService) SessionSettings(io.crate.metadata.settings.SessionSettings) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) KillJobsRequest(io.crate.execution.jobs.kill.KillJobsRequest) JobsLogs(io.crate.execution.engine.collect.stats.JobsLogs) UUID(java.util.UUID) RoutedCollectPhase(io.crate.execution.dsl.phases.RoutedCollectPhase) TestingRowConsumer(io.crate.testing.TestingRowConsumer) Before(org.junit.Before)

Aggregations

RoutedCollectPhase (io.crate.execution.dsl.phases.RoutedCollectPhase)1 JobsLogs (io.crate.execution.engine.collect.stats.JobsLogs)1 TasksService (io.crate.execution.jobs.TasksService)1 KillJobsRequest (io.crate.execution.jobs.kill.KillJobsRequest)1 TransportKillJobsNodeAction (io.crate.execution.jobs.kill.TransportKillJobsNodeAction)1 TransportJobAction (io.crate.execution.jobs.transport.TransportJobAction)1 Routing (io.crate.metadata.Routing)1 SessionSettings (io.crate.metadata.settings.SessionSettings)1 TestingRowConsumer (io.crate.testing.TestingRowConsumer)1 UUID (java.util.UUID)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Before (org.junit.Before)1