use of org.apache.druid.sql.calcite.schema.MetadataSegmentView in project druid by druid-io.
the class CalciteTests method createMockSystemSchema.
public static SystemSchema createMockSystemSchema(final DruidSchema druidSchema, final SpecificSegmentsQuerySegmentWalker walker, final PlannerConfig plannerConfig, final AuthorizerMapper authorizerMapper) {
final DruidNode coordinatorNode = new DruidNode("test-coordinator", "dummy", false, 8081, null, true, false);
FakeDruidNodeDiscoveryProvider provider = new FakeDruidNodeDiscoveryProvider(ImmutableMap.of(NodeRole.COORDINATOR, new FakeDruidNodeDiscovery(ImmutableMap.of(NodeRole.COORDINATOR, coordinatorNode))));
final DruidNode overlordNode = new DruidNode("test-overlord", "dummy", false, 8090, null, true, false);
FakeDruidNodeDiscoveryProvider overlordProvider = new FakeDruidNodeDiscoveryProvider(ImmutableMap.of(NodeRole.OVERLORD, new FakeDruidNodeDiscovery(ImmutableMap.of(NodeRole.OVERLORD, coordinatorNode))));
final DruidLeaderClient druidLeaderClient = new DruidLeaderClient(new FakeHttpClient(), provider, NodeRole.COORDINATOR, "/simple/leader") {
@Override
public String findCurrentLeader() {
return coordinatorNode.getHostAndPortToUse();
}
};
final DruidLeaderClient overlordLeaderClient = new DruidLeaderClient(new FakeHttpClient(), overlordProvider, NodeRole.OVERLORD, "/simple/leader") {
@Override
public String findCurrentLeader() {
return overlordNode.getHostAndPortToUse();
}
};
return new SystemSchema(druidSchema, new MetadataSegmentView(druidLeaderClient, getJsonMapper(), new BrokerSegmentWatcherConfig(), plannerConfig), new TestServerInventoryView(walker.getSegments()), new FakeServerInventoryView(), authorizerMapper, druidLeaderClient, overlordLeaderClient, provider, getJsonMapper());
}
Aggregations