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

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

Source:PropertyService.java Github

copy

Full Screen

...180 /**181 * First create testCaseExecutionData object182 */183 now = new Date().getTime();184 tcExeData = factoryTestCaseExecutionData.create(tCExecution.getId(), eachTccp.getProperty(), 1, eachTccp.getDescription(), null, eachTccp.getType(), eachTccp.getRank(),185 eachTccp.getValue1(), eachTccp.getValue2(), null, null, now, now, now, now, new MessageEvent(MessageEventEnum.PROPERTY_PENDING),186 eachTccp.getRetryNb(), eachTccp.getRetryPeriod(), eachTccp.getDatabase(), eachTccp.getValue1(), eachTccp.getValue2(), eachTccp.getLength(),187 eachTccp.getLength(), eachTccp.getRowLimit(), eachTccp.getNature(), tCExecution.getApplicationObj().getSystem(), tCExecution.getEnvironment(), tCExecution.getCountry(), "", null, "N");188 tcExeData.setTestCaseCountryProperties(eachTccp);189 tcExeData.settCExecution(tCExecution);190 if (LOG.isDebugEnabled()) {191 LOG.debug("Trying to calculate Property : '" + tcExeData.getProperty() + "' " + tcExeData);192 }193 /* First check if property has already been calculated 194 * if action is calculateProperty, then set isKnownData to false. 195 */196 tcExeData = getExecutionDataFromList(tCExecution.getTestCaseExecutionDataMap(), eachTccp, forceCalculation, tcExeData);197 /**198 * If testcasecountryproperty not defined, set ExecutionData with199 * the same resultMessage200 */201 if (eachTccp.getResult() != null) {202 tcExeData.setPropertyResultMessage(eachTccp.getResult());203 }204 /*205 * If not already calculated, or calculateProperty, then calculate it and insert or update it.206 */207 if (MessageEventEnum.PROPERTY_PENDING.equals(tcExeData.getPropertyResultMessage().getSource())) {208 calculateProperty(tcExeData, tCExecution, testCaseStepActionExecution, eachTccp, forceCalculation);209 msg = tcExeData.getPropertyResultMessage();210 //saves the result 211 try {212 testCaseExecutionDataService.save(tcExeData);213 /**214 * Add TestCaseExecutionData in TestCaseExecutionData List215 * of the TestCaseExecution216 */217 LOG.debug("Adding into Execution data list. Property : '" + tcExeData.getProperty() + "' Index : '" + String.valueOf(tcExeData.getIndex()) + "' Value : '" + tcExeData.getValue() + "'");218 tCExecution.getTestCaseExecutionDataMap().put(tcExeData.getProperty(), tcExeData);219 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.220 for (int i = 1; i < (tcExeData.getDataLibRawData().size()); i++) {221 now = new Date().getTime();222 TestCaseExecutionData tcedS = factoryTestCaseExecutionData.create(tcExeData.getId(), tcExeData.getProperty(), (i + 1),223 tcExeData.getDescription(), tcExeData.getDataLibRawData().get(i).get(""), tcExeData.getType(), tcExeData.getRank(), "", "",224 tcExeData.getRC(), "", now, now, now, now, null, 0, 0, "", "", "", "", "", 0, "", tcExeData.getSystem(), tcExeData.getEnvironment(), tcExeData.getCountry(), tcExeData.getDataLib(), null, "N");225 testCaseExecutionDataService.save(tcedS);226 }227 }228 } catch (CerberusException cex) {229 LOG.error(cex.getMessage(), cex);230 }231 }232 /**233 * After calculation, replace properties by value calculated234 */235 stringToDecode = decodeStringWithAlreadyCalculatedProperties(stringToDecode, tCExecution);236 if (LOG.isDebugEnabled()) {237 LOG.debug("Property " + eachTccp.getProperty() + " calculated with Value = " + tcExeData.getValue() + ", Value1 = " + tcExeData.getValue1() + ", Value2 = " + tcExeData.getValue2());238 }239 /**240 * Log TestCaseExecutionData241 */242 if (tCExecution.getVerbose() > 0) {243 LOG.info(tcExeData.toJson(false, true));244 }245 }246 if (LOG.isDebugEnabled()) {247 LOG.debug("Finished to decode String (property) : '" + stringToDecodeInit + "' to :'" + stringToDecode + "'");248 }249 answer.setResultMessage(msg);250 answer.setItem(stringToDecode);251 return answer;252 }253 /**254 * Auxiliary method that returns the execution data for a property.255 *256 * @param hashTemp1 list of execution data257 * @param eachTccp property to be calculated258 * @param forceCalculation indicates whether a property must be259 * re-calculated if it was already computed in previous steps260 * @param tecd execution data for the property261 * @return the updated execution data for the property262 */263 private TestCaseExecutionData getExecutionDataFromList(TreeMap<String, TestCaseExecutionData> hashTemp1, TestCaseCountryProperties eachTccp, boolean forceCalculation, TestCaseExecutionData tecd) {264 LOG.debug("Searching " + eachTccp.getProperty() + " Into list of " + hashTemp1.size());265 try {266 if (hashTemp1.containsKey(eachTccp.getProperty())) {267 if (forceCalculation) {268 LOG.debug("Property has already been calculated but forcing new calculation by removing it : " + hashTemp1.get(eachTccp.getProperty()));269 hashTemp1.remove(eachTccp.getProperty());270 return tecd;271 } else {272 LOG.debug("Property has already been calculated : " + hashTemp1.get(eachTccp.getProperty()));273 return hashTemp1.get(eachTccp.getProperty());274 }275 } else {276 LOG.debug("Property was never calculated.");277 return tecd;278 }279 } catch (Exception ex) {280 LOG.error("Exception catched inside getExecutionDataFromList : " + ex, ex);281 }282 return tecd;283 }284 /**285 * Method that takes the potencial @param property, finds it (or not if it286 * is not a existing property) inside the existing property list @param287 * propertiesOfTestcase and gets the list of all other properties required288 * (contained inside value1 or value2).289 *290 * @param country country used to filter property from propertiesOfTestcase291 * @param property property to be calculated292 * @param crossedProperties List of previously found properties.293 * @param propertiesOfTestcase List of properties defined from the testcase.294 * @return list of TestCaseCountryProperties that are included inside the295 * definition of the @param property296 */297 private List<TestCaseCountryProperties> getListOfPropertiesLinkedToProperty(String country, String property, List<String> crossedProperties,298 List<TestCaseCountryProperties> propertiesOfTestcase) {299 List<TestCaseCountryProperties> result = new ArrayList<>();300 TestCaseCountryProperties testCaseCountryProperty = null;301 /*302 * Check if property is not already known (recursive case).303 */304 if (crossedProperties.contains(property)) {305 return result;306 }307 crossedProperties.add(property);308 /*309 * Check if property is defined for this testcase310 */311 AnswerItem ansSearch = findMatchingTestCaseCountryProperty(property, country, propertiesOfTestcase);312 testCaseCountryProperty = (TestCaseCountryProperties) ansSearch.getItem();313 if (testCaseCountryProperty == null) {314 return result;315 }316 /* 317 * Check if property value1 and value2 contains internal properties318 */319 List<String> allProperties = new ArrayList<>();320 // Value1 treatment321 List<String> propertiesValue1 = new ArrayList<>();322 //check the properties specified in the test323 for (String propNameFromValue1 : this.getPropertiesListFromString(testCaseCountryProperty.getValue1())) {324 for (TestCaseCountryProperties pr : propertiesOfTestcase) {325 if (pr.getProperty().equals(propNameFromValue1)) {326 propertiesValue1.add(propNameFromValue1);327 break;328 }329 }330 }331 allProperties.addAll(propertiesValue1);332 // Value2 treatment :333 List<String> propertiesValue2 = new ArrayList<>();334 //check the properties specified in the test335 for (String propNameFromValue2 : this.getPropertiesListFromString(testCaseCountryProperty.getValue2())) {336 for (TestCaseCountryProperties pr : propertiesOfTestcase) {337 if (pr.getProperty().equals(propNameFromValue2)) {338 propertiesValue2.add(propNameFromValue2);339 break;340 }341 }342 }343 allProperties.addAll(propertiesValue2);344 for (String internalProperty : allProperties) {345 result.addAll(getListOfPropertiesLinkedToProperty(country, internalProperty, crossedProperties, propertiesOfTestcase));346 }347 result.add(testCaseCountryProperty);348 return result;349 }350 private String decodeStringWithAlreadyCalculatedProperties(String stringToReplace, TestCaseExecution tCExecution) {351 String variableValue = "";352 String variableString1 = "";353 String variableString2 = "";354 TestCaseExecutionData tced;355 for (String key1 : tCExecution.getTestCaseExecutionDataMap().keySet()) {356 tced = tCExecution.getTestCaseExecutionDataMap().get(key1);357 if ((tced.getType() != null) && (tced.getType().equals(TestCaseCountryProperties.TYPE_GETFROMDATALIB))) { // Type could be null in case property do not exist.358 /* Replacement in case of TestDataLib */359 // Key value of the DataLib.360 if (tced.getValue() != null) {361 stringToReplace = stringToReplace.replace("%property." + tced.getProperty() + "%", tced.getValue());362 stringToReplace = stringToReplace.replace("%" + tced.getProperty() + "%", tced.getValue());363 }364 // For each subdata of the getFromDataLib property, we try to replace with PROPERTY(SUBDATA).365 if (!(tced.getDataLibRawData() == null)) {366 int ind = 0;367 for (HashMap<String, String> dataRow : tced.getDataLibRawData()) { // We loop every row result.368 for (String key : dataRow.keySet()) { // We loop every subdata369 if (dataRow.get(key) != null) {370 variableValue = dataRow.get(key);371 variableString1 = tced.getProperty() + "(" + (ind + 1) + ")" + "(" + key + ")";372 stringToReplace = stringToReplace.replace("%property." + variableString1 + "%", variableValue);373 stringToReplace = stringToReplace.replace("%" + variableString1 + "%", variableValue);374 variableString2 = tced.getProperty() + "." + (ind + 1) + "." + key;375 stringToReplace = stringToReplace.replace("%property." + variableString2 + "%", variableValue);376 stringToReplace = stringToReplace.replace("%" + variableString2 + "%", variableValue);377 if (key.equals("")) { // If subdata is empty we can omit the () or .378 variableString1 = tced.getProperty() + "(" + (ind + 1) + ")";379 stringToReplace = stringToReplace.replace("%property." + variableString1 + "%", variableValue);380 stringToReplace = stringToReplace.replace("%" + variableString1 + "%", variableValue);381 variableString2 = tced.getProperty() + "." + (ind + 1);382 stringToReplace = stringToReplace.replace("%property." + variableString2 + "%", variableValue);383 stringToReplace = stringToReplace.replace("%" + variableString2 + "%", variableValue);384 }385 if (ind == 0) { // Dimention of the data is not mandatory for the 1st row.386 variableString1 = tced.getProperty() + "(" + key + ")";387 stringToReplace = stringToReplace.replace("%property." + variableString1 + "%", variableValue);388 stringToReplace = stringToReplace.replace("%" + variableString1 + "%", variableValue);389 variableString2 = tced.getProperty() + "." + key;390 stringToReplace = stringToReplace.replace("%property." + variableString2 + "%", variableValue);391 stringToReplace = stringToReplace.replace("%" + variableString2 + "%", variableValue);392 }393 }394 }395 ind++;396 }397 }398 } else if (tced.getValue() != null) {399 /* Replacement in case of normal PROPERTY */400 stringToReplace = stringToReplace.replace("%property." + tced.getProperty() + "%", tced.getValue());401 stringToReplace = stringToReplace.replace("%" + tced.getProperty() + "%", tced.getValue());402 }403 }404 return stringToReplace;405 }406 /**407 * Gets all properties names contained into the given {@link String}408 *409 * <p>410 * A property is defined by including its name between two '%' character.411 * </p>412 *413 * @param str the {@link String} to get all properties414 * @return a list of properties contained into the given {@link String}415 */416 private List<String> getPropertiesListFromString(String str) {417 List<String> properties = new ArrayList<String>();418 LOG.debug("Starting to guess properties from string : " + str);419 if (str == null) {420 LOG.debug("Stoping to guess properties - Empty String ");421 return properties;422 }423 String[] text1 = str.split("%");424 int i = 0;425 for (String rawProperty : text1) {426 if (((i > 0) || (str.startsWith("%"))) && ((i < (text1.length - 1)) || str.endsWith("%"))) { // First and last string from split is not to be considered.427 // Removes "property." string.428 rawProperty = rawProperty.replaceFirst("^property\\.", "");429 // Removes the variable part of the property eg : (subdata)430 String[] ramProp1 = rawProperty.split("\\(");431 // Removes the variable part of the property eg : .subdata432 String[] ramProp2 = ramProp1[0].split("\\.");433 if (!(StringUtil.isNullOrEmpty(ramProp2[0].trim())) // Avoid getting empty Property names.434 && ramProp2[0].trim().length() <= TestCaseCountryProperties.MAX_PROPERTY_LENGTH // Properties cannot be bigger than n caracters.435 && !ramProp2[0].trim().contains("\n")) { // Properties cannot contain \n.436 properties.add(ramProp2[0].trim());437 LOG.debug("Adding string to result " + ramProp2[0].trim());438 } else {439 LOG.debug("Discarding string (empty or too big or contains cariage return).");440 }441 // Avoid getting empty Property names.442 } else {443 LOG.debug("Discarding string (first or last split).");444 }445 i++;446 }447 LOG.debug("Stopping to guess properties - Finished.");448 return properties;449 }450 /**451 * Auxiliary method that verifies if a property is defined in the scope of452 * the test case.453 *454 * @param property - property name455 * @param country - country were the property was implemented456 * @param propertieOfTestcase - list of properties defined for the test case457 * @return an AnswerItem that contains the property in case of success, and458 * null otherwise. also it returns a message indicating error or success.459 */460 private AnswerItem<TestCaseCountryProperties> findMatchingTestCaseCountryProperty(String property, String country, List<TestCaseCountryProperties> propertieOfTestcase) {461 AnswerItem<TestCaseCountryProperties> item = new AnswerItem<TestCaseCountryProperties>();462 boolean propertyDefined = false;463 item.setResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS));464 TestCaseCountryProperties testCaseCountryProperty = null;465 //searches for properties that match the propertyname (even if they use the getFromDataLib syntax)466 if (propertieOfTestcase != null) {467 for (TestCaseCountryProperties tccp : propertieOfTestcase) {468 if (tccp.getProperty().equals(property)) {469 //property is defined470 propertyDefined = true;471 //check if is defined for country472 if (tccp.getCountry().equals(country)) {473 //if is a sub data access then we create a auxiliary property474 testCaseCountryProperty = tccp;475 if (LOG.isDebugEnabled()) {476 LOG.debug("Property found : " + tccp);477 }478 break;479 }480 }481 }482 }483 /**484 * If property defined on another Country, set a specific message. If485 * property is not defined at all, trigger the end of the testcase.486 */487 if (testCaseCountryProperty == null) {488 MessageEvent msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_NO_PROPERTY_DEFINITION);489 if (!propertyDefined) {490 msg = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_UNKNOWNPROPERTY);491 }492 msg.setDescription(msg.getDescription().replace("%COUNTRY%", country));493 msg.setDescription(msg.getDescription().replace("%PROP%", property));494 item.setResultMessage(msg);495 if (LOG.isDebugEnabled()) {496 LOG.debug(msg.getDescription());497 }498 }499 item.setItem(testCaseCountryProperty);500 return item;501 }502 @Override503 public void calculateProperty(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseStepActionExecution testCaseStepActionExecution,504 TestCaseCountryProperties testCaseCountryProperty, boolean forceRecalculation) {505 testCaseExecutionData.setStart(new Date().getTime());506 MessageEvent res;507 String test = tCExecution.getTest();508 String testCase = tCExecution.getTestCase();509 AnswerItem<String> answerDecode = new AnswerItem<>();510 if (LOG.isDebugEnabled()) {511 LOG.debug("Starting to calculate Property : '" + testCaseCountryProperty.getProperty() + "'");512 }513 // Checking recursive decode.514 if ((tCExecution.getRecursiveAlreadyCalculatedPropertiesList() != null) && (tCExecution.getRecursiveAlreadyCalculatedPropertiesList().contains(testCaseCountryProperty.getProperty()))) {515 res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_RECURSIVE);516 res.setDescription(res.getDescription().replace("%PROPERTY%", testCaseCountryProperty.getProperty())517 .replace("%HISTO%", tCExecution.getRecursiveAlreadyCalculatedPropertiesList().toString()));518 testCaseExecutionData.setPropertyResultMessage(res);519 testCaseExecutionData.setEnd(new Date().getTime());520 LOG.debug("Finished to calculate Property (interupted) : '" + testCaseCountryProperty.getProperty() + "' : " + testCaseExecutionData.getPropertyResultMessage().getDescription());521 return;522 }523 if (tCExecution.getRecursiveAlreadyCalculatedPropertiesList() != null) {524 tCExecution.getRecursiveAlreadyCalculatedPropertiesList().add(testCaseCountryProperty.getProperty());525 }526 try {527 // Check if cache activated and cache entry exist.528 int cacheValue = testCaseCountryProperty.getCacheExpire();529 boolean useCache = false;530 TestCaseExecutionData data = null;531 if (cacheValue > 0) {532 try {533 data = testCaseExecutionDataService.readLastCacheEntry(tCExecution.getApplicationObj().getSystem(), tCExecution.getEnvironment(), tCExecution.getCountry(), testCaseCountryProperty.getProperty(), cacheValue);534 if (data != null) {535 useCache = true;536 }537 } catch (CerberusException e) {538 // do nothing, useCache will be false539 }540 }541 if (!useCache) {542 /**543 * Decode Property replacing properties encapsulated with %544 */545 if (testCaseCountryProperty.getValue1().contains("%")) {546 answerDecode = variableService.decodeStringCompletly(testCaseCountryProperty.getValue1(), tCExecution, null, false);547 testCaseExecutionData.setValue1((String) answerDecode.getItem());548 if (!(answerDecode.isCodeStringEquals("OK"))) {549 // If anything wrong with the decode --> we stop here with decode message in the property result.550 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Property Value1"));551 testCaseExecutionData.setEnd(new Date().getTime());552 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());553 LOG.debug("Finished to calculate Property (interupted) : '" + testCaseCountryProperty.getProperty() + "' : " + testCaseExecutionData.getPropertyResultMessage().getDescription());554 return;555 }556 }557 if (testCaseCountryProperty.getValue2() != null && testCaseCountryProperty.getValue2().contains("%")) {558 answerDecode = variableService.decodeStringCompletly(testCaseCountryProperty.getValue2(), tCExecution, null, false);559 testCaseExecutionData.setValue2((String) answerDecode.getItem());560 if (!(answerDecode.isCodeStringEquals("OK"))) {561 // If anything wrong with the decode --> we stop here with decode message in the property result.562 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Property Value2"));563 testCaseExecutionData.setEnd(new Date().getTime());564 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());565 LOG.debug("Finished to calculate Property (interupted) : '" + testCaseCountryProperty.getProperty() + "' : " + testCaseExecutionData.getPropertyResultMessage().getDescription());566 return;567 }568 }569 // cache not activated or no entry exist.570 int execution_count = 0;571 int retries = testCaseCountryProperty.getRetryNb();572 int periodms = testCaseCountryProperty.getRetryPeriod();573 LOG.debug("Init Retries : " + retries + " Period : " + periodms);574 /**575 * Controling that retrynb and retryperiod are correctly feeded.576 * <br>577 * This is to avoid that <br>578 * 1/ retry is greater than cerberus_property_maxretry <br>579 * 2/ total duration of property calculation is longuer than580 * cerberus_property_maxretrytotalduration581 */582 boolean forced_retry = false;583 String forced_retry_message = "";584 if (!(retries == 0)) {585 int maxretry = parameterService.getParameterIntegerByKey("cerberus_property_maxretry", "", 50);586 if (retries > maxretry) {587 retries = maxretry;588 forced_retry = true;589 }590 int maxtotalduration = parameterService.getParameterIntegerByKey("cerberus_property_maxretrytotalduration", "", 1800000);591 if (periodms > maxtotalduration) {592 periodms = maxtotalduration;593 forced_retry = true;594 }595 if (retries * periodms > maxtotalduration) {596 retries = (int) maxtotalduration / periodms;597 forced_retry = true;598 }599 if (forced_retry) {600 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 + ")";601 LOG.debug("Forced Retries : " + retries + " Period : " + periodms + " in order to respect the constrains cerberus_property_maxretry " + maxretry + " & cerberus_property_maxtotalduration " + maxtotalduration);602 }603 }604 /**605 * Looping on calculating the action until result is OK or reach606 * the max retry.607 */608 while (execution_count <= retries && !(testCaseExecutionData.getPropertyResultMessage().getCodeString().equals("OK"))) {609 LOG.debug("Attempt #" + execution_count + " " + testCaseCountryProperty.getProperty() + " " + testCaseCountryProperty.getValue1());610 if (execution_count >= 1) { // We only wait the period if not on the very first calculation.611 try {612 Thread.sleep(periodms);613 LOG.debug("Attempt #" + execution_count + " " + testCaseCountryProperty.getProperty() + " " + testCaseCountryProperty.getValue1() + " Waiting " + periodms + " ms");614 } catch (InterruptedException ex) {615 LOG.error(ex.toString(), ex);616 }617 }618 /**619 * Calculate Property regarding the type620 */621 switch (testCaseCountryProperty.getType()) {622 case TestCaseCountryProperties.TYPE_TEXT:623 testCaseExecutionData = this.property_calculateText(testCaseExecutionData, testCaseCountryProperty, forceRecalculation);624 break;625 case TestCaseCountryProperties.TYPE_GETFROMDATALIB:626 testCaseExecutionData = this.property_getFromDataLib(testCaseExecutionData, tCExecution, testCaseStepActionExecution, testCaseCountryProperty, forceRecalculation);627 break;628 case TestCaseCountryProperties.TYPE_GETFROMSQL:629 testCaseExecutionData = this.property_getFromSql(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);630 break;631 case TestCaseCountryProperties.TYPE_GETFROMHTML:632 testCaseExecutionData = this.property_getFromHtml(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);633 break;634 case TestCaseCountryProperties.TYPE_GETFROMHTMLVISIBLE:635 testCaseExecutionData = this.property_getFromHtmlVisible(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);636 break;637 case TestCaseCountryProperties.TYPE_GETFROMJS:638 testCaseExecutionData = this.property_getFromJS(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);639 break;640 case TestCaseCountryProperties.TYPE_GETATTRIBUTEFROMHTML:641 testCaseExecutionData = this.property_getAttributeFromHtml(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);642 break;643 case TestCaseCountryProperties.TYPE_GETFROMCOOKIE:644 testCaseExecutionData = this.property_getFromCookie(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);645 break;646 case TestCaseCountryProperties.TYPE_GETFROMXML:647 testCaseExecutionData = this.property_getFromXml(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);648 break;649 case TestCaseCountryProperties.TYPE_GETDIFFERENCESFROMXML:650 testCaseExecutionData = this.property_getDifferencesFromXml(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);651 break;652 case TestCaseCountryProperties.TYPE_GETFROMJSON:653 testCaseExecutionData = this.property_getFromJson(testCaseExecutionData, tCExecution, forceRecalculation);654 break;655 case TestCaseCountryProperties.TYPE_GETFROMGROOVY:656 testCaseExecutionData = this.property_getFromGroovy(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);657 break;658 case TestCaseCountryProperties.TYPE_GETFROMCOMMAND:659 testCaseExecutionData = this.property_getFromCommand(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);660 break;661 case TestCaseCountryProperties.TYPE_GETELEMENTPOSITION:662 testCaseExecutionData = this.property_getElementPosition(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceRecalculation);663 break;664 case TestCaseCountryProperties.TYPE_GETFROMNETWORKTRAFFIC:665 testCaseExecutionData = this.property_getFromNetworkTraffic(testCaseExecutionData, testCaseCountryProperty, tCExecution, forceRecalculation);666 break;667 // DEPRECATED Property types.668 case TestCaseCountryProperties.TYPE_EXECUTESOAPFROMLIB: // DEPRECATED669 testCaseExecutionData = this.property_executeSoapFromLib(testCaseExecutionData, tCExecution, testCaseStepActionExecution, testCaseCountryProperty, forceRecalculation);670 res = testCaseExecutionData.getPropertyResultMessage();671 res.setDescription(MESSAGE_DEPRECATED + " " + res.getDescription());672 testCaseExecutionData.setPropertyResultMessage(res);673 logEventService.createForPrivateCalls("ENGINE", TestCaseCountryProperties.TYPE_EXECUTESOAPFROMLIB, MESSAGE_DEPRECATED + " Deprecated Property triggered by TestCase : ['" + test + "|" + testCase + "']");674 LOG.warn(MESSAGE_DEPRECATED + " Deprecated Property " + TestCaseCountryProperties.TYPE_EXECUTESOAPFROMLIB + " triggered by TestCase : ['" + test + "'|'" + testCase + "']");675 break;676 case TestCaseCountryProperties.TYPE_EXECUTESQLFROMLIB: // DEPRECATED677 testCaseExecutionData = this.property_executeSqlFromLib(testCaseExecutionData, testCaseCountryProperty, tCExecution, forceRecalculation);678 res = testCaseExecutionData.getPropertyResultMessage();679 res.setDescription(MESSAGE_DEPRECATED + " " + res.getDescription());680 testCaseExecutionData.setPropertyResultMessage(res);681 logEventService.createForPrivateCalls("ENGINE", TestCaseCountryProperties.TYPE_EXECUTESQLFROMLIB, MESSAGE_DEPRECATED + " Deprecated Property triggered by TestCase : ['" + test + "|" + testCase + "']");682 LOG.warn(MESSAGE_DEPRECATED + " Deprecated Property " + TestCaseCountryProperties.TYPE_EXECUTESQLFROMLIB + " triggered by TestCase : ['" + test + "'|'" + testCase + "']");683 break;684 default:685 res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_UNKNOWNPROPERTY);686 res.setDescription(res.getDescription().replace("%PROPERTY%", testCaseCountryProperty.getType()));687 testCaseExecutionData.setPropertyResultMessage(res);688 }689 execution_count++;690 }691 if (execution_count >= 2) { // If there were at least 1 retry, we notify it in the result message.692 res = testCaseExecutionData.getPropertyResultMessage();693 res.setDescription("Retried " + (execution_count - 1) + " time(s) with " + periodms + "ms period - " + res.getDescription());694 testCaseExecutionData.setPropertyResultMessage(res);695 }696 if (forced_retry) { // If the retry and period parameter was changed, we notify it in the result message.697 res = testCaseExecutionData.getPropertyResultMessage();698 res.setDescription(forced_retry_message + " - " + res.getDescription());699 testCaseExecutionData.setPropertyResultMessage(res);700 }701 } else {702 // cache activated and entry exist. We set the current value with cache entry data and notify the result from the messsage.703 TestCaseExecutionData testCaseExecutionDataFromCache = data;704 testCaseExecutionData.setFromCache("Y");705 testCaseExecutionData.setDataLib(testCaseExecutionDataFromCache.getDataLib());706 testCaseExecutionData.setValue(testCaseExecutionDataFromCache.getValue());707 testCaseExecutionData.setJsonResult(testCaseExecutionDataFromCache.getJsonResult());708 DateFormat df = new SimpleDateFormat(DateUtil.DATE_FORMAT_DISPLAY);709 res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_FROMCACHE).resolveDescription("ID", String.valueOf(testCaseExecutionDataFromCache.getId())).resolveDescription("DATE", df.format(testCaseExecutionDataFromCache.getStart()));710 testCaseExecutionData.setPropertyResultMessage(res);711 if (!StringUtil.isNullOrEmpty(testCaseExecutionDataFromCache.getJsonResult())) {712 // Convert json to HashMap.713 List<HashMap<String, String>> result = null;714 result = new ArrayList<>();715 try {716 LOG.debug("Converting Json : " + testCaseExecutionDataFromCache.getJsonResult());717 JSONArray json = new JSONArray(testCaseExecutionDataFromCache.getJsonResult());718 for (int i = 0; i < json.length(); i++) {719 JSONObject explrObject = json.getJSONObject(i);720 LOG.debug(explrObject.toString());721 HashMap<String, String> resultHash = new HashMap<>();722 Iterator<?> nameItr = explrObject.keys();723 while (nameItr.hasNext()) {724 String name = (String) nameItr.next();725 if (name.equals("KEY")) {726 resultHash.put("", explrObject.getString(name));727 } else {728 resultHash.put(name, explrObject.getString(name));729 }730 }731 result.add(resultHash);732 }733 } catch (JSONException ex) {734 java.util.logging.Logger.getLogger(PropertyService.class.getName()).log(Level.SEVERE, null, ex);735 LOG.error(ex, ex);736 }737 testCaseExecutionData.setDataLibRawData(result);738 //Record result in filessytem.739 recorderService.recordTestDataLibProperty(tCExecution.getId(), testCaseCountryProperty.getProperty(), 1, result);740 }741 }742 } catch (CerberusEventException ex) {743 LOG.error(ex.toString(), ex);744 testCaseExecutionData.setEnd(new Date().getTime());745 testCaseExecutionData.setPropertyResultMessage(ex.getMessageError());746 }747 testCaseExecutionData.setEnd(new Date().getTime());748 if (LOG.isDebugEnabled()) {749 LOG.debug("Finished to calculate Property : '" + testCaseCountryProperty.getProperty() + "'");750 }751 }752 private TestCaseExecutionData property_getFromCommand(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceRecalculation) {753 // Check if script has been correctly defined754 String script = testCaseExecutionData.getValue1();755 if (script == null || script.isEmpty()) {756 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMCOMMAND_NULL));757 return testCaseExecutionData;758 }759 // Try to evaluate Command script760 try {761 if (tCExecution.getApplicationObj().getType().equals(Application.TYPE_APK)) {762 String message = androidAppiumService.executeCommandString(tCExecution.getSession(), script, "");763 String value = "";764 if (!StringUtil.isNullOrEmpty(message)) {765 value = message;766 }767 testCaseExecutionData.setValue(value);768 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMCOMMAND).resolveDescription("VALUE", value));769 } else {770 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_FEATURENOTSUPPORTED);771 res.setDescription(res.getDescription().replace("%APPTYPE%", tCExecution.getApplicationObj().getType()));772 res.setDescription(res.getDescription().replace("%PROPTYPE%", testCaseExecutionData.getType()));773 testCaseExecutionData.setPropertyResultMessage(res);774 }775 } catch (Exception e) {776 LOG.debug("Exception Running Command Script :" + e.getMessage());777 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMCOMMAND_EXCEPTION).resolveDescription("REASON", e.getMessage()));778 }779 return testCaseExecutionData;780 }781 private TestCaseExecutionData property_getElementPosition(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceRecalculation) {782 // Check if script has been correctly defined783 String script = testCaseExecutionData.getValue1();784 if (script == null || script.isEmpty()) {785 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETELEMENTPOSITION_NULL));786 return testCaseExecutionData;787 }788 try {789 Identifier identifier = new Identifier();790 if (script != null) {791 identifier = identifierService.convertStringToIdentifier(script);792 }793 if (tCExecution.getApplicationObj().getType().equals(Application.TYPE_APK)) {794 String message = androidAppiumService.getElementPosition(tCExecution.getSession(), identifier);795 String value = "";796 if (!StringUtil.isNullOrEmpty(message)) {797 value = message;798 }799 testCaseExecutionData.setValue(value);800 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETELEMENTPOSITION).resolveDescription("VALUE", value));801 } else if (tCExecution.getApplicationObj().getType().equals(Application.TYPE_IPA)) {802 String message = iosAppiumService.getElementPosition(tCExecution.getSession(), identifier);803 String value = "";804 if (!StringUtil.isNullOrEmpty(message)) {805 value = message;806 }807 testCaseExecutionData.setValue(value);808 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETELEMENTPOSITION).resolveDescription("VALUE", value));809 } else {810 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_FEATURENOTSUPPORTED);811 res.setDescription(res.getDescription().replace("%APPTYPE%", tCExecution.getApplicationObj().getType()));812 res.setDescription(res.getDescription().replace("%PROPTYPE%", testCaseExecutionData.getType()));813 testCaseExecutionData.setPropertyResultMessage(res);814 }815 } catch (Exception e) {816 LOG.debug("Exception Running Command Script :" + e.getMessage());817 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETELEMENTPOSITION_EXCEPTION).resolveDescription("REASON", e.getMessage()));818 }819 return testCaseExecutionData;820 }821 private TestCaseExecutionData property_executeSqlFromLib(TestCaseExecutionData testCaseExecutionData, TestCaseCountryProperties testCaseCountryProperty, TestCaseExecution tCExecution, boolean forceCalculation) {822 try {823 String script = this.sqlLibraryService.findSqlLibraryByKey(testCaseExecutionData.getValue1()).getScript();824 testCaseExecutionData.setValue1(script); //TODO use the new library 825 } catch (CerberusException ex) {826 LOG.warn(ex);827 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_SQL_SQLLIB_NOTEXIT);828 res.setDescription(res.getDescription().replace("%SQLLIB%", testCaseExecutionData.getValue1()));829 testCaseExecutionData.setPropertyResultMessage(res);830 testCaseExecutionData.setEnd(new Date().getTime());831 return testCaseExecutionData;832 }833 testCaseExecutionData = this.property_getFromSql(testCaseExecutionData, tCExecution, testCaseCountryProperty, forceCalculation);834 return testCaseExecutionData;835 }836 private TestCaseExecutionData property_getFromNetworkTraffic(TestCaseExecutionData testCaseExecutionData, TestCaseCountryProperties testCaseCountryProperty, TestCaseExecution tCExecution, boolean forceCalculation) {837 if (tCExecution.getApplicationObj().getType().equals(Application.TYPE_GUI)) {838 try {839 //TODO : check if HAR is the same than the last one to avoid to download same har file several times840 // String remoteHarMD5 = "http://" + tCExecution.getRobotExecutorObj().getHost() + ":" + tCExecution.getRobotExecutorObj().getExecutorExtensionPort() + "/getHarMD5?uuid="+tCExecution.getRemoteProxyUUID();841 //getHarFile842 String url = "http://" + tCExecution.getRobotExecutorObj().getHost() + ":" + tCExecution.getRobotExecutorObj().getExecutorExtensionPort() + "/getHar?uuid=" + tCExecution.getRemoteProxyUUID();843 //tCExecution.addFileList(recorderService.recordHarLog(tCExecution, url));844 testCaseExecutionData.setValue2(url);845 testCaseExecutionData = this.property_getFromJson(testCaseExecutionData, tCExecution, forceCalculation);846 } catch (Exception ex) {847 LOG.warn(ex);848 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_SQL_SQLLIB_NOTEXIT);849 res.setDescription(res.getDescription().replace("%SQLLIB%", testCaseExecutionData.getValue1()));850 testCaseExecutionData.setPropertyResultMessage(res);851 testCaseExecutionData.setEnd(new Date().getTime());852 return testCaseExecutionData;853 }854 } else {855 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_FEATURENOTSUPPORTED);856 res.setDescription(res.getDescription().replace("%APPTYPE%", tCExecution.getApplicationObj().getType()));857 res.setDescription(res.getDescription().replace("%PROPTYPE%", testCaseExecutionData.getType()));858 testCaseExecutionData.setPropertyResultMessage(res);859 }860 return testCaseExecutionData;861 }862 private TestCaseExecutionData property_getFromSql(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {863 return sQLService.calculateOnDatabase(testCaseExecutionData, testCaseCountryProperty, tCExecution);864 }865 private TestCaseExecutionData property_calculateText(TestCaseExecutionData testCaseExecutionData, TestCaseCountryProperties testCaseCountryProperty, boolean forceRecalculation) {866 if (TestCaseCountryProperties.NATURE_RANDOM.equals(testCaseCountryProperty.getNature())867 //TODO CTE Voir avec B. Civel "RANDOM_NEW"868 || (testCaseCountryProperty.getNature().equals(TestCaseCountryProperties.NATURE_RANDOMNEW))) {869 if (testCaseCountryProperty.getLength().equals("0")) {870 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_TEXTRANDOMLENGHT0);871 testCaseExecutionData.setPropertyResultMessage(res);872 } else {873 String charset;874 if (testCaseExecutionData.getValue1() != null && !"".equals(testCaseExecutionData.getValue1().trim())) {875 charset = testCaseExecutionData.getValue1();876 } else {877 charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";878 }879 String value = StringUtil.getRandomString(ParameterParserUtil.parseIntegerParam(testCaseCountryProperty.getLength(), 0), charset);880 testCaseExecutionData.setValue(value);881 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_RANDOM);882 res.setDescription(res.getDescription().replace("%FORCED%", forceRecalculation == true ? "Re-" : ""));883 res.setDescription(res.getDescription().replace("%VALUE%", ParameterParserUtil.securePassword(value, testCaseCountryProperty.getProperty())));884 testCaseExecutionData.setPropertyResultMessage(res);885// if (testCaseCountryProperty.getNature().equals("RANDOM_NEW")) {886// //TODO check if value exist on DB ( used in another test case of the revision )887// }888 }889 } else {890 LOG.debug("Setting value : " + testCaseExecutionData.getValue1());891 String value = testCaseExecutionData.getValue1();892 testCaseExecutionData.setValue(value);893 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_TEXT);894 res.setDescription(res.getDescription().replace("%VALUE%", ParameterParserUtil.securePassword(value, testCaseCountryProperty.getProperty())));895 testCaseExecutionData.setPropertyResultMessage(res);896 }897 return testCaseExecutionData;898 }899 private TestCaseExecutionData property_getFromHtmlVisible(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {900 try {901 Identifier identifier = identifierService.convertStringToIdentifier(testCaseExecutionData.getValue1());902 String valueFromHTML = this.webdriverService.getValueFromHTMLVisible(tCExecution.getSession(), identifier);903 if (valueFromHTML != null) {904 testCaseExecutionData.setValue(valueFromHTML);905 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_HTMLVISIBLE);906 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));907 res.setDescription(res.getDescription().replace("%VALUE%", valueFromHTML));908 testCaseExecutionData.setPropertyResultMessage(res);909 } else {910 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTMLVISIBLE_ELEMENTDONOTEXIST);911 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));912 testCaseExecutionData.setPropertyResultMessage(res);913 }914 } catch (NoSuchElementException exception) {915 LOG.debug(exception.toString());916 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTMLVISIBLE_ELEMENTDONOTEXIST);917 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));918 testCaseExecutionData.setPropertyResultMessage(res);919 }920 return testCaseExecutionData;921 }922 private TestCaseExecutionData property_getFromHtml(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {923 if (tCExecution.getApplicationObj().getType().equals(Application.TYPE_APK)924 || tCExecution.getApplicationObj().getType().equals(Application.TYPE_IPA)925 || tCExecution.getApplicationObj().getType().equals(Application.TYPE_GUI)) {926 try {927 Identifier identifier = identifierService.convertStringToIdentifier(testCaseExecutionData.getValue1());928 String valueFromHTML = this.webdriverService.getValueFromHTML(tCExecution.getSession(), identifier);929 if (valueFromHTML != null) {930 testCaseExecutionData.setValue(valueFromHTML);931 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_HTML);932 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));933 res.setDescription(res.getDescription().replace("%VALUE%", valueFromHTML));934 testCaseExecutionData.setPropertyResultMessage(res);935 }936 } catch (NoSuchElementException exception) {937 LOG.debug(exception.toString());938 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTML_ELEMENTDONOTEXIST);939 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));940 testCaseExecutionData.setPropertyResultMessage(res);941 }942 } else {943 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_FEATURENOTSUPPORTED);944 res.setDescription(res.getDescription().replace("%APPTYPE%", tCExecution.getApplicationObj().getType()));945 res.setDescription(res.getDescription().replace("%PROPTYPE%", testCaseExecutionData.getType()));946 }947 return testCaseExecutionData;948 }949 private TestCaseExecutionData property_getFromJS(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {950 String script = testCaseExecutionData.getValue1();951 String valueFromJS;952 String message = "";953 if (tCExecution.getManualExecution().equals("Y")) {954 MessageEvent mes = new MessageEvent(MessageEventEnum.PROPERTY_NOTPOSSIBLE);955 testCaseExecutionData.setPropertyResultMessage(mes);956 } else {957 try {958 valueFromJS = this.webdriverService.getValueFromJS(tCExecution.getSession(), script);959 } catch (Exception e) {960 message = e.getMessage().split("\n")[0];961 LOG.debug("Exception Running JS Script :" + message);962 valueFromJS = null;963 }964 if (valueFromJS != null) {965 testCaseExecutionData.setValue(valueFromJS);966 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_JS);967 res.setDescription(res.getDescription().replace("%SCRIPT%", script));968 res.setDescription(res.getDescription().replace("%VALUE%", valueFromJS));969 testCaseExecutionData.setPropertyResultMessage(res);970 } else {971 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_JS_EXCEPTION);972 res.setDescription(res.getDescription().replace("%EXCEPTION%", message));973 testCaseExecutionData.setPropertyResultMessage(res);974 }975 }976 return testCaseExecutionData;977 }978 private TestCaseExecutionData property_getFromGroovy(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {979 // Check if script has been correctly defined980 String script = testCaseExecutionData.getValue1();981 if (script == null || script.isEmpty()) {982 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMGROOVY_NULL));983 return testCaseExecutionData;984 }985 // Try to evaluate Groovy script986 try {987 String valueFromGroovy = groovyService.eval(script);988 testCaseExecutionData.setValue(valueFromGroovy);989 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMGROOVY)990 .resolveDescription("VALUE", valueFromGroovy));991 } catch (IGroovyService.IGroovyServiceException e) {992 LOG.debug("Exception Running Grrovy Script :" + e.getMessage());993 testCaseExecutionData.setPropertyResultMessage(new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMGROOVY_EXCEPTION).resolveDescription("REASON", e.getMessage()));994 }995 return testCaseExecutionData;996 }997 private TestCaseExecutionData property_getAttributeFromHtml(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {998 MessageEvent res;999 try {1000 Identifier identifier = identifierService.convertStringToIdentifier(testCaseExecutionData.getValue1());1001 String valueFromHTML = this.webdriverService.getAttributeFromHtml(tCExecution.getSession(), identifier, testCaseExecutionData.getValue2());1002 if (valueFromHTML != null) {1003 testCaseExecutionData.setValue(valueFromHTML);1004 res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETATTRIBUTEFROMHTML);1005 res.setDescription(res.getDescription().replace("%VALUE%", valueFromHTML));1006 } else {1007 res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTML_ATTRIBUTEDONOTEXIST);1008 }1009 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));1010 res.setDescription(res.getDescription().replace("%ATTRIBUTE%", testCaseExecutionData.getValue2()));1011 } catch (NoSuchElementException exception) {1012 LOG.debug(exception.toString());1013 res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_HTMLVISIBLE_ELEMENTDONOTEXIST);1014 res.setDescription(res.getDescription().replace("%ELEMENT%", testCaseExecutionData.getValue1()));1015 }1016 testCaseExecutionData.setPropertyResultMessage(res);1017 return testCaseExecutionData;1018 }1019 private TestCaseExecutionData property_executeSoapFromLib(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseStepActionExecution testCaseStepActionExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {1020 String result = null;1021 AnswerItem<String> answerDecode = new AnswerItem<>();1022 try {1023 AppService appService = this.appServiceService.findAppServiceByKey(testCaseExecutionData.getValue1());1024 if (appService != null) {1025 String decodedEnveloppe = appService.getServiceRequest();1026 String decodedServicePath = appService.getServicePath();1027 String decodedMethod = appService.getOperation();1028 String decodedAttachement = appService.getAttachementURL();1029 if (appService.getServiceRequest().contains("%")) {1030 answerDecode = variableService.decodeStringCompletly(appService.getServiceRequest(), tCExecution, testCaseStepActionExecution, false);1031 decodedEnveloppe = (String) answerDecode.getItem();1032 if (!(answerDecode.isCodeStringEquals("OK"))) {1033 // If anything wrong with the decode --> we stop here with decode message in the action result.1034 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SOAP Service Request"));1035 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());1036 LOG.debug("Property interupted due to decode 'SOAP Service Request' Error.");1037 return testCaseExecutionData;1038 }1039 }1040 if (appService.getServicePath().contains("%")) {1041 answerDecode = variableService.decodeStringCompletly(appService.getServicePath(), tCExecution, testCaseStepActionExecution, false);1042 decodedServicePath = (String) answerDecode.getItem();1043 if (!(answerDecode.isCodeStringEquals("OK"))) {1044 // If anything wrong with the decode --> we stop here with decode message in the action result.1045 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SOAP Service Path"));1046 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());1047 LOG.debug("Property interupted due to decode 'SOAP Service Path.");1048 return testCaseExecutionData;1049 }1050 }1051 if (appService.getOperation().contains("%")) {1052 answerDecode = variableService.decodeStringCompletly(appService.getOperation(), tCExecution, testCaseStepActionExecution, false);1053 decodedMethod = (String) answerDecode.getItem();1054 if (!(answerDecode.isCodeStringEquals("OK"))) {1055 // If anything wrong with the decode --> we stop here with decode message in the action result.1056 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SOAP Operation"));1057 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());1058 LOG.debug("Property interupted due to decode 'SOAP Operation.");1059 return testCaseExecutionData;1060 }1061 }1062 if (appService.getAttachementURL().contains("%")) {1063 answerDecode = variableService.decodeStringCompletly(appService.getAttachementURL(), tCExecution, testCaseStepActionExecution, false);1064 decodedAttachement = (String) answerDecode.getItem();1065 if (!(answerDecode.isCodeStringEquals("OK"))) {1066 // If anything wrong with the decode --> we stop here with decode message in the action result.1067 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SOAP Attachement URL"));1068 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());1069 LOG.debug("Property interupted due to decode 'SOAP Attachement URL.");1070 return testCaseExecutionData;1071 }1072 }1073 //Call Soap and set LastSoapCall of the testCaseExecution.1074 AnswerItem soapCall = soapService.callSOAP(decodedEnveloppe, decodedServicePath, decodedMethod, decodedAttachement, null, null, 60000, tCExecution.getApplicationObj().getSystem());1075 AppService se1 = (AppService) soapCall.getItem();1076// tCExecution.setLastSOAPCalled(soapCall);1077 if (soapCall.isCodeEquals(200)) {1078// SOAPExecution lastSoapCalled = (SOAPExecution) tCExecution.getLastSOAPCalled().getItem();1079 String xmlResponse = se1.getResponseHTTPBody();1080 result = xmlUnitService.getFromXml(xmlResponse, appService.getAttachementURL());1081 }1082 if (result != null) {1083 testCaseExecutionData.setValue(result);1084 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_SOAP);1085 testCaseExecutionData.setPropertyResultMessage(res);1086 } else {1087 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_SOAPFROMLIB_NODATA);1088 testCaseExecutionData.setPropertyResultMessage(res);1089 }1090 }1091 } catch (CerberusException exception) {1092 LOG.error(exception.toString(), exception);1093 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_TESTDATA_PROPERTYDONOTEXIST);1094 res.setDescription(res.getDescription().replace("%PROPERTY%", testCaseExecutionData.getValue1()));1095 testCaseExecutionData.setPropertyResultMessage(res);1096 } catch (CerberusEventException ex) {1097 LOG.error(ex.toString(), ex);1098 MessageEvent message = new MessageEvent(MessageEventEnum.ACTION_FAILED_CALLSOAP);1099 message.setDescription(message.getDescription().replace("%SOAPNAME%", testCaseExecutionData.getValue1()));1100 message.setDescription(message.getDescription().replace("%DESCRIPTION%", ex.getMessageError().getDescription()));1101 testCaseExecutionData.setPropertyResultMessage(message);1102 }1103 return testCaseExecutionData;1104 }1105 private TestCaseExecutionData property_getFromXml(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {1106 // 1. Get XML value to parse1107 String xmlToParse = null;1108 // If value2 is defined, then take it as XML value to parse1109 if (!(StringUtil.isNullOrEmpty(testCaseExecutionData.getValue2()))) {1110 xmlToParse = testCaseExecutionData.getValue2();1111 } // Else try to get the last known response from service call1112 else if (tCExecution.getLastServiceCalled() != null) {1113 xmlToParse = tCExecution.getLastServiceCalled().getResponseHTTPBody();1114 } // If XML to parse is still null, then there is an error in XML value definition1115 else if (xmlToParse == null) {1116 testCaseExecutionData.setPropertyResultMessage(1117 new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMXML)1118 .resolveDescription("VALUE1", testCaseExecutionData.getValue1())1119 .resolveDescription("VALUE2", testCaseExecutionData.getValue2()));1120 return testCaseExecutionData;1121 }1122 // Else we can try to parse it thanks to the dedicated service1123 try {1124 String valueFromXml = xmlUnitService.getFromXml(xmlToParse, testCaseExecutionData.getValue1());1125 if (valueFromXml != null) {1126 testCaseExecutionData.setValue(valueFromXml);1127 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMXML);1128 res.setDescription(res.getDescription().replace("%VALUE%", valueFromXml));1129 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1130 testCaseExecutionData.setPropertyResultMessage(res);1131 } else {1132 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMXML);1133 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1134 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1135 testCaseExecutionData.setPropertyResultMessage(res);1136 }1137 } catch (Exception ex) {1138 LOG.debug(ex.toString());1139 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMXML);1140 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1141 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1142 testCaseExecutionData.setPropertyResultMessage(res);1143 }1144 return testCaseExecutionData;1145 }1146 private TestCaseExecutionData property_getFromCookie(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {1147 try {1148 String valueFromCookie = this.webdriverService.getFromCookie(tCExecution.getSession(), testCaseExecutionData.getValue1(), testCaseExecutionData.getValue2());1149 if (valueFromCookie != null) {1150 if (!valueFromCookie.equals("cookieNotFound")) {1151 testCaseExecutionData.setValue(valueFromCookie);1152 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMCOOKIE);1153 res.setDescription(res.getDescription().replace("%COOKIE%", testCaseExecutionData.getValue1()));1154 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue2()));1155 res.setDescription(res.getDescription().replace("%VALUE%", valueFromCookie));1156 testCaseExecutionData.setPropertyResultMessage(res);1157 } else {1158 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMCOOKIE_COOKIENOTFOUND);1159 res.setDescription(res.getDescription().replace("%COOKIE%", testCaseExecutionData.getValue1()));1160 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue2()));1161 testCaseExecutionData.setPropertyResultMessage(res);1162 }1163 } else {1164 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMCOOKIE_PARAMETERNOTFOUND);1165 res.setDescription(res.getDescription().replace("%COOKIE%", testCaseExecutionData.getValue1()));1166 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue2()));1167 testCaseExecutionData.setPropertyResultMessage(res);1168 }1169 } catch (Exception exception) {1170 LOG.debug(exception.toString());1171 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMCOOKIE_COOKIENOTFOUND);1172 res.setDescription(res.getDescription().replace("%COOKIE%", testCaseExecutionData.getValue1()));1173 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue2()));1174 testCaseExecutionData.setPropertyResultMessage(res);1175 }1176 return testCaseExecutionData;1177 }1178 private TestCaseExecutionData property_getDifferencesFromXml(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceCalculation) {1179 try {1180 LOG.debug("Computing differences between " + testCaseExecutionData.getValue1() + " and " + testCaseExecutionData.getValue2());1181 String differences = xmlUnitService.getDifferencesFromXml(testCaseExecutionData.getValue1(), testCaseExecutionData.getValue2());1182 if (differences != null) {1183 LOG.debug("Computing done.");1184 testCaseExecutionData.setValue(differences);1185 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETDIFFERENCESFROMXML);1186 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1187 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1188 testCaseExecutionData.setPropertyResultMessage(res);1189 } else {1190 LOG.debug("Computing failed.");1191 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETDIFFERENCESFROMXML);1192 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1193 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1194 testCaseExecutionData.setPropertyResultMessage(res);1195 }1196 } catch (Exception ex) {1197 LOG.debug(ex.toString());1198 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETDIFFERENCESFROMXML);1199 res.setDescription(res.getDescription().replace("%VALUE1%", testCaseExecutionData.getValue1()));1200 res.setDescription(res.getDescription().replace("%VALUE2%", testCaseExecutionData.getValue2()));1201 testCaseExecutionData.setPropertyResultMessage(res);1202 }1203 return testCaseExecutionData;1204 }1205 private TestCaseExecutionData property_getFromJson(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution, boolean forceRecalculation) {1206 String jsonResponse = "";1207 try {1208 /**1209 * If tCExecution LastServiceCalled exist, get the response;1210 */1211 if (null != tCExecution.getLastServiceCalled()) {1212 jsonResponse = tCExecution.getLastServiceCalled().getResponseHTTPBody();1213 }1214 if (!(StringUtil.isNullOrEmpty(testCaseExecutionData.getValue2()))) {1215 try {1216 URL myurl;1217 myurl = new URL(testCaseExecutionData.getValue2());1218 String str = "";1219 StringBuilder sb = new StringBuilder();1220 BufferedReader br = null;1221 try {1222 br = new BufferedReader(new InputStreamReader(myurl.openStream()));1223 while (null != (str = br.readLine())) {1224 sb.append(str);1225 }1226 } catch (IOException ex) {1227 LOG.warn("Error Getting Json File " + ex);1228 } finally {1229 if (br != null) {1230 try {1231 br.close();1232 } catch (IOException e) {1233 LOG.warn(e.toString());1234 }1235 }1236 }1237 jsonResponse = sb.toString();1238 } catch (MalformedURLException e) {1239 LOG.debug("URL is invalid so we consider that it is a json file.");1240 jsonResponse = testCaseExecutionData.getValue2();1241 }1242 }1243 //Record result in filessytem.1244 recorderService.recordProperty(tCExecution.getId(), testCaseExecutionData.getProperty(), 1, jsonResponse);1245 String valueFromJson = this.jsonService.getFromJson(jsonResponse, null, testCaseExecutionData.getValue1());1246 if (valueFromJson != null) {1247 testCaseExecutionData.setValue(valueFromJson);1248 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMJSON);1249 res.setDescription(res.getDescription().replace("%URL%", testCaseExecutionData.getValue2()));1250 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue1()));1251 res.setDescription(res.getDescription().replace("%VALUE%", valueFromJson));1252 testCaseExecutionData.setPropertyResultMessage(res);1253 } else {1254 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMJSON_PARAMETERNOTFOUND);1255 res.setDescription(res.getDescription().replace("%URL%", testCaseExecutionData.getValue2()));1256 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue1()));1257 res.setDescription(res.getDescription().replace("%ERROR%", ""));1258 testCaseExecutionData.setPropertyResultMessage(res);1259 }1260 } catch (Exception exception) {1261 if (LOG.isDebugEnabled()) {1262 LOG.error("Exception when getting property from JSON.", exception);1263 }1264 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_FAILED_GETFROMJSON_PARAMETERNOTFOUND);1265 res.setDescription(res.getDescription().replace("%URL%", testCaseExecutionData.getValue2()));1266 res.setDescription(res.getDescription().replace("%PARAM%", testCaseExecutionData.getValue1()));1267 res.setDescription(res.getDescription().replace("%ERROR%", exception.toString()));1268 testCaseExecutionData.setPropertyResultMessage(res);1269 }1270 return testCaseExecutionData;1271 }1272 private TestCaseExecutionData property_getFromDataLib(TestCaseExecutionData testCaseExecutionData, TestCaseExecution tCExecution,1273 TestCaseStepActionExecution testCaseStepActionExecution, TestCaseCountryProperties testCaseCountryProperty, boolean forceRecalculation) {1274 MessageEvent res = new MessageEvent(MessageEventEnum.PROPERTY_SUCCESS_GETFROMDATALIB);1275 TestDataLib testDataLib;1276 List<HashMap<String, String>> result = null;1277 AnswerItem<String> answerDecode = new AnswerItem<>();1278 // We get here the correct TestDataLib entry from the Value1 (name) that better match the context on system, environment and country.1279 AnswerItem<TestDataLib> answer = testDataLibService.readByNameBySystemByEnvironmentByCountry(testCaseExecutionData.getValue1(),1280 tCExecution.getApplicationObj().getSystem(), tCExecution.getEnvironmentData(),1281 tCExecution.getCountry());1282 if (answer.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode()) && answer.getItem() != null) {1283 testDataLib = (TestDataLib) answer.getItem();1284 AnswerList<HashMap<String, String>> serviceAnswer;1285 //check if there are properties defined in the data specification1286 try {1287 if (testDataLib.getType().equals(TestDataLib.TYPE_SQL)) {1288 //check if the script contains properties that neeed to be calculated1289 answerDecode = variableService.decodeStringCompletly(testDataLib.getScript(), tCExecution, testCaseStepActionExecution, false);1290 String decodedScript = (String) answerDecode.getItem();1291 testDataLib.setScript(decodedScript);1292 if (!(answerDecode.isCodeStringEquals("OK"))) {1293 // If anything wrong with the decode --> we stop here with decode message in the action result.1294 testCaseExecutionData.setPropertyResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "SQL Script"));1295 testCaseExecutionData.setStopExecution(answerDecode.getResultMessage().isStopTest());1296 LOG.debug("Property interupted due to decode 'SQL Script'.");1297 return testCaseExecutionData;1298 }1299 }1300 } catch (CerberusEventException cex) {1301 LOG.error(cex.toString(), cex);...

Full Screen

Full Screen

Source:TestCaseExecutionDataDAO.java Github

copy

Full Screen

...238 ps.setString(i++, object.getProperty());239 ps.setInt(i++, object.getIndex());240 ps.setString(i++, object.getDescription());241 ps.setString(i++, ParameterParserUtil.securePassword(StringUtil.getLeftString(object.getValue(), 65000), object.getProperty()));242 ps.setString(i++, object.getType());243 ps.setInt(i++, object.getRank());244 ps.setString(i++, ParameterParserUtil.securePassword(StringUtil.getLeftString(object.getValue1(), 65000), object.getProperty()));245 ps.setString(i++, ParameterParserUtil.securePassword(StringUtil.getLeftString(object.getValue2(), 65000), object.getProperty()));246 ps.setString(i++, object.getRC());247 ps.setString(i++, StringUtil.getLeftString(object.getrMessage(), 65000));248 ps.setTimestamp(i++, new Timestamp(object.getStart()));249 ps.setTimestamp(i++, new Timestamp(object.getEnd()));250 ps.setString(i++, df.format(object.getStart()));251 ps.setString(i++, df.format(object.getEnd()));252 ps.setString(i++, object.getDatabase());253 ps.setString(i++, object.getValue1Init());254 ps.setString(i++, object.getValue2Init());255 ps.setString(i++, object.getLengthInit());256 ps.setString(i++, object.getLength());257 ps.setInt(i++, object.getRowLimit());258 ps.setString(i++, object.getNature());259 ps.setInt(i++, object.getRetryNb());260 ps.setInt(i++, object.getRetryPeriod());261 ps.setString(i++, object.getSystem());262 ps.setString(i++, object.getEnvironment());263 ps.setString(i++, object.getCountry());264 ps.setString(i++, object.getDataLib());265 ps.setString(i++, StringUtil.getLeftString(object.getJsonResult(), 65000));266 ps.setString(i++, object.getFromCache());267 }268 );269 }270 @Override271 public void delete(TestCaseExecutionData object) throws CerberusException {272 MessageEvent msg = null;273 final String query = "DELETE FROM testcaseexecutiondata WHERE id = ? AND property = ? AND `index` = ? ";274 // Debug message on SQL.275 if (LOG.isDebugEnabled()) {276 LOG.debug("SQL.param.id : " + String.valueOf(object.getId()));277 LOG.debug("SQL.param.property : " + object.getProperty());278 LOG.debug("SQL.param.index : " + String.valueOf(object.getIndex()));279 }280 RequestDbUtils.executeUpdate(databaseSpring, query.toString(),281 ps -> {282 int i = 1;283 ps.setLong(i++, object.getId());284 ps.setString(i++, object.getProperty());285 ps.setInt(i++, object.getIndex());286 }287 );288 }289 @Override290 public void update(TestCaseExecutionData object) throws CerberusException {291 StringBuilder query = new StringBuilder();292 query.append("UPDATE testcaseexecutiondata SET DESCRIPTION = ?, VALUE = ?, TYPE = ?, `Rank` = ?, VALUE1 = ?, VALUE2 = ?, rc = ?, rmessage = ?, start = ?, ");293 query.append("END = ?, startlong = ?, endlong = ?, `database` = ?, `value1Init` = ?, `value2Init` = ?, ");294 query.append("`lengthInit` = ?, `length` = ?, `rowLimit` = ?, `nature` = ?, `retrynb` = ?, `retryperiod` = ?, ");295 query.append("`system` = ?, `environment` = ?, `country` = ?, `dataLib` = ?, `jsonResult` = ? , `FromCache` = ? ");296 query.append("WHERE id = ? AND property = ? AND `index` = ?");297 // Debug message on SQL.298 if (LOG.isDebugEnabled()) {299 LOG.debug("SQL.param.id : " + object.getId());300 LOG.debug("SQL.param.property : " + object.getProperty());301 LOG.debug("SQL.param.index : " + object.getIndex());302 LOG.debug("SQL.param.value : " + ParameterParserUtil.securePassword(StringUtil.getLeftString(object.getValue(), 65000), object.getProperty()));303 LOG.debug("SQL.param.value1 : " + ParameterParserUtil.securePassword(StringUtil.getLeftString(object.getValue1(), 65000), object.getProperty()));304 LOG.debug("SQL.param.value2 : " + ParameterParserUtil.securePassword(StringUtil.getLeftString(object.getValue2(), 65000), object.getProperty()));305 }306 RequestDbUtils.executeUpdate(databaseSpring, query.toString(),307 ps -> {308 DateFormat df = new SimpleDateFormat(DateUtil.DATE_FORMAT_TIMESTAMP);309 int i = 1;310 ps.setString(i++, object.getDescription());311 ps.setString(i++, ParameterParserUtil.securePassword(StringUtil.getLeftString(object.getValue(), 65000), object.getProperty()));312 ps.setString(i++, object.getType());313 ps.setInt(i++, object.getRank());314 ps.setString(i++, ParameterParserUtil.securePassword(StringUtil.getLeftString(object.getValue1(), 65000), object.getProperty()));315 ps.setString(i++, StringUtil.getLeftString(object.getValue2(), 65000));316 ps.setString(i++, object.getRC());317 ps.setString(i++, StringUtil.getLeftString(object.getrMessage(), 65000));318 ps.setTimestamp(i++, new Timestamp(object.getStart()));319 ps.setTimestamp(i++, new Timestamp(object.getEnd()));320 ps.setString(i++, df.format(object.getStart()));321 ps.setString(i++, df.format(object.getEnd()));322 ps.setString(i++, object.getDatabase());323 ps.setString(i++, object.getValue1Init());324 ps.setString(i++, object.getValue2Init());325 ps.setString(i++, object.getLengthInit());326 ps.setString(i++, object.getLength());...

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();2testCaseExecutionData.getType();3TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();4testCaseExecutionData.getLength();5TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();6testCaseExecutionData.getRowLimit();7TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();8testCaseExecutionData.getOrigin();9TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();10testCaseExecutionData.getDatabase();11TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();12testCaseExecutionData.getSubData();13TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();14testCaseExecutionData.getSubData();15TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();16testCaseExecutionData.getSubData();17TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();18testCaseExecutionData.getSubData();19TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();20testCaseExecutionData.getSubData();21TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();22testCaseExecutionData.getSubData();

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();2testCaseExecutionData.getType();3TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();4testCaseExecutionData.setBuildRevision("buildRevision");5TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();6testCaseExecutionData.getBuildRevision();7TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();8testCaseExecutionData.getEnvironment();9TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();10testCaseExecutionData.setEnvironment("environment");11TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();12testCaseExecutionData.getCountry();13TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();14testCaseExecutionData.setCountry("country");15TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();16testCaseExecutionData.getBrowser();17TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();18testCaseExecutionData.setBrowser("browser");19TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();20testCaseExecutionData.getBrowserFullVersion();21TestCaseExecutionData testCaseExecutionData = new TestCaseExecutionData();22testCaseExecutionData.setBrowserFullVersion("

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1public class TestcaseexecutiondataGetType {2 public static void main(String[] args) {3 TestCaseExecutionData testcaseexecutiondata = new TestCaseExecutionData();4 System.out.println(testcaseexecutiondata.getType());5 }6}7public class TestcaseexecutiondataSetType {8 public static void main(String[] args) {9 TestCaseExecutionData testcaseexecutiondata = new TestCaseExecutionData();10 testcaseexecutiondata.setType("MyType");11 System.out.println(testcaseexecutiondata.getType());12 }13}14public class TestcaseexecutiondataGetLength {15 public static void main(String[] args) {16 TestCaseExecutionData testcaseexecutiondata = new TestCaseExecutionData();17 System.out.println(testcaseexecutiondata.getLength());18 }19}20public class TestcaseexecutiondataSetLength {21 public static void main(String[] args) {22 TestCaseExecutionData testcaseexecutiondata = new TestCaseExecutionData();23 testcaseexecutiondata.setLength(1);24 System.out.println(testcaseexecutiondata.getLength());25 }26}27public class TestcaseexecutiondataGetRowLimit {28 public static void main(String[] args) {29 TestCaseExecutionData testcaseexecutiondata = new TestCaseExecutionData();30 System.out.println(testcaseexecutiondata.getRowLimit());31 }32}33public class TestcaseexecutiondataSetRowLimit {34 public static void main(String[] args) {35 TestCaseExecutionData testcaseexecutiondata = new TestCaseExecutionData();36 testcaseexecutiondata.setRowLimit(1);37 System.out.println(testcaseexecutiondata.getRowLimit());38 }39}

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2import java.util.Date;3public class TestCaseExecutionData {4 private long id;5 private long test;6 private long testCase;7 private long testBattery;8 private long testCaseExecutionQueue;9 private String type;10 private String subData;11 private String value;12 private String description;13 private Date dateCreated;14 private Date dateModif;15 private String usrCreated;16 private String usrModif;17 public long getId() {18 return id;19 }20 public void setId(long id) {21 this.id = id;22 }23 public long getTest() {24 return test;25 }26 public void setTest(long test) {27 this.test = test;28 }29 public long getTestCase() {30 return testCase;31 }32 public void setTestCase(long testCase) {33 this.testCase = testCase;34 }35 public long getTestBattery() {36 return testBattery;37 }38 public void setTestBattery(long testBattery) {39 this.testBattery = testBattery;40 }41 public long getTestCaseExecutionQueue() {42 return testCaseExecutionQueue;43 }44 public void setTestCaseExecutionQueue(long testCaseExecutionQueue) {45 this.testCaseExecutionQueue = testCaseExecutionQueue;46 }47 public String getType() {48 return type;49 }50 public void setType(String type) {51 this.type = type;52 }53 public String getSubData() {54 return subData;55 }56 public void setSubData(String subData) {57 this.subData = subData;58 }59 public String getValue() {60 return value;61 }62 public void setValue(String value) {63 this.value = value;64 }65 public String getDescription() {66 return description;67 }68 public void setDescription(String description) {69 this.description = description;70 }71 public Date getDateCreated() {72 return dateCreated;73 }74 public void setDateCreated(Date dateCreated) {75 this.dateCreated = dateCreated;76 }77 public Date getDateModif() {78 return dateModif;79 }80 public void setDateModif(Date dateModif) {81 this.dateModif = dateModif;82 }83 public String getUsrCreated() {84 return usrCreated;85 }86 public void setUsrCreated(String usrCreated) {87 this.usrCreated = usrCreated;88 }

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1package org.cerberus.crud.entity;2public class TestCaseExecutionData {3 private String value;4 private String type;5 public String getValue() {6 return value;7 }8 public void setValue(String value) {9 this.value = value;10 }11 public String getType() {12 return type;13 }14 public void setType(String type) {15 this.type = type;16 }17}18package org.cerberus.crud.entity;19public class TestCaseExecutionData {20 private String value;21 private String type;22 public String getValue() {23 return value;24 }25 public void setValue(String value) {26 this.value = value;27 }28 public String getType() {29 return type;30 }31 public void setType(String type) {32 this.type = type;33 }34}35package org.cerberus.crud.entity;36public class TestCaseExecutionData {37 private String value;38 private String type;39 private Date dateCreated;40 public String getValue() {41 return value;42 }43 public void setValue(String value) {44 this.value = value;45 }46 public String getType() {47 return type;48 }49 public void setType(String type) {50 this.type = type;51 }52 public Date getDateCreated() {53 return dateCreated;54 }55 public void setDateCreated(Date dateCreated) {56 this.dateCreated = dateCreated;57 }58}59package org.cerberus.crud.entity;60public class TestCaseExecutionData {61 private String value;62 private String type;63 private Date dateCreated;64 public String getValue() {65 return value;66 }67 public void setValue(String value) {68 this.value = value;69 }70 public String getType() {71 return type;72 }

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1import org.cerberus.crud.entity.TestCaseExecutionData;2public class 3 {3 public static void main(String[] args) {4 TestCaseExecutionData obj = new TestCaseExecutionData();5 obj.setType("type");6 String type = obj.getType();7 System.out.println(type);8 }9}10import org.cerberus.crud.entity.TestCaseExecutionData;11public class 4 {12 public static void main(String[] args) {13 TestCaseExecutionData obj = new TestCaseExecutionData();14 obj.setReturnCode("returnCode");15 String returnCode = obj.getReturnCode();16 System.out.println(returnCode);17 }18}19import org.cerberus.crud.entity.TestCaseExecutionData;20public class 5 {21 public static void main(String[] args) {22 TestCaseExecutionData obj = new TestCaseExecutionData();23 obj.setReturnMessage("returnMessage");24 String returnMessage = obj.getReturnMessage();25 System.out.println(returnMessage);26 }27}28import org.cerberus.crud.entity.TestCaseExecutionData;29public class 6 {30 public static void main(String[] args) {31 TestCaseExecutionData obj = new TestCaseExecutionData();32 obj.setReturnCodeDescription("returnCodeDescription");33 String returnCodeDescription = obj.getReturnCodeDescription();34 System.out.println(returnCodeDescription);35 }36}37import org.cerberus.crud.entity.TestCaseExecutionData;38public class 7 {39 public static void main(String[] args) {

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1import org.cerberus.crud.entity.TestCaseExecutionData;2public class 3 {3 public static void main(String[] args) {4 TestCaseExecutionData data = new TestCaseExecutionData();5 data.setType("text");6 System.out.println(data.getType());7 }8}9import org.cerberus.crud.entity.TestCaseExecutionData;10public class 4 {11 public static void main(String[] args) {12 TestCaseExecutionData data = new TestCaseExecutionData();13 data.setTestDataLibID("testDataLibID");14 System.out.println(data.getTestDataLibID());15 }16}17import org.cerberus.crud.entity.TestCaseExecutionData;18public class 5 {19 public static void main(String[] args) {20 TestCaseExecutionData data = new TestCaseExecutionData();21 data.setTestDataLibName("testDataLibName");22 System.out.println(data.getTestDataLibName());23 }24}25import org.cerberus.crud.entity.TestCaseExecutionData;26public class 6 {27 public static void main(String[] args) {28 TestCaseExecutionData data = new TestCaseExecutionData();29 data.setTestDataLibColumn("testDataLibColumn");30 System.out.println(data.getTestDataLibColumn());31 }32}

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