[BAEL-9497] Fix failing context tests - part 1 (#7719)

* fixed context dependency issue and added LiveContext notes in persistence-modules/spring-data-couchbase-2 module

* fixed Context tests and added notes for spring-cloud-bus/spring-cloud-config-client module

* Added context test in spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/data-flow-server module, mainly due to incompatible dependencies, plus fixed parent pom path in different modules

* fixed context tests for spring-cloud/spring-cloud-task/springcloudtaskbatch module, renamed ContextLiveTest as IntegrationTest, now configured to run with an H2 embedded instance. Moved the run note to the application

* Added SpringContextLiveTests in persistence-modules/spring-data-mongodb module
This commit is contained in:
Ger Roza
2019-09-06 06:19:30 -03:00
committed by Josh Cummings
parent c709251eeb
commit e9e4f63313
19 changed files with 199 additions and 58 deletions

View File

@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung.cloud</groupId>
@@ -43,6 +44,11 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-task-batch</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@@ -14,6 +14,13 @@ import org.springframework.cloud.task.configuration.EnableTask;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
/**
* This Application 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`)
*
*/
@SpringBootApplication
@EnableTask
@EnableBatchProcessing

View File

@@ -10,18 +10,10 @@ 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 {
@ContextConfiguration(classes = { JobConfiguration.class, TaskDemo.class }, initializers = { ConfigFileApplicationContextInitializer.class })
public class SpringContextIntegrationTest {
@Test
public void whenSpringContextIsBootstrapped_thenNoExceptions() {

View File

@@ -0,0 +1,11 @@
spring:
datasource:
url: jdbc:h2:mem:springcloud
username: sa
password:
jpa:
hibernate:
ddl-auto: create-drop
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect