How to use getType method of org.cerberus.crud.entity.TestDataLib class

Best Cerberus-source code snippet using org.cerberus.crud.entity.TestDataLib.getType

Source:PropertyService.java Github

copy

Full Screen

...165 /**166 * First create testCaseExecutionData object167 */168 now = new Date().getTime();169 tcExeData = factoryTestCaseExecutionData.create(tCExecution.getId(), eachTccp.getProperty(), 1, eachTccp.getDescription(), null, eachTccp.getType(),170 eachTccp.getValue1(), eachTccp.getValue2(), null, null, now, now, now, now, new MessageEvent(MessageEventEnum.PROPERTY_PENDING),171 eachTccp.getRetryNb(), eachTccp.getRetryPeriod(), eachTccp.getDatabase(), eachTccp.getValue1(), eachTccp.getValue2(), eachTccp.getLength(),172 eachTccp.getLength(), eachTccp.getRowLimit(), eachTccp.getNature(), tCExecution.getApplicationObj().getSystem(), tCExecution.getEnvironment(), tCExecution.getCountry(), "", null, "N");173 tcExeData.setTestCaseCountryProperties(eachTccp);174 tcExeData.settCExecution(tCExecution);175 if (LOG.isDebugEnabled()) {176 LOG.debug("Trying to calculate Property : '" + tcExeData.getProperty() + "' " + tcExeData);177 }178 /* First check if property has already been calculated 179 * if action is calculateProperty, then set isKnownData to false. 180 */181 tcExeData = getExecutionDataFromList(tCExecution.getTestCaseExecutionDataMap(), eachTccp, forceCalculation, tcExeData);182 /**183 * If testcasecountryproperty not defined, set ExecutionData with184 * the same resultMessage185 */186 if (eachTccp.getResult() != null) {187 tcExeData.setPropertyResultMessage(eachTccp.getResult());188 }189 /*190 * If not already calculated, or calculateProperty, then calculate it and insert or update it.191 */192 if (MessageEventEnum.PROPERTY_PENDING.equals(tcExeData.getPropertyResultMessage().getSource())) {193 calculateProperty(tcExeData, tCExecution, testCaseStepActionExecution, eachTccp, forceCalculation);194 msg = tcExeData.getPropertyResultMessage();195 //saves the result 196 try {197 testCaseExecutionDataService.convert(testCaseExecutionDataService.save(tcExeData));198 /**199 * Add TestCaseExecutionData in TestCaseExecutionData List200 * of the TestCaseExecution201 */202 LOG.debug("Adding into Execution data list. Property : '" + tcExeData.getProperty() + "' Index : '" + String.valueOf(tcExeData.getIndex()) + "' Value : '" + tcExeData.getValue() + "'");203 tCExecution.getTestCaseExecutionDataMap().put(tcExeData.getProperty(), tcExeData);204 if (tcExeData.getDataLibRawData() != null) { // If the property is a TestDataLib, we same all rows retreived in order to support nature such as NOTINUSe or RANDOMNEW.205 for (int i = 1; i < (tcExeData.getDataLibRawData().size()); i++) {206 now = new Date().getTime();207 TestCaseExecutionData tcedS = factoryTestCaseExecutionData.create(tcExeData.getId(), tcExeData.getProperty(), (i + 1),208 tcExeData.getDescription(), tcExeData.getDataLibRawData().get(i).get(""), tcExeData.getType(), "", "",209 tcExeData.getRC(), "", now, now, now, now, null, 0, 0, "", "", "", "", "", 0, "", tcExeData.getSystem(), tcExeData.getEnvironment(), tcExeData.getCountry(), tcExeData.getDataLib(), null, "N");210 testCaseExecutionDataService.convert(testCaseExecutionDataService.save(tcedS));211 }212 }213 } catch (CerberusException cex) {214 LOG.error(cex.getMessage(), cex);215 }216 }217 /**218 * After calculation, replace properties by value calculated219 */220 stringToDecode = decodeStringWithAlreadyCalculatedProperties(stringToDecode, tCExecution);221 if (LOG.isDebugEnabled()) {222 LOG.debug("Property " + eachTccp.getProperty() + " calculated with Value = " + tcExeData.getValue() + ", Value1 = " + tcExeData.getValue1() + ", Value2 = " + tcExeData.getValue2());223 }224 /**225 * Log TestCaseExecutionData226 */227 if (tCExecution.getVerbose() > 0) {228 LOG.info(tcExeData.toJson(false, true));229 }230 }231 if (LOG.isDebugEnabled()) {232 LOG.debug("Finished to decode String (property) : '" + stringToDecodeInit + "' to :'" + stringToDecode + "'");233 }234 answer.setResultMessage(msg);235 answer.setItem(stringToDecode);236 return answer;237 }238 /**239 * Auxiliary method that returns the execution data for a property.240 *241 * @param dataList list of execution data242 * @param eachTccp property to be calculated243 * @param forceCalculation indicates whether a property must be244 * re-calculated if it was already computed in previous steps245 * @param tecd execution data for the property246 * @return the updated execution data for the property247 */248 private TestCaseExecutionData getExecutionDataFromList(TreeMap<String, TestCaseExecutionData> hashTemp1, TestCaseCountryProperties eachTccp, boolean forceCalculation, TestCaseExecutionData tecd) {249 LOG.debug("Searching " + eachTccp.getProperty() + " Into list of " + hashTemp1.size());250 try {251 if (hashTemp1.containsKey(eachTccp.getProperty())) {252 if (forceCalculation) {253 LOG.debug("Property has already been calculated but forcing new calculation by removing it : " + hashTemp1.get(eachTccp.getProperty()));254 hashTemp1.remove(eachTccp.getProperty());255 return tecd;256 } else {257 LOG.debug("Property has already been calculated : " + hashTemp1.get(eachTccp.getProperty()));258 return hashTemp1.get(eachTccp.getProperty());259 }260 } else {261 LOG.debug("Property was never calculated.");262 return tecd;263 }264 } catch (Exception ex) {265 LOG.error("Exception catched inside getExecutionDataFromList : " + ex);266 }267 return tecd;268 }269 /**270 * Method that takes the potencial @param property, finds it (or not if it271 * is not a existing property) inside the existing property list @param272 * propertiesOfTestcase and gets the list of all other properties required273 * (contained inside value1 or value2).274 *275 * @param country country used to filter property from propertiesOfTestcase276 * @param property property to be calculated277 * @param crossedProperties List of previously found properties.278 * @param propertiesOfTestcase List of properties defined from the testcase.279 * @return list of TestCaseCountryProperties that are included inside the280 * definition of the @param property281 */282 private List<TestCaseCountryProperties> getListOfPropertiesLinkedToProperty(String country, String property, List<String> crossedProperties,283 List<TestCaseCountryProperties> propertiesOfTestcase) {284 List<TestCaseCountryProperties> result = new ArrayList();285 TestCaseCountryProperties testCaseCountryProperty = null;286 /*287 * Check if property is not already known (recursive case).288 */289 if (crossedProperties.contains(property)) {290 return result;291 }292 crossedProperties.add(property);293 /*294 * Check if property is defined for this testcase295 */296 AnswerItem ansSearch = findMatchingTestCaseCountryProperty(property, country, propertiesOfTestcase);297 testCaseCountryProperty = (TestCaseCountryProperties) ansSearch.getItem();298 if (testCaseCountryProperty == null) {299 return result;300 }301 /* 302 * Check if property value1 and value2 contains internal properties303 */304 List<String> allProperties = new ArrayList();305 // Value1 treatment306 List<String> propertiesValue1 = new ArrayList();307 //check the properties specified in the test308 for (String propNameFromValue1 : this.getPropertiesListFromString(testCaseCountryProperty.getValue1())) {309 for (TestCaseCountryProperties pr : propertiesOfTestcase) {310 if (pr.getProperty().equals(propNameFromValue1)) {311 propertiesValue1.add(propNameFromValue1);312 break;313 }314 }315 }316 allProperties.addAll(propertiesValue1);317 // Value2 treatment :318 List<String> propertiesValue2 = new ArrayList();319 //check the properties specified in the test320 for (String propNameFromValue2 : this.getPropertiesListFromString(testCaseCountryProperty.getValue2())) {321 for (TestCaseCountryProperties pr : propertiesOfTestcase) {322 if (pr.getProperty().equals(propNameFromValue2)) {323 propertiesValue2.add(propNameFromValue2);324 break;325 }326 }327 }328 allProperties.addAll(propertiesValue2);329 for (String internalProperty : allProperties) {330 result.addAll(getListOfPropertiesLinkedToProperty(country, internalProperty, crossedProperties, propertiesOfTestcase));331 }332 result.add(testCaseCountryProperty);333 return result;334 }335 private String decodeStringWithAlreadyCalculatedProperties(String stringToReplace, TestCaseExecution tCExecution) {336 String variableValue = "";337 String variableString1 = "";338 String variableString2 = "";339 TestCaseExecutionData tced;340 for (String key1 : tCExecution.getTestCaseExecutionDataMap().keySet()) {341 tced = tCExecution.getTestCaseExecutionDataMap().get(key1);342 if ((tced.getType() != null) && (tced.getType().equals(TestCaseCountryProperties.TYPE_GETFROMDATALIB))) { // Type could be null in case property do not exist.343 /* Replacement in case of TestDataLib */344 // Key value of the DataLib.345 if (tced.getValue() != null) {346 stringToReplace = stringToReplace.replace("%property." + tced.getProperty() + "%", tced.getValue());347 stringToReplace = stringToReplace.replace("%" + tced.getProperty() + "%", tced.getValue());348 }349 // For each subdata of the getFromDataLib property, we try to replace with PROPERTY(SUBDATA).350 if (!(tced.getDataLibRawData() == null)) {351 int ind = 0;352 for (HashMap<String, String> dataRow : tced.getDataLibRawData()) { // We loop every row result.353 for (String key : dataRow.keySet()) { // We loop every subdata354 if (dataRow.get(key) != null) {355 variableValue = dataRow.get(key);356 variableString1 = tced.getProperty() + "(" + (ind + 1) + ")" + "(" + key + ")";357 stringToReplace = stringToReplace.replace("%property." + variableString1 + "%", variableValue);358 stringToReplace = stringToReplace.replace("%" + variableString1 + "%", variableValue);359 variableString2 = tced.getProperty() + "." + (ind + 1) + "." + key;360 stringToReplace = stringToReplace.replace("%property." + variableString2 + "%", variableValue);361 stringToReplace = stringToReplace.replace("%" + variableString2 + "%", variableValue);362 if (key.equals("")) { // If subdata is empty we can omit the () or .363 variableString1 = tced.getProperty() + "(" + (ind + 1) + ")";364 stringToReplace = stringToReplace.replace("%property." + variableString1 + "%", variableValue);365 stringToReplace = stringToReplace.replace("%" + variableString1 + "%", variableValue);366 variableString2 = tced.getProperty() + "." + (ind + 1);367 stringToReplace = stringToReplace.replace("%property." + variableString2 + "%", variableValue);368 stringToReplace = stringToReplace.replace("%" + variableString2 + "%", variableValue);369 }370 if (ind == 0) { // Dimention of the data is not mandatory for the 1st row.371 variableString1 = tced.getProperty() + "(" + key + ")";372 stringToReplace = stringToReplace.replace("%property." + variableString1 + "%", variableValue);373 stringToReplace = stringToReplace.replace("%" + variableString1 + "%", variableValue);374 variableString2 = tced.getProperty() + "." + key;375 stringToReplace = stringToReplace.replace("%property." + variableString2 + "%", variableValue);376 stringToReplace = stringToReplace.replace("%" + variableString2 + "%", variableValue);377 }378 }379 }380 ind++;381 }382 }383 } else if (tced.getValue() != null) {384 /* Replacement in case of normal PROPERTY */385 stringToReplace = stringToReplace.replace("%property." + tced.getProperty() + "%", tced.getValue());386 stringToReplace = stringToReplace.replace("%" + tced.getProperty() + "%", tced.getValue());387 }388 }389 return stringToReplace;390 }391 /**392 * Gets all properties names contained into the given {@link String}393 *394 * <p>395 * A property is defined by including its name between two '%' character.396 * </p>397 *398 * @param str the {@link String} to get all properties399 * @param variableType400 * @return a list of properties contained into the given {@link String}401 */402 private List<String> getPropertiesListFromString(String str) {403 List<String> properties = new ArrayList<String>();404 LOG.debug("Starting to guess properties from string : " + str);405 if (str == null) {406 LOG.debug("Stoping to guess properties - Empty String ");407 return properties;408 }409 String[] text1 = str.split("%");410 int i = 0;411 for (String rawProperty : text1) {412 if (((i > 0) || (str.startsWith("%"))) && ((i < (text1.length - 1)) || str.endsWith("%"))) { // First and last string from split is not to be considered.413 // Removes "property." string.414 rawProperty = rawProperty.replaceFirst("^property\\.", "");415 // Removes the variable part of the property eg : (subdata)416 String[] ramProp1 = rawProperty.split("\\(");417 // Removes the variable part of the property eg : .subdata418 String[] ramProp2 = ramProp1[0].split("\\.");419 if (!(StringUtil.isNullOrEmpty(ramProp2[0].trim())) // Avoid getting empty Property names.420 && ramProp2[0].trim().length() <= TestCaseCountryProperties.MAX_PROPERTY_LENGTH // Properties cannot be bigger than n caracters.421 && !ramProp2[0].trim().contains("\n")) { // Properties cannot contain \n.422 properties.add(ramProp2[0].trim());423 LOG.debug("Adding string to result " + ramProp2[0].trim());424 } else {425 LOG.debug("Discarding string (empty or too big or contains cariage return).");426 }427 // Avoid getting empty Property names.428 } else {429 LOG.debug("Discarding string (first or last split).");430 }431 i++;432 }433 LOG.debug("Stopping to guess properties - Finished.");434 return properties;435 }436 /**437 * Auxiliary method that verifies if a property is defined in the scope of438 * the test case.439 *440 * @param property - property name441 * @param country - country were the property was implemented442 * @param propertieOfTestcase - list of properties defined for the test case443 * @return an AnswerItem that contains the property in case of success, and444 * null otherwise. also it returns a message indicating error or success.445 */446 private AnswerItem<TestCaseCountryProperties> findMatchingTestCaseCountryProperty(String property, String country, List<TestCaseCountryProperties> propertieOfTestcase) {447 AnswerItem<TestCaseCountryProperties> item = new AnswerItem<TestCaseCountryProperties>();448 boolean propertyDefined = false;449 item.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS));450 TestCaseCountryProperties testCaseCountryProperty = null;451 //searches for properties that match the propertyname (even if they use the getFromDataLib syntax)452 for (TestCaseCountryProperties tccp : propertieOfTestcase) {453 if (tccp.getProperty().equals(property)) {454 //property is defined455 propertyDefined = true;456 //check if is defined for country457 if (tccp.getCountry().equals(country)) {458 //if is a sub data access then we create a auxiliary property459 testCaseCountryProperty = tccp;460 if (LOG.isDebugEnabled()) {461 LOG.debug("Property found : " + tccp);462 }463 break;464 }465 }466 }467 /**468 * If property defined on another Country, set a specific message. If469 * property is not defined at all, trigger the end of the testcase.470 */471 if (testCaseCountryProperty == null) {472 MessageEvent msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_NO_PROPERTY_DEFINITION);473 if (!propertyDefined) {474 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_UNKNOWNPROPERTY);475 }476 msg.setDescription(msg.getDescription().replace("%COUNTRY%", country));477 msg.setDescription(msg.getDescription().replace("%PROP%", property));478 item.setResultMessage(msg);479 if (LOG.isDebugEnabled()) {480 LOG.debug(msg.getDescription());481 }482 }483 item.setItem(testCaseCountryProperty);484 return item;485 }486 @Override487 public void calculateProperty(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseStepActionExecution testCaseStepActionExecution,488 TestCaseCountryProperties testCaseCountryProperty, boolean forceRecalculation) {489 testCaseExecutionData.setStart(new Date().getTime());490 MessageEvent res;491 String test = tCExecution.getTest();492 String testCase = tCExecution.getTestCase();493 AnswerItem<String> answerDecode = new AnswerItem();494 if (LOG.isDebugEnabled()) {495 LOG.debug("Starting to calculate Property : '" + testCaseCountryProperty.getProperty() + "'");496 }497 // Checking recursive decode.498 if ((tCExecution.getRecursiveAlreadyCalculatedPropertiesList() != null) && (tCExecution.getRecursiveAlreadyCalculatedPropertiesList().contains(testCaseCountryProperty.getProperty()))) {499 res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_RECURSIVE);500 res.setDescription(res.getDescription().replace("%PROPERTY%", testCaseCountryProperty.getProperty())501 .replace("%HISTO%", tCExecution.getRecursiveAlreadyCalculatedPropertiesList().toString()));502 testCaseExecutionData.setPropertyResultMessage(res);503 testCaseExecutionData.setEnd(new Date().getTime());504 LOG.debug("Finished to calculate Property (interupted) : '" + testCaseCountryProperty.getProperty() + "' : " + testCaseExecutionData.getPropertyResultMessage().getDescription());505 return;506 }507 if (tCExecution.getRecursiveAlreadyCalculatedPropertiesList() != null) {508 tCExecution.getRecursiveAlreadyCalculatedPropertiesList().add(testCaseCountryProperty.getProperty());509 }510 try {511 // Check if cache activated and cache entry exist.512 int cacheValue = testCaseCountryProperty.getCacheExpire();513 boolean useCache = false;514 AnswerItem<TestCaseExecutionData> answerData = null;515 if (cacheValue > 0) {516 answerData = testCaseExecutionDataService.readLastCacheEntry(tCExecution.getApplicationObj().getSystem(), tCExecution.getEnvironment(), tCExecution.getCountry(), testCaseCountryProperty.getProperty(), cacheValue);517 if (answerData.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode()) && answerData.getItem() != null) {518 useCache = true;519 }520 }521 if (!useCache) {522 /**523 * Decode Property replacing properties encapsulated with %524 */525 if (testCaseCountryProperty.getValue1().contains("%")) {526 answerDecode = variableService.decodeStringCompletly(testCaseCountryProperty.getValue1(), tCExecution, null, false);527 testCaseExecutionData.setValue1((String) answerDecode.getItem());528 if (!(answerDecode.isCodeStringEquals("OK"))) {529 // If anything wrong with the decode --> we stop here with decode message in the property result.530 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Property Value1"));531 testCaseExecutionData.setEnd(new Date().getTime());532 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());533 LOG.debug("Finished to calculate Property (interupted) : '" + testCaseCountryProperty.getProperty() + "' : " + testCaseExecutionData.getPropertyResultMessage().getDescription());534 return;535 }536 }537 if (testCaseCountryProperty.getValue2() != null && testCaseCountryProperty.getValue2().contains("%")) {538 answerDecode = variableService.decodeStringCompletly(testCaseCountryProperty.getValue2(), tCExecution, null, false);539 testCaseExecutionData.setValue2((String) answerDecode.getItem());540 if (!(answerDecode.isCodeStringEquals("OK"))) {541 // If anything wrong with the decode --> we stop here with decode message in the property result.542 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Property Value2"));543 testCaseExecutionData.setEnd(new Date().getTime());544 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());545 LOG.debug("Finished to calculate Property (interupted) : '" + testCaseCountryProperty.getProperty() + "' : " + testCaseExecutionData.getPropertyResultMessage().getDescription());546 return;547 }548 }549 // cache not activated or no entry exist.550 int execution_count = 0;551 int retries = testCaseCountryProperty.getRetryNb();552 int periodms = testCaseCountryProperty.getRetryPeriod();553 LOG.debug("Init Retries : " + retries + " Period : " + periodms);554 /**555 * Controling that retrynb and retryperiod are correctly feeded.556 * <br>557 * This is to avoid that <br>558 * 1/ retry is greater than cerberus_property_maxretry <br>559 * 2/ total duration of property calculation is longuer than560 * cerberus_property_maxretrytotalduration561 */562 boolean forced_retry = false;563 String forced_retry_message = "";564 if (!(retries == 0)) {565 int maxretry = parameterService.getParameterIntegerByKey("cerberus_property_maxretry", "", 50);566 if (retries > maxretry) {567 retries = maxretry;568 forced_retry = true;569 }570 int maxtotalduration = parameterService.getParameterIntegerByKey("cerberus_property_maxretrytotalduration", "", 1800000);571 if (periodms > maxtotalduration) {572 periodms = maxtotalduration;573 forced_retry = true;574 }575 if (retries * periodms > maxtotalduration) {576 retries = (int) maxtotalduration / periodms;577 forced_retry = true;578 }579 if (forced_retry) {580 forced_retry_message = "WARNING : Forced Retries : " + testCaseCountryProperty.getRetryNb() + "-->" + retries + " and Period : " + testCaseCountryProperty.getRetryPeriod() + "-->" + periodms + " (in order to respect the constrains cerberus_property_maxretry " + maxretry + " & cerberus_property_maxtotalduration " + maxtotalduration + ")";581 LOG.debug("Forced Retries : " + retries + " Period : " + periodms + " in order to respect the constrains cerberus_property_maxretry " + maxretry + " & cerberus_property_maxtotalduration " + maxtotalduration);582 }583 }584 /**585 * Looping on calculating the action until result is OK or reach586 * the max retry.587 */588 while (execution_count <= retries && !(testCaseExecutionData.getPropertyResultMessage().getCodeString().equals("OK"))) {589 LOG.debug("Attempt #" + execution_count + " " + testCaseCountryProperty.getProperty() + " " + testCaseCountryProperty.getValue1());590 if (execution_count >= 1) { // We only wait the period if not on the very first calculation.591 try {592 Thread.sleep(periodms);593 LOG.debug("Attempt #" + execution_count + " " + testCaseCountryProperty.getProperty() + " " + testCaseCountryProperty.getValue1() + " Waiting " + periodms + " ms");594 } catch (InterruptedException ex) {595 LOG.error(ex.toString());596 }597 }598 /**599 * Calculate Property regarding the type600 */601 switch (testCaseCountryProperty.getType()) {602 case TestCaseCountryProperties.TYPE_TEXT:603 testCaseExecutionData = this.property_calculateText(testCaseExecutionData, testCaseCountryProperty, forceRecalculation);604 break;605 case TestCaseCountryProperties.TYPE_GETFROMDATALIB:606 testCaseExecutionData = this.property_getFromDataLib(testCaseExecutionData, tCExecution, testCaseStepActionExecution, testCaseCountryProperty, forceRecalculation);607 break;608 case TestCaseCountryProperties.TYPE_GETFROMSQL:609 testCaseExecutionData = this.property_getFromSql(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);610 break;611 case TestCaseCountryProperties.TYPE_GETFROMHTML:612 testCaseExecutionData = this.property_getFromHtml(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);613 break;614 case TestCaseCountryProperties.TYPE_GETFROMHTMLVISIBLE:615 testCaseExecutionData = this.property_getFromHtmlVisible(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);616 break;617 case TestCaseCountryProperties.TYPE_GETFROMJS:618 testCaseExecutionData = this.property_getFromJS(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);619 break;620 case TestCaseCountryProperties.TYPE_GETATTRIBUTEFROMHTML:621 testCaseExecutionData = this.property_getAttributeFromHtml(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);622 break;623 case TestCaseCountryProperties.TYPE_GETFROMCOOKIE:624 testCaseExecutionData = this.property_getFromCookie(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);625 break;626 case TestCaseCountryProperties.TYPE_GETFROMXML:627 testCaseExecutionData = this.property_getFromXml(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);628 break;629 case TestCaseCountryProperties.TYPE_GETDIFFERENCESFROMXML:630 testCaseExecutionData = this.property_getDifferencesFromXml(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);631 break;632 case TestCaseCountryProperties.TYPE_GETFROMJSON:633 testCaseExecutionData = this.property_getFromJson(testCaseExecutionData, tCExecution, forceRecalculation);634 break;635 case TestCaseCountryProperties.TYPE_GETFROMGROOVY:636 testCaseExecutionData = this.property_getFromGroovy(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);637 break;638 case TestCaseCountryProperties.TYPE_EXECUTESOAPFROMLIB: // DEPRECATED639 testCaseExecutionData = this.property_executeSoapFromLib(testCaseExecutionData, tCExecution, testCaseStepActionExecution, testCaseCountryProperty, forceRecalculation);640 res = testCaseExecutionData.getPropertyResultMessage();641 res.setDescription(MESSAGE_DEPRECATED + " " + res.getDescription());642 testCaseExecutionData.setPropertyResultMessage(res);643 logEventService.createForPrivateCalls("ENGINE", TestCaseCountryProperties.TYPE_EXECUTESOAPFROMLIB, MESSAGE_DEPRECATED + " Deprecated Property triggered by TestCase : ['" + test + "|" + testCase + "']");644 LOG.warn(MESSAGE_DEPRECATED + " Deprecated Property " + TestCaseCountryProperties.TYPE_EXECUTESOAPFROMLIB + " triggered by TestCase : ['" + test + "'|'" + testCase + "']");645 break;646 case TestCaseCountryProperties.TYPE_EXECUTESQLFROMLIB: // DEPRECATED647 testCaseExecutionData = this.property_executeSqlFromLib(testCaseExecutionData, testCaseCountryProperty, tCExecution, forceRecalculation);648 res = testCaseExecutionData.getPropertyResultMessage();649 res.setDescription(MESSAGE_DEPRECATED + " " + res.getDescription());650 testCaseExecutionData.setPropertyResultMessage(res);651 logEventService.createForPrivateCalls("ENGINE", TestCaseCountryProperties.TYPE_EXECUTESQLFROMLIB, MESSAGE_DEPRECATED + " Deprecated Property triggered by TestCase : ['" + test + "|" + testCase + "']");652 LOG.warn(MESSAGE_DEPRECATED + " Deprecated Property " + TestCaseCountryProperties.TYPE_EXECUTESQLFROMLIB + " triggered by TestCase : ['" + test + "'|'" + testCase + "']");653 break;654 default:655 res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_UNKNOWNPROPERTY);656 res.setDescription(res.getDescription().replace("%PROPERTY%", testCaseCountryProperty.getType()));657 testCaseExecutionData.setPropertyResultMessage(res);658 }659 execution_count++;660 }661 if (execution_count >= 2) { // If there were at least 1 retry, we notify it in the result message.662 res = testCaseExecutionData.getPropertyResultMessage();663 res.setDescription("Retried " + (execution_count - 1) + " time(s) with " + periodms + "ms period - " + res.getDescription());664 testCaseExecutionData.setPropertyResultMessage(res);665 }666 if (forced_retry) { // If the retry and period parameter was changed, we notify it in the result message.667 res = testCaseExecutionData.getPropertyResultMessage();668 res.setDescription(forced_retry_message + " - " + res.getDescription());669 testCaseExecutionData.setPropertyResultMessage(res);670 }671 } else {672 // cache activated and entry exist. We set the current value with cache entry data and notify the result from the messsage.673 TestCaseExecutionData testCaseExecutionDataFromCache = (TestCaseExecutionData) answerData.getItem();674 testCaseExecutionData.setFromCache("Y");675 testCaseExecutionData.setDataLib(testCaseExecutionDataFromCache.getDataLib());676 testCaseExecutionData.setValue(testCaseExecutionDataFromCache.getValue());677 testCaseExecutionData.setJsonResult(testCaseExecutionDataFromCache.getJsonResult());678 DateFormat df = new SimpleDateFormat(DateUtil.DATE_FORMAT_DISPLAY);679 res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_FROMCACHE).resolveDescription("ID", String.valueOf(testCaseExecutionDataFromCache.getId())).resolveDescription("DATE", df.format(testCaseExecutionDataFromCache.getStart()));680 testCaseExecutionData.setPropertyResultMessage(res);681 if (!StringUtil.isNullOrEmpty(testCaseExecutionDataFromCache.getJsonResult())) {682 // Convert json to HashMap.683 List<HashMap<String, String>> result = null;684 result = new ArrayList();685 try {686 LOG.debug("Converting Json : " + testCaseExecutionDataFromCache.getJsonResult());687 JSONArray json = new JSONArray(testCaseExecutionDataFromCache.getJsonResult());688 for (int i = 0; i < json.length(); i++) {689 JSONObject explrObject = json.getJSONObject(i);690 LOG.debug(explrObject.toString());691 HashMap<String, String> resultHash = new HashMap<String, String>();692 Iterator<String> nameItr = explrObject.keys();693 while (nameItr.hasNext()) {694 String name = nameItr.next();695 if (name.equals("KEY")) {696 resultHash.put("", explrObject.getString(name));697 } else {698 resultHash.put(name, explrObject.getString(name));699 }700 }701 result.add(resultHash);702 }703 } catch (JSONException ex) {704 java.util.logging.Logger.getLogger(PropertyService.class.getName()).log(Level.SEVERE, null, ex);705 LOG.error(ex);706 }707 testCaseExecutionData.setDataLibRawData(result);708 //Record result in filessytem.709 recorderService.recordTestDataLibProperty(tCExecution.getId(), testCaseCountryProperty.getProperty(), 1, result);710 }711 }712 } catch (CerberusEventException ex) {713 LOG.error(ex.toString());714 testCaseExecutionData.setEnd(new Date().getTime());715 testCaseExecutionData.setPropertyResultMessage(ex.getMessageError());716 }717 testCaseExecutionData.setEnd(new Date().getTime());718 if (LOG.isDebugEnabled()) {719 LOG.debug("Finished to calculate Property : '" + testCaseCountryProperty.getProperty() + "'");720 }721 }722 private TestCaseExecutionData property_executeSqlFromLib(TestCaseExecutionData testCaseExecutionData, TestCaseCountryProperties testCaseCountryProperty, TestCaseExecution tCExecution, boolean forceCalculation) {723 try {724 String script = this.sqlLibraryService.findSqlLibraryByKey(testCaseExecutionData.getValue1()).getScript();725 testCaseExecutionData.setValue1(script); //TODO use the new library 726 } catch (CerberusException ex) {727 LOG.warn(ex);728 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_SQL_SQLLIB_NOTEXIT);729 res.setDescription(res.getDescription().replace("%SQLLIB%", testCaseExecutionData.getValue1()));730 testCaseExecutionData.setPropertyResultMessage(res);731 testCaseExecutionData.setEnd(732 new Date().getTime());733 return testCaseExecutionData;734 }735 testCaseExecutionData = this.property_getFromSql(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceCalculation);736 return testCaseExecutionData;737 }738 private TestCaseExecutionData property_getFromSql(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {739 return sQLService.calculateOnDatabase(testCaseExecutionData, testCaseCountryProperty, tCExecution);740 }741 private TestCaseExecutionData property_calculateText(TestCaseExecutionData testCaseExecutionData, TestCaseCountryProperties testCaseCountryProperty, boolean forceRecalculation) {742 if (TestCaseCountryProperties.NATURE_RANDOM.equals(testCaseCountryProperty.getNature())743 //TODO CTE Voir avec B. Civel "RANDOM_NEW"744 || (testCaseCountryProperty.getNature().equals(TestCaseCountryProperties.NATURE_RANDOMNEW))) {745 if (testCaseCountryProperty.getLength().equals("0")) {746 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_TEXTRANDOMLENGHT0);747 testCaseExecutionData.setPropertyResultMessage(res);748 } else {749 String charset;750 if (testCaseExecutionData.getValue1() != null && !"".equals(testCaseExecutionData.getValue1().trim())) {751 charset = testCaseExecutionData.getValue1();752 } else {753 charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";754 }755 String value = StringUtil.getRandomString(ParameterParserUtil.parseIntegerParam(testCaseCountryProperty.getLength(), 0), charset);756 testCaseExecutionData.setValue(value);757 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_RANDOM);758 res.setDescription(res.getDescription().replace("%FORCED%", forceRecalculation == true ? "Re-" : ""));759 res.setDescription(res.getDescription().replace("%VALUE%", ParameterParserUtil.securePassword(value, testCaseCountryProperty.getProperty())));760 testCaseExecutionData.setPropertyResultMessage(res);761// if (testCaseCountryProperty.getNature().equals("RANDOM_NEW")) {762// //TODO check if value exist on DB ( used in another test case of the revision )763// }764 }765 } else {766 LOG.debug("Setting value : " + testCaseExecutionData.getValue1());767 String value = testCaseExecutionData.getValue1();768 testCaseExecutionData.setValue(value);769 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_TEXT);770 res.setDescription(res.getDescription().replace("%VALUE%", ParameterParserUtil.securePassword(value, testCaseCountryProperty.getProperty())));771 testCaseExecutionData.setPropertyResultMessage(res);772 }773 return testCaseExecutionData;774 }775 private TestCaseExecutionData property_getFromHtmlVisible(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {776 try {777 Identifier identifier = identifierService.convertStringToIdentifier(testCaseExecutionData.getValue1());778 String valueFromHTML = this.webdriverService.getValueFromHTMLVisible(tCExecution.getSession(), identifier);779 if (valueFromHTML != null) {780 testCaseExecutionData.setValue(valueFromHTML);781 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_HTMLVISIBLE);782 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));783 res.setDescription(res.getDescription().replace("%VALUE%", valueFromHTML));784 testCaseExecutionData.setPropertyResultMessage(res);785 } else {786 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTMLVISIBLE_ELEMENTDONOTEXIST);787 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));788 testCaseExecutionData.setPropertyResultMessage(res);789 }790 } catch (NoSuchElementException exception) {791 LOG.debug(exception.toString());792 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTMLVISIBLE_ELEMENTDONOTEXIST);793 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));794 testCaseExecutionData.setPropertyResultMessage(res);795 }796 return testCaseExecutionData;797 }798 private TestCaseExecutionData property_getFromHtml(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {799 if (tCExecution.getApplicationObj().getType().equals(Application.TYPE_APK)800 || tCExecution.getApplicationObj().getType().equals(Application.TYPE_IPA)801 || tCExecution.getApplicationObj().getType().equals(Application.TYPE_GUI)) {802 try {803 Identifier identifier = identifierService.convertStringToIdentifier(testCaseExecutionData.getValue1());804 String valueFromHTML = this.webdriverService.getValueFromHTML(tCExecution.getSession(), identifier);805 if (valueFromHTML != null) {806 testCaseExecutionData.setValue(valueFromHTML);807 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_HTML);808 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));809 res.setDescription(res.getDescription().replace("%VALUE%", valueFromHTML));810 testCaseExecutionData.setPropertyResultMessage(res);811 }812 } catch (NoSuchElementException exception) {813 LOG.debug(exception.toString());814 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTML_ELEMENTDONOTEXIST);815 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));816 testCaseExecutionData.setPropertyResultMessage(res);817 }818 } else {819 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_FEATURENOTSUPPORTED);820 res.setDescription(res.getDescription().replace("%APPTYPE%", tCExecution.getApplicationObj().getType()));821 res.setDescription(res.getDescription().replace("%PROPTYPE%", testCaseExecutionData.getType()));822 }823 return testCaseExecutionData;824 }825 private TestCaseExecutionData property_getFromJS(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {826 String script = testCaseExecutionData.getValue1();827 String valueFromJS;828 String message = "";829 try {830 valueFromJS = this.webdriverService.getValueFromJS(tCExecution.getSession(), script);831 } catch (Exception e) {832 message = e.getMessage().split("\n")[0];833 LOG.debug("Exception Running JS Script :" + message);834 valueFromJS = null;835 }836 if (valueFromJS != null) {837 testCaseExecutionData.setValue(valueFromJS);838 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_JS);839 res.setDescription(res.getDescription().replace("%SCRIPT%", script));840 res.setDescription(res.getDescription().replace("%VALUE%", valueFromJS));841 testCaseExecutionData.setPropertyResultMessage(res);842 } else {843 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_JS_EXCEPTION);844 res.setDescription(res.getDescription().replace("%EXCEPTION%", message));845 testCaseExecutionData.setPropertyResultMessage(res);846 }847 return testCaseExecutionData;848 }849 private TestCaseExecutionData property_getFromGroovy(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {850 // Check if script has been correctly defined851 String script = testCaseExecutionData.getValue1();852 if (script == null || script.isEmpty()) {853 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMGROOVY_NULL));854 return testCaseExecutionData;855 }856 // Try to evaluate Groovy script857 try {858 String valueFromGroovy = groovyService.eval(script);859 testCaseExecutionData.setValue(valueFromGroovy);860 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMGROOVY)861 .resolveDescription("VALUE", valueFromGroovy));862 } catch (IGroovyService.IGroovyServiceException e) {863 LOG.debug("Exception Running Grrovy Script :" + e.getMessage());864 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMGROOVY_EXCEPTION).resolveDescription("REASON", e.getMessage()));865 }866 return testCaseExecutionData;867 }868 private TestCaseExecutionData property_getAttributeFromHtml(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {869 MessageEvent res;870 try {871 Identifier identifier = identifierService.convertStringToIdentifier(testCaseExecutionData.getValue1());872 String valueFromHTML = this.webdriverService.getAttributeFromHtml(tCExecution.getSession(), identifier, testCaseExecutionData.getValue2());873 if (valueFromHTML != null) {874 testCaseExecutionData.setValue(valueFromHTML);875 res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETATTRIBUTEFROMHTML);876 res.setDescription(res.getDescription().replace("%VALUE%", valueFromHTML));877 } else {878 res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTML_ATTRIBUTEDONOTEXIST);879 }880 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));881 res.setDescription(res.getDescription().replace("%ATTRIBUTE%", testCaseExecutionData.getValue2()));882 } catch (NoSuchElementException exception) {883 LOG.debug(exception.toString());884 res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTMLVISIBLE_ELEMENTDONOTEXIST);885 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));886 }887 testCaseExecutionData.setPropertyResultMessage(res);888 return testCaseExecutionData;889 }890 private TestCaseExecutionData property_executeSoapFromLib(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseStepActionExecution testCaseStepActionExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {891 String result = null;892 AnswerItem<String> answerDecode = new AnswerItem();893 try {894 AppService appService = this.appServiceService.findAppServiceByKey(testCaseExecutionData.getValue1());895 if (appService != null) {896 String decodedEnveloppe = appService.getServiceRequest();897 String decodedServicePath = appService.getServicePath();898 String decodedMethod = appService.getOperation();899 String decodedAttachement = appService.getAttachementURL();900 if (appService.getServiceRequest().contains("%")) {901 answerDecode = variableService.decodeStringCompletly(appService.getServiceRequest(), tCExecution, testCaseStepActionExecution, false);902 decodedEnveloppe = (String) answerDecode.getItem();903 if (!(answerDecode.isCodeStringEquals("OK"))) {904 // If anything wrong with the decode --> we stop here with decode message in the action result.905 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SOAP Service Request"));906 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());907 LOG.debug("Property interupted due to decode 'SOAP Service Request' Error.");908 return testCaseExecutionData;909 }910 }911 if (appService.getServicePath().contains("%")) {912 answerDecode = variableService.decodeStringCompletly(appService.getServicePath(), tCExecution, testCaseStepActionExecution, false);913 decodedServicePath = (String) answerDecode.getItem();914 if (!(answerDecode.isCodeStringEquals("OK"))) {915 // If anything wrong with the decode --> we stop here with decode message in the action result.916 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SOAP Service Path"));917 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());918 LOG.debug("Property interupted due to decode 'SOAP Service Path.");919 return testCaseExecutionData;920 }921 }922 if (appService.getOperation().contains("%")) {923 answerDecode = variableService.decodeStringCompletly(appService.getOperation(), tCExecution, testCaseStepActionExecution, false);924 decodedMethod = (String) answerDecode.getItem();925 if (!(answerDecode.isCodeStringEquals("OK"))) {926 // If anything wrong with the decode --> we stop here with decode message in the action result.927 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SOAP Operation"));928 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());929 LOG.debug("Property interupted due to decode 'SOAP Operation.");930 return testCaseExecutionData;931 }932 }933 if (appService.getAttachementURL().contains("%")) {934 answerDecode = variableService.decodeStringCompletly(appService.getAttachementURL(), tCExecution, testCaseStepActionExecution, false);935 decodedAttachement = (String) answerDecode.getItem();936 if (!(answerDecode.isCodeStringEquals("OK"))) {937 // If anything wrong with the decode --> we stop here with decode message in the action result.938 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SOAP Attachement URL"));939 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());940 LOG.debug("Property interupted due to decode 'SOAP Attachement URL.");941 return testCaseExecutionData;942 }943 }944 //Call Soap and set LastSoapCall of the testCaseExecution.945 AnswerItem soapCall = soapService.callSOAP(decodedEnveloppe, decodedServicePath, decodedMethod, decodedAttachement, null, null, 60000, tCExecution.getApplicationObj().getSystem());946 AppService se1 = (AppService) soapCall.getItem();947// tCExecution.setLastSOAPCalled(soapCall);948 if (soapCall.isCodeEquals(200)) {949// SOAPExecution lastSoapCalled = (SOAPExecution) tCExecution.getLastSOAPCalled().getItem();950 String xmlResponse = se1.getResponseHTTPBody();951 result = xmlUnitService.getFromXml(xmlResponse, appService.getAttachementURL());952 }953 if (result != null) {954 testCaseExecutionData.setValue(result);955 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_SOAP);956 testCaseExecutionData.setPropertyResultMessage(res);957 } else {958 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_SOAPFROMLIB_NODATA);959 testCaseExecutionData.setPropertyResultMessage(res);960 }961 }962 } catch (CerberusException exception) {963 LOG.error(exception.toString());964 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_TESTDATA_PROPERTYDONOTEXIST);965 res.setDescription(res.getDescription().replace("%PROPERTY%", testCaseExecutionData.getValue1()));966 testCaseExecutionData.setPropertyResultMessage(res);967 } catch (CerberusEventException ex) {968 LOG.error(ex.toString());969 MessageEvent message = new MessageEvent(MessageEventEnum.ACTION_FAILED_CALLSOAP);970 message.setDescription(message.getDescription().replace("%SOAPNAME%", testCaseExecutionData.getValue1()));971 message.setDescription(message.getDescription().replace("%DESCRIPTION%", ex.getMessageError().getDescription()));972 testCaseExecutionData.setPropertyResultMessage(message);973 }974 return testCaseExecutionData;975 }976 private TestCaseExecutionData property_getFromXml(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {977 // 1. Get XML value to parse978 String xmlToParse = null;979 // If value2 is defined, then take it as XML value to parse980 if (!(StringUtil.isNullOrEmpty(testCaseExecutionData.getValue2()))) {981 xmlToParse = testCaseExecutionData.getValue2();982 } // Else try to get the last known response from service call983 else if (tCExecution.getLastServiceCalled() != null) {984 xmlToParse = tCExecution.getLastServiceCalled().getResponseHTTPBody();985 } // If XML to parse is still null, then there is an error in XML value definition986 else if (xmlToParse == null) {987 testCaseExecutionData.setPropertyResultMessage(988 new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMXML)989 .resolveDescription("VALUE1", testCaseExecutionData.getValue1())990 .resolveDescription("VALUE2", testCaseExecutionData.getValue2()));991 return testCaseExecutionData;992 }993 // Else we can try to parse it thanks to the dedicated service994 try {995 String valueFromXml = xmlUnitService.getFromXml(xmlToParse, testCaseExecutionData.getValue1());996 if (valueFromXml != null) {997 testCaseExecutionData.setValue(valueFromXml);998 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMXML);999 res.setDescription(res.getDescription().replace("%VALUE%", valueFromXml));1000 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1001 testCaseExecutionData.setPropertyResultMessage(res);1002 } else {1003 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMXML);1004 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1005 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1006 testCaseExecutionData.setPropertyResultMessage(res);1007 }1008 } catch (Exception ex) {1009 LOG.debug(ex.toString());1010 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMXML);1011 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1012 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1013 testCaseExecutionData.setPropertyResultMessage(res);1014 }1015 return testCaseExecutionData;1016 }1017 private TestCaseExecutionData property_getFromCookie(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {1018 try {1019 String valueFromCookie = this.webdriverService.getFromCookie(tCExecution.getSession(), testCaseExecutionData.getValue1(), testCaseExecutionData.getValue2());1020 if (valueFromCookie != null) {1021 if (!valueFromCookie.equals("cookieNotFound")) {1022 testCaseExecutionData.setValue(valueFromCookie);1023 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMCOOKIE);1024 res.setDescription(res.getDescription().replace("%COOKIE%", testCaseExecutionData.getValue1()));1025 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue2()));1026 res.setDescription(res.getDescription().replace("%VALUE%", valueFromCookie));1027 testCaseExecutionData.setPropertyResultMessage(res);1028 } else {1029 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMCOOKIE_COOKIENOTFOUND);1030 res.setDescription(res.getDescription().replace("%COOKIE%", testCaseExecutionData.getValue1()));1031 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue2()));1032 testCaseExecutionData.setPropertyResultMessage(res);1033 }1034 } else {1035 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMCOOKIE_PARAMETERNOTFOUND);1036 res.setDescription(res.getDescription().replace("%COOKIE%", testCaseExecutionData.getValue1()));1037 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue2()));1038 testCaseExecutionData.setPropertyResultMessage(res);1039 }1040 } catch (Exception exception) {1041 LOG.debug(exception.toString());1042 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMCOOKIE_COOKIENOTFOUND);1043 res.setDescription(res.getDescription().replace("%COOKIE%", testCaseExecutionData.getValue1()));1044 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue2()));1045 testCaseExecutionData.setPropertyResultMessage(res);1046 }1047 return testCaseExecutionData;1048 }1049 private TestCaseExecutionData property_getDifferencesFromXml(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {1050 try {1051 LOG.debug("Computing differences between " + testCaseExecutionData.getValue1() + " and " + testCaseExecutionData.getValue2());1052 String differences = xmlUnitService.getDifferencesFromXml(testCaseExecutionData.getValue1(), testCaseExecutionData.getValue2());1053 if (differences != null) {1054 LOG.debug("Computing done.");1055 testCaseExecutionData.setValue(differences);1056 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETDIFFERENCESFROMXML);1057 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1058 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1059 testCaseExecutionData.setPropertyResultMessage(res);1060 } else {1061 LOG.debug("Computing failed.");1062 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETDIFFERENCESFROMXML);1063 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1064 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1065 testCaseExecutionData.setPropertyResultMessage(res);1066 }1067 } catch (Exception ex) {1068 LOG.debug(ex.toString());1069 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETDIFFERENCESFROMXML);1070 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1071 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1072 testCaseExecutionData.setPropertyResultMessage(res);1073 }1074 return testCaseExecutionData;1075 }1076 private TestCaseExecutionData property_getFromJson(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, boolean forceRecalculation) {1077 String jsonResponse = "";1078 try {1079 /**1080 * If tCExecution LastServiceCalled exist, get the response;1081 */1082 if (null != tCExecution.getLastServiceCalled()) {1083 jsonResponse = tCExecution.getLastServiceCalled().getResponseHTTPBody();1084 }1085 String newUrl = null;1086 if (!(StringUtil.isNullOrEmpty(testCaseExecutionData.getValue2()))) {1087 newUrl = testCaseExecutionData.getValue2();1088 }1089 String valueFromJson = this.jsonService.getFromJson(jsonResponse, newUrl, testCaseExecutionData.getValue1());1090 if (valueFromJson != null) {1091 if (!"".equals(valueFromJson)) {1092 testCaseExecutionData.setValue(valueFromJson);1093 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMJSON);1094 res.setDescription(res.getDescription().replace("%URL%", testCaseExecutionData.getValue2()));1095 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue1()));1096 res.setDescription(res.getDescription().replace("%VALUE%", valueFromJson));1097 testCaseExecutionData.setPropertyResultMessage(res);1098 } else {1099 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMJSON_PARAMETERNOTFOUND);1100 res.setDescription(res.getDescription().replace("%URL%", testCaseExecutionData.getValue2()));1101 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue1()));1102 testCaseExecutionData.setPropertyResultMessage(res);1103 }1104 } else {1105 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMJSON_PARAMETERNOTFOUND);1106 res.setDescription(res.getDescription().replace("%URL%", testCaseExecutionData.getValue2()));1107 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue1()));1108 testCaseExecutionData.setPropertyResultMessage(res);1109 }1110 } catch (Exception exception) {1111 if (LOG.isDebugEnabled()) {1112 LOG.error(exception.toString());1113 }1114 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMJSON_PARAMETERNOTFOUND);1115 res.setDescription(res.getDescription().replace("%URL%", testCaseExecutionData.getValue2()));1116 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue1()));1117 res.setDescription(res.getDescription().replace("%ERROR%", exception.toString()));1118 testCaseExecutionData.setPropertyResultMessage(res);1119 }1120 return testCaseExecutionData;1121 }1122 private TestCaseExecutionData property_getFromDataLib(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution,1123 TestCaseStepActionExecution testCaseStepActionExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceRecalculation) {1124 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB);1125 TestDataLib testDataLib;1126 List<HashMap<String, String>> result = null;1127 AnswerItem<String> answerDecode = new AnswerItem();1128 // We get here the correct TestDataLib entry from the Value1 (name) that better match the context on system, environment and country.1129 AnswerItem<TestDataLib> answer = testDataLibService.readByNameBySystemByEnvironmentByCountry(testCaseExecutionData.getValue1(),1130 tCExecution.getApplicationObj().getSystem(), tCExecution.getEnvironmentData(),1131 tCExecution.getCountry());1132 if (answer.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode()) && answer.getItem() != null) {1133 testDataLib = (TestDataLib) answer.getItem();1134 AnswerList serviceAnswer;1135 //check if there are properties defined in the data specification1136 try {1137 if (testDataLib.getType().equals(TestDataLib.TYPE_SQL)) {1138 //check if the script contains properties that neeed to be calculated1139 answerDecode = variableService.decodeStringCompletly(testDataLib.getScript(), tCExecution, testCaseStepActionExecution, false);1140 String decodedScript = (String) answerDecode.getItem();1141 testDataLib.setScript(decodedScript);1142 if (!(answerDecode.isCodeStringEquals("OK"))) {1143 // If anything wrong with the decode --> we stop here with decode message in the action result.1144 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SQL Script"));1145 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());1146 LOG.debug("Property interupted due to decode 'SQL Script'.");1147 return testCaseExecutionData;1148 }1149 }1150 } catch (CerberusEventException cex) {1151 LOG.error(cex.toString());...

Full Screen

Full Screen

Source:DataLibService.java Github

copy

Full Screen

...429 AnswerItem<HashMap<String, String>> result = new AnswerItem();430 MessageEvent msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS);431 List<TestDataLibData> objectDataList = new ArrayList<TestDataLibData>();432 HashMap<String, String> row = new HashMap<String, String>();433 switch (lib.getType()) {434 case TestDataLib.TYPE_CSV:435 answerData = testDataLibDataService.readByVarious(lib.getTestDataLibID(), null, null, "N");436 if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && !answerData.getDataList().isEmpty()) {437 objectDataList = answerData.getDataList();438 boolean missingKey = true;439 for (TestDataLibData tdld : objectDataList) {440 row.put(tdld.getSubData(), tdld.getColumnPosition());441 if (tdld.getSubData().equalsIgnoreCase("")) {442 missingKey = false;443 }444 }445 result.setItem(row);446 if (missingKey) {447 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATACSVNOKEY);448 result.setResultMessage(msg);449 } else {450 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SUBDATA);451 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(answerData.getDataList().size())));452 result.setResultMessage(msg);453 }454 } else if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && answerData.getDataList().isEmpty()) {455 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_NOSUBDATACSV);456 result.setResultMessage(msg);457 } else {458 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATACSV);459 result.setResultMessage(msg);460 }461 break;462 case TestDataLib.TYPE_SQL:463 answerData = testDataLibDataService.readByVarious(lib.getTestDataLibID(), "N", null, null);464 if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && !answerData.getDataList().isEmpty()) {465 objectDataList = answerData.getDataList();466 boolean missingKey = true;467 for (TestDataLibData tdld : objectDataList) {468 row.put(tdld.getSubData(), tdld.getColumn());469 if (tdld.getSubData().equalsIgnoreCase("")) {470 missingKey = false;471 }472 }473 result.setItem(row);474 if (missingKey) {475 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATASQLNOKEY);476 result.setResultMessage(msg);477 } else {478 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SUBDATA);479 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(answerData.getDataList().size())));480 result.setResultMessage(msg);481 }482 } else if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && answerData.getDataList().isEmpty()) {483 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_NOSUBDATASQL);484 result.setResultMessage(msg);485 } else {486 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATASQL);487 result.setResultMessage(msg);488 }489 break;490 case TestDataLib.TYPE_SERVICE:491 answerData = testDataLibDataService.readByVarious(lib.getTestDataLibID(), null, "N", null);492 if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && !answerData.getDataList().isEmpty()) {493 objectDataList = answerData.getDataList();494 boolean missingKey = true;495 for (TestDataLibData tdld : objectDataList) {496 row.put(tdld.getSubData(), tdld.getParsingAnswer());497 if (tdld.getSubData().equalsIgnoreCase("")) {498 missingKey = false;499 }500 }501 result.setItem(row);502 if (missingKey) {503 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATASOAPNOKEY);504 result.setResultMessage(msg);505 } else {506 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SUBDATA);507 msg.setDescription(msg.getDescription().replace("%NBROW%", String.valueOf(answerData.getDataList().size())));508 result.setResultMessage(msg);509 }510 } else if ((answerData.getResultMessage().getCode() == MessageEventEnum.DATA_OPERATION_OK.getCode()) && answerData.getDataList().isEmpty()) {511 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_NOSUBDATASOAP);512 result.setResultMessage(msg);513 } else {514 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMDATALIB_SUBDATASOAP);515 result.setResultMessage(msg);516 }517 break;518 case TestDataLib.TYPE_INTERNAL:519 // For static Type, there is no need to fetch the subdata as subdata are loaded at the same time of the data.520 msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB_SUBDATA);521 result.setResultMessage(msg);522 result.setItem(null);523 break;524 }525 return result;526 }527 /**528 * Get the dataObject List depending on the type529 *530 * @param lib531 * @param columnList532 * @return533 */534 private AnswerList<HashMap<String, String>> getDataObjectList(TestDataLib lib, HashMap<String, String> columnList, int rowLimit,535 TestCaseExecution tCExecution, TestCaseExecutionData testCaseExecutionData) {536 AnswerList result = new AnswerList();537 MessageEvent msg = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS);538 CountryEnvironmentDatabase countryEnvironmentDatabase;539 AnswerList responseList;540 String system = tCExecution.getApplicationObj().getSystem();541 String country = tCExecution.getCountry();542 String environment = tCExecution.getEnvironment();543 Pattern pattern;544 Matcher matcher;545 Parameter p;546 List<HashMap<String, String>> list;547 switch (lib.getType()) {548 case TestDataLib.TYPE_CSV:549 /**550 * Before making the call we check if the Service Path is551 * already a proper URL. If it is not, we prefix with the CsvUrl552 * defined from corresponding database. This is used to get the553 * data from the correct environment.554 */555 String servicePathCsv = lib.getCsvUrl();556 LOG.debug("Service Path (Csv) : " + lib.getCsvUrl());557 // Trying making an URL with database context path.558 if (!StringUtil.isURL(servicePathCsv)) {559 // Url is not valid, we try to get the corresponding DatabaseURL CsvURL to prefix.560 if (!(StringUtil.isNullOrEmpty(lib.getDatabaseCsv()))) {561 try {...

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2public class TestDataLib {3 private String type;4 public String getType() {5 return type;6 }7 public void setType(String type) {8 this.type = type;9 }10}11package org.cerberus.crud.entity;12public class TestDataLibData {13 private String testDataLibData;14 public String getTestDataLibData() {15 return testDataLibData;16 }17 public void setTestDataLibData(String testDataLibData) {18 this.testDataLibData = testDataLibData;19 }20}21package org.cerberus.crud.entity;22public class TestDataLibData {23 private String testDataLibName;24 public String getTestDataLibName() {25 return testDataLibName;26 }27 public void setTestDataLibName(String testDataLibName) {28 this.testDataLibName = testDataLibName;29 }30}31package org.cerberus.crud.entity;32public class TestDataLibData {33 private int testDataLibID;34 public int getTestDataLibID() {35 return testDataLibID;36 }37 public void setTestDataLibID(int testDataLibID) {38 this.testDataLibID = testDataLibID;39 }40}41package org.cerberus.crud.entity;42public class TestDataLibData {43 private int testDataLibID;44 public int getTestDataLibID() {45 return testDataLibID;46 }47 public void setTestDataLibID(int testDataLibID) {48 this.testDataLibID = testDataLibID;49 }50}51package org.cerberus.crud.entity;52public class TestDataLibData {53 private int testDataLibID;

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestDataLib;3import org.cerberus.crud.entity.TestDataLibData;4public class 3 {5 public static void main(String[] args) {6 TestDataLibData testDataLibData = new TestDataLibData();7 testDataLibData.setType("type");8 System.out.println(testDataLibData.getType());9 }10}

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestDataLib;3import org.cerberus.crud.entity.TestDataLibData;4public class 3 {5 public static void main(String[] args) {6 TestDataLibData testDataLibData = new TestDataLibData();7 testDataLibData.setType("type");8 System.out.println(testDataLibData.getType());9 }10}

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2public class TestDataLib {3 private int id;4 private String name;5 private String system;6 private String type;7 private String method;8 private String database;9 private String servicePath;10 private String servicePathClean;11 private String serviceRequest;12 private String serviceResponse;13 private String envelope;14 private String description;15 private String usrCreated;16 private String dateCreated;17 private String usrModif;18 private String dateModif;19 public int getId() {20 return id;21 }22 public void setId(int id) {23 this.id = id;24 }25 public String getName() {26 return name;27 }28 public void setName(String name) {29 this.name = name;30 }31 public String getSystem() {32 return system;33 }34 public void setSystem(String system) {35 this.system = system;36 }37 public String getType() {38 return type;39 }40 public void setType(String type) {41 this.type = type;42 }43 public String getMethod() {44 return method;45 }46 public void setMethod(String method) {47 this.method = method;48 }49 public String getDatabase() {50 return database;51 }52 public void setDatabase(String database) {53 this.database = database;54 }55 public String getServicePath() {56 return servicePath;57 }58 public void setServicePath(String servicePath) {59 this.servicePath = servicePath;60 }61 public String getServicePathClean() {62 return servicePathClean;63 }64 public void setServicePathClean(String servicePathClean) {65 this.servicePathClean = servicePathClean;66 }67 public String getServiceRequest() {68 return serviceRequest;69 }70 public void setServiceRequest(String serviceRequest) {71 this.serviceRequest = serviceRequest;72 }73 public String getServiceResponse() {74 return serviceResponse;75 }76 public void setServiceResponse(String serviceResponse) {77 this.serviceResponse = serviceResponse;78 }79 public String getEnvelope() {80 return envelope;81 }82 public void setEnvelope(String envelope) {83 this.envelope = envelope;84 }85 public String getDescription() {86 return description;87 }88 public void setDescription(String description) {89 this.description = description;90 }91 public String getUsrCreated() {

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2public class TestDatalib {3 public String getType() {4 return type;5 }6}7package org.cerberus.crud.entity;8public class TestDatalib {9 public String getType() {10 return type;11 }12}13package org.cerberus.crud.entity;14public class TestDatalib {15 public String getType() {16 return type;17 }18}19package org.cerberus.crud.entity;20public class TestDatalib {21 public String getType() {22 return type;23 }24}25package org.cerberus.crud.entity;26public class TestDatalib {27 public String getType() {28 return type;29 }30}31package org.cerberus.crud.entity;32public class TestDatalib {33 public String getType() {34 return type;35 }36}37package org.cerberus.crud.entity;38public class TestDatalib {39 public String getType() {40 return type;41 }42}43package org.cerberus.crud.entity;44public class TestDatalib {45 public String getType() {46 return type;47 }48}49package org.cerberus.crud.entity;50public class TestDatalib {51 public String getType() {52 return type;53 }54}55package org.cerberus.crud.entity;56public class TestDatalib {57 public String getType() {58 return type;59 }60}61package org.cerberus.crud.entity;62lic class TestDatab {

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1packageorg.cerberus.crud.entity;2import org.cerberus.crud.entity.Lib;3pubc class Test {4 pulic staticvoid main(String[] args) 5 TestDataLib test = new TestDataLib();6 test.setType("SQL");7 System.out.println(test.getType());8 }9}10package org.cerberus.crud.entity;11import org.cerberus.crud.entity.TestDataLib;12public class Test {13 public static void main(String[] args) {14 TestDataLib test = new TestDataLib();15 test.setType("SQL");16 System.out.println(test.getType());17 }18}19package org.cerberus.crud.entity;20import org.cerberus.crud.entity.TestDataLib;21public class Test {22 public static void main(String[] args) {23 TestDataLib test = new TestDataLib();24 test.setSubData("sub data");25 System.out.println(test.getSubData());26 }27}28package org.cerberus.crud.entity;29import org.cerberus.crud.entity.TestDataLib;30public class Test {31 public static void main(String[] args) {32 TestDataLib test = new TestDataLib();33 test.setSubData("sub data");34 System.out.println(test.getSubData());35 }36}37package org.cerberus.crud.entity;38import org.cerberus.crud.entity.TestDataLib;39public class Test {40 public static void main(String[] args) {41 TestDataLib test = new TestDataLib();42public class TestDatalib {43 public String getType() {44 return type;45 }46}47package org.cerberus.crud.entity;48public class TestDatalib {49 public String getType() {50 return type;51 }52}53package org.cerberus.crud.entity;54public class TestDatalib {55 public String getType() {56 return type;57 }58}59package org.cerberus.crud.entity;60public class TestDatalib {

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestDataLib;3public class Test {4 public static void main(String[] args) {5 TestDataLib test = new TestDataLib();6 test.setType("SQL");7 System.out.println(test.getType());8 }9}10package org.cerberus.crud.entity;11import org.cerberus.crud.entity.TestDataLib;12public class Test {13 public static void main(String[] args) {14 TestDataLib test = new TestDataLib();15 test.setType("SQL");16 System.out.println(test.getType());17 }18}19package org.cerberus.crud.entity;20import org.cerberus.crud.entity.TestDataLib;21public class Test {22 public static void main(String[] args) {23 TestDataLib test = new TestDataLib();24 test.setSubData("sub data");25 System.out.println(test.getSubData());26 }27}28package org.cerberus.crud.entity;29import org.cerberus.crud.entity.TestDataLib;30public class Test {31 public static void main(String[] args) {32 TestDataLib test = new TestDataLib();33 test.setSubData("sub data");34 System.out.println(test.getSubData());35 }36}37package org.cerberus.crud.entity;38import org.cerberus.crud.entity.TestDataLib;39public class Test {40 public static void main(String[] args) {41 TestDataLib test = new TestDataLib();

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1public class 3 {2 public static void main(String[] args) {3 TestDataLib testdatalib = new TestDataLib();4 testdatalib.getType();5 }6}

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1public class TestClass {2 public static void main(String args[]) {3 TestDataLib testdatalib = new TestDataLib();4 System.out.println(testdatalib.getType());5 }6}7public class TestClass {8 public static void main(String args[]) {9 TestDataLib testdatalib = new TestDataLib();10 System.out.println(testdatalib.getDatabase());11 }12}13public class TestClass {14 public static void main(String args[]) {15 TestDataLib testdatalib = new TestDataLib();16 System.out.println(testdatalib.getScript());17 }18}19public class TestClass {20 public static void main(String args[]) {21 TestDataLib testdatalib = new TestDataLib();22 System.out.println(testdatalib.getUsrCreated());23 }24}25public class TestClass {26 public static void main(String args[]) {27 TestDataLib testdatalib = new TestDataLib();28 System.out.println(testdatalib.getDateCreated());29 }30}31public class TestClass {32 public static void main(String args[]) {33 TestDataLib testdatalib = new TestDataLib();34 System.out.println(testdatalib.getUsrModif());35 }36}37public class TestClass {38 public static void main(String args[]) {39 TestDataLib testdatalib = new TestDataLib();40 System.out.println(testdatalib.getDateModif());41 }42}

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import java.util.Objects;3public class TestDataLib {4 private Integer id;5 private String name;6 private String system;7 private String group;8 private String type;9 private String database;10 private String script;11 private String servicePath;12 private String method;13 private String envelope;14 private String description;15 private String usrCreated;16 private String dateCreated;17 private String usrModif;18 private String dateModif;19 public TestDataLib() {20 }21 public TestDataLib(Integer id, String name, String system, String group, String type, String database, String script, String servicePath, String method, String envelope, String description, String usrCreated, String dateCreated, String usrModif, String dateModif) {22 this.id = id;23 this.name = name;24 this.system = system;25 this.group = group;26 this.type = type;27 this.database = database;28 this.script = script;29 this.servicePath = servicePath;30 this.method = method;31 this.envelope = envelope;32 this.description = description;33 this.usrCreated = usrCreated;34 this.dateCreated = dateCreated;35 this.usrModif = usrModif;36 this.dateModif = dateModif;37 }38 public Integer getId() {39 return id;40 }41 public void setId(Integer id) {42 this.id = id;43 }44 public String getName() {45 return name;46 }47 public void setName(String name) {48 this.name = name;49 }50 public String getSystem() {51 return system;52 }53 public void setSystem(String system) {54 this.system = system;55 }56 public String getGroup() {57 return group;58 }59 public void setGroup(String group) {60 this.group = group;61 }62 public String getType() {63 return type;64 }65 public void setType(String type) {66 this.type = type;67 }68 public String getDatabase() {69 return database;70 }71 public void setDatabase(String database) {72 this.database = database;73 }74 public String getScript() {75 return script;76 }77 public void setScript(String script) {78 this.script = script;79 }80 public String getServicePath() {

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1public class TestClass {2 public static void main(String args[]) {3 TestDataLib testdatalib = new TestDataLib();4 System.out.println(testdatalib.getType());5 }6}7public class TestClass {8 public static void main(String args[]) {9 TestDataLib testdatalib = new TestDataLib();10 System.out.println(testdatalib.getDatabase());11 }12}13public class TestClass {14 public static void main(String args[]) {15 TestDataLib testdatalib = new TestDataLib();16 System.out.println(testdatalib.getScript());17 }18}19public class TestClass {20 public static void main(String args[]) {21 TestDataLib testdatalib = new TestDataLib();22 System.out.println(testdatalib.getUsrCreated());23 }24}25public class TestClass {26 public static void main(String args[]) {27 TestDataLib testdatalib = new TestDataLib();28 System.out.println(testdatalib.getDateCreated());29 }30}31public class TestClass {32 public static void main(String args[]) {33 TestDataLib testdatalib = new TestDataLib();34 System.out.println(testdatalib.getUsrModif());35 }36}37public class TestClass {38 public static void main(String args[]) {39 TestDataLib testdatalib = new TestDataLib();40 System.out.println(testdatalib.getDateModif());41 }42}

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import java.util.Objects;3public class TestDataLib {4 private Integer id;5 private String name;6 private String system;7 private String group;8 private String type;9 private String database;10 private String script;11 private String servicePath;12 private String method;13 private String envelope;14 private String description;15 private String usrCreated;16 private String dateCreated;17 private String usrModif;18 private String dateModif;19 public TestDataLib() {20 }21 public TestDataLib(Integer id, String name, String system, String group, String type, String database, String script, String servicePath, String method, String envelope, String description, String usrCreated, String dateCreated, String usrModif, String dateModif) {22 this.id = id;23 this.name = name;24 this.system = system;25 this.group = group;26 this.type = type;27 this.database = database;28 this.script = script;29 this.servicePath = servicePath;30 this.method = method;31 this.envelope = envelope;32 this.description = description;33 this.usrCreated = usrCreated;34 this.dateCreated = dateCreated;35 this.usrModif = usrModif;36 this.dateModif = dateModif;37 }38 public Integer getId() {39 return id;40 }41 public void setId(Integer id) {42 this.id = id;43 }44 public String getName() {45 return name;46 }47 public void setName(String name) {48 this.name = name;49 }50 public String getSystem() {51 return system;52 }53 public void setSystem(String system) {54 this.system = system;55 }56 public String getGroup() {57 return group;58 }59 public void setGroup(String group) {60 this.group = group;61 }62 public String getType() {63 return type;64 }65 public void setType(String type) {66 this.type = type;67 }68 public String getDatabase() {69 return database;70 }71 public void setDatabase(String database) {72 this.database = database;73 }74 public String getScript() {75 return script;76 }77 public void setScript(String script) {78 this.script = script;79 }80 public String getServicePath() {

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful