diff --git a/spring-batch/src/main/java/org/baeldung/batch/SpringBatchRetryConfig.java b/spring-batch/src/main/java/org/baeldung/batch/SpringBatchRetryConfig.java index 65a75c2324..86ee82c7e4 100644 --- a/spring-batch/src/main/java/org/baeldung/batch/SpringBatchRetryConfig.java +++ b/spring-batch/src/main/java/org/baeldung/batch/SpringBatchRetryConfig.java @@ -38,7 +38,7 @@ public class SpringBatchRetryConfig { @Autowired private StepBuilderFactory stepBuilderFactory; - @Value("input/record.csv") + @Value("input/recordRetry.csv") private Resource inputCsv; @Value("file:xml/retryOutput.xml") diff --git a/spring-batch/src/main/resources/input/recordRetry.csv b/spring-batch/src/main/resources/input/recordRetry.csv new file mode 100644 index 0000000000..08a6dec658 --- /dev/null +++ b/spring-batch/src/main/resources/input/recordRetry.csv @@ -0,0 +1,3 @@ +username, user_id, transaction_date, transaction_amount +sammy, 1234, 31/10/2015, 10000 +john, 2134, 3/12/2015, 12321 \ No newline at end of file diff --git a/spring-batch/src/test/java/org/baeldung/batch/SpringBatchRetryIntegrationTest.java b/spring-batch/src/test/java/org/baeldung/batch/SpringBatchRetryIntegrationTest.java index f788650c5e..366a028034 100644 --- a/spring-batch/src/test/java/org/baeldung/batch/SpringBatchRetryIntegrationTest.java +++ b/spring-batch/src/test/java/org/baeldung/batch/SpringBatchRetryIntegrationTest.java @@ -92,7 +92,10 @@ public class SpringBatchRetryIntegrationTest { //fails for first two calls and passes third time onwards when(httpResponse.getEntity()).thenReturn(new StringEntity("{ \"age\":10, \"postCode\":\"430222\" }")); - when(httpClient.execute(any())).thenThrow(new ConnectTimeoutException("Timeout count 1")).thenThrow(new ConnectTimeoutException("Timeout count 2")).thenReturn(httpResponse); + when(httpClient.execute(any())) + .thenThrow(new ConnectTimeoutException("Timeout count 1")) + .thenThrow(new ConnectTimeoutException("Timeout count 2")) + .thenReturn(httpResponse); JobExecution jobExecution = jobLauncherTestUtils.launchJob(defaultJobParameters()); JobInstance actualJobInstance = jobExecution.getJobInstance(); diff --git a/spring-batch/src/test/resources/output/batchRetry/retryOutput.xml b/spring-batch/src/test/resources/output/batchRetry/retryOutput.xml index 31da7bd6b3..4170a1dc31 100644 --- a/spring-batch/src/test/resources/output/batchRetry/retryOutput.xml +++ b/spring-batch/src/test/resources/output/batchRetry/retryOutput.xml @@ -1 +1 @@ -1010000.04302222015-10-31T00:00:00+05:301234devendra1012321.04302222015-12-03T00:00:00+05:302134john1023411.04302222015-02-02T00:00:00+05:302134robin \ No newline at end of file +1010000.04302222015-10-31T00:00:00+05:301234sammy1012321.04302222015-12-03T00:00:00+05:302134john \ No newline at end of file diff --git a/spring-batch/xml/retryOutput.xml b/spring-batch/xml/retryOutput.xml index 31da7bd6b3..4170a1dc31 100644 --- a/spring-batch/xml/retryOutput.xml +++ b/spring-batch/xml/retryOutput.xml @@ -1 +1 @@ -1010000.04302222015-10-31T00:00:00+05:301234devendra1012321.04302222015-12-03T00:00:00+05:302134john1023411.04302222015-02-02T00:00:00+05:302134robin \ No newline at end of file +1010000.04302222015-10-31T00:00:00+05:301234sammy1012321.04302222015-12-03T00:00:00+05:302134john \ No newline at end of file