diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java index 2b3f7f739..cc2e04ec8 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java @@ -29,7 +29,7 @@ import java.util.Properties; import org.springframework.batch.io.exception.BatchCriticalException; import org.springframework.batch.io.exception.BatchEnvironmentException; import org.springframework.batch.io.file.mapping.FieldSet; -import org.springframework.batch.io.file.mapping.FieldSetUnmapper; +import org.springframework.batch.io.file.mapping.FieldSetCreator; import org.springframework.batch.io.file.transform.DelimitedLineAggregator; import org.springframework.batch.io.file.transform.LineAggregator; import org.springframework.batch.io.support.AbstractTransactionalIoSource; @@ -84,7 +84,7 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements private LineAggregator lineAggregator = new DelimitedLineAggregator(); - private FieldSetUnmapper fieldSetUnmapper; + private FieldSetCreator fieldSetCreator; /** * Assert that mandatory properties (resource) are set. @@ -92,7 +92,7 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements */ public void afterPropertiesSet() throws Exception { Assert.notNull(resource, "The resource must be set"); - Assert.notNull(fieldSetUnmapper, "A FieldSetUnmapper must be provided."); + Assert.notNull(fieldSetCreator, "A FieldSetUnmapper must be provided."); File file = resource.getFile(); Assert.state(!file.exists() || file.canWrite(), "Resource is not writable: [" + resource + "]"); } @@ -108,14 +108,14 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements } /** - * Public setter for the {@link FieldSetUnmapper}. This will be used to + * Public setter for the {@link FieldSetCreator}. This will be used to * transform the item into a {@link FieldSet} before it is aggregated by the * {@link LineAggregator}. * - * @param fieldSetUnmapper the {@link FieldSetUnmapper} to set + * @param fieldSetCreator the {@link FieldSetCreator} to set */ - public void setFieldSetUnmapper(FieldSetUnmapper fieldSetUnmapper) { - this.fieldSetUnmapper = fieldSetUnmapper; + public void setFieldSetUnmapper(FieldSetCreator fieldSetCreator) { + this.fieldSetCreator = fieldSetCreator; } /** @@ -141,7 +141,7 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements * @throws Exception if the transformer or file output fail */ public void write(Object data) throws Exception { - FieldSet fieldSet = fieldSetUnmapper.unmapItem(data); + FieldSet fieldSet = fieldSetCreator.mapItem(data); getOutputState().write(lineAggregator.aggregate(fieldSet) + LINE_SEPARATOR); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSetUnmapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSetCreator.java similarity index 71% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSetUnmapper.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSetCreator.java index 680424cb1..ea481ec58 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSetUnmapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSetCreator.java @@ -15,17 +15,22 @@ */ package org.springframework.batch.io.file.mapping; +import org.springframework.batch.io.file.transform.LineTokenizer; /** + * Strategy interface for mapping between arbitrary objects and {@link FieldSet}. + * Similar to a {@link LineTokenizer}, but the input is generally a domain + * object, not a String. + * * @author Dave Syer * */ -public interface FieldSetUnmapper { +public interface FieldSetCreator { /** * @param data an Object to convert. * @return a {@link FieldSet} created from the input. */ - FieldSet unmapItem(Object data); + FieldSet mapItem(Object data); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/PassThroughFieldSetMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/PassThroughFieldSetMapper.java index d8155e468..d3ac1b7b7 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/PassThroughFieldSetMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/PassThroughFieldSetMapper.java @@ -23,7 +23,7 @@ package org.springframework.batch.io.file.mapping; * @author Lucas Ward * */ -public class PassThroughFieldSetMapper implements FieldSetMapper, FieldSetUnmapper { +public class PassThroughFieldSetMapper implements FieldSetMapper, FieldSetCreator { /* * (non-Javadoc) @@ -38,9 +38,9 @@ public class PassThroughFieldSetMapper implements FieldSetMapper, FieldSetUnmapp * convert to a String with toString() and convert it to a single field * {@link FieldSet}. * - * @see org.springframework.batch.io.file.mapping.FieldSetUnmapper#unmapItem(java.lang.Object) + * @see org.springframework.batch.io.file.mapping.FieldSetCreator#mapItem(java.lang.Object) */ - public FieldSet unmapItem(Object data) { + public FieldSet mapItem(Object data) { if (data instanceof FieldSet) { return (FieldSet) data; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/ResourceLineReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/ResourceLineReader.java index d8490119b..93ab15bda 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/ResourceLineReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/ResourceLineReader.java @@ -30,7 +30,7 @@ import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.exception.MarkFailedException; import org.springframework.batch.item.exception.ResetFailedException; -import org.springframework.batch.item.stream.ItemStreamAdapter; +import org.springframework.batch.item.stream.ItemStreamSupport; import org.springframework.core.io.Resource; import org.springframework.util.Assert; @@ -57,7 +57,7 @@ import org.springframework.util.Assert; * @author Dave Syer * @author Rob Harrop */ -public class ResourceLineReader extends ItemStreamAdapter implements LineReader, ItemReader { +public class ResourceLineReader extends ItemStreamSupport implements LineReader, ItemReader { private static final Collection DEFAULT_COMMENTS = Collections.singleton("#"); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/FieldSetUnmapperItemTransformer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/FieldSetUnmapperItemTransformer.java deleted file mode 100644 index 3667c239d..000000000 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/FieldSetUnmapperItemTransformer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.io.file.transform; - -import org.springframework.batch.io.file.mapping.FieldSet; -import org.springframework.batch.io.file.mapping.FieldSetUnmapper; -import org.springframework.batch.item.writer.ItemTransformer; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.util.Assert; - -/** - * An {@link ItemTransformer} that delegates to a {@link FieldSetUnmapper}, so - * the result of the transformation is a {@link FieldSet}. - * - * @author Dave Syer - * - */ -public class FieldSetUnmapperItemTransformer implements ItemTransformer, InitializingBean { - - private FieldSetUnmapper fieldSetUnmapper; - - /** - * Assert that mandatory properties are set. - * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() - */ - public void afterPropertiesSet() throws Exception { - Assert.notNull(fieldSetUnmapper, "A FieldSetUnmapper must be provided."); - } - - /* (non-Javadoc) - * @see org.springframework.batch.item.writer.ItemTransformer#transform(java.lang.Object) - */ - public Object transform(Object item) throws Exception { - return fieldSetUnmapper.unmapItem(item); - } -} diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java index 67f9836f9..05e465460 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java @@ -17,7 +17,7 @@ package org.springframework.batch.io.support; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; -import org.springframework.batch.item.stream.ItemStreamAdapter; +import org.springframework.batch.item.stream.ItemStreamSupport; /** *
@@ -31,7 +31,7 @@ import org.springframework.batch.item.stream.ItemStreamAdapter; * @author Lucas Ward * @since 1.0 */ -public abstract class AbstractTransactionalIoSource extends ItemStreamAdapter { +public abstract class AbstractTransactionalIoSource extends ItemStreamSupport { /* * Called when a transaction has been committed. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/AbstractItemStreamItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/AbstractItemStreamItemReader.java index 9961c248e..4f96e02d1 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/AbstractItemStreamItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/AbstractItemStreamItemReader.java @@ -17,13 +17,13 @@ package org.springframework.batch.item.reader; import org.springframework.batch.item.ItemReader; -import org.springframework.batch.item.stream.ItemStreamAdapter; +import org.springframework.batch.item.stream.ItemStreamSupport; /** * Base class for {@link ItemReader} implementations. * @author Dave Syer * */ -public abstract class AbstractItemStreamItemReader extends ItemStreamAdapter implements ItemReader { +public abstract class AbstractItemStreamItemReader extends ItemStreamSupport implements ItemReader { } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/ItemReaderAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/ItemReaderAdapter.java index c96891814..4676c5a4d 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/ItemReaderAdapter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/ItemReaderAdapter.java @@ -23,18 +23,19 @@ import org.springframework.batch.item.exception.StreamException; import org.springframework.batch.support.AbstractMethodInvokingDelegator; /** - * Invokes a custom method which provides an item. + * Invokes a custom method on a delegate plain old Java object which itself + * provides an item. * * @author Robert Kasanicky */ public class ItemReaderAdapter extends AbstractMethodInvokingDelegator implements ItemReader { - + /** * @return return value of the target method. */ - public Object read() throws Exception { + public Object read() throws Exception { return invokeDelegateMethod(); - } + } /** * Do nothing. @@ -42,13 +43,12 @@ public class ItemReaderAdapter extends AbstractMethodInvokingDelegator implement * @see org.springframework.batch.item.ItemReader#close() */ public void close() throws StreamException { - + } public void mark() throws MarkFailedException { } - + public void reset() throws ResetFailedException { } } - diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamSupport.java similarity index 94% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamSupport.java index d907f02ed..ca97f8171 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamSupport.java @@ -20,10 +20,12 @@ import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.exception.StreamException; /** + * Empty method implementation of {@link ItemStream}. + * * @author Dave Syer * */ -public class ItemStreamAdapter implements ItemStream { +public class ItemStreamSupport implements ItemStream { /** * No-op. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatListenerAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatListenerSupport.java similarity index 87% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatListenerAdapter.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatListenerSupport.java index c4c94658b..e78b3b4e2 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatListenerAdapter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/interceptor/RepeatListenerSupport.java @@ -20,7 +20,13 @@ import org.springframework.batch.repeat.ExitStatus; import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.RepeatListener; -public class RepeatListenerAdapter implements RepeatListener { +/** + * Empty method implementation of {@link RepeatListener}. + * + * @author Dave Syer + * + */ +public class RepeatListenerSupport implements RepeatListener { public void before(RepeatContext context) { } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/interceptor/RetryListenerAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/interceptor/RetryListenerSupport.java similarity index 87% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/interceptor/RetryListenerAdapter.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/interceptor/RetryListenerSupport.java index aa9a21e83..6988df48c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/interceptor/RetryListenerAdapter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/interceptor/RetryListenerSupport.java @@ -20,7 +20,13 @@ import org.springframework.batch.retry.RetryCallback; import org.springframework.batch.retry.RetryContext; import org.springframework.batch.retry.RetryListener; -public class RetryListenerAdapter implements RetryListener { +/** + * Empty method implementation of {@link RetryListener}. + * + * @author Dave Syer + * + */ +public class RetryListenerSupport implements RetryListener { public void close(RetryContext context, RetryCallback callback, Throwable throwable) { } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java index 2835630e0..7f0fc0594 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java @@ -25,7 +25,7 @@ import junit.framework.TestCase; import org.springframework.batch.io.file.mapping.DefaultFieldSet; import org.springframework.batch.io.file.mapping.FieldSet; -import org.springframework.batch.io.file.mapping.FieldSetUnmapper; +import org.springframework.batch.io.file.mapping.FieldSetCreator; import org.springframework.batch.io.file.mapping.PassThroughFieldSetMapper; import org.springframework.batch.item.ExecutionContext; import org.springframework.core.io.FileSystemResource; @@ -117,8 +117,8 @@ public class FlatFileItemWriterTests extends TestCase { * @throws Exception */ public void testWriteWithConverter() throws Exception { - inputSource.setFieldSetUnmapper(new FieldSetUnmapper() { - public FieldSet unmapItem(Object data) { + inputSource.setFieldSetUnmapper(new FieldSetCreator() { + public FieldSet mapItem(Object data) { return new DefaultFieldSet(new String[] { "FOO:" + data }); } }); @@ -135,8 +135,8 @@ public class FlatFileItemWriterTests extends TestCase { * @throws Exception */ public void testWriteWithConverterAndInfiniteLoop() throws Exception { - inputSource.setFieldSetUnmapper(new FieldSetUnmapper() { - public FieldSet unmapItem(Object data) { + inputSource.setFieldSetUnmapper(new FieldSetCreator() { + public FieldSet mapItem(Object data) { return new DefaultFieldSet(new String[] { "FOO:" + data }); } }); @@ -153,8 +153,8 @@ public class FlatFileItemWriterTests extends TestCase { * @throws Exception */ public void testWriteWithConverterAndString() throws Exception { - inputSource.setFieldSetUnmapper(new FieldSetUnmapper() { - public FieldSet unmapItem(Object data) { + inputSource.setFieldSetUnmapper(new FieldSetCreator() { + public FieldSet mapItem(Object data) { return new DefaultFieldSet(new String[] { "FOO:" + data }); } }); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/mapping/PassThroughFieldSetMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/mapping/PassThroughFieldSetMapperTests.java index 5123a19af..39db6b1c5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/mapping/PassThroughFieldSetMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/mapping/PassThroughFieldSetMapperTests.java @@ -36,27 +36,27 @@ public class PassThroughFieldSetMapperTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.io.file.mapping.PassThroughFieldSetMapper#unmapItem(java.lang.Object)}. + * {@link org.springframework.batch.io.file.mapping.PassThroughFieldSetMapper#mapItem(java.lang.Object)}. */ public void testUnmapItemAsFieldSet() { FieldSet fieldSet = new DefaultFieldSet(new String[] { "foo", "bar" }); - assertEquals(fieldSet, mapper.unmapItem(fieldSet)); + assertEquals(fieldSet, mapper.mapItem(fieldSet)); } /** * Test method for - * {@link org.springframework.batch.io.file.mapping.PassThroughFieldSetMapper#unmapItem(java.lang.Object)}. + * {@link org.springframework.batch.io.file.mapping.PassThroughFieldSetMapper#mapItem(java.lang.Object)}. */ public void testUnmapItemAsString() { - assertEquals(new DefaultFieldSet(new String[] { "foo" }), mapper.unmapItem("foo")); + assertEquals(new DefaultFieldSet(new String[] { "foo" }), mapper.mapItem("foo")); } /** * Test method for - * {@link org.springframework.batch.io.file.mapping.PassThroughFieldSetMapper#unmapItem(java.lang.Object)}. + * {@link org.springframework.batch.io.file.mapping.PassThroughFieldSetMapper#mapItem(java.lang.Object)}. */ public void testUnmapItemAsNonString() { Object object = new Object(); - assertEquals(new DefaultFieldSet(new String[] { "" + object }), mapper.unmapItem(object)); + assertEquals(new DefaultFieldSet(new String[] { "" + object }), mapper.mapItem(object)); } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java index d929a5fb0..96a93ef2e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java @@ -38,7 +38,7 @@ public class SimpleStreamManagerTests extends TestCase { private SimpleStreamManager manager = new SimpleStreamManager(new ResourcelessTransactionManager()); - private ItemStreamAdapter stream = new ItemStreamAdapterExtension(); + private ItemStreamSupport stream = new StubItemStream(); private List list = new ArrayList(); @@ -139,12 +139,12 @@ public class SimpleStreamManagerTests extends TestCase { * {@link org.springframework.batch.item.stream.SimpleStreamManager#getExecutionContext(java.lang.Object)}. */ public void testGetStreamContextTwoRegistrations() { - manager.register("foo", new ItemStreamAdapter() { + manager.register("foo", new ItemStreamSupport() { public ExecutionContext getExecutionContext() { return new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")); } }); - manager.register("foo", new ItemStreamAdapter() { + manager.register("foo", new ItemStreamSupport() { public ExecutionContext getExecutionContext() { return new ExecutionContext(PropertiesConverter.stringToProperties("foo=spam")); } @@ -158,7 +158,7 @@ public class SimpleStreamManagerTests extends TestCase { * {@link org.springframework.batch.item.stream.SimpleStreamManager#close(java.lang.Object)}. */ public void testClose() { - manager.register("foo", new ItemStreamAdapter() { + manager.register("foo", new ItemStreamSupport() { public void close() throws StreamException { list.add("bar"); super.close(); @@ -173,7 +173,7 @@ public class SimpleStreamManagerTests extends TestCase { * {@link org.springframework.batch.item.stream.SimpleStreamManager#commit(org.springframework.transaction.TransactionStatus)}. */ public void testCommitWithoutMark() { - manager.register("foo", new ItemStreamAdapter() { + manager.register("foo", new ItemStreamSupport() { public void mark() { list.add("bar"); } @@ -188,7 +188,7 @@ public class SimpleStreamManagerTests extends TestCase { * {@link org.springframework.batch.item.stream.SimpleStreamManager#rollback(org.springframework.transaction.TransactionStatus)}. */ public void testRollbackWithoutMark() { - manager.register("foo", new ItemStreamAdapter() { + manager.register("foo", new ItemStreamSupport() { public void reset() { list.add("bar"); } @@ -203,7 +203,7 @@ public class SimpleStreamManagerTests extends TestCase { * manager's execution context. */ public void testGetExecutionContextPreservesValues() { - stream = new ItemStreamAdapter() { + stream = new ItemStreamSupport() { public ExecutionContext getExecutionContext() { ExecutionContext ctx = new ExecutionContext(); ctx.putString("string", "testString"); @@ -221,7 +221,7 @@ public class SimpleStreamManagerTests extends TestCase { } } - private final class ItemStreamAdapterExtension extends ItemStreamAdapter { + private final class StubItemStream extends ItemStreamSupport { public ExecutionContext getExecutionContext() { return new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterAdapterIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterAdapterTests.java similarity index 89% rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterAdapterIntegrationTests.java rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterAdapterTests.java index 7b24dd60b..76fafac7a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterAdapterIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterAdapterTests.java @@ -12,7 +12,7 @@ import org.springframework.test.AbstractDependencyInjectionSpringContextTests; * * @author Robert Kasanicky */ -public class ItemWriterAdapterIntegrationTests extends AbstractDependencyInjectionSpringContextTests { +public class ItemWriterAdapterTests extends AbstractDependencyInjectionSpringContextTests { private ItemWriter processor; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/interceptor/RepeatListenerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/interceptor/RepeatListenerTests.java index 4969750d8..3ad4e1622 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/interceptor/RepeatListenerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/interceptor/RepeatListenerTests.java @@ -36,11 +36,11 @@ public class RepeatListenerTests extends TestCase { public void testBeforeInterceptors() throws Exception { RepeatTemplate template = new RepeatTemplate(); final List calls = new ArrayList(); - template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() { + template.setListeners(new RepeatListener[] { new RepeatListenerSupport() { public void before(RepeatContext context) { calls.add("1"); } - }, new RepeatListenerAdapter() { + }, new RepeatListenerSupport() { public void before(RepeatContext context) { calls.add("2"); } @@ -62,7 +62,7 @@ public class RepeatListenerTests extends TestCase { public void testBeforeInterceptorCanVeto() throws Exception { RepeatTemplate template = new RepeatTemplate(); final List calls = new ArrayList(); - template.setListener(new RepeatListenerAdapter() { + template.setListener(new RepeatListenerSupport() { public void before(RepeatContext context) { calls.add("1"); context.setCompleteOnly(); @@ -82,11 +82,11 @@ public class RepeatListenerTests extends TestCase { public void testAfterInterceptors() throws Exception { RepeatTemplate template = new RepeatTemplate(); final List calls = new ArrayList(); - template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() { + template.setListeners(new RepeatListener[] { new RepeatListenerSupport() { public void after(RepeatContext context, ExitStatus result) { calls.add("1"); } - }, new RepeatListenerAdapter() { + }, new RepeatListenerSupport() { public void after(RepeatContext context, ExitStatus result) { calls.add("2"); } @@ -106,11 +106,11 @@ public class RepeatListenerTests extends TestCase { public void testOpenInterceptors() throws Exception { RepeatTemplate template = new RepeatTemplate(); final List calls = new ArrayList(); - template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() { + template.setListeners(new RepeatListener[] { new RepeatListenerSupport() { public void open(RepeatContext context) { calls.add("1"); } - }, new RepeatListenerAdapter() { + }, new RepeatListenerSupport() { public void open(RepeatContext context) { calls.add("2"); context.setCompleteOnly(); @@ -129,7 +129,7 @@ public class RepeatListenerTests extends TestCase { public void testSingleOpenInterceptor() throws Exception { RepeatTemplate template = new RepeatTemplate(); final List calls = new ArrayList(); - template.setListener(new RepeatListenerAdapter() { + template.setListener(new RepeatListenerSupport() { public void open(RepeatContext context) { calls.add("1"); } @@ -148,11 +148,11 @@ public class RepeatListenerTests extends TestCase { public void testCloseInterceptors() throws Exception { RepeatTemplate template = new RepeatTemplate(); final List calls = new ArrayList(); - template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() { + template.setListeners(new RepeatListener[] { new RepeatListenerSupport() { public void close(RepeatContext context) { calls.add("1"); } - }, new RepeatListenerAdapter() { + }, new RepeatListenerSupport() { public void close(RepeatContext context) { calls.add("2"); } @@ -173,11 +173,11 @@ public class RepeatListenerTests extends TestCase { public void testOnErrorInterceptors() throws Exception { RepeatTemplate template = new RepeatTemplate(); final List calls = new ArrayList(); - template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() { + template.setListeners(new RepeatListener[] { new RepeatListenerSupport() { public void onError(RepeatContext context, Throwable t) { calls.add("1"); } - }, new RepeatListenerAdapter() { + }, new RepeatListenerSupport() { public void onError(RepeatContext context, Throwable t) { calls.add("2"); } @@ -200,11 +200,11 @@ public class RepeatListenerTests extends TestCase { public void testOnErrorInterceptorsPrecedence() throws Exception { RepeatTemplate template = new RepeatTemplate(); final List calls = new ArrayList(); - template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() { + template.setListeners(new RepeatListener[] { new RepeatListenerSupport() { public void after(RepeatContext context, ExitStatus result) { calls.add("1"); } - }, new RepeatListenerAdapter() { + }, new RepeatListenerSupport() { public void onError(RepeatContext context, Throwable t) { calls.add("2"); } @@ -230,11 +230,11 @@ public class RepeatListenerTests extends TestCase { template.setTaskExecutor(new SimpleAsyncTaskExecutor()); final List calls = new ArrayList(); final List fails = new ArrayList(); - template.setListeners(new RepeatListener[] { new RepeatListenerAdapter() { + template.setListeners(new RepeatListener[] { new RepeatListenerSupport() { public void after(RepeatContext context, ExitStatus result) { calls.add("1"); } - }, new RepeatListenerAdapter() { + }, new RepeatListenerSupport() { public void onError(RepeatContext context, Throwable t) { calls.add("2"); fails.add("2"); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerAdapterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerSupportTests.java similarity index 81% rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerAdapterTests.java rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerSupportTests.java index fa8c2bd96..83859393b 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerAdapterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerSupportTests.java @@ -18,10 +18,10 @@ package org.springframework.batch.retry.interceptor; import junit.framework.TestCase; -public class RetryListenerAdapterTests extends TestCase { +public class RetryListenerSupportTests extends TestCase { public void testClose() { - RetryListenerAdapter support = new RetryListenerAdapter(); + RetryListenerSupport support = new RetryListenerSupport(); try { support.close(null, null, null); } @@ -31,7 +31,7 @@ public class RetryListenerAdapterTests extends TestCase { } public void testOnError() { - RetryListenerAdapter support = new RetryListenerAdapter(); + RetryListenerSupport support = new RetryListenerSupport(); try { support.onError(null, null, null); } @@ -41,7 +41,7 @@ public class RetryListenerAdapterTests extends TestCase { } public void testOpen() { - RetryListenerAdapter support = new RetryListenerAdapter(); + RetryListenerSupport support = new RetryListenerSupport(); assertTrue(support.open(null, null)); } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerTests.java index 06aafb8cd..adb198996 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/interceptor/RetryListenerTests.java @@ -37,13 +37,13 @@ public class RetryListenerTests extends TestCase { List list = new ArrayList(); public void testOpenInterceptors() throws Exception { - template.setListeners(new RetryListener[] { new RetryListenerAdapter() { + template.setListeners(new RetryListener[] { new RetryListenerSupport() { public boolean open(RetryContext context, RetryCallback callback) { count++; list.add("1:" + count); return true; } - }, new RetryListenerAdapter() { + }, new RetryListenerSupport() { public boolean open(RetryContext context, RetryCallback callback) { count++; list.add("2:" + count); @@ -61,7 +61,7 @@ public class RetryListenerTests extends TestCase { } public void testOpenCanVetoRetry() throws Exception { - template.setListener(new RetryListenerAdapter() { + template.setListener(new RetryListenerSupport() { public boolean open(RetryContext context, RetryCallback callback) { list.add("1"); return false; @@ -85,12 +85,12 @@ public class RetryListenerTests extends TestCase { } public void testCloseInterceptors() throws Exception { - template.setListeners(new RetryListener[] { new RetryListenerAdapter() { + template.setListeners(new RetryListener[] { new RetryListenerSupport() { public void close(RetryContext context, RetryCallback callback, Throwable t) { count++; list.add("1:" + count); } - }, new RetryListenerAdapter() { + }, new RetryListenerSupport() { public void close(RetryContext context, RetryCallback callback, Throwable t) { count++; list.add("2:" + count); @@ -109,11 +109,11 @@ public class RetryListenerTests extends TestCase { public void testOnError() throws Exception { template.setRetryPolicy(new NeverRetryPolicy()); - template.setListeners(new RetryListener[] { new RetryListenerAdapter() { + template.setListeners(new RetryListener[] { new RetryListenerSupport() { public void onError(RetryContext context, RetryCallback callback, Throwable throwable) { list.add("1"); } - }, new RetryListenerAdapter() { + }, new RetryListenerSupport() { public void onError(RetryContext context, RetryCallback callback, Throwable throwable) { list.add("2"); } @@ -139,7 +139,7 @@ public class RetryListenerTests extends TestCase { } public void testCloseInterceptorsAfterRetry() throws Exception { - template.setListener(new RetryListenerAdapter() { + template.setListener(new RetryListenerSupport() { public void close(RetryContext context, RetryCallback callback, Throwable t) { list.add("" + count); // The last attempt should have been successful: