use of com.hazelcast.spi.discovery.integration.DiscoveryServiceProvider in project hazelcast by hazelcast.
the class DiscoverySpiTest method testCustomDiscoveryService_whenDiscoveredNodes_isEmpty.
@Test
public void testCustomDiscoveryService_whenDiscoveredNodes_isEmpty() {
Config config = new Config();
config.setProperty(ClusterProperty.DISCOVERY_SPI_ENABLED.getName(), "true");
final DiscoveryService discoveryService = mock(DiscoveryService.class);
DiscoveryServiceProvider discoveryServiceProvider = new DiscoveryServiceProvider() {
public DiscoveryService newDiscoveryService(DiscoveryServiceSettings arg0) {
when(discoveryService.discoverNodes()).thenReturn(Collections.<DiscoveryNode>emptyList());
return discoveryService;
}
};
config.getNetworkConfig().getJoin().getDiscoveryConfig().setDiscoveryServiceProvider(discoveryServiceProvider);
HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
try {
verify(discoveryService, atLeastOnce()).discoverNodes();
} finally {
instance.getLifecycleService().terminate();
}
}
Aggregations