IN PROGRESS - issue BATCH-7: Remove transaction synchronization and state management from input/output sources (formerly buffering)

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

Remove GenericStreamContext
This commit is contained in:
dsyer
2008-02-02 15:16:20 +00:00
parent d1ab2086a6
commit 2d1ccb0cc6
30 changed files with 60 additions and 151 deletions

View File

@@ -10,7 +10,6 @@ import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.stream.GenericStreamContext;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;
@@ -118,7 +117,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
* @throws Exception
*/
public void testRestoreFromEmptyData() throws Exception {
StreamContext streamContext = new GenericStreamContext(new Properties());
StreamContext streamContext = new StreamContext();
getAsRestartable(source).restoreFrom(streamContext);
@@ -174,7 +173,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
//restart data properties cannot be empty.
props.setProperty("", "");
streamContext = new GenericStreamContext(props);
streamContext = new StreamContext(props);
}
public MockKeyGenerator() {

View File

@@ -12,7 +12,6 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.stream.GenericStreamContext;
import org.springframework.core.CollectionFactory;
import org.springframework.jdbc.core.PreparedStatementSetter;
@@ -78,7 +77,7 @@ public class ColumnMapRestartDataRowMapperTests extends TestCase {
Properties props = new Properties();
props.setProperty(KEY + "0", "1");
props.setProperty(KEY + "1", "2");
StreamContext streamContext = new GenericStreamContext(props);
StreamContext streamContext = new StreamContext(props);
PreparedStatementSetter setter = mapper.createSetter(streamContext);
ps = (PreparedStatement)psControl.getMock();

View File

@@ -8,7 +8,6 @@ import java.util.Map;
import java.util.Properties;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.stream.GenericStreamContext;
import org.springframework.core.CollectionFactory;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
@@ -49,7 +48,7 @@ public class MultipleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTran
Properties props = new Properties();
props.setProperty(ColumnMapStreamContextRowMapper.KEY_PREFIX + "0", "3");
props.setProperty(ColumnMapStreamContextRowMapper.KEY_PREFIX + "1", "3");
StreamContext streamContext = new GenericStreamContext(props);
StreamContext streamContext = new StreamContext(props);
List keys = keyStrategy.restoreKeys(streamContext);

View File

@@ -4,7 +4,6 @@ import java.util.List;
import java.util.Properties;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.stream.GenericStreamContext;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
/**
@@ -44,7 +43,7 @@ public class SingleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTransa
Properties props = new Properties();
props.setProperty(SingleColumnJdbcKeyGenerator.RESTART_KEY, "3");
StreamContext streamContext = new GenericStreamContext(props);
StreamContext streamContext = new StreamContext(props);
List keys = keyStrategy.restoreKeys(streamContext);

View File

@@ -1,12 +1,9 @@
package org.springframework.batch.io.sql;
import java.util.Properties;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.stream.GenericStreamContext;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
@@ -123,7 +120,7 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra
* @throws Exception
*/
public void testRestoreFromEmptyData() throws Exception {
StreamContext streamContext = new GenericStreamContext(new Properties());
StreamContext streamContext = new StreamContext();
getAsRestartable(source).restoreFrom(streamContext);

View File

@@ -1,13 +1,10 @@
package org.springframework.batch.io.support;
import java.util.Properties;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.stream.GenericStreamContext;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
@@ -130,7 +127,7 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends Abstr
* @throws Exception
*/
public void testRestoreFromEmptyData() throws Exception {
StreamContext streamContext = new GenericStreamContext(new Properties());
StreamContext streamContext = new StreamContext();
getAsRestartable(source).restoreFrom(streamContext);

View File

@@ -24,7 +24,6 @@ import org.springframework.batch.io.Skippable;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.stream.GenericStreamContext;
import org.springframework.batch.support.PropertiesConverter;
/**
@@ -83,7 +82,7 @@ public class DelegatingItemReaderTests extends TestCase {
* @throws Exception
*/
public void testRestoreFrom() throws Exception {
itemProvider.restoreFrom(new GenericStreamContext(PropertiesConverter.stringToProperties("value=bar")));
itemProvider.restoreFrom(new StreamContext(PropertiesConverter.stringToProperties("value=bar")));
assertEquals("bar", itemProvider.read());
}
@@ -101,7 +100,7 @@ public class DelegatingItemReaderTests extends TestCase {
}
public StreamContext getStreamContext() {
return new GenericStreamContext(PropertiesConverter.stringToProperties("value=foo"));
return new StreamContext(PropertiesConverter.stringToProperties("value=foo"));
}
public void restoreFrom(StreamContext data) {

View File

@@ -24,7 +24,6 @@ import junit.framework.TestCase;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.stream.GenericStreamContext;
import org.springframework.batch.support.PropertiesConverter;
/**
@@ -66,7 +65,7 @@ public class ItemWriterItemProcessorTests extends TestCase {
* @throws Exception
*/
public void testRestoreFrom() throws Exception {
processor.restoreFrom(new GenericStreamContext(PropertiesConverter.stringToProperties("value=bar")));
processor.restoreFrom(new StreamContext(PropertiesConverter.stringToProperties("value=bar")));
processor.write("foo");
assertEquals("bar:foo", list.get(0));
}
@@ -93,7 +92,7 @@ public class ItemWriterItemProcessorTests extends TestCase {
public void testRestoreFromWithoutRestartable() throws Exception {
processor.setDelegate(null);
try {
processor.restoreFrom(new GenericStreamContext(PropertiesConverter.stringToProperties("value=bar")));
processor.restoreFrom(new StreamContext(PropertiesConverter.stringToProperties("value=bar")));
fail("Expected IllegalStateException");
}
catch (IllegalStateException e) {
@@ -145,12 +144,8 @@ public class ItemWriterItemProcessorTests extends TestCase {
public void open() {
}
public Properties getStatistics() {
return PropertiesConverter.stringToProperties("a=b");
}
public StreamContext getStreamContext() {
return new GenericStreamContext(PropertiesConverter.stringToProperties("value=foo"));
return new StreamContext(PropertiesConverter.stringToProperties("value=foo"));
}
public void restoreFrom(StreamContext data) {