OPEN - issue BATCH-789: Remove mark/reset from ItemReader
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
package org.springframework.batch.item.database;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
@@ -9,14 +16,8 @@ import org.springframework.batch.item.sample.Foo;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
import org.junit.Before;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* Common scenarios for testing {@link ItemReader} implementations which read data from database.
|
||||
|
||||
@@ -57,17 +57,4 @@ class FooItemReader implements ItemStream, ItemReader<Foo>, DisposableBean, Init
|
||||
itemReader.close(executionContext);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.StreamContext)
|
||||
*/
|
||||
public void mark() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.StreamContext)
|
||||
*/
|
||||
public void reset() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,6 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
assertEquals("[testLine1testLine2]", reader.read().toString());
|
||||
assertEquals("[testLine3testLine4]", reader.read().toString());
|
||||
|
||||
reader.mark();
|
||||
reader.update(executionContext);
|
||||
|
||||
reader.close(executionContext);
|
||||
@@ -156,15 +155,13 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
// read some records
|
||||
reader.read();
|
||||
reader.read();
|
||||
// commit them
|
||||
reader.mark();
|
||||
// get restart data
|
||||
reader.update(executionContext);
|
||||
// read next two records
|
||||
reader.read();
|
||||
reader.read();
|
||||
|
||||
// get restart data
|
||||
reader.update(executionContext);
|
||||
assertEquals(4, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
|
||||
assertEquals(2, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
|
||||
+ ".read.count"));
|
||||
// close input
|
||||
reader.close(executionContext);
|
||||
@@ -175,11 +172,11 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
reader.open(executionContext);
|
||||
|
||||
// read remaining records
|
||||
assertEquals("[testLine5]", reader.read().toString());
|
||||
assertEquals("[testLine6]", reader.read().toString());
|
||||
assertEquals("[testLine3]", reader.read().toString());
|
||||
assertEquals("[testLine4]", reader.read().toString());
|
||||
|
||||
reader.update(executionContext);
|
||||
assertEquals(6, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
|
||||
assertEquals(4, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
|
||||
+ ".read.count"));
|
||||
}
|
||||
|
||||
@@ -193,15 +190,13 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
// read some records
|
||||
reader.read();
|
||||
reader.read();
|
||||
// commit them
|
||||
reader.mark();
|
||||
// get restart data
|
||||
reader.update(executionContext);
|
||||
// read next two records
|
||||
reader.read();
|
||||
reader.read();
|
||||
|
||||
// get restart data
|
||||
reader.update(executionContext);
|
||||
assertEquals(4, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
|
||||
assertEquals(2, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
|
||||
+ ".read.count"));
|
||||
// close input
|
||||
reader.close(executionContext);
|
||||
@@ -212,11 +207,11 @@ public class FlatFileItemReaderAdvancedTests extends TestCase {
|
||||
reader.open(executionContext);
|
||||
|
||||
// read remaining records
|
||||
assertEquals("[testLine5]", reader.read().toString());
|
||||
assertEquals("[testLine6]", reader.read().toString());
|
||||
assertEquals("[testLine3]", reader.read().toString());
|
||||
assertEquals("[testLine4]", reader.read().toString());
|
||||
|
||||
reader.update(executionContext);
|
||||
assertEquals(6, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
|
||||
assertEquals(4, executionContext.getLong(ClassUtils.getShortName(FlatFileItemReader.class)
|
||||
+ ".read.count"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,12 +89,6 @@ public class DelegatingItemReaderTests extends TestCase {
|
||||
public void open(ExecutionContext executionContext) {
|
||||
}
|
||||
|
||||
public void mark() {
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user