How to use DataLibService class of org.cerberus.service.datalib.impl package

Best Cerberus-source code snippet using org.cerberus.service.datalib.impl.DataLibService

Source:DataLibService.java Github

copy

Full Screen

...35import org.cerberus.crud.service.ICountryEnvironmentDatabaseService;36import org.cerberus.crud.service.IParameterService;37import org.cerberus.crud.service.ITestCaseExecutionDataService;38import org.cerberus.crud.service.ITestDataLibDataService;39import org.cerberus.crud.service.ITestDataLibService;40import org.cerberus.engine.entity.MessageEvent;41import org.cerberus.engine.execution.IRecorderService;42import org.cerberus.engine.gwt.IVariableService;43import org.cerberus.enums.MessageEventEnum;44import org.cerberus.exception.CerberusEventException;45import org.cerberus.exception.CerberusException;46import org.cerberus.service.appservice.IServiceService;47import org.cerberus.service.datalib.IDataLibService;48import org.cerberus.service.file.IFileService;49import org.cerberus.service.json.IJsonService;50import org.cerberus.service.sql.ISQLService;51import org.cerberus.service.xmlunit.IXmlUnitService;52import org.cerberus.util.ParameterParserUtil;53import org.cerberus.util.StringUtil;54import org.cerberus.util.XmlUtil;55import org.cerberus.util.XmlUtilException;56import org.cerberus.util.answer.AnswerItem;57import org.cerberus.util.answer.AnswerList;58import org.json.JSONArray;59import org.json.JSONException;60import org.json.JSONObject;61import org.springframework.beans.factory.annotation.Autowired;62import org.springframework.stereotype.Service;63import org.w3c.dom.Document;64import org.w3c.dom.NodeList;65/**66 *67 * @author bcivel68 * @author vertigo1769 *70 */71@Service72public class DataLibService implements IDataLibService {73 private static final Logger LOG = LogManager.getLogger(DataLibService.class);74 @Autowired75 private IFileService fileService;76 @Autowired77 private ITestCaseExecutionDataService testCaseExecutionDataService;78 @Autowired79 private IParameterService parameterService;80 @Autowired81 private ITestDataLibService testDataLibService;82 @Autowired83 private ITestDataLibDataService testDataLibDataService;84 @Autowired85 private ICountryEnvironmentDatabaseService countryEnvironmentDatabaseService;86 @Autowired87 private ISQLService sqlService;88 @Autowired89 private IServiceService serviceService;90 @Autowired91 private IXmlUnitService xmlUnitService;92 @Autowired93 private IJsonService jsonService;94 @Autowired95 private IRecorderService recorderService;96 @Autowired97 private IVariableService variableService;98 @Override99 public AnswerList<HashMap<String, String>> getFromDataLib(TestDataLib lib, TestCaseCountryProperties testCaseCountryProperty,100 TestCaseExecution execution, TestCaseExecutionData testCaseExecutionData) {101 AnswerItem<HashMap<String, String>> resultColumns;102 AnswerList<HashMap<String, String>> resultData;103 AnswerList<HashMap<String, String>> result;104 MessageEvent msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS);105 // Length contains the nb of rows that the result must fetch. If defined at 0 we force at 1.106 Integer nbRowsRequested = 0;107 try {108 nbRowsRequested = Integer.parseInt(testCaseExecutionData.getLength());109 if (nbRowsRequested < 1) {110 nbRowsRequested = 1;111 }112 } catch (NumberFormatException e) {113 LOG.error(e.toString(), e);114 }115 /**116 * Gets the list of columns (subdata) to get from TestDataLibData.117 */118 resultColumns = getSubDataFromType(lib);119 HashMap<String, String> columnList = null;120 //Manage error message.121 if (resultColumns.getResultMessage().getCode() == MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SUBDATA.getCode()) {122 AnswerItem answerDecode = new AnswerItem<>();123 columnList = resultColumns.getItem();124 // Now that we have the list of column with subdata and value, we can try to decode it.125 if (columnList != null) {126 for (Map.Entry<String, String> entry : columnList.entrySet()) { // Loop on all Column in order to decode all values.127 String eKey = entry.getKey(); // SubData128 String eValue = entry.getValue(); // Parsing Answer129 try {130 answerDecode = variableService.decodeStringCompletly(eValue, execution, null, false);131 columnList.put(eKey, (String) answerDecode.getItem());132 if (!(answerDecode.isCodeStringEquals("OK"))) {133 // If anything wrong with the decode --> we stop here with decode message in the action result.134 result = new AnswerList<>();135 result.setDataList(null);136 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_GLOBAL_SUBDATAISSUE);137 msg.setDescription(msg.getDescription().replace("%SUBDATAMESSAGE%", answerDecode.getMessageDescription().replace("%FIELD%", "Column value '" + eValue + "'")));138 result.setResultMessage(msg);139 LOG.debug("Datalib interupted due to decode 'column value' Error.");140 return result;141 }142 } catch (CerberusEventException cex) {143 LOG.warn(cex);144 }145 }146 }147 } else if (resultColumns.getResultMessage().getCode() == MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATA.getCode()) {148 result = new AnswerList<>();149 result.setDataList(null);150 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_GLOBAL_SUBDATAISSUE);151 msg.setDescription(msg.getDescription().replace("%SUBDATAMESSAGE%", resultColumns.getMessageDescription()));152 result.setResultMessage(msg);153 return result;154 }155 /**156 * Get List of DataObject in a format List<Map<String, String>> - 1 item157 * per row with key = column and value = content158 */159 int rowLimit = testCaseCountryProperty.getRowLimit();160 if (testCaseCountryProperty.getNature().equalsIgnoreCase(TestCaseCountryProperties.NATURE_STATIC)) { // If Nature of the property is static, we don't need to get more than requested record.161 rowLimit = nbRowsRequested;162 }163 resultData = getDataObjectList(lib, columnList, rowLimit, execution, testCaseExecutionData);164 //Manage error message.165 if (resultData.getResultMessage().getCode() == MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_DATA.getCode()) {166 if (resultData.getDataList().size() < nbRowsRequested) { // We check if the data provided is enought to provide the answer.167 result = new AnswerList<>();168 result.setDataList(null);169 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_GLOBAL_NOTENOUGHTDATA);170 msg.setDescription(msg.getDescription().replace("%DATAMESSAGE%", resultData.getMessageDescription()).replace("%NBREQUEST%", Integer.toString(nbRowsRequested)));171 result.setResultMessage(msg);172 return result;173 }174 } else if (resultData.getResultMessage().getCode() == MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_GENERIC_NODATA.getCode()) {175 result = new AnswerList<>();176 result.setDataList(null);177 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_GLOBAL_NODATA);178 msg.setDescription(msg.getDescription().replace("%DATAMESSAGE%", resultData.getMessageDescription()));179 result.setResultMessage(msg);180 return result;181 } else {182 result = new AnswerList<>();183 result.setDataList(null);184 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_GLOBAL_DATAISSUE);185 msg.setDescription(msg.getDescription().replace("%DATAMESSAGE%", resultData.getMessageDescription()));186 result.setResultMessage(msg);187 return result;188 }189 /**190 * Filter out the result from requested rows depending on the nature191 */192 result = filterWithNature(testCaseCountryProperty.getNature(), resultData, execution, testCaseCountryProperty, nbRowsRequested);193 //Manage error message.194 if (result.getResultMessage().getCode() == MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_NATURE.getCode()) {195 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_GLOBAL);196 msg.setDescription(msg.getDescription().replace("%DATAMESSAGE%", resultData.getMessageDescription())197 .replace("%FILTERNATUREMESSAGE%", result.getMessageDescription()));198 result.setResultMessage(msg);199 } else if (result.getResultMessage().getCode() == MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_GENERIC_NATURENOMORERECORD.getCode()) {200 //if the script does not return 201 result.setDataList(null);202 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_GLOBAL_NODATALEFT);203 msg.setDescription(msg.getDescription().replace("%DATAMESSAGE%", resultData.getMessageDescription())204 .replace("%FILTERNATUREMESSAGE%", result.getMessageDescription()));205 result.setResultMessage(msg);206 } else {207 //other error had occured208 result.setDataList(null);209 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_GLOBAL_GENERIC);210 msg.setDescription(msg.getDescription().replace("%DATAMESSAGE%", resultData.getMessageDescription())211 .replace("%FILTERNATUREMESSAGE%", result.getMessageDescription()));212 result.setResultMessage(msg);213 }214 return result;215 }216 /**217 * This method route to the method regarding the nature218 *219 * @param nature : Nature of the property220 * @param dataObjectList : List of dataObject221 * @param tCExecution : TestCaseExecution222 * @param testCaseCountryProperties : TestCaseCountryProperties223 * @return List of items (dataObject) from the dataObjectList filtered out224 * of records depending on the nature.225 */226 private AnswerList<HashMap<String, String>> filterWithNature(String nature, AnswerList<HashMap<String, String>> dataObjectList, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperties, int outputRequestedDimention) {227 switch (nature) {228 case TestCaseCountryProperties.NATURE_STATIC:229 return filterWithNatureSTATIC(dataObjectList, outputRequestedDimention);230 case TestCaseCountryProperties.NATURE_RANDOM:231 return filterWithNatureRANDOM(dataObjectList, outputRequestedDimention);232 case TestCaseCountryProperties.NATURE_RANDOMNEW:233 return filterWithNatureRANDOMNEW(dataObjectList, tCExecution, testCaseCountryProperties, outputRequestedDimention);234 case TestCaseCountryProperties.NATURE_NOTINUSE:235 return filterWithNatureNOTINUSE(dataObjectList, tCExecution, testCaseCountryProperties, outputRequestedDimention);236 }237 //TODO throw exception when Nature not known238 return null;239 }240 private List<Integer> getRandomListOfInteger(int inputRange, int nbOfResult) {241 List<Integer> listTempRandom;242 listTempRandom = new ArrayList<>();243 for (int i = 0; i < inputRange; i++) {244 listTempRandom.add(i);245 }246 List<Integer> listRandom;247 listRandom = new ArrayList<>();248 for (int i = 0; i < nbOfResult; i++) {249 Random r = new Random();250 int position = r.nextInt(listTempRandom.size());251 listRandom.add(listTempRandom.remove(position));252 }253 return listRandom;254 }255 @Override256 public AnswerList<HashMap<String, String>> filterWithNatureSTATIC(AnswerList<HashMap<String, String>> dataObjectList, int outputRequestedDimention) {257 AnswerList<HashMap<String, String>> result = new AnswerList<>();258 List<HashMap<String, String>> resultObject;259 resultObject = new ArrayList<>();260 for (int i = 0; i < outputRequestedDimention; i++) {261 resultObject.add(dataObjectList.getDataList().get(i));262 }263 result.setDataList(resultObject);264 String rowMessage = "";265 if (outputRequestedDimention < 2) {266 rowMessage = "row";267 } else {268 rowMessage = Integer.toString(outputRequestedDimention) + " rows";269 }270 result.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_NATURESTATIC).resolveDescription("ROW", rowMessage));271 return result;272 }273 @Override274 public AnswerList<HashMap<String, String>> filterWithNatureRANDOM(AnswerList<HashMap<String, String>> dataObjectList, int outputRequestedDimention) {275 AnswerList<HashMap<String, String>> result = new AnswerList<>();276 String selectedList = "";277 List<HashMap<String, String>> resultObject;278 resultObject = new ArrayList<>();279 List<Integer> listTempRandom = getRandomListOfInteger(dataObjectList.getDataList().size(), outputRequestedDimention);280 for (int i : listTempRandom) {281 int j = i + 1;282 selectedList += Integer.toString(j) + ",";283 resultObject.add(dataObjectList.getDataList().get(i));284 }285 selectedList = StringUtil.removeLastChar(selectedList, 1);286 result.setDataList(resultObject);287 result.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_NATURERANDOM)288 .resolveDescription("POS", selectedList).resolveDescription("TOTALPOS", Integer.toString(dataObjectList.getDataList().size())));289 return result;290 }291 @Override292 public AnswerList<HashMap<String, String>> filterWithNatureRANDOMNEW(AnswerList<HashMap<String, String>> dataObjectList, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseProperties, int outputRequestedDimention) {293 AnswerList<HashMap<String, String>> result = new AnswerList<>();294 List<HashMap<String, String>> list; // Temporary list in order to treat the input list295 List<HashMap<String, String>> resultObject;296 resultObject = new ArrayList<>();297 int initNB = dataObjectList.getDataList().size();298 // We get the list of values that were already used.299 List<String> pastValues = new LinkedList<>();300 try {301 pastValues = this.testCaseExecutionDataService.getPastValuesOfProperty(tCExecution.getId(),302 testCaseProperties.getProperty(), tCExecution.getTest(), tCExecution.getTestCase(),303 tCExecution.getCountryEnvParam().getBuild(), tCExecution.getEnvironmentData(), tCExecution.getCountry());304 } catch (CerberusException e) {305 LOG.error(e.getMessage(), e);306 result.setResultMessage(new MessageEvent(MessageEventEnum.GENERIC_ERROR)307 .resolveDescription("REASON", e.getMessage()));308 }309 int removedNB = 0;310 // We save all rows that needs to be removed to listToremove.311 List<Map<String, String>> listToremove = new ArrayList<>();312 list = dataObjectList.getDataList();313 for (String valueToRemove : pastValues) {314 for (Map<String, String> curentRow : list) {315 if (curentRow.get("").equals(valueToRemove)) {316 if (true) {317 listToremove.add(curentRow);318 removedNB++;319 }320 }321 }322 }323 // We remove all listToremove entries from list.324 list.removeAll(listToremove);325 if (list != null && !list.isEmpty()) { // We pick a random value from the left entries of the list.326 if (list.size() < outputRequestedDimention) { // Still some results available but not enougth compared to what we requested.327 result.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_RANDOMNEW_NOTENOUGTHRECORDS)328 .resolveDescription("REMNB", Integer.toString(listToremove.size()))329 .resolveDescription("TOTNB", Integer.toString(initNB))330 .resolveDescription("NBREQUEST", Integer.toString(outputRequestedDimention)));331 } else {332 // Get a random list.333 List<Integer> listTempRandom = getRandomListOfInteger(dataObjectList.getDataList().size(), outputRequestedDimention);334 String selectedList = "";335 // Pick the result from list.336 for (int i : listTempRandom) {337 int j = i + 1;338 selectedList += Integer.toString(j) + ",";339 resultObject.add(dataObjectList.getDataList().get(i));340 }341 selectedList = StringUtil.removeLastChar(selectedList, 1);342 result.setDataList(resultObject);343 result.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_NATURERANDOMNEW)344 .resolveDescription("TOTNB", Integer.toString(initNB))345 .resolveDescription("REMNB", Integer.toString(removedNB))346 .resolveDescription("POS", selectedList)347 .resolveDescription("TOTALPOS", Integer.toString(list.size())));348 }349 } else { // No more entries available.350 result.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_RANDOMNEW_NOMORERECORD)351 .resolveDescription("TOTNB", Integer.toString(initNB)));352 }353 return result;354 }355 @Override356 public AnswerList<HashMap<String, String>> filterWithNatureNOTINUSE(AnswerList<HashMap<String, String>> dataObjectList, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, int outputRequestedDimention) {357 AnswerList<HashMap<String, String>> result = new AnswerList<>();358 List<HashMap<String, String>> list = dataObjectList.getDataList(); // Temporary list in order to treat the input list359 List<HashMap<String, String>> resultObject;360 resultObject = new ArrayList<>();361 int initNB = dataObjectList.getDataList().size();362 // We get the list of values that are beeing used.363 Integer peTimeout;364 try {365 peTimeout = Integer.valueOf(parameterService.findParameterByKey("cerberus_notinuse_timeout", tCExecution.getApplicationObj().getSystem()).getValue());366 List<String> pastValues = this.testCaseExecutionDataService.getInUseValuesOfProperty(tCExecution.getId(), testCaseCountryProperty.getProperty(), tCExecution.getEnvironmentData(), tCExecution.getCountry(), peTimeout);367 int removedNB = 0;368 // We save all rows that needs to be removed to listToremove.369 List<Map<String, String>> listToremove = new ArrayList<>();370 for (String valueToRemove : pastValues) {371 for (Map<String, String> curentRow : list) {372 if (curentRow.get("").equals(valueToRemove)) {373 if (true) {374 listToremove.add(curentRow);375 removedNB++;376 }377 }378 }379 }380 // We remove all listToremove entries from list.381 list.removeAll(listToremove);382 if (list != null && !list.isEmpty()) { // We pick a random value from the left entries of the list.383 if (list.size() < outputRequestedDimention) { // Still some results available but not enougth compared to what we requested.384 result.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_NOTINUSE_NOTENOUGTHRECORDS)385 .resolveDescription("REMNB", Integer.toString(listToremove.size()))386 .resolveDescription("TOTNB", Integer.toString(initNB))387 .resolveDescription("NBREQUEST", Integer.toString(outputRequestedDimention)));388 } else {389 // Get a random list.390 List<Integer> listTempRandom = getRandomListOfInteger(dataObjectList.getDataList().size(), outputRequestedDimention);391 String selectedList = "";392 // Pick the result from list.393 for (int i : listTempRandom) {394 int j = i + 1;395 selectedList += Integer.toString(j) + ",";396 resultObject.add(dataObjectList.getDataList().get(i));397 }398 selectedList = StringUtil.removeLastChar(selectedList, 1);399 result.setDataList(resultObject);400 result.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_NATURENOTINUSE)401 .resolveDescription("TOTNB", Integer.toString(initNB))402 .resolveDescription("REMNB", Integer.toString(removedNB))403 .resolveDescription("POS", selectedList)404 .resolveDescription("TOTALPOS", Integer.toString(list.size())));405 }406 } else { // No more entries available.407 result.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_NOTINUSE_NOMORERECORD)408 .resolveDescription("TOTNB", Integer.toString(initNB)));409 }410 } catch (CerberusException ex) {411 LOG.warn(ex);412 }413 return result;414 }415 /**416 * Get the list of subData417 *418 * @param dataLib419 * @return420 */421 private AnswerItem<HashMap<String, String>> getSubDataFromType(TestDataLib dataLib) {422 AnswerList<TestDataLibData> answerData = new AnswerList<>();423 AnswerItem<HashMap<String, String>> result = new AnswerItem<>();424 MessageEvent msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS);425 List<TestDataLibData> objectDataList = new ArrayList<>();426 HashMap<String, String> row = new HashMap<>();427 switch (dataLib.getType()) {428 case TestDataLib.TYPE_CSV:429 answerData = testDataLibDataService.readByVarious(dataLib.getTestDataLibID(), null, null, "N");430 if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && !answerData.getDataList().isEmpty()) {431 objectDataList = answerData.getDataList();432 boolean missingKey = true;433 for (TestDataLibData tdld : objectDataList) {434 row.put(tdld.getSubData(), tdld.getColumnPosition());435 if (tdld.getSubData().isEmpty()) {436 missingKey = false;437 }438 }439 result.setItem(row);440 if (missingKey) {441 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATACSVNOKEY);442 result.setResultMessage(msg);443 } else {444 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SUBDATA);445 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(answerData.getDataList().size())));446 result.setResultMessage(msg);447 }448 } else if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && answerData.getDataList().isEmpty()) {449 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_NOSUBDATACSV);450 result.setResultMessage(msg);451 } else {452 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATACSV);453 result.setResultMessage(msg);454 }455 break;456 case TestDataLib.TYPE_SQL:457 answerData = testDataLibDataService.readByVarious(dataLib.getTestDataLibID(), "N", null, null);458 if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && !answerData.getDataList().isEmpty()) {459 objectDataList = answerData.getDataList();460 boolean missingKey = true;461 for (TestDataLibData tdld : objectDataList) {462 row.put(tdld.getSubData(), tdld.getColumn());463 if (tdld.getSubData().isEmpty()) {464 missingKey = false;465 }466 }467 result.setItem(row);468 if (missingKey) {469 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATASQLNOKEY);470 result.setResultMessage(msg);471 } else {472 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SUBDATA);473 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(answerData.getDataList().size())));474 result.setResultMessage(msg);475 }476 } else if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && answerData.getDataList().isEmpty()) {477 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_NOSUBDATASQL);478 result.setResultMessage(msg);479 } else {480 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATASQL);481 result.setResultMessage(msg);482 }483 break;484 case TestDataLib.TYPE_SERVICE:485 answerData = testDataLibDataService.readByVarious(dataLib.getTestDataLibID(), null, "N", null);486 if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && !answerData.getDataList().isEmpty()) {487 objectDataList = answerData.getDataList();488 boolean missingKey = true;489 for (TestDataLibData tdld : objectDataList) {490 row.put(tdld.getSubData(), tdld.getParsingAnswer());491 if (tdld.getSubData().isEmpty()) {492 missingKey = false;493 }494 }495 result.setItem(row);496 if (missingKey) {497 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATASOAPNOKEY);498 result.setResultMessage(msg);499 } else {500 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SUBDATA);501 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(answerData.getDataList().size())));502 result.setResultMessage(msg);503 }504 } else if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && answerData.getDataList().isEmpty()) {505 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_NOSUBDATA);506 result.setResultMessage(msg);507 } else {508 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATASERVICE);509 result.setResultMessage(msg);510 }511 break;512 case TestDataLib.TYPE_INTERNAL:513 // For static Type, there is no need to fetch the subdata as subdata are loaded at the same time of the data.514 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SUBDATA);515 result.setResultMessage(msg);516 result.setItem(null);517 break;518 }519 return result;520 }521 /**522 * Get list of subdata that are secrets.523 */524 private List<String> getListOfSecrets(Integer dataLibId) {525 AnswerList<TestDataLibData> answerData = new AnswerList<>();526 List<TestDataLibData> objectDataList = new ArrayList<>();527 List<String> result = new ArrayList<>();528 answerData = testDataLibDataService.readByVarious(dataLibId, null, null, null);529 if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && !answerData.getDataList().isEmpty()) {530 objectDataList = answerData.getDataList();531 for (TestDataLibData tdld : objectDataList) {532 if (ParameterParserUtil.parseBooleanParam(tdld.getEncrypt(), false)) {533 result.add(tdld.getSubData());534 }535 }536 }537 LOG.debug("List of Subdata that needs to be hidden : " + result);538 return result;539 }540 /**541 * Get the dataObject List depending on the type542 *543 * @param lib544 * @param columnList545 * @return546 */547 private AnswerList<HashMap<String, String>> getDataObjectList(TestDataLib lib, HashMap<String, String> columnList, int rowLimit, TestCaseExecution execution, TestCaseExecutionData testCaseExecutionData) {548 AnswerList<HashMap<String, String>> result = new AnswerList<>();549 MessageEvent msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS);550 CountryEnvironmentDatabase countryEnvironmentDatabase;551 AnswerList<HashMap<String, String>> responseList;552 String system = execution.getApplicationObj().getSystem();553 String country = execution.getCountry();554 String environment = execution.getEnvironment();555 Pattern pattern;556 Matcher matcher;557 Parameter p;558 List<HashMap<String, String>> list;559 List<String> columnsToHide = new ArrayList<>();560 switch (lib.getType()) {561 case TestDataLib.TYPE_CSV:562 /**563 * Before making the call we check if the Service Path is564 * already a proper URL. If it is not, we prefix with the CsvUrl565 * defined from corresponding database. This is used to get the566 * data from the correct environment.567 */568 String servicePathCsv = lib.getCsvUrl();569 LOG.debug("Service Path (Csv) : " + lib.getCsvUrl());570 // Trying making an URL with database context path.571 if (!StringUtil.isURL(servicePathCsv)) {572 // Url is not valid, we try to get the corresponding DatabaseURL CsvURL to prefix.573 if (!(StringUtil.isNullOrEmpty(lib.getDatabaseCsv()))) {574 try {575 countryEnvironmentDatabase = countryEnvironmentDatabaseService.convert(this.countryEnvironmentDatabaseService.readByKey(system,576 country, environment, lib.getDatabaseCsv()));577 if (countryEnvironmentDatabase == null) {578 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_CSV_URLKOANDDATABASECSVURLNOTEXIST);579 msg.setDescription(msg.getDescription()580 .replace("%SERVICEURL%", lib.getCsvUrl())581 .replace("%SYSTEM%", system)582 .replace("%COUNTRY%", country)583 .replace("%ENV%", environment)584 .replace("%DATABASE%", lib.getDatabaseCsv()));585 result.setResultMessage(msg);586 return result;587 } else {588 String csvURL = countryEnvironmentDatabase.getCsvUrl();589 if (StringUtil.isNullOrEmpty(csvURL)) {590 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_CSV_URLKOANDDATABASECSVURLEMPTY);591 msg.setDescription(msg.getDescription()592 .replace("%SERVICEURL%", lib.getCsvUrl())593 .replace("%SYSTEM%", system)594 .replace("%COUNTRY%", country)595 .replace("%ENV%", environment)596 .replace("%DATABASE%", lib.getDatabaseCsv()));597 result.setResultMessage(msg);598 return result;599 }600 // soapURL from database is not empty so we prefix the Service URL with it.601 servicePathCsv = csvURL + lib.getCsvUrl();602 if (!StringUtil.isURL(servicePathCsv)) {603 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_CSV_URLKO);604 msg.setDescription(msg.getDescription()605 .replace("%SERVICEURL%", servicePathCsv)606 .replace("%SOAPURL%", csvURL)607 .replace("%SERVICEPATH%", lib.getCsvUrl())608 .replace("%ENTRY%", lib.getName())609 .replace("%ENTRYID%", lib.getTestDataLibID().toString()));610 result.setResultMessage(msg);611 return result;612 }613 }614 } catch (CerberusException ex) {615 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_CSV_URLKOANDDATABASECSVURLNOTEXIST);616 msg.setDescription(msg.getDescription()617 .replace("%SERVICEURL%", lib.getCsvUrl())618 .replace("%SYSTEM%", system)619 .replace("%COUNTRY%", country)620 .replace("%ENV%", environment)621 .replace("%DATABASE%", lib.getDatabaseCsv()));622 result.setResultMessage(msg);623 return result;624 }625 }626 }627 // Trying make a valid path with csv parameter path.628 if (!StringUtil.isURL(servicePathCsv)) {629 // Url is still not valid. We try to add the path from csv parameter.630 String csv_path = parameterService.getParameterStringByKey("cerberus_testdatalibcsv_path", "", "");631 csv_path = StringUtil.addSuffixIfNotAlready(csv_path, File.separator);632 servicePathCsv = csv_path + servicePathCsv;633 }634 // Get list of columns to hide.635 columnsToHide = getListOfSecrets(lib.getTestDataLibID());636 // CSV Call is made here.637 responseList = fileService.parseCSVFile(servicePathCsv, lib.getSeparator(), columnList, columnsToHide, execution);638 list = responseList.getDataList();639 //if the query returns sucess then we can get the data640 if (responseList.getResultMessage().getCode() == MessageEventEnum.PROPERTY_SUCCESS_CSV.getCode()) {641 if (list != null && !list.isEmpty()) {642 result.setDataList(list);643 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_CSV);644 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(result.getDataList().size())).replace("%CSVURL%", servicePathCsv));645 } else {646 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_CSVDATABASENODATA);647 msg.setDescription(msg.getDescription().replace("%CSVURL%", servicePathCsv));648 }649 } else {650 msg = responseList.getResultMessage();651 }652 result.setResultMessage(msg);653 break;654 case TestDataLib.TYPE_SQL:655 String connectionName;656 String db = lib.getDatabase();657 try {658 if (StringUtil.isNullOrEmpty(db)) {659 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SQLDATABASEEMPTY);660 } else {661 countryEnvironmentDatabase = countryEnvironmentDatabaseService.convert(countryEnvironmentDatabaseService.readByKey(system,662 country, environment, db));663 if (countryEnvironmentDatabase == null) {664 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SQLDATABASENOTCONFIGURED);665 msg.setDescription(msg.getDescription().replace("%SYSTEM%", system)666 .replace("%COUNTRY%", country).replace("%ENV%", environment)667 .replace("%DATABASE%", db));668 } else {669 connectionName = countryEnvironmentDatabase.getConnectionPoolName();670 if (!(StringUtil.isNullOrEmpty(connectionName))) {671 // Get list of columns to hide.672 columnsToHide = getListOfSecrets(lib.getTestDataLibID());673 LOG.debug("To hide : " + columnsToHide);674 Integer sqlTimeout = parameterService.getParameterIntegerByKey("cerberus_propertyexternalsql_timeout", system, 60);675 //performs a query that returns several rows containing n columns676 responseList = sqlService.queryDatabaseNColumns(connectionName, lib.getScript(), rowLimit, sqlTimeout, system, columnList, columnsToHide, execution);677 //if the query returns sucess then, we can get the data678 if (responseList.getResultMessage().getCode() == MessageEventEnum.PROPERTY_SUCCESS_SQL.getCode()) {679 list = responseList.getDataList();680 if (list != null && !list.isEmpty()) {681 result.setDataList(list);682 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SQL);683 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(result.getDataList().size())));684 } else {685 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SQLDATABASENODATA);686 }687 } else {688 msg = responseList.getResultMessage();689 }690 msg.setDescription(msg.getDescription().replace("%DATABASE%", db));691 msg.setDescription(msg.getDescription().replace("%SQL%", lib.getScript()));692 msg.setDescription(msg.getDescription().replace("%JDBCPOOLNAME%", connectionName));693 } else {694 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SQLDATABASEJDBCRESSOURCEMPTY);695 msg.setDescription(msg.getDescription().replace("%SYSTEM%", system).replace("%COUNTRY%", country).replace("%ENV%", environment).replace("%DATABASE%", db));696 }697 }698 }699 } catch (CerberusException ex) {700 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SQLDATABASENOTCONFIGURED);701 msg.setDescription(msg.getDescription().replace("%SYSTEM%", system).replace("%COUNTRY%", country).replace("%ENV%", environment).replace("%DATABASE%", db));702 }703 result.setResultMessage(msg);704 break;705 case TestDataLib.TYPE_SERVICE:706 AppService appService = new AppService();707 HashMap<String, String> resultHash = new HashMap<>();708 List<HashMap<String, String>> listResult = new ArrayList<>();709 // Temporary list of string.710 List<String> listTemp1 = null;711 // String containing the XML712 String responseString = "";713 /**714 * Before making the call we check if the Service Path is715 * already a propper URL. If it is not, we prefix with the716 * SoapUrl defined from corresponding database. This is used to717 * get the data from the correct environment.718 */719 String servicePath = lib.getServicePath();720 LOG.debug("Service Path : " + lib.getServicePath());721 // Get list of columns to hide.722 columnsToHide = getListOfSecrets(lib.getTestDataLibID());723 // Service Call is made here.724 AnswerItem ai = serviceService.callService(lib.getService(), null, null, lib.getDatabaseUrl(), lib.getEnvelope(), lib.getServicePath(), lib.getMethod(), execution);725 msg = ai.getResultMessage();726 //if the call returns success then we can process the soap ressponse727 if (msg.getCode() == MessageEventEnum.ACTION_SUCCESS_CALLSERVICE.getCode()) {728 appService = (AppService) ai.getItem();729 // Call successful so we can start to parse the result and build RawData per columns from subdata entries.730 /**731 * This Step will calculate hashTemp1 : Hash of List from732 * the Service response.733 */734 // Will contain the nb of row of the target list of Hash.735 int finalnbRow = 0;736 // Will contain the result of the XML parsing.737 HashMap<String, List<String>> hashTemp1 = new HashMap<>();738 if (columnList.isEmpty()) { // No subdata could be found on the testdatalib.739 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SERVICE_NOSUBDATA);740 msg.setDescription(msg.getDescription()741 .replace("%ENTRY%", lib.getName())742 .replace("%ENTRYID%", lib.getTestDataLibID().toString()));743 } else {744 switch (appService.getResponseHTTPBodyContentType()) {745 case AppService.RESPONSEHTTPBODYCONTENTTYPE_XML:746 Document xmlDocument = xmlUnitService.getXmlDocument(appService.getResponseHTTPBody());747 // We get the content of the XML in order to report it log messages.748 responseString = appService.getResponseHTTPBody();749 for (Map.Entry<String, String> entry : columnList.entrySet()) {750 String subDataColumnToTreat = entry.getKey(); // SubData751 String subDataParsingAnswer = entry.getValue(); // Parsing Answer752 listTemp1 = new ArrayList<>();753 try {754 // We try to parse the XML with the subdata Parsing Answer.755 NodeList candidates = XmlUtil.evaluate(xmlDocument, subDataParsingAnswer);756 if (candidates.getLength() > 0) {757 for (int i = 0; i < candidates.getLength(); i++) { // Loop on all Values that match in XML.758 //We get the value from XML759 String value = candidates.item(i).getNodeValue();760 if (value == null) { // No value found.761 if (candidates.item(i) != null) {762 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SERVICE_CHECK_XPATH);763 msg.setDescription(msg.getDescription()764 .replace("%XPATH%", subDataParsingAnswer)765 .replace("%SUBDATA%", subDataColumnToTreat)766 .replace("%ENTRY%", lib.getName())767 .replace("%ENTRYID%", lib.getTestDataLibID().toString()));768 } else {769 //no elements were returned by the XPATH expression770 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SERVICE_XML_NOTFOUND);771 msg.setDescription(msg.getDescription()772 .replace("%XPATH%", subDataParsingAnswer)773 .replace("%SUBDATA%", subDataColumnToTreat)774 .replace("%ENTRY%", lib.getName())775 .replace("%XMLCONTENT%", responseString)776 .replace("%ENTRYID%", lib.getTestDataLibID().toString())777 );778 }779 } else { // Value were found we add it to the current list.780 listTemp1.add(value);781 }782 }783 // If column is on the columns to hide we add it to the secret list784 if (columnsToHide.contains(subDataColumnToTreat)) {785 execution.appendSecrets(listTemp1);786 }787 // Add the Subdata with associated list in the HashMap.788 hashTemp1.put(subDataColumnToTreat, listTemp1);789 // Getting the nb of row of the final result. (Max of all the Subdata retrieved from the XML)790 if (listTemp1.size() > finalnbRow) {791 finalnbRow = listTemp1.size();792 }793 } else {794 //no elements were returned by the XPATH expression795 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SERVICE_XML_NOTFOUND);796 msg.setDescription(msg.getDescription()797 .replace("%XPATH%", subDataParsingAnswer)798 .replace("%SUBDATA%", subDataColumnToTreat)799 .replace("%ENTRY%", lib.getName())800 .replace("%XMLCONTENT%", responseString)801 .replace("%ENTRYID%", lib.getTestDataLibID().toString())802 );803 }804 } catch (XmlUtilException ex) {805 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SERVICE_XMLEXCEPTION);806 msg.setDescription(msg.getDescription()807 .replace("%XPATH%", subDataParsingAnswer)808 .replace("%SUBDATA%", subDataColumnToTreat)809 .replace("%ENTRY%", lib.getName())810 .replace("%ENTRYID%", lib.getTestDataLibID().toString())811 .replace("%REASON%", ex.toString() + " Detail answer " + responseString));812 } catch (Exception ex) {813 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SERVICE_XMLEXCEPTION);814 msg.setDescription(msg.getDescription()815 .replace("%XPATH%", lib.getSubDataParsingAnswer())816 .replace("%SUBDATA%", "")817 .replace("%REASON%", ex.toString()));818 }819 }820 /**821 * This Step will convert hashTemp1 (Hash of822 * List) to target listResult (list of Hash).823 */824 if (msg.getCode() == MessageEventEnum.ACTION_SUCCESS_CALLSERVICE.getCode()) {825 for (int i = 0; i < finalnbRow; i++) { // Loop on all Values that match in XML.826 resultHash = new HashMap<>();827 for (Map.Entry<String, String> entry : columnList.entrySet()) { // Loop on all SubData of the TestDataLib.828 listTemp1 = hashTemp1.get(entry.getKey());829 if (listTemp1 != null) {830 if (i < listTemp1.size()) {831 resultHash.put(entry.getKey(), listTemp1.get(i));832 } else {833 resultHash.put(entry.getKey(), "");834 }835 }836 }837 listResult.add(resultHash);838 }839 }840 /**841 * This Step will pick the correct listResult842 * (list of Hash) from the type of Property.843 */844 if (msg.getCode() == MessageEventEnum.ACTION_SUCCESS_CALLSERVICE.getCode()) {845 result.setDataList(listResult);846 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SOAP);847 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(result.getDataList().size()))848 .replace("%URL%", servicePath).replace("%OPER%", lib.getMethod()));849 }850 break;851 case AppService.RESPONSEHTTPBODYCONTENTTYPE_JSON:852 // We get the content of the XML in order to report it log messages.853 responseString = appService.getResponseHTTPBody();854 for (Map.Entry<String, String> entry : columnList.entrySet()) {855 String subDataColumnToTreat = entry.getKey(); // SubData856 String subDataParsingAnswer = entry.getValue(); // Parsing Answer857 listTemp1 = new ArrayList<>();858 try {859 // We try to parse the XML with the subdata Parsing Answer.860 listTemp1 = jsonService.getFromJson(responseString, subDataParsingAnswer);861 if (listTemp1.size() > 0) {862 // If column is on the columns to hide we add it to the secret list863 if (columnsToHide.contains(subDataColumnToTreat)) {864 execution.appendSecrets(listTemp1);865 }866 // Add the Subdata with associated list in the HashMap.867 hashTemp1.put(subDataColumnToTreat, listTemp1);868 // Getting the nb of row of the final result. (Max of all the Subdata retrieved from the XML)869 if (listTemp1.size() > finalnbRow) {870 finalnbRow = listTemp1.size();871 }872 } else {873 //no elements were returned by the XPATH expression874 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SERVICE_JSON_NOTFOUND);875 msg.setDescription(msg.getDescription()876 .replace("%XPATH%", subDataParsingAnswer)877 .replace("%SUBDATA%", subDataColumnToTreat)878 .replace("%ENTRY%", lib.getName())879 .replace("%XMLCONTENT%", responseString)880 .replace("%ENTRYID%", lib.getTestDataLibID().toString())881 );882 }883 } catch (Exception ex) {884 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SERVICE_JSONEXCEPTION);885 msg.setDescription(msg.getDescription()886 .replace("%XPATH%", lib.getSubDataParsingAnswer())887 .replace("%SUBDATA%", "")888 .replace("%REASON%", ex.toString()889 + "\n api response : " + appService.getResponseHTTPBody()));890 }891 }892 /**893 * This Step will convert hashTemp1 (Hash of894 * List) to target listResult (list of Hash).895 */896 if (msg.getCode() == MessageEventEnum.ACTION_SUCCESS_CALLSERVICE.getCode()) {897 for (int i = 0; i < finalnbRow; i++) { // Loop on all Values that match in XML.898 resultHash = new HashMap<>();899 for (Map.Entry<String, String> entry : columnList.entrySet()) { // Loop on all SubData of the TestDataLib.900 listTemp1 = hashTemp1.get(entry.getKey());901 if (listTemp1 != null) {902 if (i < listTemp1.size()) {903 resultHash.put(entry.getKey(), listTemp1.get(i));904 } else {905 resultHash.put(entry.getKey(), "");906 }907 }908 }909 listResult.add(resultHash);910 }911 }912 /**913 * This Step will pick the correct listResult914 * (list of Hash) from the type of Property.915 */916 if (msg.getCode() == MessageEventEnum.ACTION_SUCCESS_CALLSERVICE.getCode()) {917 result.setDataList(listResult);918 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SERVICE);919 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(result.getDataList().size()))920 .replace("%URL%", appService.getServicePath()).replace("%METHOD%", appService.getMethod()));921 }922 break;923 default:924 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_NOTSUPPORTEDSERVICERESULT);925 msg.setDescription(msg.getDescription().replace("%FORMAT%", appService.getResponseHTTPBodyContentType()));926 }927 }928 //Record result in filessytem.929 execution.addFileList(recorderService.recordServiceCall(execution, null, 0, testCaseExecutionData.getProperty(), appService));930 } else {931 String soapError = msg.getDescription();932 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SERVICE_SOAPCALLFAILED);933 msg.setDescription(msg.getDescription()934 .replace("%SOAPERROR%", soapError));935 }936 msg.setDescription(msg.getDescription()937 .replace("%SERVICE%", servicePath)938 .replace("%OPERATION%", lib.getMethod()));939 result.setResultMessage(msg);940 break;941 case TestDataLib.TYPE_INTERNAL:942 result = testDataLibService.readINTERNALWithSubdataByCriteria(lib.getName(), lib.getSystem(), lib.getCountry(), lib.getEnvironment(), rowLimit, system, execution);943 //if the sql service returns a success message then we can process it944 if ((result.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && !result.getDataList().isEmpty()) {945 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_INTERNAL);946 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(result.getDataList().size())));947 result.setResultMessage(msg);948 } else if ((result.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && result.getDataList().isEmpty()) {949 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_INTERNALNODATA);950 msg.setDescription(msg.getDescription().replace("%SYSTEM%", lib.getSystem())951 .replace("%ENV%", lib.getEnvironment()).replace("%COUNTRY%", lib.getCountry()));952 result.setResultMessage(msg);953 } else {954 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_INTERNAL);955 msg.setDescription(msg.getDescription().replace("%SYSTEM%", lib.getSystem())956 .replace("%ENV%", lib.getEnvironment()).replace("%COUNTRY%", lib.getCountry()));...

Full Screen

Full Screen

DataLibService

Using AI Code Generation

copy

Full Screen

1import org.cerberus.service.datalib.impl.DataLibService;2import org.cerberus.service.datalib.impl.DataLibService;3import org.cerberus.service.datalib.impl.DataLibService;4import org.cerberus.service.datalib.impl.DataLibService;5import org.cerberus.service.datalib.impl.DataLibService;6import org.cerberus.service.datalib.impl.DataLibService;7import org.cerberus.service.datalib.impl.DataLibService;8import org.cerberus.service.datalib.impl.DataLibService;9import org.cerberus.service.datalib.impl.DataLibService;10import org.cerberus.service.datalib.impl.DataLibService;11import org.cerberus.service.datalib.impl.DataLibService;12import org.cerberus.service.datalib.impl.DataLibService;13import org.cerberus.service.datalib.impl.DataLibService;14import org.cerberus.service.datalib.impl.DataLibService;

Full Screen

Full Screen

DataLibService

Using AI Code Generation

copy

Full Screen

1import org.cerberus.service.datalib.impl.DataLibService2import org.cerberus.service.datalib.DataLibService3import org.cerberus.service.datalib.impl.DataLibService4import org.cerberus.service.datalib.DataLibService5import org.cerberus.service.datalib.impl.DataLibService6import org.cerberus.service.datalib.DataLibService7import org.cerberus.service.datalib.impl.DataLibService8import org.cerberus.service.datalib.DataLibService9import org.cerberus.service.datalib.impl.DataLibService10import org.cerberus.service.datalib.DataLibService11import org.cerberus.service.datalib.impl.DataLibService12import org.cerberus.service.datalib.DataLibService13import org.cerberus.service.datalib.impl.DataLibService14import org.cerberus.service.datalib.DataLibService15import org.cer

Full Screen

Full Screen

DataLibService

Using AI Code Generation

copy

Full Screen

1import org.cerberus.service.datalib.impl.DataLibService;2import org.cerberus.service.datalib.impl.DataLibService;3DataLibService dataLibService = new DataLibService();4dataLibService.getLibData("MyLib", "MyData", "MyCountry", "MyEnv", "MyEnvData");5import org.cerberus.service.datalib.impl.DataLibService;6DataLibService dataLibService = new DataLibService();7dataLibService.getLibData("MyLib", "MyData", "MyCountry", "MyEnv", "MyEnvData");

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Cerberus-source automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful