BATCH-220: Half way to rename StepHandler -> Tasklet
This commit is contained in:
@@ -17,7 +17,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration()
|
||||
public class HandlerJobFunctionalTests extends AbstractValidatingBatchLauncherTests {
|
||||
public class TaskletJobFunctionalTests extends AbstractValidatingBatchLauncherTests {
|
||||
|
||||
private Resource directory = new FileSystemResource("target/test-outputs/test-dir");
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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.sample.support;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.item.validator.ValidationException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class ItemTrackingItemWriterTests {
|
||||
|
||||
private ItemTrackingItemWriter<String> writer = new ItemTrackingItemWriter<String>();
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.sample.support.ItemTrackingItemWriter#write(java.util.List)}.
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testWrite() throws Exception {
|
||||
assertEquals(0, writer.getItems().size());
|
||||
writer.write(Arrays.asList("a", "b", "c"));
|
||||
assertEquals(3, writer.getItems().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidationFailure() throws Exception {
|
||||
writer.setValidationFailure(2);
|
||||
try {
|
||||
writer.write(Arrays.asList("a", "b", "c"));
|
||||
fail("Expected ValidationException");
|
||||
}
|
||||
catch (ValidationException e) {
|
||||
// expected
|
||||
}
|
||||
assertEquals(3, writer.getItems().size());
|
||||
writer.write(Arrays.asList("a", "e", "c"));
|
||||
assertEquals(6, writer.getItems().size());
|
||||
try {
|
||||
writer.write(Arrays.asList("f", "b", "g"));
|
||||
fail("Expected ValidationException");
|
||||
}
|
||||
catch (ValidationException e) {
|
||||
// expected
|
||||
}
|
||||
assertEquals(6, writer.getItems().size());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,6 @@
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<import resource="classpath:/simple-job-launcher-context.xml" />
|
||||
<import resource="classpath:/jobs/handlerJob.xml" />
|
||||
<import resource="classpath:/jobs/taskletJob.xml" />
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user