Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions spring-cloud-netflix-eureka-client-tls-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions spring-cloud-netflix-eureka-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-test-support</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,22 @@
import com.netflix.discovery.shared.transport.EurekaHttpClient;
import com.netflix.discovery.shared.transport.EurekaHttpResponse;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.boot.test.system.CapturedOutput;
import org.springframework.boot.test.system.OutputCaptureExtension;
import org.springframework.cloud.config.client.ConfigServerInstanceProvider;
import org.springframework.cloud.netflix.eureka.CloudEurekaClient;
import org.springframework.cloud.netflix.eureka.EurekaClientConfigBean;
import org.springframework.cloud.netflix.eureka.http.RestTemplateEurekaHttpClient;
import org.springframework.cloud.test.ClassPathExclusions;
import org.springframework.cloud.test.ModifiedClassPathRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -54,102 +53,99 @@
* @author Tang Xiong
*/
@SuppressWarnings("removal")
@RunWith(ModifiedClassPathRunner.class)
@ExtendWith(OutputCaptureExtension.class)
@ClassPathExclusions("spring-webflux-*")
public class EurekaConfigServerBootstrapConfigurationTests {

@Rule
public OutputCaptureRule output = new OutputCaptureRule();
class EurekaConfigServerBootstrapConfigurationTests {

@Test
public void offByDefault() {
void offByDefault() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.run(this::assertEurekaBeansNotPresent);
}

@Test
public void properBeansCreatedWhenDiscoveryEnabled() {
void properBeansCreatedWhenDiscoveryEnabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("spring.cloud.config.discovery.enabled=true")
.run(this::assertEurekaBeansPresent);
}

@Test
public void beansNotCreatedWhenDiscoveryNotEnabled() {
void beansNotCreatedWhenDiscoveryNotEnabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("spring.cloud.config.discovery.enabled=false")
.run(this::assertEurekaBeansNotPresent);
}

@Test
public void beansNotCreatedWhenDiscoveryDisabled() {
void beansNotCreatedWhenDiscoveryDisabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("spring.cloud.config.discovery.disabled")
.run(this::assertEurekaBeansNotPresent);
}

@Test
public void beansNotCreatedWhenEurekaClientEnabled() {
void beansNotCreatedWhenEurekaClientEnabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("eureka.client.enabled=true")
.run(this::assertEurekaBeansNotPresent);
}

@Test
public void beansNotCreatedWhenEurekaClientNotEnabled() {
void beansNotCreatedWhenEurekaClientNotEnabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("eureka.client.enabled=false")
.run(this::assertEurekaBeansNotPresent);
}

@Test
public void beansNotCreatedWhenEurekaClientDisabled() {
void beansNotCreatedWhenEurekaClientDisabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("eureka.client.disabled")
.run(this::assertEurekaBeansNotPresent);
}

@Test
public void properBeansCreatedWhenDiscoveryEnabled_EurekaEnabled() {
void properBeansCreatedWhenDiscoveryEnabled_EurekaEnabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("spring.cloud.config.discovery.enabled=true", "eureka.client.enabled=true")
.run(this::assertEurekaBeansPresent);
}

@Test
public void beansNotCreatedWhenDiscoveryEnabled_EurekaNotEnabled() {
void beansNotCreatedWhenDiscoveryEnabled_EurekaNotEnabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("spring.cloud.config.discovery.enabled=true", "eureka.client.enabled=false")
.run(this::assertEurekaBeansNotPresent);
}

@Test
public void beansNotCreatedWhenDiscoveryNotEnabled_EurekaEnabled() {
void beansNotCreatedWhenDiscoveryNotEnabled_EurekaEnabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("spring.cloud.config.discovery.enabled=false", "eureka.client.enabled=true")
.run(this::assertEurekaBeansNotPresent);
}

@Test
public void beansNotCreatedWhenDiscoveryNotEnabled_EurekaNotEnabled() {
void beansNotCreatedWhenDiscoveryNotEnabled_EurekaNotEnabled() {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("spring.cloud.config.discovery.enabled=false", "eureka.client.enabled=false")
.run(this::assertEurekaBeansNotPresent);
}

@Test
public void eurekaDnsConfigurationWorks() {
void eurekaDnsConfigurationWorks(CapturedOutput output) {
new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class))
.withPropertyValues("spring.cloud.config.discovery.enabled=true", "eureka.client.enabled=true",
Expand All @@ -161,7 +157,7 @@ public void eurekaDnsConfigurationWorks() {
}

@Test
public void eurekaConfigServerInstanceProviderCalled() {
void eurekaConfigServerInstanceProviderCalled(CapturedOutput output) {
// FIXME: why do I need to do this? (fails in maven build without it.
TomcatURLStreamHandlerFactory.disable();
new SpringApplicationBuilder(TestConfigDiscoveryConfiguration.class)
Expand All @@ -176,7 +172,7 @@ public void eurekaConfigServerInstanceProviderCalled() {
}

@Test
public void eurekaConfigServerInstanceProviderCalledWithRemoteRegions() {
void eurekaConfigServerInstanceProviderCalledWithRemoteRegions(CapturedOutput output) {
TomcatURLStreamHandlerFactory.disable();
new SpringApplicationBuilder(TestConfigDiscoveryConfiguration.class)
.properties("spring.config.use-legacy-processing=true", "spring.cloud.config.discovery.enabled=true",
Expand All @@ -190,7 +186,7 @@ public void eurekaConfigServerInstanceProviderCalledWithRemoteRegions() {
}

@Test
public void eurekaConfigServerInstanceProviderCalledWithVipAddress() {
void eurekaConfigServerInstanceProviderCalledWithVipAddress(CapturedOutput output) {
TomcatURLStreamHandlerFactory.disable();
new SpringApplicationBuilder(TestConfigDiscoveryConfiguration.class)
.properties("spring.config.use-legacy-processing=true", "spring.cloud.config.discovery.enabled=true",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@
package org.springframework.cloud.netflix.eureka.config;

import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.cloud.netflix.eureka.sample.EurekaSampleApplication;
import org.springframework.cloud.test.ClassPathExclusions;
import org.springframework.cloud.test.ModifiedClassPathRunner;
import org.springframework.context.ConfigurableApplicationContext;

import static org.assertj.core.api.AssertionsForClassTypes.fail;
Expand All @@ -34,13 +30,11 @@
/**
* @author Daniel Lavoie
*/
@RunWith(ModifiedClassPathRunner.class)
@ClassPathExclusions({ "jersey-client-*", "jersey-core-*", "jersey-apache-client4-*", "spring-webflux-*" })
@SpringBootTest(classes = EurekaSampleApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
public class EurekaHttpClientsOptionalArgsConfigurationNoWebFluxTests {
class EurekaHttpClientsOptionalArgsConfigurationNoWebFluxTests {

@Test
public void contextFailsWithoutWebClient() {
void contextFailsWithoutWebClient() {

ConfigurableApplicationContext ctx = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,26 @@

package org.springframework.cloud.netflix.eureka.config;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;

import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.cloud.netflix.eureka.http.RestClientDiscoveryClientOptionalArgs;
import org.springframework.cloud.netflix.eureka.http.RestTemplateDiscoveryClientOptionalArgs;
import org.springframework.cloud.netflix.eureka.http.WebClientDiscoveryClientOptionalArgs;
import org.springframework.cloud.netflix.eureka.sample.EurekaSampleApplication;
import org.springframework.cloud.test.ClassPathExclusions;
import org.springframework.cloud.test.ModifiedClassPathRunner;

import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;

/**
* @author Daniel Lavoie
* @author Wonchul Heo
*/
@RunWith(ModifiedClassPathRunner.class)
@ClassPathExclusions({ "jersey-client-*", "jersey-core-*", "jersey-apache-client4-*" })
@SpringBootTest(classes = EurekaSampleApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
public class EurekaHttpClientsOptionalArgsConfigurationTests {
class EurekaHttpClientsOptionalArgsConfigurationTests {

@Test
public void contextLoadsWithRestTemplateWhenWebClientDisabled() {
void contextLoadsWithRestTemplateWhenWebClientDisabled() {
new WebApplicationContextRunner().withUserConfiguration(EurekaSampleApplication.class)
.withPropertyValues("eureka.client.webclient.enabled=false")
.withPropertyValues("eureka.client.restclient.enabled=false")
Expand All @@ -53,7 +47,7 @@ public void contextLoadsWithRestTemplateWhenWebClientDisabled() {
}

@Test
public void contextLoadsWithRestTemplateWhenRestClientDisabled() {
void contextLoadsWithRestTemplateWhenRestClientDisabled() {
new WebApplicationContextRunner().withUserConfiguration(EurekaSampleApplication.class)
.withPropertyValues("eureka.client.restclient.enabled=false")
.run(context -> {
Expand All @@ -64,7 +58,7 @@ public void contextLoadsWithRestTemplateWhenRestClientDisabled() {
}

@Test
public void contextLoadsWithWebClient() {
void contextLoadsWithWebClient() {
new WebApplicationContextRunner().withUserConfiguration(EurekaSampleApplication.class)
.withPropertyValues("eureka.client.webclient.enabled=true")
.run(context -> {
Expand All @@ -75,7 +69,7 @@ public void contextLoadsWithWebClient() {
}

@Test
public void contextLoadsWithRestClient() {
void contextLoadsWithRestClient() {
new WebApplicationContextRunner().withUserConfiguration(EurekaSampleApplication.class)
.withPropertyValues("eureka.client.restclient.enabled=true")
.run(context -> {
Expand All @@ -86,7 +80,7 @@ public void contextLoadsWithRestClient() {
}

@Test
public void contextLoadsWithRestTemplateAsDefault() {
void contextLoadsWithRestTemplateAsDefault() {
new WebApplicationContextRunner().withUserConfiguration(EurekaSampleApplication.class)
.withPropertyValues("eureka.client.restclient.enabled=false")
.run(context -> {
Expand Down