use of org.cerberus.crud.service.ILogEventService in project cerberus-source by cerberustesting.
the class DeleteTestDataLib method processRequest.
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
JSONObject jsonResponse = new JSONObject();
Answer ans = new Answer();
MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));
ans.setResultMessage(msg);
response.setContentType("application/json");
/**
* Parsing and securing all required parameters.
*/
Integer key = 0;
boolean testdatalibid_error = true;
try {
if (request.getParameter("testdatalibid") != null && !request.getParameter("testdatalibid").isEmpty()) {
key = Integer.valueOf(request.getParameter("testdatalibid"));
testdatalibid_error = false;
}
} catch (NumberFormatException ex) {
testdatalibid_error = true;
LOG.warn(ex);
}
/**
* Checking all constrains before calling the services.
*/
if (testdatalibid_error) {
msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);
msg.setDescription(msg.getDescription().replace("%ITEM%", "Test Data Library").replace("%OPERATION%", "Delete").replace("%REASON%", "Test data library (testdatalibid) is missing."));
ans.setResultMessage(msg);
} else {
/**
* All data seems cleans so we can call the services.
*/
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
ITestDataLibService libService = appContext.getBean(ITestDataLibService.class);
AnswerItem resp = libService.readByKey(key);
if (!(resp.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode()) && resp.getItem() != null)) {
/**
* Object could not be found. We stop here and report the error.
*/
msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);
msg.setDescription(msg.getDescription().replace("%ITEM%", "Test Data Library").replace("%OPERATION%", "Delete").replace("%REASON%", "Test Data Library does not exist."));
ans.setResultMessage(msg);
} else {
/**
* The service was able to perform the query and confirm the
* object exist, then we can delete it.
*/
TestDataLib lib = (TestDataLib) resp.getItem();
ans = libService.delete(lib);
/**
* Delete was perform with success. Adding Log entry.
*/
if (ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
ILogEventService logEventService = appContext.getBean(LogEventService.class);
logEventService.createForPrivateCalls("/DeleteTestDataLib", "DELETE", "Delete TestDataLib : " + key, request);
}
}
}
try {
/**
* Formating and returning the json result.
*/
jsonResponse.put("messageType", ans.getResultMessage().getMessage().getCodeString());
jsonResponse.put("message", ans.getResultMessage().getDescription());
response.getWriter().print(jsonResponse.toString());
response.getWriter().flush();
} catch (JSONException ex) {
LOG.warn(ex);
response.setContentType("application/json");
response.getWriter().print(AnswerUtil.createGenericErrorAnswer());
response.getWriter().flush();
}
}
use of org.cerberus.crud.service.ILogEventService in project cerberus-source by cerberustesting.
the class CreateTestDataLib method processRequest.
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
IFactoryTestDataLibData tdldFactory = appContext.getBean(IFactoryTestDataLibData.class);
ITestDataLibDataService tdldService = appContext.getBean(ITestDataLibDataService.class);
IParameterService parameterService = appContext.getBean(IParameterService.class);
JSONObject jsonResponse = new JSONObject();
Answer ans = new Answer();
AnswerItem ansItem = new AnswerItem();
MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));
ans.setResultMessage(msg);
PolicyFactory policy = Sanitizers.FORMATTING.and(Sanitizers.LINKS);
String charset = request.getCharacterEncoding();
response.setContentType("application/json");
Map<String, String> fileData = new HashMap<String, String>();
FileItem file = null;
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
try {
List<FileItem> fields = upload.parseRequest(request);
Iterator<FileItem> it = fields.iterator();
if (!it.hasNext()) {
return;
}
while (it.hasNext()) {
FileItem fileItem = it.next();
boolean isFormField = fileItem.isFormField();
if (isFormField) {
fileData.put(fileItem.getFieldName(), ParameterParserUtil.parseStringParamAndDecode(fileItem.getString("UTF-8"), "", charset));
} else {
file = fileItem;
}
}
} catch (FileUploadException e) {
e.printStackTrace();
}
try {
/**
* Parsing and securing all required parameters.
*/
// Parameter that are already controled by GUI (no need to decode) --> We SECURE them
String type = policy.sanitize(fileData.get("type"));
String system = policy.sanitize(fileData.get("system"));
String environment = policy.sanitize(fileData.get("environment"));
String country = policy.sanitize(fileData.get("country"));
String database = policy.sanitize(fileData.get("database"));
String databaseUrl = policy.sanitize(fileData.get("databaseUrl"));
String databaseCsv = policy.sanitize(fileData.get("databaseCsv"));
// Parameter that needs to be secured --> We SECURE+DECODE them
// this is mandatory
String name = fileData.get("name");
String group = fileData.get("group");
String description = fileData.get("libdescription");
String service = fileData.get("service");
// Parameter that we cannot secure as we need the html --> We DECODE them
String script = fileData.get("script");
String servicePath = fileData.get("servicepath");
String method = fileData.get("method");
String envelope = fileData.get("envelope");
String csvUrl = fileData.get("csvUrl");
String separator = fileData.get("separator");
String test = fileData.get("subdataCheck");
/**
* Checking all constrains before calling the services.
*/
// Prepare the final answer.
MessageEvent msg1 = new MessageEvent(MessageEventEnum.GENERIC_OK);
Answer finalAnswer = new Answer(msg1);
if (StringUtil.isNullOrEmpty(name)) {
msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);
msg.setDescription(msg.getDescription().replace("%ITEM%", "Test Data Library").replace("%OPERATION%", "Create").replace("%REASON%", "Test data library name is missing! "));
finalAnswer.setResultMessage(msg);
} else {
/**
* All data seems cleans so we can call the services.
*/
ITestDataLibService libService = appContext.getBean(ITestDataLibService.class);
IFactoryTestDataLib factoryLibService = appContext.getBean(IFactoryTestDataLib.class);
TestDataLib lib = factoryLibService.create(0, name, system, environment, country, group, type, database, script, databaseUrl, service, servicePath, method, envelope, databaseCsv, csvUrl, separator, description, request.getRemoteUser(), null, "", null, null, null, null, null);
// Creates the entries and the subdata list
ansItem = libService.create(lib);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) ansItem);
/**
* Object created. Adding Log entry.
*/
if (ansItem.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
ILogEventService logEventService = appContext.getBean(LogEventService.class);
logEventService.createForPrivateCalls("/CreateTestDataLib", "CREATE", "Create TestDataLib : " + request.getParameter("name"), request);
}
List<TestDataLibData> tdldList = new ArrayList();
TestDataLib dataLibWithUploadedFile = (TestDataLib) ansItem.getItem();
if (file != null) {
ans = libService.uploadFile(dataLibWithUploadedFile.getTestDataLibID(), file);
if (ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
dataLibWithUploadedFile.setCsvUrl(File.separator + dataLibWithUploadedFile.getTestDataLibID() + File.separator + file.getName());
libService.update(dataLibWithUploadedFile);
}
}
// Getting list of SubData from JSON Call
if (fileData.get("subDataList") != null) {
JSONArray objSubDataArray = new JSONArray(fileData.get("subDataList"));
tdldList = getSubDataFromParameter(request, appContext, dataLibWithUploadedFile.getTestDataLibID(), objSubDataArray);
}
if (file != null && test.equals("1")) {
String firstLine = "";
String secondLine = "";
try (BufferedReader reader = new BufferedReader(new FileReader(parameterService.getParameterStringByKey("cerberus_testdatalibCSV_path", "", null) + lib.getCsvUrl()))) {
firstLine = reader.readLine();
secondLine = reader.readLine();
String[] firstLineSubData = (!dataLibWithUploadedFile.getSeparator().isEmpty()) ? firstLine.split(dataLibWithUploadedFile.getSeparator()) : firstLine.split(",");
String[] secondLineSubData = (!dataLibWithUploadedFile.getSeparator().isEmpty()) ? secondLine.split(dataLibWithUploadedFile.getSeparator()) : secondLine.split(",");
int i = 0;
int y = 1;
TestDataLibData firstLineLibData = tdldList.get(0);
tdldList = new ArrayList();
if (StringUtil.isNullOrEmpty(firstLineLibData.getColumnPosition())) {
firstLineLibData.setColumnPosition("1");
}
if (StringUtil.isNullOrEmpty(firstLineLibData.getValue())) {
firstLineLibData.setValue(secondLineSubData[0]);
}
if (StringUtil.isNullOrEmpty(firstLineLibData.getColumn())) {
firstLineLibData.setColumn(firstLineSubData[0]);
}
tdldList.add(firstLineLibData);
for (String item : firstLineSubData) {
TestDataLibData tdld = tdldFactory.create(null, dataLibWithUploadedFile.getTestDataLibID(), item + "_" + y, secondLineSubData[i], item, null, Integer.toString(y), null);
tdldList.add(tdld);
i++;
y++;
}
// Update the Database with the new list.
} finally {
try {
file.getInputStream().close();
} catch (Throwable ignore) {
}
}
}
ans = tdldService.compareListAndUpdateInsertDeleteElements(dataLibWithUploadedFile.getTestDataLibID(), tdldList);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) ans);
}
/**
* Formating and returning the json result.
*/
// sets the message returned by the operations
jsonResponse.put("messageType", finalAnswer.getResultMessage().getMessage().getCodeString());
jsonResponse.put("message", finalAnswer.getResultMessage().getDescription());
response.getWriter().print(jsonResponse);
response.getWriter().flush();
} catch (JSONException ex) {
LOG.warn(ex);
response.getWriter().print(AnswerUtil.createGenericErrorAnswer());
response.getWriter().flush();
}
}
use of org.cerberus.crud.service.ILogEventService in project cerberus-source by cerberustesting.
the class CreateProject method processRequest.
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
* @throws org.cerberus.exception.CerberusException
* @throws org.json.JSONException
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, CerberusException, JSONException {
JSONObject jsonResponse = new JSONObject();
Answer ans = new Answer();
MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));
ans.setResultMessage(msg);
PolicyFactory policy = Sanitizers.FORMATTING.and(Sanitizers.LINKS);
response.setContentType("application/json");
// Calling Servlet Transversal Util.
ServletUtil.servletStart(request);
/**
* Parsing and securing all required parameters.
*/
String idProject = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("idProject"), "");
String code = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("VCCode"), "");
String description = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("Description"), "");
String active = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("Active"), "");
/**
* Checking all constrains before calling the services.
*/
if (idProject.isEmpty() || code.isEmpty()) {
msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);
msg.setDescription(msg.getDescription().replace("%ITEM%", "Project").replace("%OPERATION%", "Create").replace("%REASON%", "Some mendatory fields are missing!"));
ans.setResultMessage(msg);
} else {
/**
* All data seems cleans so we can call the services.
*/
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
IProjectService projectService = appContext.getBean(IProjectService.class);
IFactoryProject factoryProject = appContext.getBean(IFactoryProject.class);
Project projectData = factoryProject.create(idProject, code, description, active, "");
ans = projectService.create(projectData);
if (ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
/**
* Object created. Adding Log entry.
*/
ILogEventService logEventService = appContext.getBean(LogEventService.class);
IFactoryLogEvent factoryLogEvent = appContext.getBean(FactoryLogEvent.class);
logEventService.createForPrivateCalls("/CreateProject", "CREATE", "Create Project : ['" + idProject + "']", request);
}
}
/**
* Formating and returning the json result.
*/
jsonResponse.put("messageType", ans.getResultMessage().getMessage().getCodeString());
jsonResponse.put("message", ans.getResultMessage().getDescription());
response.getWriter().print(jsonResponse);
response.getWriter().flush();
}
use of org.cerberus.crud.service.ILogEventService in project cerberus-source by cerberustesting.
the class CreateNotDefinedProperty method processRequest.
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
JSONObject jsonResponse = new JSONObject();
MessageEvent rs = null;
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
ITestCaseCountryPropertiesService testCaseCountryPropertiesService = appContext.getBean(TestCaseCountryPropertiesService.class);
ITestCaseCountryService testCaseCountryService = appContext.getBean(TestCaseCountryService.class);
IFactoryTestCaseCountryProperties factoryTestCaseCountryProperties = appContext.getBean(FactoryTestCaseCountryProperties.class);
try {
String propertyName = request.getParameter("property");
if (propertyName != null) {
propertyName = propertyName.replace("%", "");
}
String toTest = request.getParameter("totest");
String toTestCase = request.getParameter("totestcase");
String propertyType = request.getParameter("propertyType");
String userLanguage = request.getParameter("userLanguage");
// We retrieve all country of the destination TestCase
List<String> toCountriesAll = testCaseCountryService.findListOfCountryByTestTestCase(toTest, toTestCase);
if (toCountriesAll != null && toCountriesAll.size() > 0) {
// Variable for the properties list of the destination TestCase
List<TestCaseCountryProperties> listOfPropertiesToInsert = new ArrayList<TestCaseCountryProperties>();
// Variable for the countries of a property of the destination TestCase
List<String> toCountriesProp;
IDocumentationService docService = appContext.getBean(DocumentationService.class);
String notDefinedProperty = docService.findLabel("page_testcase", "txt_property_not_defined", "** Property not defined **", userLanguage);
// List of all country of the destination test for the current property
List<String> toCountries = new ArrayList<String>();
toCountries.addAll(toCountriesAll);
// Retrieve the country of the destination TestCase for the property,
// if not empty remove it (property aleady exists for these countries)
toCountriesProp = testCaseCountryPropertiesService.findCountryByPropertyNameAndTestCase(toTest, toTestCase, propertyName);
if (toCountriesProp != null && toCountriesProp.size() > 0) {
toCountries.removeAll(toCountriesProp);
}
for (String country : toCountries) {
listOfPropertiesToInsert.add(factoryTestCaseCountryProperties.create(toTest, toTestCase, country, propertyName, "", propertyType, "---", notDefinedProperty, "", "0", 0, "STATIC", 0, 10000, 0));
}
Answer answer = testCaseCountryPropertiesService.createListTestCaseCountryPropertiesBatch(listOfPropertiesToInsert);
rs = answer.getResultMessage();
// then a new entry should be added by the log service
if (answer.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
// Adding Log entry.
ILogEventService logEventService = appContext.getBean(LogEventService.class);
logEventService.createForPrivateCalls("/CreateNotDefinedProperty", "CREATE", "Create NotDefinedProperty:" + " " + propertyName, request);
}
} else {
rs = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);
rs.setDescription(rs.getDescription().replace("%ITEM%", "Property ").replace("%OPERATION%", "CREATE").replace("%REASON%", "No countries were defined for the test case."));
}
// sets the message returned by the operations
jsonResponse.put("messageType", rs.getMessage().getCodeString());
jsonResponse.put("message", rs.getDescription());
response.setContentType("application/json");
response.getWriter().print(jsonResponse);
response.getWriter().flush();
} catch (JSONException ex) {
LOG.warn(ex);
// returns a default error message with the json format that is able to be parsed by the client-side
response.getWriter().print(AnswerUtil.createGenericErrorAnswer());
}
}
use of org.cerberus.crud.service.ILogEventService in project cerberus-source by cerberustesting.
the class CreateTestCase method processRequest.
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, CerberusException, JSONException {
JSONObject jsonResponse = new JSONObject();
Answer ans = new Answer();
MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));
ans.setResultMessage(msg);
PolicyFactory policy = Sanitizers.FORMATTING.and(Sanitizers.LINKS);
response.setContentType("application/json");
// Calling Servlet Transversal Util.
ServletUtil.servletStart(request);
/**
* Parsing and securing all required parameters.
*/
String test = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("test"), "");
String testcase = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("testCase"), "");
String originalTest = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("originalTest"), "");
String originalTestCase = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("originalTestCase"), "");
// Prepare the final answer.
MessageEvent msg1 = new MessageEvent(MessageEventEnum.GENERIC_OK);
Answer finalAnswer = new Answer(msg1);
/**
* Checking all constrains before calling the services.
*/
if (StringUtil.isNullOrEmpty(test) && StringUtil.isNullOrEmpty(testcase)) {
msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);
msg.setDescription(msg.getDescription().replace("%ITEM%", "Test Case").replace("%OPERATION%", "Create").replace("%REASON%", "mandatory fields (test or testcase) are missing."));
finalAnswer.setResultMessage(msg);
} else {
/**
* All data seems cleans so we can call the services.
*/
ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
testCaseService = appContext.getBean(ITestCaseService.class);
testCaseLabelService = appContext.getBean(ITestCaseLabelService.class);
testCaseLabelFactory = appContext.getBean(IFactoryTestCaseLabel.class);
testCaseCountryService = appContext.getBean(ITestCaseCountryService.class);
testCaseCountryFactory = appContext.getBean(IFactoryTestCaseCountry.class);
testCaseCountryPropertiesService = appContext.getBean(ITestCaseCountryPropertiesService.class);
testCaseStepService = appContext.getBean(ITestCaseStepService.class);
testCaseStepActionService = appContext.getBean(ITestCaseStepActionService.class);
testCaseStepActionControlService = appContext.getBean(ITestCaseStepActionControlService.class);
TestCase testCaseData = getTestCaseFromRequest(request);
ans = testCaseService.create(testCaseData);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) ans);
if (ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
/**
* Object created. Adding Log entry.
*/
ILogEventService logEventService = appContext.getBean(LogEventService.class);
logEventService.createForPrivateCalls("/CreateTestCase", "CREATE", "Create TestCase : ['" + testcase + "']", request);
// Update labels
if (request.getParameter("labelList") != null) {
JSONArray objLabelArray = new JSONArray(request.getParameter("labelList"));
List<TestCaseLabel> labelList = new ArrayList();
labelList = getLabelListFromRequest(request, appContext, test, testcase, objLabelArray);
// Update the Database with the new list.
ans = testCaseLabelService.compareListAndUpdateInsertDeleteElements(test, testcase, labelList);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) ans);
}
// Update Countries
if (request.getParameter("countryList") != null) {
JSONArray objCountryArray = new JSONArray(request.getParameter("countryList"));
List<TestCaseCountry> tccList = new ArrayList();
tccList = getCountryListFromRequest(request, appContext, test, testcase, objCountryArray);
// Update the Database with the new list.
ans = testCaseCountryService.compareListAndUpdateInsertDeleteElements(test, testcase, tccList);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) ans);
// Duplicate other objects.
List<TestCaseCountryProperties> tccpList = new ArrayList();
List<TestCaseCountryProperties> newTccpList = new ArrayList();
if (!tccList.isEmpty() && ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
tccpList = testCaseCountryPropertiesService.findListOfPropertyPerTestTestCase(originalTest, originalTestCase);
// Build a new list with the countries that exist for the testcase.
for (TestCaseCountryProperties curTccp : tccpList) {
if (testCaseCountryService.exist(test, testcase, curTccp.getCountry())) {
newTccpList.add(curTccp);
}
}
if (!newTccpList.isEmpty()) {
ans = testCaseCountryPropertiesService.duplicateList(newTccpList, test, testcase);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) ans);
}
}
}
List<TestCaseStep> tcsList = new ArrayList();
if (ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
tcsList = testCaseStepService.getListOfSteps(originalTest, originalTestCase);
if (!tcsList.isEmpty()) {
ans = testCaseStepService.duplicateList(tcsList, test, testcase);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) ans);
}
}
List<TestCaseStepAction> tcsaList = new ArrayList();
if (!tcsList.isEmpty() && ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
tcsaList = testCaseStepActionService.findTestCaseStepActionbyTestTestCase(originalTest, originalTestCase);
if (!tcsaList.isEmpty()) {
ans = testCaseStepActionService.duplicateList(tcsaList, test, testcase);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) ans);
}
}
if (!tcsList.isEmpty() && !tcsaList.isEmpty() && ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
List<TestCaseStepActionControl> tcsacList = testCaseStepActionControlService.findControlByTestTestCase(originalTest, originalTestCase);
if (!tcsacList.isEmpty()) {
ans = testCaseStepActionControlService.duplicateList(tcsacList, test, testcase);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) ans);
}
}
}
}
/**
* Formating and returning the json result.
*/
jsonResponse.put("messageType", finalAnswer.getResultMessage().getMessage().getCodeString());
jsonResponse.put("message", finalAnswer.getResultMessage().getDescription());
response.getWriter().print(jsonResponse);
response.getWriter().flush();
}
Aggregations