Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

made test for case of no transition elements #55

Merged
merged 3 commits into from
Aug 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 International Business Machines Corp.
* Copyright 2016 International Business Machines Corp.
*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. Licensed under the Apache License,
Expand Down Expand Up @@ -168,6 +168,43 @@ public void testInvokeJobWithNextElement() throws Exception {
handleException(METHOD, e);
}
}


/*
* @testName: testJobWithNoMatchingTransitionElement
* @assertion: job will finish successfully with an exit status set to "nullUnusedExitStatusForPartitions"
* @test_Strategy: The job is written with no transitions elements in the first step, and no next attribute for step1.
* With no clear next step, the job should finish on step 1. The test ensures that step 2 is not run.
*/

@TCKTest(
specRefs={
@SpecRef(section="8.9.2",version="1.0", citation={"If a match is not found among the transition elements... If execution ended normally, and the execution element whose execution is completing does not contain a ‘next’ attribute, then the job ends normally (with COMPLETED batch status)."}),
},
apiRefs={},
versions="1.1.WORKING",
assertions={"Step 2 does not execute"})
@Test
@org.junit.Test
public void testJobWithNoMatchingTransitionElement() throws Exception {
String METHOD = "testJobWithNoMatchingTransitionElement";
begin(METHOD);

try {
Reporter.log("Locate job XML file: job_batchlet_no_matching_element.xml<p>");

Reporter.log("Invoking startJobAndWaitForResult for Execution #1<p>");
JobExecution jobExec = jobOp.startJobAndWaitForResult("job_batchlet_no_matching_element");

Reporter.log("execution #1 JobExecution getBatchStatus()="+jobExec.getBatchStatus()+"<p>");
assertObjEquals(BatchStatus.COMPLETED, jobExec.getBatchStatus());
Reporter.log("execution #1 JobExecution getExitStatus()="+jobExec.getExitStatus()+"<p>");
final String expectedExitStatus="nullUnusedExitStatusForPartitions";
assertObjEquals(expectedExitStatus, jobExec.getExitStatus());
} catch (Exception e) {
handleException(METHOD, e);
}
}

/*
* @testName: testInvokeJobWithFailElement
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2016 International Business Machines Corp.

See the NOTICE file distributed with this work for additional information
regarding copyright ownership. 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.
-->
<job id="job_batchlet_no_matching_element" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
<step id="step1">
<batchlet ref="myBatchletImpl" />
</step>
<step id="step2" >
<batchlet ref="myBatchletImpl" />
<end on="*" exit-status="STEP 2 COMPLETED"/>
</step>
</job>