BATCH-1103: Bad meta data for listener methods fixed

This commit is contained in:
dsyer
2009-02-25 19:03:24 +00:00
parent 6150a05615
commit da522c20e0
2 changed files with 12 additions and 11 deletions

View File

@@ -17,6 +17,7 @@ package org.springframework.batch.core.listener;
import java.lang.annotation.Annotation;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.batch.core.ChunkListener;
@@ -62,11 +63,11 @@ public enum StepListenerMetaData {
AFTER_READ("afterRead", "after-read-method", AfterRead.class, ItemReadListener.class, Object.class),
ON_READ_ERROR("onReadError", "on-read-error-method", OnReadError.class, ItemReadListener.class, Exception.class),
BEFORE_PROCESS("beforeProcess", "before-process-method", BeforeProcess.class, ItemProcessListener.class, Object.class),
AFTER_PROCESS("afterProcess", "after-process-method", AfterProcess.class, ItemProcessListener.class, Object.class),
AFTER_PROCESS("afterProcess", "after-process-method", AfterProcess.class, ItemProcessListener.class, Object.class, Object.class),
ON_PROCESS_ERROR("onProcessError", "on-process-error-method", OnProcessError.class, ItemProcessListener.class, Object.class, Exception.class),
BEFORE_WRITE("beforeWrite", "before-write-method", BeforeWrite.class, ItemWriteListener.class, Object.class),
AFTER_WRITE("afterWrite", "after-write-method", AfterWrite.class, ItemWriteListener.class, Object.class),
ON_WRITE_ERROR("onWriteError", "on-write-error-method", OnWriteError.class, ItemWriteListener.class, Object.class, Exception.class),
BEFORE_WRITE("beforeWrite", "before-write-method", BeforeWrite.class, ItemWriteListener.class, List.class),
AFTER_WRITE("afterWrite", "after-write-method", AfterWrite.class, ItemWriteListener.class, List.class),
ON_WRITE_ERROR("onWriteError", "on-write-error-method", OnWriteError.class, ItemWriteListener.class, Exception.class, List.class),
ON_SKIP_IN_READ("onSkipInRead", "on-skip-in-read-method", OnSkipInRead.class, SkipListener.class, Throwable.class),
ON_SKIP_IN_PROCESS("onSkipInProcess", "on-skip-in-process-method", OnSkipInProcess.class, SkipListener.class, Object.class, Throwable.class),
ON_SKIP_IN_WRITE("onSkipInWrite", "on-skip-in-write-method", OnSkipInWrite.class, SkipListener.class, Object.class, Throwable.class);

View File

@@ -299,7 +299,7 @@ public class SimpleStepFactoryBeanTests {
SimpleStepFactoryBean<String, String> factory = getStepFactory(new String[] { "foo", "bar", "spam" });
final List<Integer> listenerCalls = new ArrayList<Integer>();
final List<String> listenerCalls = new ArrayList<String>();
class TestItemListenerWriter implements ItemWriter<String>, ItemReadListener<String>,
ItemWriteListener<String>, ItemProcessListener<String, String>, ChunkListener {
@@ -307,7 +307,7 @@ public class SimpleStepFactoryBeanTests {
}
public void afterRead(String item) {
listenerCalls.add(1);
listenerCalls.add("read");
}
public void beforeRead() {
@@ -317,7 +317,7 @@ public class SimpleStepFactoryBeanTests {
}
public void afterWrite(List<? extends String> items) {
listenerCalls.add(2);
listenerCalls.add("write");
}
public void beforeWrite(List<? extends String> items) {
@@ -327,7 +327,7 @@ public class SimpleStepFactoryBeanTests {
}
public void afterProcess(String item, String result) {
listenerCalls.add(3);
listenerCalls.add("process");
}
public void beforeProcess(String item) {
@@ -337,7 +337,7 @@ public class SimpleStepFactoryBeanTests {
}
public void afterChunk() {
listenerCalls.add(4);
listenerCalls.add("chunk");
}
public void beforeChunk() {
@@ -356,8 +356,8 @@ public class SimpleStepFactoryBeanTests {
job.execute(jobExecution);
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
for (int i = 1; i <= 4; i++) {
assertTrue(listenerCalls.contains(i));
for (String type : new String[] { "read", "write", "process", "chunk" }) {
assertTrue("Missing listener call: " + type + " from " + listenerCalls, listenerCalls.contains(type));
}
}