From 267b5501da32c73e88c5ab3c916284547db363df Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Thu, 4 May 2017 18:44:12 +0200 Subject: [PATCH 1/2] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bcff16f5f1..fdd741154b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: java -install: travis_wait 60 mvn -q test +install: travis_wait 60 mvn -q test -fae before_script: - echo "MAVEN_OPTS='-Xmx2048M -Xss128M -XX:MaxPermSize=2048M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-UseGCOverheadLimit'" > ~/.mavenrc From 14f90c8636c9b0ab25478eb7f54c8fb2a704ab9e Mon Sep 17 00:00:00 2001 From: Yasin Date: Fri, 5 May 2017 01:23:03 +0530 Subject: [PATCH 2/2] BAEL-905 Improvements in spring boot testing (#1783) * BAEL-88 Testing in Spring Boot * BAEL-88 Integration tests fixed. * BAEL-905 Improvement task for spring boot testing * BAEL-905 Improvement task for spring boot testing --- .../boottest/EmployeeRestControllerIntegrationTest.java | 5 +++-- .../test/resources/application-integrationtest.properties | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java index 110092d293..4c3a50f933 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java @@ -19,18 +19,19 @@ import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.http.MediaType; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = DemoApplication.class) @AutoConfigureMockMvc -@TestPropertySource(locations = "classpath:application-integrationtest.properties") +// @TestPropertySource(locations = "classpath:application-integrationtest.properties") +@AutoConfigureTestDatabase public class EmployeeRestControllerIntegrationTest { @Autowired diff --git a/spring-boot/src/test/resources/application-integrationtest.properties b/spring-boot/src/test/resources/application-integrationtest.properties index 508acf45e0..bcd03226d3 100644 --- a/spring-boot/src/test/resources/application-integrationtest.properties +++ b/spring-boot/src/test/resources/application-integrationtest.properties @@ -1,2 +1,4 @@ -spring.datasource.url = jdbc:h2:mem:test -spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.H2Dialect \ No newline at end of file +spring.datasource.url=jdbc:mysql://localhost:3306/employee_int_test +spring.datasource.username=root +spring.datasource.password=root +