BATCH-316: Continued work on the Jdbc ItemReader documentation. Mostly additions to the DrivingQuery section.
This commit is contained in:
@@ -163,7 +163,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
public void saveState(Object key, ExecutionContext executionContext) {
|
||||
public void updateContext(Object key, ExecutionContext executionContext) {
|
||||
}});
|
||||
|
||||
try{
|
||||
@@ -235,7 +235,7 @@ public class DrivingQueryItemReaderTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveState(Object key, ExecutionContext executionContext) {
|
||||
public void updateContext(Object key, ExecutionContext executionContext) {
|
||||
executionContext.put(RESTART_KEY, restartKeys);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class MultipleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTran
|
||||
return null;
|
||||
}
|
||||
});
|
||||
keyStrategy.saveState(key, executionContext);
|
||||
keyStrategy.updateContext(key, executionContext);
|
||||
Properties props = executionContext.getProperties();
|
||||
|
||||
assertEquals(2, props.size());
|
||||
@@ -102,7 +102,7 @@ public class MultipleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTran
|
||||
public void testGetNullKeyAsStreamContext(){
|
||||
|
||||
try{
|
||||
keyStrategy.saveState(null, null);
|
||||
keyStrategy.updateContext(null, null);
|
||||
fail();
|
||||
}catch(IllegalArgumentException ex){
|
||||
//expected
|
||||
|
||||
@@ -40,31 +40,39 @@ public class SingleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTransa
|
||||
Long id = (Long)keys.get(i);
|
||||
assertEquals(new Long(i + 1), id);
|
||||
}
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
System.out.println(keys.get(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testRestoreKeys(){
|
||||
|
||||
executionContext.putString("key", "3");
|
||||
keyStrategy.updateContext(new Long(3), executionContext);
|
||||
|
||||
List keys = keyStrategy.retrieveKeys(executionContext);
|
||||
|
||||
assertEquals(2, keys.size());
|
||||
assertEquals(new Long(4), keys.get(0));
|
||||
assertEquals(new Long(5), keys.get(1));
|
||||
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
System.out.println(keys.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetKeyAsStreamContext(){
|
||||
|
||||
keyStrategy.saveState(new Long(3), executionContext);
|
||||
keyStrategy.updateContext(new Long(3), executionContext);
|
||||
|
||||
assertEquals(1, executionContext.size());
|
||||
assertEquals("3", executionContext.getString("key"));
|
||||
assertEquals(new Long(3), executionContext.get("key"));
|
||||
}
|
||||
|
||||
public void testGetNullKeyAsStreamContext(){
|
||||
|
||||
try{
|
||||
keyStrategy.saveState(null, null);
|
||||
keyStrategy.updateContext(null, null);
|
||||
fail();
|
||||
}catch(IllegalArgumentException ex){
|
||||
//expected
|
||||
@@ -74,7 +82,7 @@ public class SingleColumnJdbcKeyGeneratorIntegrationTests extends AbstractTransa
|
||||
public void testRestoreKeysFromNull(){
|
||||
|
||||
try{
|
||||
keyStrategy.saveState(null, null);
|
||||
keyStrategy.updateContext(null, null);
|
||||
}catch(IllegalArgumentException ex){
|
||||
//expected
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user