IN PROGRESS - issue BATCH-267: Re-organise I/O (io) packages

http://jira.springframework.org/browse/BATCH-267

Remove package cycles
This commit is contained in:
dsyer
2007-12-31 17:13:40 +00:00
parent 12d7203c03
commit 03ea1e3826
62 changed files with 194 additions and 143 deletions

View File

@@ -21,8 +21,8 @@ import java.io.IOException;
import junit.framework.TestCase;
import org.springframework.batch.io.file.DefaultFlatFileItemReader;
import org.springframework.batch.io.file.FieldSet;
import org.springframework.batch.io.file.FieldSetMapper;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSetMapper;
import org.springframework.batch.io.file.transform.LineTokenizer;
import org.springframework.batch.restart.RestartData;
import org.springframework.core.io.ByteArrayResource;
@@ -87,7 +87,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase {
* Test skip and skipRollback functionality
* @throws IOException
*/
public void testSkip() throws IOException {
public void testSkip() throws Exception {
inputSource.close();
inputSource.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6"));
@@ -122,7 +122,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase {
* Test skip and skipRollback functionality
* @throws IOException
*/
public void testTransactionSynchronizationUnknown() throws IOException {
public void testTransactionSynchronizationUnknown() throws Exception {
inputSource.close();
inputSource.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6"));
@@ -164,7 +164,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase {
assertEquals("[FlatFileInputTemplate-TestData]", inputSource.read().toString());
}
public void testRestart() throws IOException {
public void testRestart() throws Exception {
inputSource.close();
inputSource.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6"));

View File

@@ -21,7 +21,7 @@ import java.text.ParseException;
import junit.framework.TestCase;
import org.springframework.batch.io.file.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSet;
public class FieldSetTests extends TestCase {
FieldSet fieldSet;

View File

@@ -25,7 +25,6 @@ import java.util.Collections;
import junit.framework.TestCase;
import org.springframework.batch.io.file.FlatFileItemWriter;
import org.springframework.batch.io.file.transform.Converter;
import org.springframework.batch.restart.RestartData;
import org.springframework.core.io.FileSystemResource;
import org.springframework.transaction.support.TransactionSynchronization;

View File

@@ -22,7 +22,7 @@ import java.io.InputStream;
import junit.framework.TestCase;
import org.springframework.batch.io.exception.BatchEnvironmentException;
import org.springframework.batch.io.file.ResourceLineReader;
import org.springframework.batch.io.file.separator.ResourceLineReader;
import org.springframework.batch.io.file.separator.SuffixRecordSeparatorPolicy;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.InputStreamResource;

View File

@@ -25,9 +25,9 @@ import junit.framework.TestCase;
import org.springframework.batch.io.exception.BatchEnvironmentException;
import org.springframework.batch.io.exception.FlatFileParsingException;
import org.springframework.batch.io.file.DefaultFlatFileItemReader;
import org.springframework.batch.io.file.FieldSet;
import org.springframework.batch.io.file.FieldSetMapper;
import org.springframework.batch.io.file.SimpleFlatFileItemReader;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSetMapper;
import org.springframework.batch.io.file.separator.DefaultRecordSeparatorPolicy;
import org.springframework.batch.io.file.transform.DelimitedLineTokenizer;
import org.springframework.batch.io.file.transform.LineTokenizer;
@@ -90,14 +90,14 @@ public class SimpleFlatFileItemReaderTests extends TestCase {
/**
* Regular usage of <code>read</code> method
*/
public void testRead() throws IOException {
public void testRead() throws Exception {
assertEquals("[FlatFileInputTemplate-TestData]", inputSource.read().toString());
}
/**
* Regular usage of <code>read</code> method
*/
public void testReadExhausted() throws IOException {
public void testReadExhausted() throws Exception {
assertEquals("[FlatFileInputTemplate-TestData]", inputSource.read().toString());
assertEquals(null, inputSource.read());
}
@@ -105,7 +105,7 @@ public class SimpleFlatFileItemReaderTests extends TestCase {
/**
* Regular usage of <code>read</code> method
*/
public void testReadWithTokenizerError() throws IOException {
public void testReadWithTokenizerError() throws Exception {
inputSource.setTokenizer(new LineTokenizer() {
public FieldSet tokenize(String line) {
throw new RuntimeException("foo");
@@ -120,7 +120,7 @@ public class SimpleFlatFileItemReaderTests extends TestCase {
}
}
public void testReadWithMapperError() throws IOException {
public void testReadWithMapperError() throws Exception {
inputSource.setFieldSetMapper(new FieldSetMapper(){
public Object mapLine(FieldSet fs) {
throw new RuntimeException("foo");

View File

@@ -24,7 +24,6 @@ import java.util.Properties;
import junit.framework.TestCase;
import org.springframework.batch.io.file.FieldSet;
import org.springframework.batch.io.file.mapping.BeanWrapperFieldSetMapper;
import org.springframework.batch.io.file.mapping.BindingException;
import org.springframework.batch.support.IntArrayPropertyEditor;

View File

@@ -18,7 +18,7 @@ package org.springframework.batch.io.file.transform;
import junit.framework.TestCase;
import org.springframework.batch.io.file.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.transform.AbstractLineTokenizer;
import org.springframework.batch.io.file.transform.DelimitedLineTokenizer;

View File

@@ -18,7 +18,7 @@ package org.springframework.batch.io.file.transform;
import junit.framework.TestCase;
import org.springframework.batch.io.file.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.transform.FixedLengthTokenizer;
import org.springframework.batch.io.file.transform.Range;

View File

@@ -23,9 +23,8 @@ import java.util.Map;
import junit.framework.TestCase;
import org.springframework.batch.io.file.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.transform.DelimitedLineTokenizer;
import org.springframework.batch.io.file.transform.LineTokenizer;
import org.springframework.batch.io.file.transform.PrefixMatchingCompositeLineTokenizer;
public class PrefixMatchingCompositeLineTokenizerTests extends TestCase {

View File

@@ -15,8 +15,7 @@ import javax.xml.stream.events.XMLEvent;
import junit.framework.TestCase;
import org.springframework.batch.io.xml.StaxEventReaderItemReader;
import org.springframework.batch.io.xml.stax.FragmentDeserializer;
import org.springframework.batch.io.xml.StaxEventItemReader;
import org.springframework.batch.restart.GenericRestartData;
import org.springframework.batch.restart.RestartData;
import org.springframework.core.io.AbstractResource;
@@ -26,14 +25,14 @@ import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.transaction.support.TransactionSynchronization;
/**
* Tests for {@link StaxEventReaderItemReader}.
* Tests for {@link StaxEventItemReader}.
*
* @author Robert Kasanicky
*/
public class StaxEventReaderItemReaderTests extends TestCase {
// object under test
private StaxEventReaderItemReader source;
private StaxEventItemReader source;
// test xml input
private String xml = "<root> <fragment> <misc1/> </fragment> <misc2/> <fragment> testString </fragment> </root>";
@@ -258,13 +257,13 @@ public class StaxEventReaderItemReaderTests extends TestCase {
private int extractRecordCountFrom(Properties statistics) {
return Integer.valueOf(
source.getStatistics().getProperty(StaxEventReaderItemReader.READ_COUNT_STATISTICS_NAME)).intValue();
source.getStatistics().getProperty(StaxEventItemReader.READ_COUNT_STATISTICS_NAME)).intValue();
}
private StaxEventReaderItemReader createNewInputSouce() {
private StaxEventItemReader createNewInputSouce() {
Resource resource = new ByteArrayResource(xml.getBytes());
StaxEventReaderItemReader newSource = new StaxEventReaderItemReader();
StaxEventItemReader newSource = new StaxEventItemReader();
newSource.setResource(resource);
newSource.setFragmentRootElementName(FRAGMENT_ROOT_ELEMENT);
@@ -349,7 +348,7 @@ public class StaxEventReaderItemReaderTests extends TestCase {
}
private static class MockStaxEventReaderItemReader extends StaxEventReaderItemReader {
private static class MockStaxEventReaderItemReader extends StaxEventItemReader {
private boolean openCalled = false;

View File

@@ -11,7 +11,7 @@ import javax.xml.transform.Result;
import junit.framework.TestCase;
import org.apache.commons.io.FileUtils;
import org.springframework.batch.io.xml.StaxEventWriterItemWriter;
import org.springframework.batch.io.xml.StaxEventItemWriter;
import org.springframework.batch.io.xml.oxm.MarshallingObjectToXmlSerializer;
import org.springframework.batch.restart.RestartData;
import org.springframework.core.io.FileSystemResource;
@@ -28,7 +28,7 @@ import org.springframework.xml.transform.StaxResult;
public class StaxEventWriterItemWriterTests extends TestCase {
// object under test
private StaxEventWriterItemWriter writer;
private StaxEventItemWriter writer;
// output file
private Resource resource;
@@ -119,7 +119,7 @@ public class StaxEventWriterItemWriterTests extends TestCase {
final int NUMBER_OF_RECORDS = 10;
for (int i = 0; i < NUMBER_OF_RECORDS; i++) {
String writeStatistics =
writer.getStatistics().getProperty(StaxEventWriterItemWriter.WRITE_STATISTICS_NAME);
writer.getStatistics().getProperty(StaxEventItemWriter.WRITE_STATISTICS_NAME);
assertEquals(String.valueOf(i), writeStatistics);
writer.write(record);
@@ -188,8 +188,8 @@ public class StaxEventWriterItemWriterTests extends TestCase {
/**
* @return new instance of fully configured writer
*/
private StaxEventWriterItemWriter createItemWriter() throws Exception {
StaxEventWriterItemWriter source = new StaxEventWriterItemWriter();
private StaxEventItemWriter createItemWriter() throws Exception {
StaxEventItemWriter source = new StaxEventItemWriter();
source.setResource(resource);
Marshaller marshaller = new SimpleMarshaller();

View File

@@ -12,7 +12,6 @@ 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.batch.io.xml.stax.FragmentEventReader;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;

View File

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

View File

@@ -6,7 +6,6 @@ import java.util.Iterator;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.io.file.FieldSetMapper;
import org.springframework.batch.item.ItemReader;
public class AggregateItemReaderTests extends TestCase {
@@ -30,11 +29,11 @@ public class AggregateItemReaderTests extends TestCase {
//set-up mock input
input.read();
inputControl.setReturnValue(FieldSetMapper.BEGIN_RECORD);
inputControl.setReturnValue(AggregateItemReader.BEGIN_RECORD);
input.read();
inputControl.setReturnValue("line",3);
input.read();
inputControl.setReturnValue(FieldSetMapper.END_RECORD);
inputControl.setReturnValue(AggregateItemReader.END_RECORD);
input.read();
inputControl.setReturnValue(null);
inputControl.replay();

View File

@@ -18,9 +18,9 @@ package org.springframework.batch.repeat.support;
import junit.framework.TestCase;
import org.springframework.batch.io.file.FieldSet;
import org.springframework.batch.io.file.FieldSetMapper;
import org.springframework.batch.io.file.SimpleFlatFileItemReader;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSetMapper;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.provider.DelegatingItemReader;
import org.springframework.core.io.ClassPathResource;

View File

@@ -18,7 +18,7 @@ package org.springframework.batch.repeat.support;
import java.math.BigDecimal;
import org.springframework.batch.io.file.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSet;
/**
* @author Rob Harrop