use of io.crate.execution.engine.collect.sources.ShardCollectSource in project crate by crate.
the class ShardCollectorProviderTest method assertNumberOfShardEntriesInShardCollectSource.
public void assertNumberOfShardEntriesInShardCollectSource(int numberOfShards) throws Exception {
final Field shards = ShardCollectSource.class.getDeclaredField("shards");
shards.setAccessible(true);
final List<ShardCollectSource> shardCollectSources = StreamSupport.stream(internalCluster().getInstances(ShardCollectSource.class).spliterator(), false).collect(Collectors.toList());
for (ShardCollectSource shardCollectSource : shardCollectSources) {
try {
// noinspection unchecked
Map<ShardId, ShardCollectorProvider> shardMap = (Map<ShardId, ShardCollectorProvider>) shards.get(shardCollectSource);
assertThat(shardMap.size(), is(numberOfShards));
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
Aggregations