use of org.cerberus.crud.service.ITestCaseStepActionControlExecutionService in project cerberus-source by cerberustesting.
the class UpdateTestCaseExecution method updateTestCaseStepActionControlExecutionFromJsonArray.
/**
* update control execution with testCaseStepActionControlJson
* @param JSONObject testCaseJson
* @param ApplicationContext appContext
* @throws JSONException
* @throws IOException
*/
void updateTestCaseStepActionControlExecutionFromJsonArray(JSONArray controlArray, ApplicationContext appContext) throws JSONException, IOException {
for (int i = 0; i < controlArray.length(); i++) {
JSONObject currentControl = controlArray.getJSONObject(i);
long id = currentControl.getLong("id");
String test = currentControl.getString("test");
String testCase = currentControl.getString("testcase");
int step = currentControl.getInt("step");
int index = currentControl.getInt("index");
int sort = currentControl.getInt("sort");
int sequence = currentControl.getInt("sequence");
int controlSequence = currentControl.getInt("control");
String conditionOper = currentControl.getString("conditionOper");
String conditionVal1Init = currentControl.getString("conditionVal1Init");
String conditionVal2Init = currentControl.getString("conditionVal2Init");
String conditionVal1 = currentControl.getString("conditionVal1");
String conditionVal2 = currentControl.getString("conditionVal2");
String control = currentControl.getString("controlType");
String value1Init = currentControl.getString("value1init");
String value2Init = currentControl.getString("value2init");
String value1 = currentControl.getString("value1");
String value2 = currentControl.getString("value2");
String fatal = currentControl.getString("fatal");
String description = currentControl.getString("description");
String returnCode = currentControl.getString("returnCode");
// String wrote by the user
String returnMessage = StringUtil.sanitize(currentControl.getString("returnMessage"));
if (// default message unchanged
returnMessage.equals("Control executed manually"))
returnMessage = "Control executed manually";
long start = currentControl.getLong("start");
long end = currentControl.getLong("end");
// currentAction.getLong("fullStart");
long fullStart = 0;
// currentAction.getLong("fullEnd");
long fullEnd = 0;
// create this TestCaseStepActionControlExecution and update the bdd with it
TestCaseStepActionControlExecution currentTestCaseStepActionControlExecution = createTestCaseStepActionControlExecution(id, test, testCase, step, index, sequence, controlSequence, sort, returnCode, returnMessage, conditionOper, conditionVal1Init, conditionVal2Init, conditionVal1, conditionVal2, control, value1Init, value2Init, value1, value2, fatal, start, end, fullStart, fullEnd, description, null, null);
ITestCaseStepActionControlExecutionService testCaseStepActionControlExecutionService = appContext.getBean(ITestCaseStepActionControlExecutionService.class);
testCaseStepActionControlExecutionService.updateTestCaseStepActionControlExecution(currentTestCaseStepActionControlExecution);
}
}
Aggregations