use of org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean 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.EurekaInstanceConfigBean 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.EurekaInstanceConfigBean in project spring-cloud-netflix by spring-cloud.
the class RestTemplateEurekaHttpClientTest method setup.
@Before
public void setup() {
eurekaHttpClient = new RestTemplateTransportClientFactory().newClient(new DefaultEndpoint(serviceUrl));
EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils);
String appname = "customapp";
config.setIpAddress("127.0.0.1");
config.setHostname("localhost");
config.setAppname(appname);
config.setVirtualHostName(appname);
config.setSecureVirtualHostName(appname);
config.setNonSecurePort(4444);
config.setSecurePort(8443);
config.setInstanceId("127.0.0.1:customapp:4444");
info = new EurekaConfigBasedInstanceInfoProvider(config).get();
}
use of org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean in project spring-cloud-netflix by spring-cloud.
the class EurekaSampleApplication method register.
@RequestMapping(path = "/register", method = POST)
public String register() {
EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils);
String appname = "customapp";
config.setIpAddress("127.0.0.1");
config.setHostname("localhost");
config.setAppname(appname);
config.setVirtualHostName(appname);
config.setSecureVirtualHostName(appname);
config.setNonSecurePort(4444);
config.setInstanceId("127.0.0.1:customapp:4444");
this.registration = EurekaRegistration.builder(config).with(this.clientConfig, this.context).build();
this.serviceRegistry.register(this.registration);
return config.getInstanceId();
}
use of org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean 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