Fixed Integration Tests for spring-cloud submodules:
* spring-cloud-archaius/basic-config * spring-cloud-aws * spring-cloud-bootstrap projects
This commit is contained in:
-17
@@ -1,17 +0,0 @@
|
||||
package org.baeldung;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.spring.cloud.bootstrap.config.ConfigApplication;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = ConfigApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -7,9 +7,15 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.spring.cloud.bootstrap.discovery.DiscoveryApplication;
|
||||
|
||||
/**
|
||||
*
|
||||
* This Live Test requires:
|
||||
* * A Redis instance running in port 6379 (e.g. using `docker run --name some-redis -p 6379:6379 -d redis`)
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = DiscoveryApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
public class SpringContextLiveTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
@@ -98,6 +98,6 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version>
|
||||
<spring-cloud-dependencies.version>Dalston.RELEASE</spring-cloud-dependencies.version>
|
||||
</properties>
|
||||
</project>
|
||||
+1
-1
@@ -71,7 +71,7 @@ public class GatewayApplication {
|
||||
InstanceInfo instance = eurekaClient.getNextServerFromEureka("zipkin", false);
|
||||
if (!(baseUrl != null && instance.getHomePageUrl().equals(baseUrl))) {
|
||||
baseUrl = instance.getHomePageUrl();
|
||||
delegate = new HttpZipkinSpanReporter(baseUrl, zipkinProperties.getFlushInterval(), zipkinProperties.getCompression().isEnabled(), spanMetricReporter);
|
||||
delegate = new HttpZipkinSpanReporter(new RestTemplate(), baseUrl, zipkinProperties.getFlushInterval(), spanMetricReporter);
|
||||
if (!span.name.matches(skipPattern)) delegate.report(span);
|
||||
}
|
||||
if (!span.name.matches(skipPattern)) delegate.report(span);
|
||||
|
||||
+7
-1
@@ -7,9 +7,15 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.spring.cloud.bootstrap.gateway.GatewayApplication;
|
||||
|
||||
/**
|
||||
*
|
||||
* This Live Test requires:
|
||||
* * A Redis instance running in port 6379 (e.g. using `docker run --name some-redis -p 6379:6379 -d redis`)
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = GatewayApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
public class SpringContextLiveTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
@@ -0,0 +1,2 @@
|
||||
# This property would be provided by the config service in a real-case scenario
|
||||
spring.sleuth.web.skipPattern=(^cleanup.|.+favicon.)
|
||||
@@ -72,7 +72,7 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version>
|
||||
<spring-cloud-dependencies.version>Dalston.RELEASE</spring-cloud-dependencies.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
+3
-1
@@ -12,6 +12,8 @@ import org.springframework.cloud.sleuth.zipkin.HttpZipkinSpanReporter;
|
||||
import org.springframework.cloud.sleuth.zipkin.ZipkinProperties;
|
||||
import org.springframework.cloud.sleuth.zipkin.ZipkinSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import zipkin.Span;
|
||||
|
||||
@SpringBootApplication
|
||||
@@ -42,7 +44,7 @@ public class BookServiceApplication {
|
||||
InstanceInfo instance = eurekaClient.getNextServerFromEureka("zipkin", false);
|
||||
if (!(baseUrl != null && instance.getHomePageUrl().equals(baseUrl))) {
|
||||
baseUrl = instance.getHomePageUrl();
|
||||
delegate = new HttpZipkinSpanReporter(baseUrl, zipkinProperties.getFlushInterval(), zipkinProperties.getCompression().isEnabled(), spanMetricReporter);
|
||||
delegate = new HttpZipkinSpanReporter(new RestTemplate(), baseUrl, zipkinProperties.getFlushInterval(), spanMetricReporter);
|
||||
if (!span.name.matches(skipPattern)) delegate.report(span);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -7,9 +7,15 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.spring.cloud.bootstrap.svcbook.BookServiceApplication;
|
||||
|
||||
/**
|
||||
*
|
||||
* This Live Test requires:
|
||||
* * A Redis instance running in port 6379 (e.g. using `docker run --name some-redis -p 6379:6379 -d redis`)
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = BookServiceApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
public class SpringContextLiveTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
@@ -0,0 +1,2 @@
|
||||
# This property would be provided by the config service in a real-case scenario
|
||||
spring.sleuth.web.skipPattern=(^cleanup.|.+favicon.)
|
||||
@@ -81,7 +81,7 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version>
|
||||
<spring-cloud-dependencies.version>Dalston.RELEASE</spring-cloud-dependencies.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
+2
-1
@@ -16,6 +16,7 @@ import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.netflix.appinfo.InstanceInfo;
|
||||
import com.netflix.discovery.EurekaClient;
|
||||
@@ -52,7 +53,7 @@ public class RatingServiceApplication {
|
||||
InstanceInfo instance = eurekaClient.getNextServerFromEureka("zipkin", false);
|
||||
if (!(baseUrl != null && instance.getHomePageUrl().equals(baseUrl))) {
|
||||
baseUrl = instance.getHomePageUrl();
|
||||
delegate = new HttpZipkinSpanReporter(baseUrl, zipkinProperties.getFlushInterval(), zipkinProperties.getCompression().isEnabled(), spanMetricReporter);
|
||||
delegate = new HttpZipkinSpanReporter(new RestTemplate(), baseUrl, zipkinProperties.getFlushInterval(), spanMetricReporter);
|
||||
if (!span.name.matches(skipPattern)) delegate.report(span);
|
||||
}
|
||||
if (!span.name.matches(skipPattern)) delegate.report(span);
|
||||
|
||||
+8
-1
@@ -7,9 +7,16 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.spring.cloud.bootstrap.svcrating.RatingServiceApplication;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* This Live Test requires:
|
||||
* * A Redis instance running in port 6379 (e.g. using `docker run --name some-redis -p 6379:6379 -d redis`)
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = RatingServiceApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
public class SpringContextLiveTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
@@ -0,0 +1,2 @@
|
||||
# This property would be provided by the config service in a real-case scenario
|
||||
spring.sleuth.web.skipPattern=(^cleanup.|.+favicon.)
|
||||
Reference in New Issue
Block a user