BAEL-9496 Fix failing context tests (#7855)
* BAEL-9496 Fix failing context tests - Fixes for SpringContextIntegrationTest in several projects * BAEL-9496 Fix failing context tests -Fixed ContextTests for spring-jms and further fixes spring-session-mongodb * BAEL-9496 Fix failing context tests -Fixed context tests from spring-rest-angular project
This commit is contained in:
parent
6f9c339986
commit
af75e04e50
|
@ -1,17 +0,0 @@
|
|||
package org.baeldung;
|
||||
|
||||
import org.baeldung.spring.cloud.DataFlowShellApplication;
|
||||
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 = DataFlowShellApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,15 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* This live test requires:
|
||||
* complete data-flow server and shell setup running
|
||||
*
|
||||
* <br>
|
||||
* For more info:
|
||||
* https://www.baeldung.com/spring-cloud-data-flow-stream-processing
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = DataFlowShellApplication.class)
|
||||
public class SpringContextLiveTest {
|
||||
|
|
|
@ -5,6 +5,15 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* This live test requires:
|
||||
* Eureka server and Gateway application up and running
|
||||
*
|
||||
* <br>
|
||||
* For more info:
|
||||
* https://www.baeldung.com/spring-cloud-netflix-eureka
|
||||
* https://www.baeldung.com/spring-cloud-gateway-pattern
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class SpringContextLiveTest {
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
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() {
|
||||
}
|
||||
}
|
|
@ -5,6 +5,15 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* This live test requires:
|
||||
* vault server up and running on the environment
|
||||
*
|
||||
* <br>
|
||||
* For more info on setting up the vault server:
|
||||
* https://www.baeldung.com/vault
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = VaultSampleApplication.class)
|
||||
public class SpringContextLiveTest {
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#To use a randomly allocated free port during tests to avoid port conflict across tests
|
||||
spring.data.mongodb.port=0
|
|
@ -6,7 +6,7 @@ import org.springframework.test.context.ContextConfiguration;
|
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = {"classpath:applicationContext.xml", "classpath:EmbeddedActiveMQ.xml"})
|
||||
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.springframework.test.context.ContextConfiguration;
|
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = {"classpath:applicationContext.xml", "classpath:EmbeddedActiveMQ.xml"})
|
||||
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
|
||||
public class SpringContextTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -26,7 +26,7 @@ public class PersistenceConfig {
|
|||
@Bean
|
||||
public DataSource dataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
|
||||
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.HSQL).addScript("db/sql/data.sql").build();
|
||||
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.HSQL).build();
|
||||
return db;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
server.servlet.contextPath=/
|
||||
spring.h2.console.enabled=true
|
||||
logging.level.org.hibernate.SQL=info
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
spring.jpa.generate-ddl=true
|
||||
spring.jpa.hibernate.ddl-auto=create
|
|
@ -1,10 +1,3 @@
|
|||
CREATE TABLE student (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name VARCHAR(30),
|
||||
gender VARCHAR(10),
|
||||
age INTEGER
|
||||
);
|
||||
|
||||
INSERT INTO student (id,name,gender,age)
|
||||
VALUES (1,'Bryan', 'Male',20);
|
||||
INSERT INTO student (id,name,gender,age)
|
|
@ -5,8 +5,10 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.session.SpringSessionApplication;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@SpringBootTest(classes = SpringSessionApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package com.baeldung.spring.cloud.bootstrap.gateway;
|
||||
package com.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.session.SpringSessionApplication;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class SpringContextIntegrationTest {
|
||||
@SpringBootTest(classes = SpringSessionApplication.class)
|
||||
public class SpringContextTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
}
|
||||
|
||||
}
|
|
@ -40,6 +40,12 @@
|
|||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.flapdoodle.embed</groupId>
|
||||
<artifactId>de.flapdoodle.embed.mongo</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SpringSessionMongoDBApplication.class)
|
||||
@SpringBootTest(classes = SpringSessionMongoDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SpringSessionMongoDBApplication.class)
|
||||
public class SpringContextLiveTest {
|
||||
@SpringBootTest(classes = SpringSessionMongoDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class SpringContextTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
|
@ -0,0 +1,2 @@
|
|||
#To use a randomly allocated free port during tests to avoid port conflict across tests
|
||||
spring.data.mongodb.port=0
|
|
@ -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.session.SessionWebApplication;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SessionWebApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
}
|
||||
}
|
|
@ -7,6 +7,10 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|||
|
||||
import com.baeldung.spring.session.SessionWebApplication;
|
||||
|
||||
/**
|
||||
* This live test requires:
|
||||
* redis instance running on the environment
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SessionWebApplication.class)
|
||||
public class SpringContextLiveTest {
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package org.baeldung;
|
||||
|
||||
import org.baeldung.springvault.SpringVaultApplication;
|
||||
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 = SpringVaultApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
}
|
||||
}
|
|
@ -6,6 +6,15 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* This live test requires:
|
||||
* vault server up and running on the environment
|
||||
*
|
||||
* <br>
|
||||
* For more info on setting up the vault server:
|
||||
* https://www.baeldung.com/vault
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SpringVaultApplication.class)
|
||||
public class SpringContextLiveTest {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
spring.main.allow-bean-definition-overriding=true
|
|
@ -1,6 +1,6 @@
|
|||
spring:
|
||||
rabbitmq:
|
||||
host: 192.168.99.100
|
||||
host: localhost
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package org.baeldung;
|
||||
|
||||
import org.baeldung.spring.amqp.SpringWebfluxAmqpApplication;
|
||||
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 = SpringWebfluxAmqpApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
}
|
||||
}
|
|
@ -6,6 +6,15 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* This live test requires:
|
||||
* rabbitmq instance running on the environment
|
||||
*
|
||||
* <br>
|
||||
* To run rabbitmq using docker image:
|
||||
* (e.g. `docker run -d --name rabbitmq -p 5672:5672 rabbitmq:3`)
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SpringWebfluxAmqpApplication.class)
|
||||
public class SpringContextLiveTest {
|
||||
|
|
Loading…
Reference in New Issue