use of io.crate.planner.node.fetch.FetchPhase in project crate by crate.
the class FetchContextTest method testSearcherIsAcquiredForShard.
@Test
public void testSearcherIsAcquiredForShard() throws Exception {
Routing routing = new Routing(TreeMapBuilder.<String, Map<String, List<Integer>>>newMapBuilder().put("dummy", TreeMapBuilder.<String, List<Integer>>newMapBuilder().put("i1", ImmutableList.of(1, 2)).map()).map());
IndexBaseVisitor ibv = new IndexBaseVisitor();
routing.walkLocations(ibv);
HashMultimap<TableIdent, String> tableIndices = HashMultimap.create();
tableIndices.put(new TableIdent(null, "i1"), "i1");
final FetchContext context = new FetchContext(new FetchPhase(1, null, ibv.build(), tableIndices, ImmutableList.of(createReference("i1", new ColumnIdent("x"), DataTypes.STRING))), "dummy", new SharedShardContexts(mock(IndicesService.class, RETURNS_MOCKS)), ImmutableList.of(routing));
context.prepare();
assertThat(context.searcher(1), Matchers.notNullValue());
assertThat(context.searcher(2), Matchers.notNullValue());
}
use of io.crate.planner.node.fetch.FetchPhase in project crate by crate.
the class FetchContextTest method testGetIndexServiceForInvalidReaderId.
@Test
public void testGetIndexServiceForInvalidReaderId() throws Exception {
final FetchContext context = new FetchContext(new FetchPhase(1, null, new TreeMap<String, Integer>(), HashMultimap.<TableIdent, String>create(), ImmutableList.<Reference>of()), "dummy", new SharedShardContexts(mock(IndicesService.class)), Collections.<Routing>emptyList());
expectedException.expect(IllegalArgumentException.class);
context.indexService(10);
}
Aggregations