use of io.crate.testing.TestingBatchConsumer in project crate by crate.
the class FileReadingCollectorTest method getObjects.
private TestingBatchConsumer getObjects(Collection<String> fileUris, String compression, S3ObjectInputStream s3InputStream) throws Throwable {
TestingBatchConsumer consumer = new TestingBatchConsumer();
getObjects(fileUris, compression, s3InputStream, consumer);
return consumer;
}
use of io.crate.testing.TestingBatchConsumer in project crate by crate.
the class FileReadingCollectorTest method testDoCollectRawFromCompressed.
@Test
public void testDoCollectRawFromCompressed() throws Throwable {
TestingBatchConsumer consumer = getObjects(Collections.singletonList(Paths.get(tmpFileGz.toURI()).toUri().toString()), "gzip");
assertCorrectResult(consumer.getBucket());
}
use of io.crate.testing.TestingBatchConsumer in project crate by crate.
the class FileReadingCollectorTest method testDoCollectRaw.
@Test
public void testDoCollectRaw() throws Throwable {
TestingBatchConsumer consumer = getObjects(Paths.get(tmpFile.toURI()).toUri().toString());
assertCorrectResult(consumer.getBucket());
}
use of io.crate.testing.TestingBatchConsumer in project crate by crate.
the class HandlerSideLevelCollectTest method collect.
private Bucket collect(RoutedCollectPhase collectPhase) throws Exception {
TestingBatchConsumer consumer = new TestingBatchConsumer();
CrateCollector collector = operation.createCollector(collectPhase, consumer, mock(JobCollectContext.class));
operation.launchCollector(collector, JobCollectContext.threadPoolName(collectPhase, clusterService().localNode().getId()));
return new CollectionBucket(consumer.getResult());
}
use of io.crate.testing.TestingBatchConsumer in project crate by crate.
the class JobCollectContextTest method testKillOnJobCollectContextPropagatesToCrateCollectors.
@Test
public void testKillOnJobCollectContextPropagatesToCrateCollectors() throws Exception {
Engine.Searcher mock1 = mock(Engine.Searcher.class);
MapSideDataCollectOperation collectOperationMock = mock(MapSideDataCollectOperation.class);
JobCollectContext jobCtx = new JobCollectContext(collectPhase, collectOperationMock, "localNodeId", ramAccountingContext, new TestingBatchConsumer(), mock(SharedShardContexts.class));
jobCtx.addSearcher(1, mock1);
CrateCollector collectorMock1 = mock(CrateCollector.class);
when(collectOperationMock.createCollector(eq(collectPhase), any(), eq(jobCtx))).thenReturn(collectorMock1);
jobCtx.prepare();
jobCtx.start();
jobCtx.kill(null);
verify(collectorMock1, times(1)).kill(any(InterruptedException.class));
verify(mock1, times(1)).close();
verify(ramAccountingContext, times(1)).close();
}
Aggregations