Search in sources :

Example 1 with DruidService

use of org.apache.druid.discovery.DruidService in project druid by druid-io.

the class DiscoverySideEffectsProviderTest method setUp.

@Before
public void setUp() {
    nodeRole = NodeRole.HISTORICAL;
    lifecycleHandlers = new ArrayList<>();
    Mockito.doAnswer((invocation) -> {
        DiscoveryDruidNode discoveryDruidNode = invocation.getArgument(0);
        boolean isAllServicesDiscoverable = discoveryDruidNode.getServices().values().stream().allMatch(DruidService::isDiscoverable);
        Assert.assertTrue(isAllServicesDiscoverable);
        return null;
    }).when(discoverableOnlyAnnouncer).announce(ArgumentMatchers.any(DiscoveryDruidNode.class));
    Mockito.doAnswer((invocation) -> lifecycleHandlers.add(invocation.getArgument(0))).when(lifecycle).addHandler(ArgumentMatchers.any(Lifecycle.Handler.class), ArgumentMatchers.eq(Lifecycle.Stage.ANNOUNCEMENTS));
    target = DiscoverySideEffectsProvider.withLegacyAnnouncer();
}
Also used : DiscoveryDruidNode(org.apache.druid.discovery.DiscoveryDruidNode) DruidService(org.apache.druid.discovery.DruidService) Before(org.junit.Before)

Aggregations

DiscoveryDruidNode (org.apache.druid.discovery.DiscoveryDruidNode)1 DruidService (org.apache.druid.discovery.DruidService)1 Before (org.junit.Before)1