本文整理汇总了Java中javax.batch.runtime.BatchStatus类的典型用法代码示例。如果您正苦于以下问题:Java BatchStatus类的具体用法?Java BatchStatus怎么用?Java BatchStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BatchStatus类属于javax.batch.runtime包,在下文中一共展示了BatchStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInvokeJobWithOnePartitionedStep
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testInvokeJobWithOnePartitionedStep() throws Exception {
String METHOD = "testInvokeJobWithOnePartitionedStep";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_partitioned_1step.xml<p>");
Reporter.log("Invoke startJobAndWaitForResult<p>");
JobExecution jobExecution = jobOp.startJobAndWaitForResult("job_partitioned_1step");
Reporter.log("JobExecution getBatchStatus()="+jobExecution.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例2: decide
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Override
public String decide(StepExecution[] stepExecutions) throws Exception {
if (stepExecutions.length != 2) {
throw new IllegalStateException("Expecting stepExecutions array of size 2, found one of size = " + stepExecutions.length);
}
for (StepExecution stepExec : stepExecutions) {
if (stepExec == null) {
throw new Exception("Null StepExecution after split.");
}
if (!stepExec.getBatchStatus().equals(BatchStatus.COMPLETED)) {
throw new Exception("All step executions must be compelete before transitioning to a decider.");
}
}
// <end exit-status="ThatsAllFolks" on="DECIDER_EXIT_STATUS*2" />
return DECIDER_EXIT_STATUS + "*" + stepExecutions.length;
}
示例3: isTerminated
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
private boolean isTerminated(JobExecution jobExecution) {
boolean retVal = false;
BatchStatus bs = jobExecution.getBatchStatus();
if (terminatedStatuses.contains(bs)) {
logger.fine("Found terminating batch status of: " + jobExecution.getBatchStatus().name());
if (jobExecution.getExitStatus() != null) {
logger.fine("Found exit status of: " + jobExecution.getExitStatus());
retVal = true;
} else {
logger.fine("Exit status is still 'null'. Poll again.");
retVal = false;
}
} else {
logger.finer("Found non-terminating batch status of: " + jobExecution.getBatchStatus().name());
retVal = false;
}
return retVal;
}
示例4: testJobContextGetId
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
/**
* @testName: testJobContextGetId
* @assertion: Section 7.7.2 JobContext
* @test_Strategy: 1. setup a simple job with one step
* 2. start job
* 3. set job exit status equals job id from JobContext in batchlet
* 4. compare job id 'job1' to job exit status
*
* <job id="job1" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
* <step id="step1">
* <batchlet ref="contextsGetIdJobContextTestBatchlet"/>
* </step>
* </job>
*
* @throws Exception
*/
@Test
@org.junit.Test
public void testJobContextGetId() throws Exception {
String METHOD = "testJobContextGetId";
try {
String jobId = "job1";
Reporter.log("starting job");
JobExecution jobExec = jobOp.startJobAndWaitForResult("contexts_getid_jobcontext", null);
Reporter.log("Job Status = " + jobExec.getBatchStatus());
assertWithMessage("job id equals job1", jobId, jobExec.getExitStatus());
assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus());
Reporter.log("job completed");
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例5: testStepContextGetId
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
/**
* @testName: testStepContextGetId
* @assertion: Section 7.7.2 StepContext
* @test_Strategy: 1. setup a simple job with one step
* 2. start job
* 3. set job exit status equals step id from StepContext in batchlet
* 4. compare step id 'step1' to job exit status
*
* <job id="job1" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
* <step id="step1">
* <batchlet ref="contextsGetIdStepContextTestBatchlet"/>
* </step>
* </job>
*
* @throws Exception
*/
@Test
@org.junit.Test
public void testStepContextGetId() throws Exception {
String METHOD = "testStepContextGetId";
try {
String stepId = "step1";
Reporter.log("starting job");
JobExecution jobExec = jobOp.startJobAndWaitForResult("contexts_getid_stepcontext", null);
Reporter.log("Job Status = " + jobExec.getBatchStatus());
assertWithMessage("job id equals job1", stepId, jobExec.getExitStatus());
assertWithMessage("Job completed", BatchStatus.COMPLETED, jobExec.getBatchStatus());
Reporter.log("job completed");
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例6: testInvokeJobWithOneBatchletStep
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testInvokeJobWithOneBatchletStep() throws Exception {
String METHOD = "testInvokeJobWithOneBatchletStep";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_batchlet_1step.xml<p>");
Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_1step");
Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
Reporter.log("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()+"<p>");
assertObjEquals("STEP 1 COMPLETED", jobExec.getExitStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例7: testInvokeJobWithTwoStepSequenceOfBatchlets
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testInvokeJobWithTwoStepSequenceOfBatchlets() throws Exception {
String METHOD = "testInvokeJobWithTwoStepSequenceOfBatchlets";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_batchlet_2steps.xml<p>");
Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_2steps");
Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
Reporter.log("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()+"<p>");
assertObjEquals("STEP 2 COMPLETED", jobExec.getExitStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例8: testInvokeJobWithFourStepSequenceOfBatchlets
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testInvokeJobWithFourStepSequenceOfBatchlets() throws Exception {
String METHOD = "testInvokeJobWithFourStepSequenceOfBatchlets";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_batchlet_4steps.xml<p>");
Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_4steps");
Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
Reporter.log("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()+"<p>");
assertObjEquals("STEP 3 COMPLETED", jobExec.getExitStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例9: testInvokeJobWithNextElement
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testInvokeJobWithNextElement() throws Exception {
String METHOD = "testInvokeJobWithNextElement";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_batchlet_nextElement.xml<p>");
Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_nextElement");
Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
Reporter.log("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()+"<p>");
assertObjEquals("STEP 2 COMPLETED", jobExec.getExitStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例10: testInvokeJobWithEndElement
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testInvokeJobWithEndElement() throws Exception {
String METHOD = "testInvokeJobWithEndElement";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_batchlet_endElement.xml<p>");
Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_endElement");
Reporter.log("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()+"<p>");
Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals("TEST_ENDED", jobExec.getExitStatus());
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例11: testInvokeJobSimpleChunk
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testInvokeJobSimpleChunk() throws Exception {
String METHOD = "testInvokeJobSimpleChunk";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_chunk_simple.xml<p>");
Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_simple");
Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
Reporter.log("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()+"<p>");
assertObjEquals("STEP 2 COMPLETED", jobExec.getExitStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例12: testInvokeJobChunkWithFullAttributes
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@org.junit.Test
@Test(enabled=false) // Disabling per Bug 5379
@Ignore("Bug 5379. Decided to exclude this test.")
public void testInvokeJobChunkWithFullAttributes() throws Exception {
String METHOD = "testInvokeJobChunkWithFullAttributes";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_chunk_full_attributes.xml<p>");
Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_full_attributes");
Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例13: testCheckpoint
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testCheckpoint() throws Exception {
String METHOD = "testCheckpoint";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_chunk_checkpoint.xml<p>");
Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_chunk_checkpoint");
Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例14: testSimpleFlow
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testSimpleFlow() throws Exception {
String METHOD = "testSimpleFlow";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_flow_batchlet_4steps.xml<p>");
Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_flow_batchlet_4steps");
Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}
示例15: testInvokeJobSimpleSplit
import javax.batch.runtime.BatchStatus; //导入依赖的package包/类
@Test
@org.junit.Test
public void testInvokeJobSimpleSplit() throws Exception {
String METHOD = "testInvokeJobSimpleSplit";
begin(METHOD);
try {
Reporter.log("Locate job XML file: job_split_batchlet_4steps.xml<p>");
Reporter.log("Invoke startJobAndWaitForResult<p>");
JobExecution execution = jobOp.startJobAndWaitForResult("job_split_batchlet_4steps");
Reporter.log("JobExecution getBatchStatus()="+execution.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
assertObjEquals("COMPLETED", execution.getExitStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}