1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

put all nacos config metadata to bootstrap

This commit is contained in:
flystar32
2018-10-29 22:16:15 +08:00
parent f4a2ddaf4b
commit 3acfc67d6a
9 changed files with 71 additions and 90 deletions

View File

@@ -63,15 +63,7 @@ public class NacosConfigAutoConfigurationTests {
@Test
public void testNacosConfigProperties() {
NacosPropertySourceLocator nacosPropertySourceLocator = this.context.getBean(NacosPropertySourceLocator.class);
Environment environment = this.context.getEnvironment();
try{
nacosPropertySourceLocator.locate(environment);
}catch (Exception e){
}
NacosConfigProperties nacosConfigProperties = this.context.getBean(NacosConfigProperties.class);
NacosConfigProperties nacosConfigProperties = this.context.getParent().getBean(NacosConfigProperties.class);
assertThat(nacosConfigProperties.getFileExtension()).isEqualTo("properties");
assertThat(nacosConfigProperties.getPrefix()).isEqualTo("myapp");

View File

@@ -68,15 +68,14 @@ public class NacosConfigBootstrapConfigurationTests {
}
Field configServiceField = ReflectionUtils
.findField(NacosPropertySourceLocator.class, "configService");
configServiceField.setAccessible(true);
Field nacosConfigPropertiesField = ReflectionUtils
.findField(NacosPropertySourceLocator.class, "nacosConfigProperties");
nacosConfigPropertiesField.setAccessible(true);
ConfigService configService = (ConfigService) ReflectionUtils
.getField(configServiceField, locator);
NacosConfigProperties configService = (NacosConfigProperties) ReflectionUtils
.getField(nacosConfigPropertiesField, locator);
assertThat(configService).isNotNull();
}
}