use of org.springframework.cloud.config.client.ConfigClientProperties in project spring-cloud-netflix by spring-cloud.
the class DiscoveryClientConfigServiceAutoConfigurationTests method onWhenRequested.
@Test
public void onWhenRequested() throws Exception {
setup("spring.cloud.config.discovery.enabled=true", "eureka.instance.metadataMap.foo:bar", "eureka.instance.nonSecurePort:7001", "eureka.instance.hostname:foo");
assertEquals(1, this.context.getBeanNamesForType(EurekaDiscoveryClientConfigServiceAutoConfiguration.class).length);
EurekaClient eurekaClient = this.context.getParent().getBean(EurekaClient.class);
Mockito.verify(eurekaClient, times(2)).getInstancesByVipAddress(DEFAULT_CONFIG_SERVER, false);
Mockito.verify(eurekaClient, times(1)).shutdown();
ConfigClientProperties locator = this.context.getBean(ConfigClientProperties.class);
assertEquals("http://foo:7001/", locator.getRawUri());
ApplicationInfoManager infoManager = this.context.getBean(ApplicationInfoManager.class);
assertEquals("bar", infoManager.getInfo().getMetadata().get("foo"));
}
use of org.springframework.cloud.config.client.ConfigClientProperties in project spring-cloud-consul by spring-cloud.
the class DiscoveryClientConfigServiceAutoConfigurationTests method onWhenRequested.
@Test
public void onWhenRequested() throws Exception {
ConsulTestcontainers.start();
Integer port = ConsulTestcontainers.getPort();
String host = ConsulTestcontainers.getHost();
setup("server.port=0", "spring.cloud.config.discovery.enabled=true", "spring.cloud.consul.port=" + port, "spring.cloud.consul.host=" + host, "logging.level.org.springframework.cloud.config.client=DEBUG", "spring.cloud.consul.discovery.catalog-services-watch.enabled=false", "spring.cloud.consul.discovery.test.enabled:true", "spring.application.name=discoveryclientconfigservicetest", "spring.jmx.enabled=false", "spring.cloud.consul.discovery.port:7001", "spring.cloud.consul.discovery.hostname:foo", "spring.cloud.config.discovery.service-id:configserver");
assertThat(this.context.getBeanNamesForType(ConsulConfigServerAutoConfiguration.class).length).isEqualTo(1);
ConsulDiscoveryClient client = this.context.getParent().getBean(ConsulDiscoveryClient.class);
verify(client, atLeast(2)).getInstances("configserver");
ConfigClientProperties locator = this.context.getBean(ConfigClientProperties.class);
assertThat(locator.getUri()[0]).isEqualTo("http://foo:7001/");
}
Aggregations