use of org.springframework.cloud.netflix.eureka.EurekaClientConfigBean in project spring-cloud-netflix by spring-cloud.
the class EurekaRibbonClientConfigurationTests method basicConfigurationCreatedForLoadBalancer.
@Test
@Ignore
public void basicConfigurationCreatedForLoadBalancer() {
EurekaClientConfigBean client = new EurekaClientConfigBean();
EurekaInstanceConfigBean configBean = getEurekaInstanceConfigBean();
client.getAvailabilityZones().put(client.getRegion(), "foo");
SpringClientFactory clientFactory = new SpringClientFactory();
EurekaRibbonClientConfiguration clientPreprocessor = new EurekaRibbonClientConfiguration(client, "service", configBean, false);
clientPreprocessor.preprocess();
ILoadBalancer balancer = clientFactory.getLoadBalancer("service");
assertNotNull(balancer);
@SuppressWarnings("unchecked") ZoneAwareLoadBalancer<DiscoveryEnabledServer> aware = (ZoneAwareLoadBalancer<DiscoveryEnabledServer>) balancer;
assertTrue(aware.getServerListImpl() instanceof DomainExtractingServerList);
assertEquals("foo", ConfigurationManager.getDeploymentContext().getValue(ContextKey.zone));
}
use of org.springframework.cloud.netflix.eureka.EurekaClientConfigBean in project spring-cloud-netflix by spring-cloud.
the class EurekaRibbonClientConfigurationTests method testDefaultZone.
@Test
public void testDefaultZone() {
EurekaClientConfigBean client = new EurekaClientConfigBean();
EurekaInstanceConfigBean configBean = getEurekaInstanceConfigBean();
EurekaRibbonClientConfiguration preprocessor = new EurekaRibbonClientConfiguration(client, "myService", configBean, false);
preprocessor.preprocess();
assertEquals("defaultZone", ConfigurationManager.getDeploymentContext().getValue(ContextKey.zone));
}
use of org.springframework.cloud.netflix.eureka.EurekaClientConfigBean in project spring-cloud-netflix by spring-cloud.
the class EurekaRibbonClientConfigurationTests method testApproximateZone.
@Test
public void testApproximateZone() {
EurekaClientConfigBean client = new EurekaClientConfigBean();
EurekaInstanceConfigBean configBean = getEurekaInstanceConfigBean();
configBean.setHostname("this.is.a.test.com");
EurekaRibbonClientConfiguration preprocessor = new EurekaRibbonClientConfiguration(client, "myService", configBean, true);
preprocessor.preprocess();
assertEquals("is.a.test.com", ConfigurationManager.getDeploymentContext().getValue(ContextKey.zone));
}
use of org.springframework.cloud.netflix.eureka.EurekaClientConfigBean in project spring-cloud-netflix by spring-cloud.
the class EurekaRibbonClientConfigurationTests method testExplicitZone.
@Test
public void testExplicitZone() {
EurekaClientConfigBean client = new EurekaClientConfigBean();
EurekaInstanceConfigBean configBean = getEurekaInstanceConfigBean();
configBean.getMetadataMap().put("zone", "myZone");
EurekaRibbonClientConfiguration preprocessor = new EurekaRibbonClientConfiguration(client, "myService", configBean, false);
preprocessor.preprocess();
assertEquals("myZone", ConfigurationManager.getDeploymentContext().getValue(ContextKey.zone));
}
Aggregations