diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java index 9bb4fde23..6e62f9c0c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/dao/XStreamExecutionContextStringSerializerTests.java @@ -43,7 +43,7 @@ public class XStreamExecutionContextStringSerializerTests { public void testComplexObject() { Map m1 = new HashMap(); ComplexObject o1 = new ComplexObject(); - o1.setName("Test"); + o1.setName("02345"); Map m = new HashMap(); m.put("object1", Long.valueOf(12345L)); m.put("object2", "OBJECT TWO"); @@ -131,5 +131,11 @@ public class XStreamExecutionContextStringSerializerTests { result = 31 * result + (map != null ? map.hashCode() : 0); return result; } + + @Override + public String toString() { + return "ComplexObject [name=" + name + ", number=" + number + "]"; + } + } } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java index 6143f828a..3c7336260 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/TaskletStepExceptionTests.java @@ -42,6 +42,7 @@ import org.springframework.transaction.support.DefaultTransactionStatus; * Tests for the behavior of TaskletStep in a failure scenario. * * @author Lucas Ward + * @author Dave Syer * */ public class TaskletStepExceptionTests { @@ -199,6 +200,7 @@ public class TaskletStepExceptionTests { protected void doCommit(DefaultTransactionStatus status) throws TransactionException { throw new RuntimeException("bar"); } + @Override protected void doRollback(DefaultTransactionStatus status) throws TransactionException { throw new RuntimeException("foo"); @@ -219,6 +221,44 @@ public class TaskletStepExceptionTests { assertEquals("foo", e.getMessage()); } + @Test + public void testRepositoryError() throws Exception { + + taskletStep.setTasklet(new Tasklet() { + + public RepeatStatus execute(StepContribution contribution, ChunkContext attributes) throws Exception { + return RepeatStatus.FINISHED; + } + + }); + + jobRepository.setFailOnUpdate(true); + taskletStep.execute(stepExecution); + assertEquals(UNKNOWN, stepExecution.getStatus()); + Throwable e = stepExecution.getFailureExceptions().get(0); + assertEquals("Expected exception in step execution context persistence", e.getMessage()); + + } + + @Test + public void testRepositoryErrorOnFailure() throws Exception { + + taskletStep.setTasklet(new Tasklet() { + + public RepeatStatus execute(StepContribution contribution, ChunkContext attributes) throws Exception { + throw new RuntimeException("Tasklet exception"); + } + + }); + + jobRepository.setFailOnUpdate(true); + taskletStep.execute(stepExecution); + assertEquals(UNKNOWN, stepExecution.getStatus()); + Throwable e = stepExecution.getFailureExceptions().get(0); + assertEquals("Expected exception in step execution context persistence", e.getMessage()); + + } + @Test public void testUpdateError() throws Exception { @@ -261,6 +301,12 @@ public class TaskletStepExceptionTests { private int updateCount = 0; + private boolean failOnUpdate = false; + + public void setFailOnUpdate(boolean failOnUpdate) { + this.failOnUpdate = failOnUpdate; + } + public void add(StepExecution stepExecution) { } @@ -289,6 +335,9 @@ public class TaskletStepExceptionTests { } public void updateExecutionContext(StepExecution stepExecution) { + if (failOnUpdate) { + throw new RuntimeException("Expected exception in step execution context persistence"); + } } public int getUpdateCount() { diff --git a/spring-batch-parent/pom.xml b/spring-batch-parent/pom.xml index bc4302ec5..d6fe8a6d5 100644 --- a/spring-batch-parent/pom.xml +++ b/spring-batch-parent/pom.xml @@ -5,8 +5,7 @@ spring-batch-parent 2.1.0.CI-SNAPSHOT Spring Batch Parent - Spring Batch parent project. Defines dependencies and common configuration for the - build process. + Spring Batch parent project. Defines dependencies and common configuration for the build process. http://static.springframework.org/spring-batch/${project.artifactId} pom @@ -406,7 +405,7 @@ org.codehaus.jettison jettison - 1.0 + 1.1 stax diff --git a/src/site/apt/migration/2.1.0.RC1-2.1.0.apt b/src/site/apt/migration/2.1.0.RC1-2.1.0.apt new file mode 100755 index 000000000..dee47c0d1 --- /dev/null +++ b/src/site/apt/migration/2.1.0.RC1-2.1.0.apt @@ -0,0 +1,34 @@ +Spring Batch 2.1.0 Release Notes + +* Bug + + * {{{http://jira.springsource.org/browse/BATCH-1490}[BATCH-1490]}} - StaxEventItemWriter outputs invalid xml if step handling is failed and retried when handling the first chunk of data + + * {{{http://jira.springsource.org/browse/BATCH-1494}[BATCH-1494]}} - FetchSize not accessible in HibernateCursorItemReader + + * {{{http://jira.springsource.org/browse/BATCH-1497}[BATCH-1497]}} - SqlServerPagingQueryProvider should use an alias for the inner query in a jump-to-item query + + * {{{http://jira.springsource.org/browse/BATCH-1498}[BATCH-1498]}} - JdbcPagingItemReader does not apply parameter values correctly on restart + + * {{{http://jira.springsource.org/browse/BATCH-1499}[BATCH-1499]}} - SqlServerPagingQueryProvider needs an alias in the jump to subquery + + * {{{http://jira.springsource.org/browse/BATCH-1502}[BATCH-1502]}} - HibernatePagingItemReader doesn't close sessions + +* Improvement + + * {{{http://jira.springsource.org/browse/BATCH-1402}[BATCH-1402]}} - MapJobRegistry throws DuplicateJobException when the same job factory instance is registered twice + + * {{{http://jira.springsource.org/browse/BATCH-1493}[BATCH-1493]}} - Step listeners detected and invoked twice + +* New Feature + + * {{{http://jira.springsource.org/browse/BATCH-1496}[BATCH-1496]}} - Expose retry-policy in namespace configuration + +* Refactoring + + * {{{http://jira.springsource.org/browse/BATCH-1393}[BATCH-1393]}} - Migrate StepScope to Spring 3.0.0 + +* Task + + * {{{http://jira.springsource.org/browse/BATCH-1488}[BATCH-1488]}} - Tests and documentation for StoredProcedureItemReader + diff --git a/src/site/apt/migration/index.apt b/src/site/apt/migration/index.apt index 4e09dd32a..edb89408f 100644 --- a/src/site/apt/migration/index.apt +++ b/src/site/apt/migration/index.apt @@ -13,6 +13,10 @@ Links: + * {{{2.1.0.RC1-2.1.0.html}2.1.0.RC1 to 2.1.0}} + + * {{{2.1.0.M4-2.1.0.RC1.html}2.1.0.M4 to 2.1.0.RC1}} + * {{{2.1.0.M3-2.1.0.M4.html}2.1.0.M3 to 2.1.0.M4}} * {{{2.1.0.M2-2.1.0.M3.html}2.1.0.M2 to 2.1.0.M3}} diff --git a/src/site/docbook/reference/index.xml b/src/site/docbook/reference/index.xml index 241a58e6d..d90ab1aea 100644 --- a/src/site/docbook/reference/index.xml +++ b/src/site/docbook/reference/index.xml @@ -5,7 +5,7 @@ Spring Batch - Reference Documentation - Spring Batch 2.1.0.RC1 + Spring Batch 2.1.0 diff --git a/src/site/docbook/reference/step.xml b/src/site/docbook/reference/step.xml index dddb066a1..4a7d750ab 100644 --- a/src/site/docbook/reference/step.xml +++ b/src/site/docbook/reference/step.xml @@ -1522,7 +1522,7 @@ itemWriter.write(items); <step id="step4" parent="s4"/> -
+
Externalizing Flow Definitions and Dependencies Between Jobs