OPEN - issue BATCH-347: aop / template interceptor class names ambiguous
http://jira.springframework.org/browse/BATCH-347 Rename Rpeat/RetryInterceptor as *Listener (and get rid of last error in samples).
This commit is contained in:
@@ -25,7 +25,7 @@ import junit.framework.TestCase;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatInterceptor;
|
||||
import org.springframework.batch.repeat.RepeatListener;
|
||||
import org.springframework.batch.repeat.context.RepeatContextSupport;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.orm.hibernate3.HibernateTemplate;
|
||||
@@ -46,7 +46,7 @@ public class HibernateAwareItemWriterTests extends TestCase {
|
||||
};
|
||||
}
|
||||
|
||||
private class StubItemWriter implements ItemWriter, RepeatInterceptor {
|
||||
private class StubItemWriter implements ItemWriter, RepeatListener {
|
||||
public void write(Object item) {
|
||||
list.add(item);
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ import junit.framework.TestCase;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class ApplicationEventPublisherRepeatInterceptorTests extends TestCase {
|
||||
public class ApplicationEventPublisherRepeatListenerTests extends TestCase {
|
||||
|
||||
private ApplicationEventPublisherRepeatInterceptor interceptor = new ApplicationEventPublisherRepeatInterceptor();
|
||||
private ApplicationEventPublisherRepeatListener interceptor = new ApplicationEventPublisherRepeatListener();
|
||||
|
||||
private List list = new ArrayList();
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ApplicationEventPublisherRepeatInterceptorTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatInterceptor#after(org.springframework.batch.repeat.RepeatContext, ExitStatus)}.
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatListener#after(org.springframework.batch.repeat.RepeatContext, ExitStatus)}.
|
||||
*/
|
||||
public void testAfter() {
|
||||
interceptor.after(context, ExitStatus.CONTINUABLE);
|
||||
@@ -62,7 +62,7 @@ public class ApplicationEventPublisherRepeatInterceptorTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatInterceptor#before(org.springframework.batch.repeat.RepeatContext)}.
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatListener#before(org.springframework.batch.repeat.RepeatContext)}.
|
||||
*/
|
||||
public void testBefore() {
|
||||
interceptor.before(context);
|
||||
@@ -73,7 +73,7 @@ public class ApplicationEventPublisherRepeatInterceptorTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatInterceptor#close(org.springframework.batch.repeat.RepeatContext)}.
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatListener#close(org.springframework.batch.repeat.RepeatContext)}.
|
||||
*/
|
||||
public void testClose() {
|
||||
interceptor.close(context);
|
||||
@@ -84,7 +84,7 @@ public class ApplicationEventPublisherRepeatInterceptorTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatInterceptor#onError(org.springframework.batch.repeat.RepeatContext, java.lang.Throwable)}.
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatListener#onError(org.springframework.batch.repeat.RepeatContext, java.lang.Throwable)}.
|
||||
*/
|
||||
public void testOnError() {
|
||||
interceptor.onError(context, new RuntimeException("foo"));
|
||||
@@ -95,7 +95,7 @@ public class ApplicationEventPublisherRepeatInterceptorTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatInterceptor#open(org.springframework.batch.repeat.RepeatContext)}.
|
||||
* Test method for {@link org.springframework.batch.repeat.interceptor.ApplicationEventPublisherRepeatListener#open(org.springframework.batch.repeat.RepeatContext)}.
|
||||
*/
|
||||
public void testOpen() {
|
||||
interceptor.open(context);
|
||||
@@ -24,23 +24,23 @@ import junit.framework.TestCase;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.batch.repeat.RepeatCallback;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatInterceptor;
|
||||
import org.springframework.batch.repeat.RepeatListener;
|
||||
import org.springframework.batch.repeat.support.RepeatTemplate;
|
||||
import org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
|
||||
public class RepeatInterceptorTests extends TestCase {
|
||||
public class RepeatListenerTests extends TestCase {
|
||||
|
||||
int count = 0;
|
||||
|
||||
public void testBeforeInterceptors() throws Exception {
|
||||
RepeatTemplate template = new RepeatTemplate();
|
||||
final List calls = new ArrayList();
|
||||
template.setInterceptors(new RepeatInterceptor[] { new RepeatInterceptorAdapter() {
|
||||
template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() {
|
||||
public void before(RepeatContext context) {
|
||||
calls.add("1");
|
||||
}
|
||||
}, new RepeatInterceptorAdapter() {
|
||||
}, new RepeatListenerAdapter() {
|
||||
public void before(RepeatContext context) {
|
||||
calls.add("2");
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class RepeatInterceptorTests extends TestCase {
|
||||
public void testBeforeInterceptorCanVeto() throws Exception {
|
||||
RepeatTemplate template = new RepeatTemplate();
|
||||
final List calls = new ArrayList();
|
||||
template.setInterceptor(new RepeatInterceptorAdapter() {
|
||||
template.setListener(new RepeatListenerAdapter() {
|
||||
public void before(RepeatContext context) {
|
||||
calls.add("1");
|
||||
context.setCompleteOnly();
|
||||
@@ -82,11 +82,11 @@ public class RepeatInterceptorTests extends TestCase {
|
||||
public void testAfterInterceptors() throws Exception {
|
||||
RepeatTemplate template = new RepeatTemplate();
|
||||
final List calls = new ArrayList();
|
||||
template.setInterceptors(new RepeatInterceptor[] { new RepeatInterceptorAdapter() {
|
||||
template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() {
|
||||
public void after(RepeatContext context, ExitStatus result) {
|
||||
calls.add("1");
|
||||
}
|
||||
}, new RepeatInterceptorAdapter() {
|
||||
}, new RepeatListenerAdapter() {
|
||||
public void after(RepeatContext context, ExitStatus result) {
|
||||
calls.add("2");
|
||||
}
|
||||
@@ -106,11 +106,11 @@ public class RepeatInterceptorTests extends TestCase {
|
||||
public void testOpenInterceptors() throws Exception {
|
||||
RepeatTemplate template = new RepeatTemplate();
|
||||
final List calls = new ArrayList();
|
||||
template.setInterceptors(new RepeatInterceptor[] { new RepeatInterceptorAdapter() {
|
||||
template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() {
|
||||
public void open(RepeatContext context) {
|
||||
calls.add("1");
|
||||
}
|
||||
}, new RepeatInterceptorAdapter() {
|
||||
}, new RepeatListenerAdapter() {
|
||||
public void open(RepeatContext context) {
|
||||
calls.add("2");
|
||||
context.setCompleteOnly();
|
||||
@@ -129,7 +129,7 @@ public class RepeatInterceptorTests extends TestCase {
|
||||
public void testSingleOpenInterceptor() throws Exception {
|
||||
RepeatTemplate template = new RepeatTemplate();
|
||||
final List calls = new ArrayList();
|
||||
template.setInterceptor(new RepeatInterceptorAdapter() {
|
||||
template.setListener(new RepeatListenerAdapter() {
|
||||
public void open(RepeatContext context) {
|
||||
calls.add("1");
|
||||
}
|
||||
@@ -148,11 +148,11 @@ public class RepeatInterceptorTests extends TestCase {
|
||||
public void testCloseInterceptors() throws Exception {
|
||||
RepeatTemplate template = new RepeatTemplate();
|
||||
final List calls = new ArrayList();
|
||||
template.setInterceptors(new RepeatInterceptor[] { new RepeatInterceptorAdapter() {
|
||||
template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() {
|
||||
public void close(RepeatContext context) {
|
||||
calls.add("1");
|
||||
}
|
||||
}, new RepeatInterceptorAdapter() {
|
||||
}, new RepeatListenerAdapter() {
|
||||
public void close(RepeatContext context) {
|
||||
calls.add("2");
|
||||
}
|
||||
@@ -173,11 +173,11 @@ public class RepeatInterceptorTests extends TestCase {
|
||||
public void testOnErrorInterceptors() throws Exception {
|
||||
RepeatTemplate template = new RepeatTemplate();
|
||||
final List calls = new ArrayList();
|
||||
template.setInterceptors(new RepeatInterceptor[] { new RepeatInterceptorAdapter() {
|
||||
template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() {
|
||||
public void onError(RepeatContext context, Throwable t) {
|
||||
calls.add("1");
|
||||
}
|
||||
}, new RepeatInterceptorAdapter() {
|
||||
}, new RepeatListenerAdapter() {
|
||||
public void onError(RepeatContext context, Throwable t) {
|
||||
calls.add("2");
|
||||
}
|
||||
@@ -200,11 +200,11 @@ public class RepeatInterceptorTests extends TestCase {
|
||||
public void testOnErrorInterceptorsPrecedence() throws Exception {
|
||||
RepeatTemplate template = new RepeatTemplate();
|
||||
final List calls = new ArrayList();
|
||||
template.setInterceptors(new RepeatInterceptor[] { new RepeatInterceptorAdapter() {
|
||||
template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() {
|
||||
public void after(RepeatContext context, ExitStatus result) {
|
||||
calls.add("1");
|
||||
}
|
||||
}, new RepeatInterceptorAdapter() {
|
||||
}, new RepeatListenerAdapter() {
|
||||
public void onError(RepeatContext context, Throwable t) {
|
||||
calls.add("2");
|
||||
}
|
||||
@@ -230,11 +230,11 @@ public class RepeatInterceptorTests extends TestCase {
|
||||
template.setTaskExecutor(new SimpleAsyncTaskExecutor());
|
||||
final List calls = new ArrayList();
|
||||
final List fails = new ArrayList();
|
||||
template.setInterceptors(new RepeatInterceptor[] { new RepeatInterceptorAdapter() {
|
||||
template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() {
|
||||
public void after(RepeatContext context, ExitStatus result) {
|
||||
calls.add("1");
|
||||
}
|
||||
}, new RepeatInterceptorAdapter() {
|
||||
}, new RepeatListenerAdapter() {
|
||||
public void onError(RepeatContext context, Throwable t) {
|
||||
calls.add("2");
|
||||
fails.add("2");
|
||||
@@ -18,10 +18,10 @@ package org.springframework.batch.retry.interceptor;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class RetryInterceptorSupportTests extends TestCase {
|
||||
public class RetryListenerSupportTests extends TestCase {
|
||||
|
||||
public void testClose() {
|
||||
RetryInterceptorSupport support = new RetryInterceptorSupport();
|
||||
RetryListenerAdapter support = new RetryListenerAdapter();
|
||||
try {
|
||||
support.close(null, null, null);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class RetryInterceptorSupportTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testOnError() {
|
||||
RetryInterceptorSupport support = new RetryInterceptorSupport();
|
||||
RetryListenerAdapter support = new RetryListenerAdapter();
|
||||
try {
|
||||
support.onError(null, null, null);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class RetryInterceptorSupportTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testOpen() {
|
||||
RetryInterceptorSupport support = new RetryInterceptorSupport();
|
||||
RetryListenerAdapter support = new RetryListenerAdapter();
|
||||
assertTrue(support.open(null, null));
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.retry.RetryCallback;
|
||||
import org.springframework.batch.retry.RetryContext;
|
||||
import org.springframework.batch.retry.RetryInterceptor;
|
||||
import org.springframework.batch.retry.RetryListener;
|
||||
import org.springframework.batch.retry.exception.TerminatedRetryException;
|
||||
import org.springframework.batch.retry.policy.NeverRetryPolicy;
|
||||
import org.springframework.batch.retry.support.RetryTemplate;
|
||||
|
||||
public class RetryInterceptorTests extends TestCase {
|
||||
public class RetryListenerTests extends TestCase {
|
||||
|
||||
RetryTemplate template = new RetryTemplate();
|
||||
|
||||
@@ -37,13 +37,13 @@ public class RetryInterceptorTests extends TestCase {
|
||||
List list = new ArrayList();
|
||||
|
||||
public void testOpenInterceptors() throws Exception {
|
||||
template.setInterceptors(new RetryInterceptor[] { new RetryInterceptorSupport() {
|
||||
template.setListeners(new RetryListener[] { new RetryListenerAdapter() {
|
||||
public boolean open(RetryContext context, RetryCallback callback) {
|
||||
count++;
|
||||
list.add("1:" + count);
|
||||
return true;
|
||||
}
|
||||
}, new RetryInterceptorSupport() {
|
||||
}, new RetryListenerAdapter() {
|
||||
public boolean open(RetryContext context, RetryCallback callback) {
|
||||
count++;
|
||||
list.add("2:" + count);
|
||||
@@ -61,7 +61,7 @@ public class RetryInterceptorTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testOpenCanVetoRetry() throws Exception {
|
||||
template.setInterceptor(new RetryInterceptorSupport() {
|
||||
template.setListener(new RetryListenerAdapter() {
|
||||
public boolean open(RetryContext context, RetryCallback callback) {
|
||||
list.add("1");
|
||||
return false;
|
||||
@@ -85,12 +85,12 @@ public class RetryInterceptorTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testCloseInterceptors() throws Exception {
|
||||
template.setInterceptors(new RetryInterceptor[] { new RetryInterceptorSupport() {
|
||||
template.setListeners(new RetryListener[] { new RetryListenerAdapter() {
|
||||
public void close(RetryContext context, RetryCallback callback, Throwable t) {
|
||||
count++;
|
||||
list.add("1:" + count);
|
||||
}
|
||||
}, new RetryInterceptorSupport() {
|
||||
}, new RetryListenerAdapter() {
|
||||
public void close(RetryContext context, RetryCallback callback, Throwable t) {
|
||||
count++;
|
||||
list.add("2:" + count);
|
||||
@@ -109,11 +109,11 @@ public class RetryInterceptorTests extends TestCase {
|
||||
|
||||
public void testOnError() throws Exception {
|
||||
template.setRetryPolicy(new NeverRetryPolicy());
|
||||
template.setInterceptors(new RetryInterceptor[] { new RetryInterceptorSupport() {
|
||||
template.setListeners(new RetryListener[] { new RetryListenerAdapter() {
|
||||
public void onError(RetryContext context, RetryCallback callback, Throwable throwable) {
|
||||
list.add("1");
|
||||
}
|
||||
}, new RetryInterceptorSupport() {
|
||||
}, new RetryListenerAdapter() {
|
||||
public void onError(RetryContext context, RetryCallback callback, Throwable throwable) {
|
||||
list.add("2");
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public class RetryInterceptorTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testCloseInterceptorsAfterRetry() throws Exception {
|
||||
template.setInterceptor(new RetryInterceptorSupport() {
|
||||
template.setListener(new RetryListenerAdapter() {
|
||||
public void close(RetryContext context, RetryCallback callback, Throwable t) {
|
||||
list.add("" + count);
|
||||
// The last attempt should have been successful:
|
||||
Reference in New Issue
Block a user