mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
fix tests
This commit is contained in:
parent
7323880c01
commit
a5905307f0
@ -45,12 +45,12 @@ public class NacosConfigAutoConfigurationTests {
|
|||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
this.context = new SpringApplicationBuilder(
|
this.context = new SpringApplicationBuilder(
|
||||||
NacosConfigBootstrapConfiguration.class,
|
NacosConfigBootstrapConfiguration.class,
|
||||||
NacosConfigAutoConfiguration.class,
|
NacosConfigAutoConfiguration.class, TestConfiguration.class)
|
||||||
TestConfiguration.class)
|
.web(WebApplicationType.NONE)
|
||||||
.web(WebApplicationType.NONE).run(
|
.run("--spring.application.name=myapp",
|
||||||
"--spring.cloud.config.enabled=true",
|
"--spring.cloud.config.enabled=true",
|
||||||
"--spring.cloud.nacos.config.server-addr=127.0.0.1:8080",
|
"--spring.cloud.nacos.config.server-addr=127.0.0.1:8080",
|
||||||
"--spring.cloud.nacos.config.prefix=myapp");
|
"--spring.cloud.nacos.config.prefix=test");
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@ -63,17 +63,19 @@ public class NacosConfigAutoConfigurationTests {
|
|||||||
@Test
|
@Test
|
||||||
public void testNacosConfigProperties() {
|
public void testNacosConfigProperties() {
|
||||||
|
|
||||||
NacosConfigProperties nacosConfigProperties = this.context.getParent().getBean(NacosConfigProperties.class);
|
NacosConfigProperties nacosConfigProperties = this.context.getParent()
|
||||||
|
.getBean(NacosConfigProperties.class);
|
||||||
assertThat(nacosConfigProperties.getFileExtension()).isEqualTo("properties");
|
assertThat(nacosConfigProperties.getFileExtension()).isEqualTo("properties");
|
||||||
assertThat(nacosConfigProperties.getPrefix()).isEqualTo("myapp");
|
assertThat(nacosConfigProperties.getPrefix()).isEqualTo("test");
|
||||||
|
assertThat(nacosConfigProperties.getName()).isEqualTo("myapp");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNacosRefreshProperties() {
|
public void testNacosRefreshProperties() {
|
||||||
|
|
||||||
NacosRefreshProperties nacosRefreshProperties = this.context.getBean(NacosRefreshProperties.class);
|
NacosRefreshProperties nacosRefreshProperties = this.context
|
||||||
|
.getBean(NacosRefreshProperties.class);
|
||||||
assertThat(nacosRefreshProperties.isEnabled()).isEqualTo(true);
|
assertThat(nacosRefreshProperties.isEnabled()).isEqualTo(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -82,7 +84,6 @@ public class NacosConfigAutoConfigurationTests {
|
|||||||
@AutoConfigureBefore(NacosConfigAutoConfiguration.class)
|
@AutoConfigureBefore(NacosConfigAutoConfiguration.class)
|
||||||
static class TestConfiguration {
|
static class TestConfiguration {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ConfigurableApplicationContext context;
|
ConfigurableApplicationContext context;
|
||||||
|
|
||||||
|
@ -43,9 +43,10 @@ public class NacosConfigBootstrapConfigurationTests {
|
|||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
this.context = new SpringApplicationBuilder(
|
this.context = new SpringApplicationBuilder(
|
||||||
NacosConfigBootstrapConfiguration.class).web(WebApplicationType.NONE).run(
|
NacosConfigBootstrapConfiguration.class).web(WebApplicationType.NONE).run(
|
||||||
|
"--spring.application.name=myapp",
|
||||||
"--spring.cloud.config.enabled=true",
|
"--spring.cloud.config.enabled=true",
|
||||||
"--spring.cloud.nacos.config.server-addr=127.0.0.1:8080",
|
"--spring.cloud.nacos.config.server-addr=127.0.0.1:8080",
|
||||||
"--spring.cloud.nacos.config.prefix=myapp");
|
"--spring.cloud.nacos.config.prefix=test");
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
Loading…
x
Reference in New Issue
Block a user