diff --git a/build.gradle b/build.gradle index 1de5197dc5..a255700d8b 100644 --- a/build.gradle +++ b/build.gradle @@ -90,7 +90,7 @@ subprojects { subproject -> commonsIoVersion = '2.4' commonsNetVersion = '3.3' curatorVersion = '2.8.0' - derbyVersion = '10.11.1.1' + derbyVersion = '10.13.1.1' eclipseLinkVersion = '2.4.2' ftpServerVersion = '1.0.6' groovyVersion = '2.4.4' @@ -458,8 +458,6 @@ project('spring-integration-jpa') { testCompile "org.springframework.data:spring-data-jpa:$springDataJpaVersion" testCompile "com.h2database:h2:$h2Version" - testCompile "org.hsqldb:hsqldb:$hsqldbVersion" - testCompile "org.apache.derby:derby:$derbyVersion" testCompile "org.hibernate:hibernate-entitymanager:$hibernateVersion" diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests-context.xml index a6721e85d0..1709d7c623 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests-context.xml @@ -8,12 +8,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd"> - - - - - - + diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcOutboundGatewayTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcOutboundGatewayTests.java index b38382e4cd..c2a6814a48 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcOutboundGatewayTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcOutboundGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -16,19 +16,20 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; -import javax.sql.DataSource; - import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.BeanFactory; import org.springframework.jdbc.core.JdbcOperations; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; /** * * @author Gunnar Hillert * @author Gary Russell + * @author Artem Bilan + * * @since 2.1 * */ @@ -36,9 +37,7 @@ public class JdbcOutboundGatewayTests { @Test public void testSetMaxRowsPerPollWithoutSelectQuery() { - - - DataSource dataSource = new EmbeddedDatabaseBuilder().build(); + EmbeddedDatabase dataSource = new EmbeddedDatabaseBuilder().build(); JdbcOutboundGateway jdbcOutboundGateway = new JdbcOutboundGateway(dataSource, "update something"); @@ -47,17 +46,17 @@ public class JdbcOutboundGatewayTests { jdbcOutboundGateway.setBeanFactory(mock(BeanFactory.class)); jdbcOutboundGateway.afterPropertiesSet(); - } catch (IllegalArgumentException e) { + fail("Expected an IllegalArgumentException to be thrown."); + } + catch (IllegalArgumentException e) { assertEquals("If you want to set 'maxRowsPerPoll', then you must provide a 'selectQuery'.", e.getMessage()); - return; } - fail("Expected an IllegalArgumentException to be thrown."); - + dataSource.shutdown(); } @Test - public void testConstructorWithNulljdbcOperations() { + public void testConstructorWithNullJdbcOperations() { JdbcOperations jdbcOperations = null; @@ -74,43 +73,39 @@ public class JdbcOutboundGatewayTests { @Test public void testConstructorWithEmptyAndNullQueries() { - - final DataSource dataSource = new EmbeddedDatabaseBuilder().build(); + EmbeddedDatabase dataSource = new EmbeddedDatabaseBuilder().build(); final String selectQuery = " "; final String updateQuery = null; try { new JdbcOutboundGateway(dataSource, updateQuery, selectQuery); + + fail("Expected an IllegalArgumentException to be thrown."); } catch (IllegalArgumentException e) { Assert.assertEquals("The 'updateQuery' and the 'selectQuery' must not both be null or empty.", e.getMessage()); - return; } - fail("Expected an IllegalArgumentException to be thrown."); + dataSource.shutdown(); } - /** - * Test method for - * {@link org.springframework.integration.jdbc.JdbcOutboundGateway#setMaxRowsPerPoll(Integer)}. - */ @Test public void testSetMaxRowsPerPoll() { - - - DataSource dataSource = new EmbeddedDatabaseBuilder().build(); + EmbeddedDatabase dataSource = new EmbeddedDatabaseBuilder().build(); JdbcOutboundGateway jdbcOutboundGateway = new JdbcOutboundGateway(dataSource, "select * from DOES_NOT_EXIST"); try { jdbcOutboundGateway.setMaxRowsPerPoll(null); - } catch (IllegalArgumentException e) { + + fail("Expected an IllegalArgumentException to be thrown."); + } + catch (IllegalArgumentException e) { assertEquals("MaxRowsPerPoll must not be null.", e.getMessage()); - return; } - fail("Expected an IllegalArgumentException to be thrown."); - + dataSource.shutdown(); } + } diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java index 20b90bf094..9fa26187b1 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,6 +61,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * Equivalent to {@link StoredProcPollingChannelAdapterWithNamespaceIntegrationTests}. * * @author Gary Russell + * @author Artem Bilan + * * @since 4.2 * */ @@ -130,7 +132,7 @@ public class StoredProcJavaConfigTests { return executor; } - @Bean + @Bean(destroyMethod = "shutdown") public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.H2) diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundChannelAdapterWithinChainTests-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundChannelAdapterWithinChainTests-context.xml index 037edc6342..46bb40ff26 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundChannelAdapterWithinChainTests-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcOutboundChannelAdapterWithinChainTests-context.xml @@ -2,10 +2,8 @@ diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests-context.xml index 4739fe0f4f..a01fc29091 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcPollingChannelAdapterWithNamespaceIntegrationTests-context.xml @@ -2,16 +2,12 @@ + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/DataSource-derby-context.xml b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/DataSource-derby-context.xml index 8e6a6130c4..6752b7db49 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/DataSource-derby-context.xml +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/store/channel/DataSource-derby-context.xml @@ -8,14 +8,7 @@ - - - - - - - +