From 5382d3b94e06c5ae3be5193f9d09f71cb886ef7a Mon Sep 17 00:00:00 2001 From: Chr1st0ph Date: Thu, 12 Apr 2018 12:41:41 +0200 Subject: [PATCH] DATAJDBC-198 - Prevent HSQL specific tests to run when a different database profile is selected. Set active profile on HSQL specific tests to HSQL. Fixed Readme to properly reflect the need to have a Docker installation. Original pull request: #59. --- README.adoc | 2 +- .../MyBatisCustomizingNamespaceHsqlIntegrationTests.java | 2 ++ .../data/jdbc/mybatis/MyBatisHsqlIntegrationTests.java | 2 ++ .../repository/query/QueryAnnotationHsqlIntegrationTests.java | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 8b6d6acd8..3306641db 100644 --- a/README.adoc +++ b/README.adoc @@ -339,7 +339,7 @@ This will execute unit tests and integration tests using an in-memory database. === Running tests with a real database -To run the integration tests against a specific database you need to have the database running on your local machine and then execute. +In order to run the integration tests against a specific database you need to have a local Docker installation available, and then execute. [source] ---- diff --git a/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisCustomizingNamespaceHsqlIntegrationTests.java b/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisCustomizingNamespaceHsqlIntegrationTests.java index 46a8d2a14..e7ee208f2 100644 --- a/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisCustomizingNamespaceHsqlIntegrationTests.java +++ b/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisCustomizingNamespaceHsqlIntegrationTests.java @@ -37,6 +37,7 @@ import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; import org.springframework.data.jdbc.testing.TestConfiguration; import org.springframework.data.repository.CrudRepository; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -49,6 +50,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Jens Schauder */ @ContextConfiguration +@ActiveProfiles("hsql") @Transactional public class MyBatisCustomizingNamespaceHsqlIntegrationTests { diff --git a/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisHsqlIntegrationTests.java b/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisHsqlIntegrationTests.java index e801ef094..37ac51df5 100644 --- a/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisHsqlIntegrationTests.java +++ b/src/test/java/org/springframework/data/jdbc/mybatis/MyBatisHsqlIntegrationTests.java @@ -36,6 +36,7 @@ import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; import org.springframework.data.jdbc.testing.TestConfiguration; import org.springframework.data.repository.CrudRepository; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -48,6 +49,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Greg Turnquist */ @ContextConfiguration +@ActiveProfiles("hsql") @Transactional public class MyBatisHsqlIntegrationTests { diff --git a/src/test/java/org/springframework/data/jdbc/repository/query/QueryAnnotationHsqlIntegrationTests.java b/src/test/java/org/springframework/data/jdbc/repository/query/QueryAnnotationHsqlIntegrationTests.java index b227f7ab2..5dfd51cad 100644 --- a/src/test/java/org/springframework/data/jdbc/repository/query/QueryAnnotationHsqlIntegrationTests.java +++ b/src/test/java/org/springframework/data/jdbc/repository/query/QueryAnnotationHsqlIntegrationTests.java @@ -36,6 +36,7 @@ import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories; import org.springframework.data.jdbc.testing.TestConfiguration; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -48,6 +49,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Kazuki Shimizu */ @ContextConfiguration +@ActiveProfiles("hsql") @Transactional public class QueryAnnotationHsqlIntegrationTests {