Skip to content

Commit

Permalink
Adapt to new test infrastructure.
Browse files Browse the repository at this point in the history
Originial pull request #1222
See #1220
See #1620
  • Loading branch information
schauder committed Oct 10, 2023
1 parent 3b2e8c7 commit ddec3cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
import org.springframework.data.jdbc.core.convert.JdbcConverter;
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
import org.springframework.data.jdbc.testing.DatabaseType;
import org.springframework.data.jdbc.testing.EnabledOnDatabase;
import org.springframework.data.jdbc.testing.IntegrationTest;
import org.springframework.data.jdbc.testing.TestClass;
import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
Expand All @@ -54,10 +58,8 @@
* @author Jens Schauder
* @author Tyler Van Gorder
*/
@ContextConfiguration
@ActiveProfiles("hsql")
@Transactional
@ExtendWith(SpringExtension.class)
@IntegrationTest
@EnabledOnDatabase(DatabaseType.HSQL)
public class MyBatisCustomizingNamespaceHsqlIntegrationTests {

@Autowired SqlSessionFactory sqlSessionFactory;
Expand All @@ -84,8 +86,8 @@ interface DummyEntityRepository extends CrudRepository<DummyEntity, Long> {}
static class Config {

@Bean
Class<?> testClass() {
return MyBatisCustomizingNamespaceHsqlIntegrationTests.class;
TestClass testClass() {
return TestClass.of(MyBatisCustomizingNamespaceHsqlIntegrationTests.class);
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -33,16 +32,16 @@
import org.springframework.data.jdbc.core.convert.DataAccessStrategy;
import org.springframework.data.jdbc.core.convert.JdbcConverter;
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
import org.springframework.data.jdbc.testing.DatabaseType;
import org.springframework.data.jdbc.testing.EnabledOnDatabase;
import org.springframework.data.jdbc.testing.IntegrationTest;
import org.springframework.data.jdbc.testing.TestClass;
import org.springframework.data.jdbc.testing.TestConfiguration;
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.repository.CrudRepository;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;

/**
* Tests the integration with Mybatis.
Expand All @@ -51,10 +50,8 @@
* @author Greg Turnquist
* @author Mark Paluch
*/
@ContextConfiguration
@ActiveProfiles("hsql")
@Transactional
@ExtendWith(SpringExtension.class)
@IntegrationTest
@EnabledOnDatabase(DatabaseType.HSQL)
public class MyBatisHsqlIntegrationTests {

@Autowired SqlSessionFactory sqlSessionFactory;
Expand Down Expand Up @@ -91,8 +88,8 @@ interface DummyEntityRepository extends CrudRepository<DummyEntity, Long> {
static class Config {

@Bean
Class<?> testClass() {
return MyBatisHsqlIntegrationTests.class;
TestClass testClass() {
return TestClass.of(MyBatisHsqlIntegrationTests.class);
}

@Bean
Expand Down

0 comments on commit ddec3cc

Please sign in to comment.