use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class NodeStatsIteratorTest method testNodeStatsIteratorContrat.
@Test
public void testNodeStatsIteratorContrat() throws Exception {
List<Symbol> toCollect = new ArrayList<>();
toCollect.add(idRef);
when(collectPhase.toCollect()).thenReturn(toCollect);
when(collectPhase.whereClause()).thenReturn(WhereClause.MATCH_ALL);
when(collectPhase.orderBy()).thenReturn(new OrderBy(Collections.singletonList(idRef), new boolean[] { false }, new Boolean[] { true }));
List<Object[]> expectedResult = Arrays.asList(new Object[] { new BytesRef("nodeOne") }, new Object[] { new BytesRef("nodeTwo") });
BatchIteratorTester tester = new BatchIteratorTester(() -> NodeStatsIterator.newInstance(transportNodeStatsAction, collectPhase, nodes, new InputFactory(getFunctions())));
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
use of io.crate.testing.BatchIteratorTester in project crate by crate.
the class OrderedLuceneBatchIteratorFactoryTest method testOrderedLuceneBatchIterator.
@Test
public void testOrderedLuceneBatchIterator() throws Exception {
BatchIteratorTester tester = new BatchIteratorTester(() -> {
LuceneOrderedDocCollector collector1 = createOrderedCollector(searcher1, 1);
LuceneOrderedDocCollector collector2 = createOrderedCollector(searcher2, 2);
return OrderedLuceneBatchIteratorFactory.newInstance(Arrays.asList(collector1, collector2), 1, OrderingByPosition.rowOrdering(new int[] { 0 }, reverseFlags, nullsFirst), MoreExecutors.directExecutor(), true);
});
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
Aggregations