Updated Spring Retry to 1.1.0.RC1

This commit is contained in:
Michael Minella
2014-05-02 13:04:31 -05:00
parent bd01760466
commit 6913f5c022
13 changed files with 112 additions and 117 deletions

View File

@@ -26,16 +26,16 @@ import org.springframework.retry.RetryListener;
public class DummyRetryListener implements RetryListener {
@Override
public <T> boolean open(RetryContext context, RetryCallback<T> callback) {
public <T, E extends Throwable> boolean open(RetryContext context, RetryCallback<T, E> callback) {
return false;
}
@Override
public <T> void close(RetryContext context, RetryCallback<T> callback, Throwable throwable) {
public <T, E extends Throwable> void close(RetryContext context, RetryCallback<T, E> callback, Throwable throwable) {
}
@Override
public <T> void onError(RetryContext context, RetryCallback<T> callback, Throwable throwable) {
public <T, E extends Throwable> void onError(RetryContext context, RetryCallback<T, E> callback, Throwable throwable) {
}
}

View File

@@ -22,17 +22,17 @@ import org.springframework.retry.RetryListener;
public class TestRetryListener extends AbstractTestComponent implements RetryListener {
@Override
public <T> void close(RetryContext context, RetryCallback<T> callback,
public <T, E extends Throwable> void close(RetryContext context, RetryCallback<T, E> callback,
Throwable throwable) {
}
@Override
public <T> void onError(RetryContext context, RetryCallback<T> callback,
public <T, E extends Throwable> void onError(RetryContext context, RetryCallback<T, E> callback,
Throwable throwable) {
}
@Override
public <T> boolean open(RetryContext context, RetryCallback<T> callback) {
public <T, E extends Throwable> boolean open(RetryContext context, RetryCallback<T, E> callback) {
executed = true;
return true;
}

View File

@@ -15,15 +15,6 @@
*/
package org.springframework.batch.core.step.item;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.springframework.retry.ExhaustedRetryException;
import org.springframework.retry.RecoveryCallback;
@@ -33,6 +24,15 @@ import org.springframework.retry.RetryState;
import org.springframework.retry.policy.SimpleRetryPolicy;
import org.springframework.retry.support.DefaultRetryState;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class BatchRetryTemplateTests {
@SuppressWarnings("serial")
@@ -53,7 +53,7 @@ public class BatchRetryTemplateTests {
BatchRetryTemplate template = new BatchRetryTemplate();
String result = template.execute(new RetryCallback<String>() {
String result = template.execute(new RetryCallback<String, Exception>() {
@Override
public String doWithRetry(RetryContext context) throws Exception {
assertTrue("Wrong context type: " + context.getClass().getSimpleName(), context.getClass()
@@ -71,7 +71,7 @@ public class BatchRetryTemplateTests {
BatchRetryTemplate template = new BatchRetryTemplate();
RetryCallback<String[]> retryCallback = new RetryCallback<String[]>() {
RetryCallback<String[], Exception> retryCallback = new RetryCallback<String[], Exception>() {
@Override
public String[] doWithRetry(RetryContext context) throws Exception {
assertEquals(count, context.getRetryCount());
@@ -103,7 +103,7 @@ public class BatchRetryTemplateTests {
template.setRetryPolicy(new SimpleRetryPolicy(1, Collections
.<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));
RetryCallback<String[]> retryCallback = new RetryCallback<String[]>() {
RetryCallback<String[], Exception> retryCallback = new RetryCallback<String[], Exception>() {
@Override
public String[] doWithRetry(RetryContext context) throws Exception {
if (count++ < 2) {
@@ -133,7 +133,7 @@ public class BatchRetryTemplateTests {
template.setRetryPolicy(new SimpleRetryPolicy(1, Collections
.<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));
RetryCallback<String[]> retryCallback = new RetryCallback<String[]>() {
RetryCallback<String[], Exception> retryCallback = new RetryCallback<String[], Exception>() {
@Override
public String[] doWithRetry(RetryContext context) throws Exception {
if (count++ < 1) {
@@ -188,7 +188,7 @@ public class BatchRetryTemplateTests {
template.setRetryPolicy(new SimpleRetryPolicy(1, Collections
.<Class<? extends Throwable>, Boolean> singletonMap(Exception.class, true)));
RetryCallback<String[]> retryCallback = new RetryCallback<String[]>() {
RetryCallback<String[], Exception> retryCallback = new RetryCallback<String[], Exception>() {
@Override
public String[] doWithRetry(RetryContext context) throws Exception {
if (count++ < 2) {