[BATCH-430] Incremental commit of exception moving

This commit is contained in:
nebhale
2008-03-07 11:54:20 +00:00
parent a60fc1e621
commit 8c2901093e
106 changed files with 736 additions and 848 deletions

View File

@@ -10,7 +10,7 @@ import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.exception.NoWorkFoundException;
import org.springframework.batch.item.NoWorkFoundException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;

View File

@@ -25,11 +25,6 @@ public abstract class AbstractExceptionTests extends TestCase {
assertEquals("foo", exception.getMessage());
}
public void testExceptionThrowable() throws Exception {
Exception exception = getException(new RuntimeException("foo"));
assertEquals("foo", exception.getCause().getMessage());
}
public void testExceptionStringThrowable() throws Exception {
Exception exception = getException("foo", new IllegalStateException());
assertEquals("foo", exception.getMessage().substring(0, 3));
@@ -37,8 +32,6 @@ public abstract class AbstractExceptionTests extends TestCase {
public abstract Exception getException(String msg) throws Exception;
public abstract Exception getException(Throwable t) throws Exception;
public abstract Exception getException(String msg, Throwable t) throws Exception;
}

View File

@@ -16,7 +16,6 @@
package org.springframework.batch.io.exception;
import org.springframework.batch.io.exception.ConfigurationException;
public class ConfigurationExceptionTests extends AbstractExceptionTests {

View File

@@ -29,7 +29,8 @@ import org.springframework.batch.io.file.separator.DefaultRecordSeparatorPolicy;
import org.springframework.batch.io.file.transform.DelimitedLineTokenizer;
import org.springframework.batch.io.file.transform.LineTokenizer;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.ReaderNotOpenException;
import org.springframework.core.io.AbstractResource;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
@@ -148,8 +149,8 @@ public class FlatFileItemReaderBasicTests extends TestCase {
itemReader.setFieldSetMapper(fieldSetMapper);
try {
itemReader.read();
fail("Expected StreamException");
} catch (StreamException e) {
fail("Expected ReaderNotOpenException");
} catch (ReaderNotOpenException e) {
assertTrue(e.getMessage().contains("open"));
}
}
@@ -210,7 +211,7 @@ public class FlatFileItemReaderBasicTests extends TestCase {
itemReader.open(executionContext);
fail("Expected BatchEnvironmentException");
}
catch (StreamException e) {
catch (ItemStreamException e) {
// expected
assertEquals("foo", e.getCause().getMessage());
}

View File

@@ -23,7 +23,8 @@ import junit.framework.TestCase;
import org.springframework.batch.io.file.separator.ResourceLineReader;
import org.springframework.batch.io.file.separator.SuffixRecordSeparatorPolicy;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.UnexpectedInputException;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.Resource;
@@ -41,9 +42,9 @@ public class ResourceLineReaderTests extends TestCase {
}));
try {
reader.read();
fail("Expected InputException");
fail("Expected UnexpectedInputException");
}
catch (StreamException e) {
catch (UnexpectedInputException e) {
// expected
assertTrue(e.getMessage().startsWith("Unable to read"));
}

View File

@@ -16,8 +16,6 @@
package org.springframework.batch.io.file.mapping;
import org.springframework.batch.io.file.mapping.PropertyMatches;
import junit.framework.TestCase;
public class PropertyMatchesTests extends TestCase {

View File

@@ -16,8 +16,6 @@
package org.springframework.batch.io.file.separator;
import org.springframework.batch.io.file.separator.DefaultRecordSeparatorPolicy;
import junit.framework.TestCase;
public class DefaultRecordSeparatorPolicyTests extends TestCase {

View File

@@ -16,8 +16,6 @@
package org.springframework.batch.io.file.separator;
import org.springframework.batch.io.file.separator.SimpleRecordSeparatorPolicy;
import junit.framework.TestCase;
public class SimpleRecordSeparatorPolicyTests extends TestCase {

View File

@@ -16,8 +16,6 @@
package org.springframework.batch.io.file.separator;
import org.springframework.batch.io.file.separator.SuffixRecordSeparatorPolicy;
import junit.framework.TestCase;
public class SuffixRecordSeparatorPolicyTests extends TestCase {

View File

@@ -2,8 +2,6 @@ package org.springframework.batch.io.file.transform;
import java.util.List;
import org.springframework.batch.io.file.transform.AbstractLineTokenizer;
import junit.framework.TestCase;
/**

View File

@@ -19,8 +19,6 @@ package org.springframework.batch.io.file.transform;
import junit.framework.TestCase;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.transform.AbstractLineTokenizer;
import org.springframework.batch.io.file.transform.DelimitedLineTokenizer;
public class DelimitedLineTokenizerTests extends TestCase {

View File

@@ -16,12 +16,10 @@
package org.springframework.batch.io.file.transform;
import org.springframework.batch.io.file.mapping.DefaultFieldSet;
import org.springframework.batch.io.file.transform.FixedLengthLineAggregator;
import org.springframework.batch.io.file.transform.Range;
import junit.framework.TestCase;
import org.springframework.batch.io.file.mapping.DefaultFieldSet;
/**
* Unit tests for {@link FixedLengthLineAggregator}
*

View File

@@ -19,8 +19,6 @@ package org.springframework.batch.io.file.transform;
import junit.framework.TestCase;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.transform.FixedLengthTokenizer;
import org.springframework.batch.io.file.transform.Range;
public class FixedLengthTokenizerTests extends TestCase {

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.batch.io.file.transform;
import org.springframework.batch.io.file.mapping.FieldSet;
import junit.framework.TestCase;
import org.springframework.batch.io.file.mapping.FieldSet;
/**
* @author Dave Syer
*

View File

@@ -25,8 +25,6 @@ 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.transform.DelimitedLineTokenizer;
import org.springframework.batch.io.file.transform.PrefixMatchingCompositeLineTokenizer;
public class PrefixMatchingCompositeLineTokenizerTests extends TestCase {

View File

@@ -1,8 +1,5 @@
package org.springframework.batch.io.file.transform;
import org.springframework.batch.io.file.transform.Range;
import org.springframework.batch.io.file.transform.RangeArrayPropertyEditor;
import junit.framework.TestCase;
public class RangeArrayPropertyEditorTests extends TestCase {

View File

@@ -18,11 +18,11 @@ package org.springframework.batch.io.file.transform;
import java.util.Arrays;
import java.util.Collections;
import junit.framework.TestCase;
import org.springframework.batch.item.writer.ItemTransformer;
import org.springframework.util.StringUtils;
import junit.framework.TestCase;
/**
* @author Dave Syer
*

View File

@@ -5,11 +5,11 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.util.Assert;
import junit.framework.TestCase;
/**
* Tests for {@link FileUtils}
*

View File

@@ -22,9 +22,9 @@ import java.util.Map;
import junit.framework.TestCase;
import org.springframework.batch.item.ClearFailedException;
import org.springframework.batch.item.FlushFailedException;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.exception.ClearFailedException;
import org.springframework.batch.item.exception.FlushFailedException;
import org.springframework.batch.repeat.context.RepeatContextSupport;
import org.springframework.batch.repeat.synch.RepeatSynchronizationManager;
import org.springframework.dao.DataAccessException;

View File

@@ -15,7 +15,8 @@ import javax.xml.stream.events.XMLEvent;
import junit.framework.TestCase;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.ReaderNotOpenException;
import org.springframework.core.io.AbstractResource;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
@@ -139,7 +140,7 @@ public class StaxEventItemReaderTests extends TestCase {
source.open(context);
fail("Expected StreamException");
}
catch (StreamException e) {
catch (ItemStreamException e) {
// expected
String message = e.getMessage();
assertTrue("Wrong message: "+message, message.contains("must be before"));
@@ -241,9 +242,9 @@ public class StaxEventItemReaderTests extends TestCase {
// calling read again should require re-initialization because of close
try {
item = newSource.read();
fail("Expected StreamException");
fail("Expected ReaderNotOpenException");
}
catch (StreamException e) {
catch (ReaderNotOpenException e) {
// expected
}
}

View File

@@ -26,7 +26,6 @@ import javax.xml.transform.Result;
import junit.framework.TestCase;
import org.springframework.batch.io.xml.oxm.MarshallingEventWriterSerializer;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.XmlMappingException;

View File

@@ -8,7 +8,6 @@ import javax.xml.stream.XMLInputFactory;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.io.xml.oxm.UnmarshallingEventReaderDeserializer;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.dao.DataAccessException;

View File

@@ -22,7 +22,6 @@ import javax.xml.stream.events.XMLEvent;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.io.xml.stax.AbstractEventReaderWrapper;
import com.bea.xml.stream.events.StartDocumentEvent;

View File

@@ -24,7 +24,6 @@ import javax.xml.stream.events.XMLEvent;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.io.xml.stax.AbstractEventWriterWrapper;
import com.bea.xml.stream.events.StartDocumentEvent;
import com.bea.xml.stream.util.NamespaceContextImpl;

View File

@@ -10,8 +10,6 @@ import javax.xml.stream.events.XMLEvent;
import junit.framework.TestCase;
import org.springframework.batch.io.xml.EventHelper;
import org.springframework.batch.io.xml.stax.DefaultFragmentEventReader;
import org.springframework.batch.io.xml.stax.DefaultTransactionalEventReader;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;

View File

@@ -6,7 +6,6 @@ import javax.xml.stream.XMLInputFactory;
import junit.framework.TestCase;
import org.springframework.batch.io.xml.EventHelper;
import org.springframework.batch.io.xml.stax.DefaultTransactionalEventReader;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;

View File

@@ -3,8 +3,6 @@ package org.springframework.batch.io.xml.stax;
import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.events.XMLEvent;
import org.springframework.batch.io.xml.stax.EventSequence;
import junit.framework.TestCase;
/**

View File

@@ -7,7 +7,6 @@ import javax.xml.stream.events.XMLEvent;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.io.xml.stax.NoStartEndDocumentStreamWriter;
/**
* Tests for {@link NoStartEndDocumentStreamWriter}

View File

@@ -14,23 +14,22 @@
* limitations under the License.
*/
package org.springframework.batch.item.exception;
package org.springframework.batch.item;
import org.springframework.batch.io.exception.AbstractExceptionTests;
public class StreamExceptionTests extends AbstractExceptionTests {
public class ItemStreamExceptionTests extends AbstractExceptionTests {
public Exception getException(String msg) throws Exception {
return new StreamException(msg);
return new ItemStreamException(msg);
}
public Exception getException(Throwable t) throws Exception {
return new StreamException(t);
return new ItemStreamException(t);
}
public Exception getException(String msg, Throwable t) throws Exception {
return new StreamException(msg, t);
return new ItemStreamException(msg, t);
}
}

View File

@@ -14,21 +14,16 @@
* limitations under the License.
*/
package org.springframework.batch.item.exception;
package org.springframework.batch.item;
import org.springframework.batch.io.exception.AbstractExceptionTests;
public class MarkFailedExceptionTests extends AbstractExceptionTests {
public Exception getException(String msg) throws Exception {
return new MarkFailedException(msg);
}
public Exception getException(Throwable t) throws Exception {
return new MarkFailedException(t);
}
public Exception getException(String msg, Throwable t) throws Exception {
return new MarkFailedException(msg, t);
}

View File

@@ -14,21 +14,16 @@
* limitations under the License.
*/
package org.springframework.batch.item.exception;
package org.springframework.batch.item;
import org.springframework.batch.io.exception.AbstractExceptionTests;
public class ResetFailedExceptionTests extends AbstractExceptionTests {
public Exception getException(String msg) throws Exception {
return new ResetFailedException(msg);
}
public Exception getException(Throwable t) throws Exception {
return new ResetFailedException(t);
}
public Exception getException(String msg, Throwable t) throws Exception {
return new ResetFailedException(msg, t);
}

View File

@@ -14,9 +14,8 @@
* limitations under the License.
*/
package org.springframework.batch.item.exception;
package org.springframework.batch.item;
import org.springframework.batch.item.exception.UnexpectedInputException;
import org.springframework.batch.repeat.exception.AbstractExceptionTests;
public class UnexpectedInputExceptionTests extends AbstractExceptionTests {

View File

@@ -7,7 +7,6 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.reader.AggregateItemReader;
public class AggregateItemReaderTests extends TestCase {

View File

@@ -25,7 +25,6 @@ import javax.jms.Queue;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.reader.JmsItemReader;
import org.springframework.jms.core.JmsOperations;
public class JmsItemReaderTests extends TestCase {

View File

@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.batch.item.reader.ListItemReader;
import junit.framework.TestCase;
public class ListItemReaderTests extends TestCase {

View File

@@ -22,7 +22,6 @@ import java.util.List;
import junit.framework.TestCase;
import org.springframework.batch.item.reader.ListItemReader;
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
import org.springframework.batch.support.transaction.TransactionAwareProxyFactory;
import org.springframework.transaction.PlatformTransactionManager;

View File

@@ -20,8 +20,6 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.io.exception.ValidationException;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.reader.AbstractItemReader;
import org.springframework.batch.item.reader.ValidatingItemReader;
import org.springframework.batch.item.validator.Validator;
/**

View File

@@ -22,7 +22,7 @@ import junit.framework.TestCase;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.batch.item.ItemStreamException;
/**
* @author Dave Syer
@@ -40,7 +40,7 @@ public class SimpleStreamManagerTests extends TestCase {
*/
public void testRegisterAndOpen() {
ItemStreamSupport stream = new ItemStreamSupport() {
public void open(ExecutionContext executionContext) throws StreamException {
public void open(ExecutionContext executionContext) throws ItemStreamException {
list.add("bar");
}
};
@@ -55,7 +55,7 @@ public class SimpleStreamManagerTests extends TestCase {
*/
public void testRegisterTwice() {
ItemStreamSupport stream = new ItemStreamSupport() {
public void open(ExecutionContext executionContext) throws StreamException {
public void open(ExecutionContext executionContext) throws ItemStreamException {
list.add("bar");
}
};
@@ -85,7 +85,7 @@ public class SimpleStreamManagerTests extends TestCase {
*/
public void testClose() {
manager.register(new ItemStreamSupport() {
public void close(ExecutionContext executionContext) throws StreamException {
public void close(ExecutionContext executionContext) throws ItemStreamException {
list.add("bar");
}
});
@@ -99,7 +99,7 @@ public class SimpleStreamManagerTests extends TestCase {
*/
public void testCloseDoesNotUnregister() {
manager.setStreams(new ItemStream[] { new ItemStreamSupport() {
public void open(ExecutionContext executionContext) throws StreamException {
public void open(ExecutionContext executionContext) throws ItemStreamException {
list.add("bar");
}
} });

View File

@@ -19,7 +19,6 @@ package org.springframework.batch.item.validator;
import junit.framework.TestCase;
import org.springframework.batch.io.exception.ValidationException;
import org.springframework.batch.item.validator.SpringValidator;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

View File

@@ -5,8 +5,6 @@ import java.util.ArrayList;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.writer.CompositeItemTransformer;
import org.springframework.batch.item.writer.ItemTransformer;
/**
* Tests for {@link CompositeItemTransformer}.

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.batch.item.writer;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.ItemWriter;
import junit.framework.TestCase;
/**
* @author Lucas Ward
*

View File

@@ -4,8 +4,6 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.writer.ItemTransformer;
import org.springframework.batch.item.writer.ItemTransformerItemWriter;
/**
* Tests for {@link ItemTransformerItemWriter}.

View File

@@ -4,7 +4,6 @@ import java.util.List;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.io.sample.domain.FooService;
import org.springframework.batch.item.writer.PropertyExtractingDelegatingItemWriter;
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
/**

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.batch.repeat;
import org.apache.commons.lang.SerializationUtils;
import junit.framework.TestCase;
import org.apache.commons.lang.SerializationUtils;
/**
* @author Dave Syer
*

View File

@@ -18,9 +18,9 @@ package org.springframework.batch.repeat.callback;
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.ExitStatus;
import org.springframework.batch.repeat.support.RepeatTemplate;
public class NestedRepeatCallbackTests extends TestCase {

View File

@@ -19,8 +19,6 @@ package org.springframework.batch.repeat.context;
import junit.framework.TestCase;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.context.RepeatContextCounter;
import org.springframework.batch.repeat.context.RepeatContextSupport;
public class RepeatContextCounterTests extends TestCase {

View File

@@ -23,7 +23,6 @@ import java.util.Map;
import junit.framework.TestCase;
import org.springframework.batch.repeat.context.SynchronizedAttributeAccessor;
import org.springframework.core.AttributeAccessorSupport;
public class SynchronizedAttributeAccessorTests extends TestCase {

View File

@@ -23,8 +23,6 @@ import junit.framework.TestCase;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatListener;
import org.springframework.batch.repeat.context.RepeatContextSupport;
import org.springframework.batch.repeat.listener.CompositeRepeatListener;
import org.springframework.batch.repeat.listener.RepeatListenerSupport;
/**
* @author Dave Syer

View File

@@ -25,7 +25,6 @@ import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.RepeatCallback;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatListener;
import org.springframework.batch.repeat.listener.RepeatListenerSupport;
import org.springframework.batch.repeat.support.RepeatTemplate;
import org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate;
import org.springframework.core.task.SimpleAsyncTaskExecutor;

View File

@@ -18,9 +18,9 @@ package org.springframework.batch.repeat.policy;
import junit.framework.TestCase;
import org.springframework.batch.repeat.CompletionPolicy;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.CompletionPolicy;
public class CompositeCompletionPolicyTests extends TestCase {

View File

@@ -19,9 +19,9 @@ package org.springframework.batch.repeat.support;
import java.util.HashSet;
import java.util.Set;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.RepeatCallback;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.callback.ItemReaderRepeatCallback;
import org.springframework.core.task.SimpleAsyncTaskExecutor;

View File

@@ -18,9 +18,9 @@ package org.springframework.batch.repeat.support;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.reader.AbstractItemReader;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.RepeatCallback;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.callback.ItemReaderRepeatCallback;
import org.springframework.batch.repeat.callback.NestedRepeatCallback;
import org.springframework.batch.repeat.policy.SimpleCompletionPolicy;

View File

@@ -19,9 +19,9 @@ package org.springframework.batch.repeat.support;
import java.util.ArrayList;
import java.util.List;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.RepeatCallback;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.callback.ItemReaderRepeatCallback;
import org.springframework.batch.repeat.callback.NestedRepeatCallback;
import org.springframework.batch.repeat.context.RepeatContextSupport;

View File

@@ -20,7 +20,6 @@ import junit.framework.TestCase;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.context.RepeatContextSupport;
import org.springframework.batch.repeat.synch.RepeatSynchronizationManager;
public class RepeatSynchronizationManagerTests extends TestCase {

View File

@@ -16,8 +16,6 @@
package org.springframework.batch.retry.listener;
import org.springframework.batch.retry.listener.RetryListenerSupport;
import junit.framework.TestCase;
public class RetryListenerSupportTests extends TestCase {

View File

@@ -18,8 +18,6 @@ package org.springframework.batch.support;
import java.util.Properties;
import org.springframework.batch.support.PropertiesConverter;
import junit.framework.TestCase;
/**