Merge pull request #6769 from rozagerardo/geroza/BAEL-14071_Fix-tests-in-spring-cloud-projects-part-3
[BAEL-14071] fix tests in spring-cloud projects - part 3
This commit is contained in:
commit
491290cb39
|
@ -5,21 +5,18 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
|
||||||
import org.junit.platform.runner.JUnitPlatform;
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.util.TestPropertyValues;
|
import org.springframework.boot.test.util.TestPropertyValues;
|
||||||
import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
|
import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import com.netflix.config.DynamicPropertyFactory;
|
import com.netflix.config.DynamicPropertyFactory;
|
||||||
import com.netflix.config.DynamicStringProperty;
|
import com.netflix.config.DynamicStringProperty;
|
||||||
|
|
||||||
@RunWith(JUnitPlatform.class)
|
@RunWith(SpringRunner.class)
|
||||||
@ExtendWith(SpringExtension.class)
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class ArchaiusBasicConfigurationIntegrationTest {
|
public class ArchaiusBasicConfigurationIntegrationTest {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.baeldung.spring.cloud.archaius.dynamosources;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To run this Live Test we need to:
|
||||||
|
* * start a dynamodb instance locally on port 8000(e.g. with the following command `docker run -p 8000:8000 --name bael-dynamodb amazon/dynamodb-local`)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = DynamoSourcesApplication.class)
|
||||||
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,17 +1,15 @@
|
||||||
package org.baeldung;
|
package com.baeldung.spring.cloud.archaius.jdbconfig;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import com.baeldung.spring.cloud.bootstrap.config.ConfigApplication;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = ConfigApplication.class)
|
@SpringBootTest(classes = JdbcSourcesApplication.class)
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.baeldung.spring.cloud.archaius.zookeeperconfig;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This Live tTest requires:
|
||||||
|
* * A Zookeeper instance running locally on port 2181 (e.g. using `docker run --name bael-zookeeper -p 2181:2181 --restart always zookeeper`)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = ZookeeperConfigApplication.class)
|
||||||
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#### Running the Integration Tests
|
#### Running the Integration Tests
|
||||||
|
|
||||||
To run the Integration Tests, we need to have an AWS account and have API keys generated for programmatic access. Edit
|
To run the Live Tests, we need to have an AWS account and have API keys generated for programmatic access. Edit
|
||||||
the `application.properties` file to add the following properties:
|
the `application.properties` file to add the following properties:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.baeldung.spring.cloud.aws;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* To run this Live Test, we need to have an AWS account and have API keys generated for programmatic access.
|
||||||
|
*
|
||||||
|
* Check the README file in this module for more information.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = SpringCloudAwsApplication.class)
|
||||||
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,12 +16,19 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import com.amazonaws.regions.Regions;
|
import com.amazonaws.regions.Regions;
|
||||||
import com.amazonaws.services.ec2.AmazonEC2;
|
import com.amazonaws.services.ec2.AmazonEC2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* To run this Live Test, we need to have an AWS account and have API keys generated for programmatic access.
|
||||||
|
*
|
||||||
|
* Check the README file in this module for more information.
|
||||||
|
*
|
||||||
|
*/
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@TestPropertySource("classpath:application-test.properties")
|
@TestPropertySource("classpath:application-test.properties")
|
||||||
public class EC2MetadataIntegrationTest {
|
public class EC2MetadataLiveTest {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(EC2MetadataIntegrationTest.class);
|
private static final Logger logger = LoggerFactory.getLogger(EC2MetadataLiveTest.class);
|
||||||
|
|
||||||
private boolean serverEc2;
|
private boolean serverEc2;
|
||||||
|
|
|
@ -14,9 +14,16 @@ import java.sql.Statement;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* To run this Live Test, we need to have an AWS account and have API keys generated for programmatic access.
|
||||||
|
*
|
||||||
|
* Check the README file in this module for more information.
|
||||||
|
*
|
||||||
|
*/
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
public class SpringCloudRDSIntegrationTest {
|
public class SpringCloudRDSLiveTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DataSource dataSource;
|
DataSource dataSource;
|
|
@ -23,10 +23,17 @@ import java.util.UUID;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* To run this Live Test, we need to have an AWS account and have API keys generated for programmatic access.
|
||||||
|
*
|
||||||
|
* Check the README file in this module for more information.
|
||||||
|
*
|
||||||
|
*/
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@TestPropertySource("classpath:application-test.properties")
|
@TestPropertySource("classpath:application-test.properties")
|
||||||
public class SpringCloudS3IntegrationTest {
|
public class SpringCloudS3LiveTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SpringCloudS3 springCloudS3;
|
private SpringCloudS3 springCloudS3;
|
|
@ -16,10 +16,17 @@ import com.amazonaws.services.sns.model.CreateTopicResult;
|
||||||
import com.baeldung.spring.cloud.aws.SpringCloudAwsTestUtil;
|
import com.baeldung.spring.cloud.aws.SpringCloudAwsTestUtil;
|
||||||
import com.baeldung.spring.cloud.aws.sqs.Greeting;
|
import com.baeldung.spring.cloud.aws.sqs.Greeting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* To run this Live Test, we need to have an AWS account and have API keys generated for programmatic access.
|
||||||
|
*
|
||||||
|
* Check the README file in this module for more information.
|
||||||
|
*
|
||||||
|
*/
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@TestPropertySource("classpath:application-test.properties")
|
@TestPropertySource("classpath:application-test.properties")
|
||||||
public class SpringCloudSNSIntegrationTest {
|
public class SpringCloudSNSLiveTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SNSMessageSender snsMessageSender;
|
private SNSMessageSender snsMessageSender;
|
|
@ -26,12 +26,19 @@ import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* To run this Live Test, we need to have an AWS account and have API keys generated for programmatic access.
|
||||||
|
*
|
||||||
|
* Check the README file in this module for more information.
|
||||||
|
*
|
||||||
|
*/
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@TestPropertySource("classpath:application-test.properties")
|
@TestPropertySource("classpath:application-test.properties")
|
||||||
public class SpringCloudSQSIntegrationTest {
|
public class SpringCloudSQSLiveTest {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SpringCloudSQSIntegrationTest.class);
|
private static final Logger logger = LoggerFactory.getLogger(SpringCloudSQSLiveTest.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
|
@ -7,9 +7,15 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import com.baeldung.spring.cloud.bootstrap.discovery.DiscoveryApplication;
|
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)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = DiscoveryApplication.class)
|
@SpringBootTest(classes = DiscoveryApplication.class)
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
|
@ -98,6 +98,6 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<properties>
|
<properties>
|
||||||
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version>
|
<spring-cloud-dependencies.version>Dalston.RELEASE</spring-cloud-dependencies.version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
|
@ -71,7 +71,7 @@ public class GatewayApplication {
|
||||||
InstanceInfo instance = eurekaClient.getNextServerFromEureka("zipkin", false);
|
InstanceInfo instance = eurekaClient.getNextServerFromEureka("zipkin", false);
|
||||||
if (!(baseUrl != null && instance.getHomePageUrl().equals(baseUrl))) {
|
if (!(baseUrl != null && instance.getHomePageUrl().equals(baseUrl))) {
|
||||||
baseUrl = instance.getHomePageUrl();
|
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);
|
||||||
}
|
}
|
||||||
if (!span.name.matches(skipPattern)) delegate.report(span);
|
if (!span.name.matches(skipPattern)) delegate.report(span);
|
||||||
|
|
|
@ -7,9 +7,15 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import com.baeldung.spring.cloud.bootstrap.gateway.GatewayApplication;
|
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)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = GatewayApplication.class)
|
@SpringBootTest(classes = GatewayApplication.class)
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
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>
|
</dependencyManagement>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version>
|
<spring-cloud-dependencies.version>Dalston.RELEASE</spring-cloud-dependencies.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -12,6 +12,8 @@ import org.springframework.cloud.sleuth.zipkin.HttpZipkinSpanReporter;
|
||||||
import org.springframework.cloud.sleuth.zipkin.ZipkinProperties;
|
import org.springframework.cloud.sleuth.zipkin.ZipkinProperties;
|
||||||
import org.springframework.cloud.sleuth.zipkin.ZipkinSpanReporter;
|
import org.springframework.cloud.sleuth.zipkin.ZipkinSpanReporter;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import zipkin.Span;
|
import zipkin.Span;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@ -42,7 +44,7 @@ public class BookServiceApplication {
|
||||||
InstanceInfo instance = eurekaClient.getNextServerFromEureka("zipkin", false);
|
InstanceInfo instance = eurekaClient.getNextServerFromEureka("zipkin", false);
|
||||||
if (!(baseUrl != null && instance.getHomePageUrl().equals(baseUrl))) {
|
if (!(baseUrl != null && instance.getHomePageUrl().equals(baseUrl))) {
|
||||||
baseUrl = instance.getHomePageUrl();
|
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,9 +7,15 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import com.baeldung.spring.cloud.bootstrap.svcbook.BookServiceApplication;
|
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)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = BookServiceApplication.class)
|
@SpringBootTest(classes = BookServiceApplication.class)
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
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>
|
</dependencyManagement>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version>
|
<spring-cloud-dependencies.version>Dalston.RELEASE</spring-cloud-dependencies.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -16,6 +16,7 @@ import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.netflix.appinfo.InstanceInfo;
|
import com.netflix.appinfo.InstanceInfo;
|
||||||
import com.netflix.discovery.EurekaClient;
|
import com.netflix.discovery.EurekaClient;
|
||||||
|
@ -52,7 +53,7 @@ public class RatingServiceApplication {
|
||||||
InstanceInfo instance = eurekaClient.getNextServerFromEureka("zipkin", false);
|
InstanceInfo instance = eurekaClient.getNextServerFromEureka("zipkin", false);
|
||||||
if (!(baseUrl != null && instance.getHomePageUrl().equals(baseUrl))) {
|
if (!(baseUrl != null && instance.getHomePageUrl().equals(baseUrl))) {
|
||||||
baseUrl = instance.getHomePageUrl();
|
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);
|
||||||
}
|
}
|
||||||
if (!span.name.matches(skipPattern)) delegate.report(span);
|
if (!span.name.matches(skipPattern)) delegate.report(span);
|
||||||
|
|
|
@ -7,9 +7,16 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import com.baeldung.spring.cloud.bootstrap.svcrating.RatingServiceApplication;
|
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)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = RatingServiceApplication.class)
|
@SpringBootTest(classes = RatingServiceApplication.class)
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
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.)
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.baeldung.spring.cloudfunction.aws;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = CloudFunctionAwsApplication.class)
|
||||||
|
public class SpringContextIntegrationTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.baeldung.spring.cloud.kubernetes.travelagency;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = Application.class)
|
||||||
|
public class SpringContextIntegrationTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
package com.baeldung.spring.cloud.aws;
|
package com.baeldung.cloud.openfeign;
|
||||||
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -6,10 +7,10 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = SpringCloudAwsApplication.class)
|
@SpringBootTest(classes = ExampleApplication.class)
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,11 +3,11 @@ logging:
|
||||||
org:
|
org:
|
||||||
springframework:
|
springframework:
|
||||||
cloud:
|
cloud:
|
||||||
task=DEBUG
|
task: DEBUG
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name=helloWorld
|
name: helloWorld
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://localhost:3306/springcloud?useSSL=false
|
url: jdbc:mysql://localhost:3306/springcloud?useSSL=false
|
||||||
username: root
|
username: root
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package org.baeldung;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
|
|
||||||
import com.baeldung.task.JobConfiguration;
|
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
|
||||||
@ContextConfiguration(classes = JobConfiguration.class)
|
|
||||||
public class SpringContextIntegrationTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import com.baeldung.task.JobConfiguration;
|
||||||
|
import com.baeldung.task.TaskDemo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This Live Test requires:
|
||||||
|
* * a MySql instance running, that allows a root user with no password, and with a database named
|
||||||
|
*
|
||||||
|
* (e.g. with the following command `docker run -p 3306:3306 --name bael-mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_DATABASE=springcloud mysql:latest`)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@SpringBootApplication
|
||||||
|
@ContextConfiguration(classes = { JobConfiguration.class, TaskDemo.class }, initializers = {
|
||||||
|
ConfigFileApplicationContextInitializer.class })
|
||||||
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.baeldung.spring.cloud.vaultsample;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = VaultSampleApplication.class)
|
||||||
|
public class SpringContextIntegrationTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,6 +34,12 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.baeldung.spring.cloud.helloworld;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = HelloWorldApplication.class)
|
||||||
|
public class SpringContextIntegrationTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.baeldung.spring.cloud.zuulratelimitdemo.controller;
|
||||||
|
|
||||||
|
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.zuulratelimitdemo.ZuulRatelimitDemoApplication;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = ZuulRatelimitDemoApplication.class)
|
||||||
|
public class SpringContextIntegrationTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue