BAEL-1543: Spring Batch: Tasklets vs Chunks

This commit is contained in:
Magdalena Krause
2018-02-15 12:57:27 -03:00
parent 4f6988b134
commit 443e990fd1
15 changed files with 599 additions and 2 deletions
@@ -0,0 +1,24 @@
package org.baeldung.taskletsvschunks.chunks;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:/taskletsvschunks/chunks.xml")
public class ChunksTest {
@Autowired private JobLauncherTestUtils jobLauncherTestUtils;
@Test
public void test() throws Exception {
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
Assert.assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus());
}
}
@@ -0,0 +1,24 @@
package org.baeldung.taskletsvschunks.tasklets;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:/taskletsvschunks/tasklets.xml")
public class TaskletsTest {
@Autowired private JobLauncherTestUtils jobLauncherTestUtils;
@Test
public void test() throws Exception {
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
Assert.assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus());
}
}