Remove unnecessary context from mark()/reset() in ItemStream.
This commit is contained in:
@@ -147,11 +147,11 @@ public class DrivingQueryItemReaderTests extends TestCase {
|
||||
|
||||
|
||||
private void commit() {
|
||||
((ItemStream) source).mark(null);
|
||||
((ItemStream) source).mark();
|
||||
}
|
||||
|
||||
private void rollback() {
|
||||
((ItemStream) source).reset(null);
|
||||
((ItemStream) source).reset();
|
||||
}
|
||||
|
||||
private InitializingBean getAsInitializingBean(ItemReader source) {
|
||||
|
||||
@@ -63,14 +63,14 @@ class FooItemReader extends AbstractItemReader implements ItemStream, ItemReader
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.StreamContext)
|
||||
*/
|
||||
public void mark(ExecutionAttributes streamContext) {
|
||||
inputSource.mark(streamContext);
|
||||
public void mark() {
|
||||
inputSource.mark();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.StreamContext)
|
||||
*/
|
||||
public void reset(ExecutionAttributes streamContext) {
|
||||
inputSource.reset(streamContext);
|
||||
public void reset() {
|
||||
inputSource.reset();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -97,13 +97,13 @@ public class DefaultFlatFileItemReaderTests extends TestCase {
|
||||
inputSource.read(); // #1
|
||||
inputSource.read(); // #2
|
||||
// commit them
|
||||
inputSource.mark(null);
|
||||
inputSource.mark();
|
||||
// read next record
|
||||
inputSource.read(); // # 3
|
||||
// mark record as skipped
|
||||
inputSource.skip();
|
||||
// read next records
|
||||
inputSource.reset(null);
|
||||
inputSource.reset();
|
||||
|
||||
// we should now process all records after first commit point, that are
|
||||
// not marked as skipped
|
||||
@@ -135,7 +135,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase {
|
||||
// mark record as skipped
|
||||
inputSource.skip();
|
||||
// rollback
|
||||
inputSource.reset(null);
|
||||
inputSource.reset();
|
||||
// read next record
|
||||
inputSource.read(); // should be #1
|
||||
|
||||
@@ -173,7 +173,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase {
|
||||
inputSource.read();
|
||||
inputSource.read();
|
||||
// commit them
|
||||
inputSource.mark(null);
|
||||
inputSource.mark();
|
||||
// read next two records
|
||||
inputSource.read();
|
||||
inputSource.read();
|
||||
|
||||
@@ -370,11 +370,11 @@ public class FlatFileItemWriterTests extends TestCase {
|
||||
}
|
||||
|
||||
private void commit() {
|
||||
((ItemStream) inputSource).mark(null);
|
||||
((ItemStream) inputSource).mark();
|
||||
}
|
||||
|
||||
private void rollback() {
|
||||
((ItemStream) inputSource).reset(null);
|
||||
((ItemStream) inputSource).reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -150,11 +150,11 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra
|
||||
|
||||
|
||||
private void commit() {
|
||||
((ItemStream) source).mark(null);
|
||||
((ItemStream) source).mark();
|
||||
}
|
||||
|
||||
private void rollback() {
|
||||
((ItemStream) source).reset(null);
|
||||
((ItemStream) source).reset();
|
||||
}
|
||||
|
||||
private ItemStream getAsRestartable(ItemReader source) {
|
||||
|
||||
@@ -221,11 +221,11 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends Abstr
|
||||
}
|
||||
|
||||
private void commit() {
|
||||
((ItemStream) source).mark(((ItemStream) source).getExecutionAttributes());
|
||||
((ItemStream) source).mark();
|
||||
}
|
||||
|
||||
private void rollback() {
|
||||
((ItemStream) source).reset(((ItemStream) source).getExecutionAttributes());
|
||||
((ItemStream) source).reset();
|
||||
}
|
||||
|
||||
private Skippable getAsSkippable(ItemReader source) {
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.batch.io.support;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.item.ExecutionAttributes;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -41,13 +40,13 @@ public class AbstractTransactionalIoSourceTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testCommit(){
|
||||
source.mark(null);
|
||||
source.mark();
|
||||
assertTrue(source.commitCalled);
|
||||
assertFalse(source.rollbackCalled);
|
||||
}
|
||||
|
||||
public void testRollback(){
|
||||
source.reset(null);
|
||||
source.reset();
|
||||
assertFalse(source.commitCalled);
|
||||
assertTrue(source.rollbackCalled);
|
||||
}
|
||||
@@ -57,12 +56,12 @@ public class AbstractTransactionalIoSourceTests extends TestCase {
|
||||
private boolean commitCalled = false;
|
||||
private boolean rollbackCalled = false;
|
||||
|
||||
public void mark(ExecutionAttributes streamContext) {
|
||||
public void mark() {
|
||||
Assert.isTrue(!commitCalled, "Commit aleady called");
|
||||
commitCalled = true;
|
||||
}
|
||||
|
||||
public void reset(ExecutionAttributes streamContext) {
|
||||
public void reset() {
|
||||
Assert.isTrue(!rollbackCalled, "Rollback aleady called");
|
||||
rollbackCalled = true;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class StaxEventItemReaderTests extends TestCase {
|
||||
source.skip();
|
||||
List second = (List) source.read();
|
||||
assertFalse(first.equals(second));
|
||||
source.reset(null);
|
||||
source.reset();
|
||||
|
||||
assertEquals(second, source.read());
|
||||
}
|
||||
@@ -168,21 +168,21 @@ public class StaxEventItemReaderTests extends TestCase {
|
||||
|
||||
// rollback between deserializing records
|
||||
List first = (List) source.read();
|
||||
source.mark(null);
|
||||
source.mark();
|
||||
List second = (List) source.read();
|
||||
assertFalse(first.equals(second));
|
||||
source.reset(null);
|
||||
source.reset();
|
||||
|
||||
assertEquals(second, source.read());
|
||||
|
||||
// rollback while deserializing record
|
||||
source.reset(null);
|
||||
source.reset();
|
||||
source.setFragmentDeserializer(new ExceptionFragmentDeserializer());
|
||||
try {
|
||||
source.read();
|
||||
}
|
||||
catch (Exception expected) {
|
||||
source.reset(null);
|
||||
source.reset();
|
||||
}
|
||||
source.setFragmentDeserializer(deserializer);
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class StaxEventWriterItemWriterTests extends TestCase {
|
||||
public void testRollback() throws Exception {
|
||||
writer.write(record);
|
||||
// rollback
|
||||
writer.reset(null);
|
||||
writer.reset();
|
||||
assertEquals("", outputFileContent());
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class StaxEventWriterItemWriterTests extends TestCase {
|
||||
public void testCommit() throws Exception {
|
||||
writer.write(record);
|
||||
// commit
|
||||
writer.mark(null);
|
||||
writer.mark();
|
||||
assertTrue(outputFileContent().contains(TEST_STRING));
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class StaxEventWriterItemWriterTests extends TestCase {
|
||||
public void testRestart() throws Exception {
|
||||
// write records
|
||||
writer.write(record);
|
||||
writer.mark(null);
|
||||
writer.mark();
|
||||
ExecutionAttributes streamContext = writer.getExecutionAttributes();
|
||||
|
||||
// create new writer from saved restart data and continue writing
|
||||
@@ -131,7 +131,7 @@ public class StaxEventWriterItemWriterTests extends TestCase {
|
||||
put("attribute", "value");
|
||||
}});
|
||||
writer.open();
|
||||
writer.mark(null);
|
||||
writer.mark();
|
||||
|
||||
assertTrue(outputFileContent().indexOf("<testroot attribute=\"value\"") != NOT_FOUND);
|
||||
|
||||
|
||||
@@ -129,10 +129,10 @@ public class DelegatingItemReaderTests extends TestCase {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void mark(ExecutionAttributes streamContext) {
|
||||
public void mark() {
|
||||
}
|
||||
|
||||
public void reset(ExecutionAttributes streamContext) {
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void mark(ExecutionAttributes streamContext) {
|
||||
public void mark() {
|
||||
list.add("bar");
|
||||
}
|
||||
}, null);
|
||||
@@ -190,7 +190,7 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
*/
|
||||
public void testCommitWithoutMark() {
|
||||
manager.register("foo", new ItemStreamAdapter() {
|
||||
public void mark(ExecutionAttributes streamContext) {
|
||||
public void mark() {
|
||||
list.add("bar");
|
||||
}
|
||||
}, null);
|
||||
@@ -209,7 +209,7 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void reset(ExecutionAttributes streamContext) {
|
||||
public void reset() {
|
||||
list.add("bar");
|
||||
}
|
||||
}, null);
|
||||
@@ -224,7 +224,7 @@ public class SimpleStreamManagerTests extends TestCase {
|
||||
*/
|
||||
public void testRollbackWithoutMark() {
|
||||
manager.register("foo", new ItemStreamAdapter() {
|
||||
public void reset(ExecutionAttributes streamContext) {
|
||||
public void reset() {
|
||||
list.add("bar");
|
||||
}
|
||||
}, null);
|
||||
|
||||
Reference in New Issue
Block a user