use of io.druid.server.coordinator.helper.DruidCoordinatorSegmentMerger in project druid by druid-io.
the class DruidCoordinatorSegmentMergerTest method merge.
/**
* Runs DruidCoordinatorSegmentMerger on a particular set of segments and returns the list of requested merges.
*/
private static List<List<DataSegment>> merge(final Collection<DataSegment> segments) {
final JacksonConfigManager configManager = EasyMock.createMock(JacksonConfigManager.class);
EasyMock.expect(configManager.watch(DatasourceWhitelist.CONFIG_KEY, DatasourceWhitelist.class)).andReturn(new AtomicReference<DatasourceWhitelist>(null)).anyTimes();
EasyMock.replay(configManager);
final List<List<DataSegment>> retVal = Lists.newArrayList();
final IndexingServiceClient indexingServiceClient = new IndexingServiceClient(null, null, null) {
@Override
public void mergeSegments(List<DataSegment> segmentsToMerge) {
retVal.add(segmentsToMerge);
}
};
final DruidCoordinatorSegmentMerger merger = new DruidCoordinatorSegmentMerger(indexingServiceClient, configManager);
final DruidCoordinatorRuntimeParams params = DruidCoordinatorRuntimeParams.newBuilder().withAvailableSegments(ImmutableSet.copyOf(segments)).withDynamicConfigs(new CoordinatorDynamicConfig.Builder().withMergeBytesLimit(mergeBytesLimit).withMergeSegmentsLimit(mergeSegmentsLimit).build()).withEmitter(EasyMock.createMock(ServiceEmitter.class)).build();
merger.run(params);
return retVal;
}
Aggregations