OPEN - issue BATCH-378: RepeatListener is confusing and too generic to use for 'intercepting' a step
http://jira.springframework.org/browse/BATCH-378 Slim down StremManager
This commit is contained in:
@@ -22,9 +22,6 @@ import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.exception.StreamException;
|
||||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
import org.springframework.transaction.TransactionException;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -32,7 +29,7 @@ import org.springframework.transaction.TransactionStatus;
|
||||
*/
|
||||
public class SimpleStreamManagerTests extends TestCase {
|
||||
|
||||
private SimpleStreamManager manager = new SimpleStreamManager(new ResourcelessTransactionManager());
|
||||
private SimpleStreamManager manager = new SimpleStreamManager();
|
||||
|
||||
private List list = new ArrayList();
|
||||
|
||||
@@ -67,36 +64,6 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.stream.SimpleStreamManager#SimpleStreamManager(org.springframework.transaction.PlatformTransactionManager)}.
|
||||
*/
|
||||
public void testSimpleStreamManagerPlatformTransactionManager() {
|
||||
manager = new SimpleStreamManager();
|
||||
try {
|
||||
manager.getTransaction();
|
||||
fail("Expected NullPointerException");
|
||||
}
|
||||
catch (NullPointerException e) {
|
||||
// expected;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.stream.SimpleStreamManager#setTransactionManager(org.springframework.transaction.PlatformTransactionManager)}.
|
||||
*/
|
||||
public void testSetTransactionManager() {
|
||||
manager.setTransactionManager(new ResourcelessTransactionManager() {
|
||||
protected Object doGetTransaction() throws TransactionException {
|
||||
list.add("bar");
|
||||
return super.doGetTransaction();
|
||||
}
|
||||
});
|
||||
manager.getTransaction();
|
||||
assertEquals("bar", list.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.stream.SimpleStreamManager#commit(org.springframework.transaction.TransactionStatus)}.
|
||||
@@ -141,34 +108,4 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.stream.SimpleStreamManager#commit(org.springframework.transaction.TransactionStatus)}.
|
||||
*/
|
||||
public void testCommitWithoutMark() {
|
||||
manager.register(new ItemStreamSupport() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
list.add("bar");
|
||||
}
|
||||
});
|
||||
TransactionStatus status = manager.getTransaction();
|
||||
manager.commit(status);
|
||||
assertEquals(0, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.item.stream.SimpleStreamManager#rollback(org.springframework.transaction.TransactionStatus)}.
|
||||
*/
|
||||
public void testRollbackWithoutMark() {
|
||||
manager.register( new ItemStreamSupport() {
|
||||
public void update(ExecutionContext executionContext) {
|
||||
list.add("bar");
|
||||
}
|
||||
});
|
||||
TransactionStatus status = manager.getTransaction();
|
||||
manager.rollback(status);
|
||||
assertEquals(0, list.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user