diff --git a/build.gradle b/build.gradle index e16bd59fd..4d278f547 100644 --- a/build.gradle +++ b/build.gradle @@ -11,6 +11,7 @@ buildscript { classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1' classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7' classpath 'io.spring.gradle:spring-io-plugin:0.0.5.RELEASE' + classpath "io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE" } } @@ -22,7 +23,7 @@ ext { linkScmConnection = 'git://github.com/spring-projects/spring-batch.git' linkScmDevConnection = 'git@github.com:spring-projects/spring-batch.git' - mainProjects = subprojects.findAll { !it.name.endsWith('tests') && !it.name.endsWith('samples') } + mainProjects = subprojects.findAll { !it.name.endsWith('tests') && !it.name.endsWith('samples') && it.name.startsWith('spring-batch-')} } allprojects { @@ -54,7 +55,7 @@ allprojects { springIntegrationVersion = '4.0.1.RELEASE' springLdapVersion = '2.0.2.RELEASE' - activemqVersion = '5.9.1' + activemqVersion = '5.13.2' aspectjVersion = '1.8.0' castorVersion = '1.3.2' commonsCollectionsVersion = '3.2.1' @@ -222,12 +223,10 @@ configure(mainProjects) { maven { url "https://repo.spring.io/libs-snapshot" } } - dependencies { - dependencyManagement { - springIoTestRuntime { - imports { - mavenBom "io.spring.platform:platform-bom:${platformVersion}" - } + dependencyManagement { + springIoTestRuntime { + imports { + mavenBom "io.spring.platform:platform-bom:${platformVersion}" } } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemReaderHelper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemReaderHelper.java index f9122b7fb..141508e03 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemReaderHelper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/database/HibernateItemReaderHelper.java @@ -15,6 +15,7 @@ */ package org.springframework.batch.item.database; +import java.lang.reflect.Method; import java.util.Collection; import java.util.List; import java.util.Map; @@ -28,6 +29,7 @@ import org.hibernate.StatelessSession; import org.springframework.batch.item.database.orm.HibernateQueryProvider; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; +import org.springframework.util.ReflectionUtils; import org.springframework.util.StringUtils; /** @@ -197,7 +199,9 @@ public class HibernateItemReaderHelper implements InitializingBean { statelessSession = null; } if (statefulSession != null) { - statefulSession.close(); + + Method close = ReflectionUtils.findMethod(Session.class, "close"); + ReflectionUtils.invokeMethod(close, statefulSession); statefulSession = null; } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulIntegrationTests.java index 7d970912b..6939ff5da 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/database/HibernateCursorItemReaderStatefulIntegrationTests.java @@ -15,16 +15,17 @@ */ package org.springframework.batch.item.database; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.junit.Test; + import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.sample.Foo; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + /** * Tests for {@link HibernateCursorItemReader} using standard hibernate {@link Session}. * @@ -53,7 +54,6 @@ public class HibernateCursorItemReaderStatefulIntegrationTests extends AbstractH when(sessionFactory.openSession()).thenReturn(session); when(session.createQuery("testQuery")).thenReturn(scrollableResults); when(scrollableResults.setFetchSize(0)).thenReturn(scrollableResults); - when(session.close()).thenReturn(null); itemReader.open(new ExecutionContext()); itemReader.close(); diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/JmsIntegrationTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/JmsIntegrationTests.java index 6dfd40b7f..9a7ac2289 100755 --- a/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/JmsIntegrationTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/integration/partition/JmsIntegrationTests.java @@ -12,15 +12,13 @@ */ package org.springframework.batch.integration.partition; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; @@ -34,6 +32,9 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + /** * @author Dave Syer * @@ -67,7 +68,7 @@ public class JmsIntegrationTests { int after = jobInstances.size(); assertEquals(1, after - before); JobExecution jobExecution = jobExplorer.getJobExecutions(jobInstances.get(jobInstances.size() - 1)).get(0); - assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus()); + assertEquals(jobExecution.getExitStatus().getExitDescription(), BatchStatus.COMPLETED, jobExecution.getStatus()); assertEquals(3, jobExecution.getStepExecutions().size()); for (StepExecution stepExecution : jobExecution.getStepExecutions()) { // BATCH-1703: we are using a map dao so the step executions in the job execution are old and we need to @@ -77,5 +78,4 @@ public class JmsIntegrationTests { assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); } } - } diff --git a/spring-batch-integration/src/test/resources/jms-context.xml b/spring-batch-integration/src/test/resources/jms-context.xml index 8bbca6eb1..b52b22eb7 100644 --- a/spring-batch-integration/src/test/resources/jms-context.xml +++ b/spring-batch-integration/src/test/resources/jms-context.xml @@ -15,9 +15,8 @@ - - vm://localhost - + +