use of org.springframework.cloud.netflix.eureka.server.EurekaServerAutoConfiguration.RefreshablePeerEurekaNodes in project spring-cloud-netflix by spring-cloud.
the class RefreshablePeerEurekaNodesTests method notUpdatedWhenIrrelevantPropertiesChanged.
@Test
public void notUpdatedWhenIrrelevantPropertiesChanged() {
// PeerEurekaNodes.updatePeerEurekaNodes() is not public, hence cannot verify with Mockito.
class VerifyablePeerEurekNode extends RefreshablePeerEurekaNodes {
public VerifyablePeerEurekNode(PeerAwareInstanceRegistry registry, EurekaServerConfig serverConfig, EurekaClientConfig clientConfig, ServerCodecs serverCodecs, ApplicationInfoManager applicationInfoManager) {
super(registry, serverConfig, clientConfig, serverCodecs, applicationInfoManager);
}
protected void updatePeerEurekaNodes(List<String> newPeerUrls) {
super.updatePeerEurekaNodes(newPeerUrls);
}
}
// Create stubs.
final EurekaClientConfigBean configClientBean = mock(EurekaClientConfigBean.class);
when(configClientBean.isUseDnsForFetchingServiceUrls()).thenReturn(false);
final VerifyablePeerEurekNode mock = spy(new VerifyablePeerEurekNode(null, null, configClientBean, null, null));
mock.onApplicationEvent(new EnvironmentChangeEvent(Collections.singleton("some.irrelevant.property")));
verify(mock, never()).updatePeerEurekaNodes(anyListOf(String.class));
}
Aggregations