use of org.apache.curator.x.discovery.ServiceDiscovery in project druid by druid-io.
the class ServiceAnnouncerTest method testServiceAnnouncement.
@Test
public void testServiceAnnouncement() throws Exception {
curator.start();
curator.blockUntilConnected();
List<String> serviceNames = ImmutableList.of("druid/overlord", "druid/coordinator", "druid/firehose/tranquility_test-50-0000-0000");
final ServiceDiscovery serviceDiscovery = createAndAnnounceServices(serviceNames);
Assert.assertTrue(Iterators.all(serviceNames.iterator(), new Predicate<String>() {
@Override
public boolean apply(String input) {
try {
return serviceDiscovery.queryForInstances(input.replaceAll("/", ":")).size() == 1;
} catch (Exception e) {
throw new ISE("Something went wrong while finding instance with name [%s] in Service Discovery", input);
}
}
}));
}
Aggregations