|
|
|
@ -24,8 +24,6 @@ import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
|
|
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
|
|
|
|
@ -50,36 +48,4 @@ public class DiscoveryPropertiesAutoConfigurationTest {
|
|
|
|
|
assertThat(context).hasSingleBean(DiscoveryConfigModifier.class);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testInit() {
|
|
|
|
|
ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner().withConfiguration(
|
|
|
|
|
AutoConfigurations.of(
|
|
|
|
|
PolarisContextAutoConfiguration.class,
|
|
|
|
|
TestConfiguration.class,
|
|
|
|
|
DiscoveryPropertiesAutoConfiguration.class))
|
|
|
|
|
.withPropertyValues("spring.cloud.polaris.discovery.register=false")
|
|
|
|
|
.withPropertyValues("spring.cloud.consul.discovery.register=false")
|
|
|
|
|
.withPropertyValues("spring.cloud.consul.discovery.enabled=false");
|
|
|
|
|
applicationContextRunner.run(context -> {
|
|
|
|
|
assertThat(context).hasSingleBean(DiscoveryPropertiesAutoConfiguration.class);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
static class TestConfiguration {
|
|
|
|
|
@Bean
|
|
|
|
|
public PolarisDiscoveryProperties polarisDiscoveryProperties() {
|
|
|
|
|
PolarisDiscoveryProperties polarisDiscoveryProperties = new PolarisDiscoveryProperties();
|
|
|
|
|
polarisDiscoveryProperties.setEnabled(false);
|
|
|
|
|
return polarisDiscoveryProperties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
public ConsulContextProperties consulContextProperties() {
|
|
|
|
|
ConsulContextProperties consulContextProperties = new ConsulContextProperties();
|
|
|
|
|
consulContextProperties.setEnabled(true);
|
|
|
|
|
return consulContextProperties;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|