OPEN - issue BATCH-87: Recoverable is a nasty abstraction - encourages stateful Tasklets.
http://opensource.atlassian.com/projects/spring/browse/BATCH-87 Moved recovery responsibility to a separate infrastructure interface.
This commit is contained in:
@@ -32,12 +32,4 @@ public class ItemProviderTests extends TestCase {
|
||||
assertEquals("foo", provider.next());
|
||||
}
|
||||
|
||||
public void testRecover() throws Exception {
|
||||
try {
|
||||
provider.recover("foo", null);
|
||||
}
|
||||
catch (Exception e) {
|
||||
fail("Unexpected Exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.item;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.item.provider.AbstractItemProvider;
|
||||
|
||||
public class ItemRecoveryHandlerTests extends TestCase {
|
||||
|
||||
ItemRecoverer recoverer = new AbstractItemProvider() {
|
||||
public Object next() {
|
||||
return "foo";
|
||||
}
|
||||
};
|
||||
|
||||
public void testRecover() throws Exception {
|
||||
try {
|
||||
recoverer.recover("foo", null);
|
||||
}
|
||||
catch (Exception e) {
|
||||
fail("Unexpected Exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class ItemProviderRetryCallbackTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testRecoverWithoutSession() throws Exception {
|
||||
callback.getProvider().recover("foo", null);
|
||||
callback.getRecoverer().recover("foo", null);
|
||||
assertEquals(1, count);
|
||||
assertEquals(1, calls.size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user