BATCH-1011: Added test cases for default "status" attribute
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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.core.configuration.xml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Dan Garrette
|
||||
* @since 2.0
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class EndTransitionDefaultStatusJobParserTests {
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private ArrayList<String> stepNamesList;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEndTransitionDefaultStatus() throws Exception {
|
||||
|
||||
assertNotNull(job);
|
||||
JobExecution jobExecution = jobRepository.createJobExecution(job.getName(), new JobParameters());
|
||||
job.execute(jobExecution);
|
||||
assertEquals(1, stepNamesList.size());
|
||||
assertTrue(stepNamesList.contains("failingStep"));
|
||||
// TODO: BATCH-1011
|
||||
// assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
// assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -68,11 +68,9 @@ public class EndTransitionJobParserTests {
|
||||
assertEquals(2, stepNamesList.size());
|
||||
assertTrue(stepNamesList.contains("step1"));
|
||||
assertTrue(stepNamesList.contains("failingStep"));
|
||||
|
||||
// TODO: BATCH-1011
|
||||
// assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
// assertEquals("EARLY TERMINATION (COMPLETE)", jobExecution.getExitStatus().getExitCode());
|
||||
|
||||
// assertEquals("EARLY TERMINATION (FAIL)", jobExecution.getExitStatus().getExitCode());
|
||||
|
||||
//
|
||||
// Second Launch
|
||||
@@ -87,5 +85,6 @@ public class EndTransitionJobParserTests {
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.core.configuration.xml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Dan Garrette
|
||||
* @since 2.0
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class FailTransitionDefaultStatusJobParserTests {
|
||||
|
||||
@Autowired
|
||||
private Job job;
|
||||
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
|
||||
@Autowired
|
||||
private ArrayList<String> stepNamesList;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MapJobRepositoryFactoryBean.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailTransitionDefaultStatus() throws Exception {
|
||||
|
||||
assertNotNull(job);
|
||||
JobExecution jobExecution = jobRepository.createJobExecution(job.getName(), new JobParameters());
|
||||
job.execute(jobExecution);
|
||||
assertEquals(1, stepNamesList.size());
|
||||
assertTrue(stepNamesList.contains("step1"));
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
// TODO: BATCH-1011
|
||||
// assertEquals(ExitStatus.FAILED, jobExecution.getExitStatus());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,11 +68,9 @@ public class FailTransitionJobParserTests {
|
||||
assertEquals(2, stepNamesList.size());
|
||||
assertTrue(stepNamesList.contains("step1"));
|
||||
assertTrue(stepNamesList.contains("failingStep"));
|
||||
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
// TODO: BATCH-1011
|
||||
// assertEquals("EARLY TERMINATION (COMPLETE)", jobExecution.getExitStatus().getExitCode());
|
||||
|
||||
// assertEquals("EARLY TERMINATION (FAIL)", jobExecution.getExitStatus().getExitCode());
|
||||
|
||||
//
|
||||
// Second Launch
|
||||
@@ -82,10 +80,9 @@ public class FailTransitionJobParserTests {
|
||||
job.execute(jobExecution);
|
||||
assertEquals(1, stepNamesList.size()); //step1 is not executed
|
||||
assertTrue(stepNamesList.contains("failingStep"));
|
||||
|
||||
assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
|
||||
// TODO: BATCH-1011
|
||||
// assertEquals("EARLY TERMINATION (COMPLETE)", jobExecution.getExitStatus().getExitCode());
|
||||
// assertEquals("EARLY TERMINATION (FAIL)", jobExecution.getExitStatus().getExitCode());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user