Updated for Spring 5 baseline

The new Spring 5 baseline consists of Spring 5, Hibernate 5, and Java 8.
This commit addresses any changes to create a successful build of Spring
Batch under those guidances.  Further commits will be coming to address
Java 8 specifics as areas of the project are touched.

Resolves BATCH-2536
This commit is contained in:
Michael Minella
2016-09-30 12:34:28 -05:00
parent f4c0530730
commit b2e6b431dc
16 changed files with 131 additions and 95 deletions

View File

@@ -42,57 +42,60 @@ allprojects {
environmentProperty = project.hasProperty('environment') ? getProperty('environment') : 'hsql'
springVersionDefault = '4.1.9.RELEASE'
springVersionDefault = '5.0.0.BUILD-SNAPSHOT'
springVersion = project.hasProperty('springVersion') ? getProperty('springVersion') : springVersionDefault
springRetryVersion = '1.1.2.RELEASE'
springAmqpVersion = '1.4.6.RELEASE'
springDataCommonsVersion = '1.9.4.RELEASE'
springDataGemfireVersion = '1.5.4.RELEASE'
springDataJpaVersion = '1.7.4.RELEASE'
springDataMongodbVersion = '1.6.4.RELEASE'
springDataNeo4jVersion = '3.2.4.RELEASE'
springDataNeo4j4Version = '4.1.2.RELEASE'
springIntegrationVersion = '4.1.8.RELEASE'
springRetryVersion = '1.1.3.RELEASE'
springAmqpVersion = '1.5.6.RELEASE'
springDataCommonsVersion = '1.11.5.RELEASE'
springDataGemfireVersion = '1.7.5.RELEASE'
springDataJpaVersion = '1.9.5.RELEASE'
springDataMongodbVersion = '1.8.5.RELEASE'
springDataNeo4jVersion = '3.4.5.RELEASE'
springDataNeo4j4Version = '4.1.3.RELEASE' //?
springIntegrationVersion = '4.2.9.RELEASE'
springLdapVersion = '2.0.4.RELEASE'
activemqVersion = '5.13.2'
aspectjVersion = '1.8.8'
aspectjVersion = '1.8.9'
castorVersion = '1.3.3'
commonsCollectionsVersion = '3.2.2'
commonsDdbcpVersion = '1.4'
commonsIoVersion = '2.4'
commonsLangVersion = '2.6'
derbyVersion = '10.10.2.0'
groovyVersion = '2.4.4'
commonsPoolVersion = '1.6'
derbyVersion = '10.12.1.1'
groovyVersion = '2.4.7'
hamcrestVersion = '1.3'
h2databaseVersion = '1.4.190'
hibernateVersion = '4.3.11.Final'
hibernateValidatorVersion = '5.1.3.Final'
h2databaseVersion = '1.4.192'
hibernateVersion = '5.2.2.Final'
hibernateValidatorVersion = '5.3.0.CR1'
hsqldbVersion = '2.3.3'
ibatisVersion = '2.3.4.726'
jacksonVersion = '1.9.13'
jackson2Version = "2.4.6"
javaMailVersion = '1.5.5'
jackson2Version = "2.4.6" //?
javaMailVersion = '1.5.6'
javaxBatchApiVersion = '1.0'
javaxInjectVersion = '1'
javaxTransactionVersion = '1.2'
jbatchTckSpi = '1.0'
jettisonVersion = '1.2'
jtdsVersion = '1.3.1'
junitVersion = '4.11'
jmsVersion = '1.1-rev-1'
jtdsVersion = '1.3.1' //?
junitVersion = '4.12'
log4jVersion = '1.2.17'
mysqlVersion = '5.1.38'
mysqlVersion = '5.1.39'
mockitoVersion = '1.10.19'
postgresqlVersion = '9.4.1209.jre6'
quartzVersion = '2.2.2'
servletApiVersion = '3.0.1'
postgresqlVersion = '9.4.1211.jre7'
quartzVersion = '2.2.3'
servletApiVersion = '3.1.0'
slf4jVersion = '1.7.21'
sqlfireclientVersion = '1.0.3'
sqliteVersion = '3.8.11.2'
sqlfireclientVersion = '1.0.3' //?
sqliteVersion = '3.8.11.2' //?
woodstoxVersion = '4.2.1'
xercesVersion = '2.11.0'
xercesVersion = '2.11.0' //?
xmlunitVersion = '1.5'
xstreamVersion = '1.4.9'
jrubyVersion = '1.7.23'
jrubyVersion = '1.7.26'
beanshellVersion = '2.0b5'
}
}
@@ -107,18 +110,18 @@ configure(subprojects - project(":spring-build-src")) { subproject ->
apply plugin: 'merge'
jacoco {
toolVersion = "0.7.0.201403182114"
toolVersion = "0.7.6.201602180812"
}
compileJava {
sourceCompatibility=1.6
targetCompatibility=1.6
sourceCompatibility=1.8
targetCompatibility=1.8
options.encoding='UTF-8'
}
compileTestJava {
sourceCompatibility=1.7
targetCompatibility=1.7
sourceCompatibility=1.8
targetCompatibility=1.8
options.encoding='UTF-8'
}
@@ -160,9 +163,9 @@ configure(subprojects - project(":spring-build-src")) { subproject ->
destinationFile = file("$buildDir/jacoco.exec")
}
// testLogging {
// showStandardStreams = true
// }
testLogging {
showStandardStreams = true
}
}
task sourcesJar(type: Jar) {
@@ -215,6 +218,10 @@ configure(subprojects - project(":spring-build-src")) { subproject ->
}
}
subprojects {
task allDeps(type: DependencyReportTask) {}
}
configure(mainProjects) {
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
@@ -319,7 +326,7 @@ project('spring-batch-infrastructure') {
testRuntime "org.beanshell:bsh:$beanshellVersion"
optional "javax.jms:jms-api:1.1-rev-1"
optional "javax.jms:jms-api:$jmsVersion"
optional "org.slf4j:slf4j-log4j12:$slf4jVersion"
optional "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion"
compile("org.hibernate:hibernate-core:$hibernateVersion") { dep ->
@@ -331,7 +338,7 @@ project('spring-batch-infrastructure') {
exclude group: 'org.jboss.spec.javax.transaction', module: 'jboss-transaction-api_1.1_spec'
}
optional "org.hibernate:hibernate-validator:$hibernateValidatorVersion"
optional "javax.transaction:javax.transaction-api:1.2"
optional "javax.transaction:javax.transaction-api:$javaxTransactionVersion"
optional "org.apache.ibatis:ibatis-sqlmap:$ibatisVersion"
optional "javax.mail:javax.mail-api:$javaMailVersion"
optional "javax.batch:javax.batch-api:$javaxBatchApiVersion"
@@ -350,14 +357,19 @@ project('spring-batch-infrastructure') {
optional "org.springframework:spring-tx:$springVersion"
optional "org.springframework.data:spring-data-commons:$springDataCommonsVersion"
optional "org.springframework.data:spring-data-mongodb:$springDataMongodbVersion"
optional "org.springframework.data:spring-data-neo4j:$springDataNeo4jVersion"
optional ("org.springframework.data:spring-data-neo4j:$springDataNeo4jVersion") {
exclude group: "org.springframework", module: "spring-aspects"
}
optional "org.springframework.data:spring-data-gemfire:$springDataGemfireVersion"
compile("org.codehaus.woodstox:woodstox-core-asl:$woodstoxVersion") { dep ->
optional dep
exclude group: 'stax', module: 'stax-api'
}
optional "org.springframework.amqp:spring-amqp:$springAmqpVersion"
optional "org.springframework.amqp:spring-rabbit:$springAmqpVersion"
optional ("org.springframework.amqp:spring-rabbit:$springAmqpVersion") {
exclude group: "org.springframework", module: "spring-messaging"
exclude group: "org.springframework", module: "spring-web"
}
optional "org.springframework.ldap:spring-ldap-core:$springLdapVersion"
optional "org.springframework.ldap:spring-ldap-core-tiger:$springLdapVersion"
optional "org.springframework.ldap:spring-ldap-ldif-core:$springLdapVersion"
@@ -378,7 +390,24 @@ project('spring-batch-infrastructure-neo4j4') {
merge.into = project(':spring-batch-infrastructure')
dependencies {
optional "org.springframework.data:spring-data-neo4j:$springDataNeo4j4Version"
optional ("org.springframework.data:spring-data-neo4j:$springDataNeo4j4Version") {
exclude group: 'org.springframework', module: 'spring-core'
exclude group: 'org.springframework', module: 'spring-aspects'
exclude group: 'org.springframework', module: 'spring-web'
exclude group: 'org.springframework', module: 'spring-context'
exclude group: 'org.springframework', module: 'spring-tx'
exclude group: 'org.springframework', module: 'spring-beans'
exclude group: 'org.springframework', module: 'spring-aop'
exclude group: 'org.springframework', module: 'spring-expression'
}
optional "org.springframework:spring-core:$springVersion"
optional "org.springframework:spring-context:$springVersion"
optional "org.springframework:spring-aspects:$springVersion"
optional "org.springframework:spring-web:$springVersion"
optional "org.springframework:spring-tx:$springVersion"
optional "org.springframework:spring-beans:$springVersion"
optional "org.springframework:spring-aop:$springVersion"
optional "org.springframework:spring-expression:$springVersion"
testCompile "org.mockito:mockito-core:$mockitoVersion"
testCompile "junit:junit:${junitVersion}"
}
@@ -544,7 +573,7 @@ project('spring-batch-integration') {
}
testCompile "org.springframework.integration:spring-integration-jdbc:$springIntegrationVersion"
optional "javax.jms:jms-api:1.1-rev-1"
optional "javax.jms:jms-api:$jmsVersion"
optional "org.slf4j:slf4j-log4j12:$slf4jVersion"
optional "log4j:log4j:$log4jVersion"
optional "org.springframework.integration:spring-integration-jms:$springIntegrationVersion"
@@ -578,7 +607,7 @@ project('spring-batch-samples') {
optional dep
exclude group: 'org.jboss.spec.javax.transaction', module: 'jboss-transaction-api_1.1_spec'
}
compile "javax.transaction:javax.transaction-api:1.2"
compile "javax.transaction:javax.transaction-api:$javaxTransactionVersion"
compile "org.apache.ibatis:ibatis-sqlmap:$ibatisVersion"
compile "org.springframework:spring-aop:$springVersion"
compile("org.springframework:spring-oxm:$springVersion") {
@@ -617,7 +646,10 @@ project('spring-batch-samples') {
optional "org.springframework:spring-web:$springVersion"
optional "org.springframework.data:spring-data-commons:$springDataCommonsVersion"
optional "org.springframework.amqp:spring-amqp:$springAmqpVersion"
optional "org.springframework.amqp:spring-rabbit:$springAmqpVersion"
optional ("org.springframework.amqp:spring-rabbit:$springAmqpVersion") {
exclude group: "org.springframework", module: "spring-messaging"
exclude group: "org.springframework", module: "spring-web"
}
optional "javax.inject:javax.inject:1"
optional "javax.batch:javax.batch-api:$javaxBatchApiVersion"
@@ -630,19 +662,19 @@ reference {
sourceDir = file('src/site/docbook/reference')
}
apply plugin: 'sonar-runner'
sonarRunner {
sonarProperties {
property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
property "sonar.links.homepage", linkHomepage
property "sonar.links.ci", linkCi
property "sonar.links.issue", linkIssue
property "sonar.links.scm", linkScmUrl
property "sonar.links.scm_dev", linkScmDevConnection
property "sonar.java.coveragePlugin", "jacoco"
}
}
//apply plugin: 'sonar-runner'
//
//sonarRunner {
// sonarProperties {
// property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec"
// property "sonar.links.homepage", linkHomepage
// property "sonar.links.ci", linkCi
// property "sonar.links.issue", linkIssue
// property "sonar.links.scm", linkScmUrl
// property "sonar.links.scm_dev", linkScmDevConnection
// property "sonar.java.coveragePlugin", "jacoco"
// }
//}
task api(type: Javadoc) {
group = 'Documentation'
@@ -802,7 +834,7 @@ task runTck(dependsOn: subprojects.compileJava) {
dependencies {
tck project(":spring-batch-core")
tck 'commons-pool:commons-pool:1.5.4'
tck "commons-pool:commons-pool:$commonsPoolVersion"
tck "javax.batch:javax.batch-api:$javaxBatchApiVersion"
tck "org.springframework:spring-core:$springVersion"
tck "org.springframework:spring-context:$springVersion"
@@ -840,5 +872,5 @@ or specify the Gradle property `TCK_HOME`, e.g: ./gradlew runTck -PTCK_HOME=/pat
task wrapper(type: Wrapper) {
description = 'Generates gradlew[.bat] scripts'
gradleVersion = '2.14.1'
gradleVersion = '3.0'
}

View File

@@ -1 +1 @@
version=3.1.0.BUILD-SNAPSHOT
version=4.0.0.BUILD-SNAPSHOT

View File

@@ -1,6 +1,6 @@
#Mon Apr 18 18:28:38 CDT 2016
#Thu Sep 29 16:06:24 CDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip

View File

@@ -22,9 +22,10 @@ import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.context.spi.CurrentSessionContext;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.orm.hibernate3.HibernateOperations;
import org.springframework.orm.hibernate5.HibernateOperations;
import org.springframework.util.Assert;
/**

View File

@@ -48,10 +48,10 @@ public class HibernateNativeQueryProvider<E> extends AbstractHibernateQueryProvi
public SQLQuery createQuery() {
if (isStatelessSession()) {
return getStatelessSession().createSQLQuery(sqlQuery).addEntity(entityClass);
return getStatelessSession().createNativeQuery(sqlQuery).addEntity(entityClass);
}
else {
return getStatefulSession().createSQLQuery(sqlQuery).addEntity(entityClass);
return getStatefulSession().createNativeQuery(sqlQuery).addEntity(entityClass);
}
}

View File

@@ -21,7 +21,7 @@ import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.sample.Foo;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
/**
* Tests for {@link HibernateCursorItemReader} using {@link StatelessSession}.

View File

@@ -21,7 +21,7 @@ import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.sample.Foo;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
public class HibernateCursorItemReaderCommonTests extends AbstractDatabaseItemStreamItemReaderTests {

View File

@@ -15,9 +15,9 @@
*/
package org.springframework.batch.item.database;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.junit.Test;
import org.springframework.batch.item.ExecutionContext;
@@ -46,7 +46,7 @@ public class HibernateCursorItemReaderStatefulIntegrationTests extends AbstractH
SessionFactory sessionFactory = mock(SessionFactory.class);
Session session = mock(Session.class);
Query scrollableResults = mock(Query.class);
HibernateCursorItemReader<Foo> itemReader = new HibernateCursorItemReader<Foo>();
HibernateCursorItemReader<Foo> itemReader = new HibernateCursorItemReader<>();
itemReader.setSessionFactory(sessionFactory);
itemReader.setQueryString("testQuery");
itemReader.setUseStatelessSession(false);

View File

@@ -15,24 +15,25 @@
*/
package org.springframework.batch.item.database;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import javax.sql.DataSource;
import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
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;
import static org.junit.Assert.fail;
/**
* Tests for {@link HibernateCursorItemReader} using {@link StatelessSession}.
*

View File

@@ -15,12 +15,6 @@
*/
package org.springframework.batch.item.database;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -29,7 +23,14 @@ import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.junit.Before;
import org.junit.Test;
import org.springframework.orm.hibernate3.HibernateOperations;
import org.springframework.orm.hibernate5.HibernateOperations;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* @author Dave Syer

View File

@@ -21,7 +21,7 @@ import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.sample.Foo;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
/**
* Tests for {@link HibernateCursorItemReader} using {@link StatelessSession}.

View File

@@ -33,7 +33,7 @@ import org.springframework.batch.item.sample.Foo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

View File

@@ -16,16 +16,17 @@
package org.springframework.batch.item.database.support;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.StatelessSession;
import org.hibernate.query.NativeQuery;
import org.junit.Test;
import org.springframework.batch.item.database.orm.HibernateNativeQueryProvider;
import org.springframework.util.Assert;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* @author Anatoly Polinsky
* @author Dave Syer
@@ -46,9 +47,9 @@ public class HibernateNativeQueryProviderTests {
hibernateQueryProvider.setSqlQuery(sqlQuery);
StatelessSession session = mock(StatelessSession.class);
SQLQuery query = mock(SQLQuery.class);
NativeQuery query = mock(NativeQuery.class);
when(session.createSQLQuery(sqlQuery)).thenReturn(query);
when(session.createNativeQuery(sqlQuery)).thenReturn(query);
when(query.addEntity(Foo.class)).thenReturn(query);
hibernateQueryProvider.setStatelessSession(session);
@@ -62,9 +63,9 @@ public class HibernateNativeQueryProviderTests {
hibernateQueryProvider.setSqlQuery(sqlQuery);
Session session = mock(Session.class);
SQLQuery query = mock(SQLQuery.class);
NativeQuery query = mock(NativeQuery.class);
when(session.createSQLQuery(sqlQuery)).thenReturn(query);
when(session.createNativeQuery(sqlQuery)).thenReturn(query);
when(query.addEntity(Foo.class)).thenReturn(query);
hibernateQueryProvider.setSession(session);

View File

@@ -181,7 +181,7 @@ public class MessageChannelPartitionHandler implements PartitionHandler, Initial
* @param messages the messages to be aggregated
* @return the list as it was passed in
*/
@Aggregator(sendPartialResultsOnExpiry = true)
@Aggregator(sendPartialResultsOnExpiry = "true")
public List<?> aggregate(@Payloads List<?> messages) {
return messages;
}

View File

@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingLocations" value="classpath*:/org/springframework/batch/sample/domain/**/*.hbm.xml" />
<property name="hibernateProperties">
@@ -16,7 +16,7 @@
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager" lazy-init="true">
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager" lazy-init="true">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>

View File

@@ -40,7 +40,7 @@ import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.orm.hibernate3.HibernateJdbcException;
import org.springframework.orm.hibernate5.HibernateJdbcException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.PlatformTransactionManager;