Search in sources :

Example 21 with TestingBatchConsumer

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;
}
Also used : TestingBatchConsumer(io.crate.testing.TestingBatchConsumer)

Example 22 with TestingBatchConsumer

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());
}
Also used : TestingBatchConsumer(io.crate.testing.TestingBatchConsumer) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 23 with TestingBatchConsumer

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());
}
Also used : TestingBatchConsumer(io.crate.testing.TestingBatchConsumer) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 24 with TestingBatchConsumer

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());
}
Also used : TestingBatchConsumer(io.crate.testing.TestingBatchConsumer) CollectionBucket(io.crate.data.CollectionBucket)

Example 25 with TestingBatchConsumer

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();
}
Also used : SharedShardContexts(io.crate.action.job.SharedShardContexts) TestingBatchConsumer(io.crate.testing.TestingBatchConsumer) Engine(org.elasticsearch.index.engine.Engine) Test(org.junit.Test) RandomizedTest(com.carrotsearch.randomizedtesting.RandomizedTest)

Aggregations

TestingBatchConsumer (io.crate.testing.TestingBatchConsumer)47 Test (org.junit.Test)41 CrateUnitTest (io.crate.test.integration.CrateUnitTest)32 BytesRef (org.apache.lucene.util.BytesRef)7 CollectionBucket (io.crate.data.CollectionBucket)6 Bucket (io.crate.data.Bucket)4 PageResultListener (io.crate.operation.PageResultListener)4 RoutedCollectPhase (io.crate.planner.node.dql.RoutedCollectPhase)4 Streamer (io.crate.Streamer)3 NestedLoopBatchIterator (io.crate.data.join.NestedLoopBatchIterator)3 SQLTransportIntegrationTest (io.crate.integrationtests.SQLTransportIntegrationTest)3 Routing (io.crate.metadata.Routing)3 SharedShardContexts (io.crate.action.job.SharedShardContexts)2 InputColumn (io.crate.analyze.symbol.InputColumn)2 ArrayBucket (io.crate.data.ArrayBucket)2 BatchConsumer (io.crate.data.BatchConsumer)2 CompositeBatchIterator (io.crate.data.CompositeBatchIterator)2 PageDownstreamContext (io.crate.jobs.PageDownstreamContext)2 PartitionName (io.crate.metadata.PartitionName)2 CollectExpression (io.crate.operation.collect.CollectExpression)2