use of io.crate.data.CompositeBatchIterator in project crate by crate.
the class MultiConsumerTest method testFirstAcceptNullIteratorDoesNotCauseNPE.
@Test
public void testFirstAcceptNullIteratorDoesNotCauseNPE() throws Exception {
TestingBatchConsumer batchConsumer = new TestingBatchConsumer();
BatchConsumer consumer = new CompositeCollector.MultiConsumer(2, batchConsumer, CompositeBatchIterator::new);
consumer.accept(null, new IllegalStateException("dummy"));
consumer.accept(RowsBatchIterator.empty(), null);
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("dummy");
batchConsumer.getResult();
}
use of io.crate.data.CompositeBatchIterator in project crate by crate.
the class MultiConsumerTest method testSuccessfulMultiConsumerUsage.
@Test
public void testSuccessfulMultiConsumerUsage() throws Exception {
TestingBatchConsumer batchConsumer = new TestingBatchConsumer();
BatchConsumer consumer = new CompositeCollector.MultiConsumer(2, batchConsumer, CompositeBatchIterator::new);
consumer.accept(TestingBatchIterators.range(3, 6), null);
consumer.accept(TestingBatchIterators.range(0, 3), null);
List<Object[]> result = batchConsumer.getResult();
assertThat(TestingHelpers.printedTable(new CollectionBucket(result)), is("0\n" + "1\n" + "2\n" + "3\n" + "4\n" + "5\n"));
}
Aggregations