How to use RobotServerService class of org.cerberus.engine.execution.impl package

Best Cerberus-source code snippet using org.cerberus.engine.execution.impl.RobotServerService

Source:ActionService.java Github

copy

Full Screen

...39import org.cerberus.engine.entity.MessageGeneral;40import org.cerberus.engine.entity.SwipeAction;41import org.cerberus.engine.execution.IIdentifierService;42import org.cerberus.engine.execution.IRecorderService;43import org.cerberus.engine.execution.IRobotServerService;44import org.cerberus.engine.execution.impl.RobotServerService;45import org.cerberus.engine.gwt.IActionService;46import org.cerberus.engine.gwt.IPropertyService;47import org.cerberus.engine.gwt.IVariableService;48import org.cerberus.enums.MessageEventEnum;49import org.cerberus.enums.MessageGeneralEnum;50import org.cerberus.exception.CerberusEventException;51import org.cerberus.exception.CerberusException;52import org.cerberus.service.appium.IAppiumService;53import org.cerberus.service.appservice.IServiceService;54import org.cerberus.service.cerberuscommand.ICerberusCommand;55import org.cerberus.service.consolelog.IConsolelogService;56import org.cerberus.service.executor.IExecutorService;57import org.cerberus.service.har.IHarService;58import org.cerberus.service.har.entity.NetworkTrafficIndex;59import org.cerberus.service.rest.IRestService;60import org.cerberus.service.sikuli.ISikuliService;61import org.cerberus.service.sikuli.impl.SikuliService;62import org.cerberus.service.soap.ISoapService;63import org.cerberus.service.sql.ISQLService;64import org.cerberus.service.webdriver.IWebDriverService;65import org.cerberus.service.xmlunit.IXmlUnitService;66import org.cerberus.util.ParameterParserUtil;67import org.cerberus.util.StringUtil;68import org.cerberus.util.answer.AnswerItem;69import org.json.JSONArray;70import org.json.JSONObject;71import org.openqa.selenium.Platform;72import org.springframework.beans.factory.annotation.Autowired;73import org.springframework.beans.factory.annotation.Qualifier;74import org.springframework.stereotype.Service;75import java.io.IOException;76import java.util.ArrayList;77import java.util.Date;78import java.util.HashMap;79import java.util.Optional;80/**81 * @author bcivel82 */83@Service84public class ActionService implements IActionService {85 @Autowired86 private IParameterService parameterService;87 @Autowired88 private IWebDriverService webdriverService;89 @Autowired90 private ISoapService soapService;91 @Autowired92 private IRestService restService;93 @Autowired94 private IHarService harService;95 @Autowired96 private IAppServiceService appServiceService;97 @Autowired98 private IRecorderService recorderService;99 @Autowired100 private IXmlUnitService xmlUnitService;101 @Autowired102 private ISikuliService sikuliService;103 @Autowired104 private IIdentifierService identifierService;105 @Autowired106 @Qualifier("AndroidAppiumService")107 private IAppiumService androidAppiumService;108 @Autowired109 @Qualifier("IOSAppiumService")110 private IAppiumService iosAppiumService;111 @Autowired112 @Qualifier("CerberusCommand")113 private ICerberusCommand cerberusCommand;114 @Autowired115 private ISQLService sqlService;116 @Autowired117 private ILogEventService logEventService;118 @Autowired119 private IVariableService variableService;120 @Autowired121 private IPropertyService propertyService;122 @Autowired123 private IServiceService serviceService;124 @Autowired125 private IConsolelogService consolelogService;126 @Autowired127 private IExecutorService executorService;128 @Autowired129 private IFactoryTestCaseExecutionData factoryTestCaseExecutionData;130 @Autowired131 private IFactoryAppService factoryAppService;132 @Autowired133 private ITestCaseExecutionDataService testCaseExecutionDataService;134 @Autowired135 private IRobotServerService robotServerService;136 private static final Logger LOG = LogManager.getLogger(ActionService.class);137 private static final String MESSAGE_DEPRECATED = "[DEPRECATED]";138 @Override139 public TestCaseStepActionExecution doAction(TestCaseStepActionExecution actionExecution) {140 MessageEvent res;141 TestCaseExecution tCExecution = actionExecution.getTestCaseStepExecution().gettCExecution();142 AnswerItem<String> answerDecode = new AnswerItem<>();143 /**144 * Decode the step action description145 */146 try {147 // When starting a new action, we reset the property list that was already calculated.148 tCExecution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());149 answerDecode = variableService.decodeStringCompletly(actionExecution.getDescription(),150 tCExecution, actionExecution, false);151 actionExecution.setDescription(answerDecode.getItem());152 if (!(answerDecode.isCodeStringEquals("OK"))) {153 // If anything wrong with the decode --> we stop here with decode message in the action result.154 actionExecution.setActionResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Description"));155 actionExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));156 actionExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());157 actionExecution.setEnd(new Date().getTime());158 LOG.debug("Action interupted due to decode 'Description' Error.");159 return actionExecution;160 }161 } catch (CerberusEventException cex) {162 actionExecution.setActionResultMessage(cex.getMessageError());163 actionExecution.setExecutionResultMessage(new MessageGeneral(cex.getMessageError().getMessage()));164 actionExecution.setEnd(new Date().getTime());165 return actionExecution;166 }167 /**168 * Decode the object field before doing the action.169 */170 try {171 // When starting a new action, we reset the property list that was already calculated.172 tCExecution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());173 answerDecode = variableService.decodeStringCompletly(actionExecution.getValue1(),174 tCExecution, actionExecution, false);175 actionExecution.setValue1(answerDecode.getItem());176 if (!(answerDecode.isCodeStringEquals("OK"))) {177 // If anything wrong with the decode --> we stop here with decode message in the action result.178 actionExecution.setActionResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Action Value1"));179 actionExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));180 actionExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());181 actionExecution.setEnd(new Date().getTime());182 LOG.debug("Action interupted due to decode 'Action Value1' Error.");183 return actionExecution;184 }185 } catch (CerberusEventException cex) {186 actionExecution.setActionResultMessage(cex.getMessageError());187 actionExecution.setExecutionResultMessage(new MessageGeneral(cex.getMessageError().getMessage()));188 actionExecution.setEnd(new Date().getTime());189 return actionExecution;190 }191 try {192 // When starting a new action, we reset the property list that was already calculated.193 tCExecution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());194 answerDecode = variableService.decodeStringCompletly(actionExecution.getValue2(),195 tCExecution, actionExecution, false);196 actionExecution.setValue2(answerDecode.getItem());197 if (!(answerDecode.isCodeStringEquals("OK"))) {198 // If anything wrong with the decode --> we stop here with decode message in the action result.199 actionExecution.setActionResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Action Value2"));200 actionExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));201 actionExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());202 actionExecution.setEnd(new Date().getTime());203 LOG.debug("Action interupted due to decode 'Action Value2' Error.");204 return actionExecution;205 }206 } catch (CerberusEventException cex) {207 actionExecution.setActionResultMessage(cex.getMessageError());208 actionExecution.setExecutionResultMessage(new MessageGeneral(cex.getMessageError().getMessage()));209 actionExecution.setEnd(new Date().getTime());210 return actionExecution;211 }212 /**213 * Timestamp starts after the decode.214 */215 actionExecution.setStart(new Date().getTime());216 String value1 = actionExecution.getValue1();217 String value2 = actionExecution.getValue2();218 String value3 = actionExecution.getValue3();219 String propertyName = actionExecution.getPropertyName();220 LOG.debug("Doing Action : " + actionExecution.getAction() + " with value1 : " + value1 + " and value2 : " + value2 + " and value3 : " + value3);221 // When starting a new action, we reset the property list that was already calculated.222 tCExecution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());223 // Define Timeout224 HashMap<String, String> optionsMap = robotServerService.getMapFromOptions(actionExecution.getOptions());225 if (optionsMap.containsKey(RobotServerService.OPTIONS_TIMEOUT_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX).isEmpty()) {226 Optional<Integer> timeoutOptionValue = Optional.ofNullable(Ints.tryParse(optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX)));227 if (timeoutOptionValue.isPresent()) {228 robotServerService.setOptionsTimeout(tCExecution.getSession(), timeoutOptionValue.get());229 } else {230 //TODO return a message alerting about the failed cast231 LOG.debug("failed to parse option value : {}", optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX));232 }233 }234 if (optionsMap.containsKey(RobotServerService.OPTIONS_HIGHLIGHTELEMENT_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_HIGHLIGHTELEMENT_SYNTAX).isEmpty()) {235 Optional<Integer> highlightOptionValue = Optional.ofNullable(Ints.tryParse(optionsMap.get(RobotServerService.OPTIONS_HIGHLIGHTELEMENT_SYNTAX)));236 if (highlightOptionValue.isPresent()) {237 robotServerService.setOptionsHighlightElement(tCExecution.getSession(), highlightOptionValue.get());238 } else {239 //TODO return a message alerting about the failed cast240 LOG.debug("failed to parse option value : {}", optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX));241 }242 }243 if (optionsMap.containsKey(RobotServerService.OPTIONS_MINSIMILARITY_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_MINSIMILARITY_SYNTAX).isEmpty()) {244 String minSimilarity = optionsMap.get(RobotServerService.OPTIONS_MINSIMILARITY_SYNTAX);245 robotServerService.setOptionsMinSimilarity(tCExecution.getSession(), minSimilarity);246 }247 if (optionsMap.containsKey(RobotServerService.OPTIONS_TYPEDELAY_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_TYPEDELAY_SYNTAX).isEmpty()) {248 String typeDelay = optionsMap.get(RobotServerService.OPTIONS_TYPEDELAY_SYNTAX);249 robotServerService.setOptionsTypeDelay(tCExecution.getSession(), typeDelay);250 }251 // Record picture= files at action level.252 Identifier identifier = identifierService.convertStringToIdentifier(value1);253 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE) && !StringUtil.isNullOrEmpty(identifier.getLocator())) {254 LOG.warn("Saving Image 1 on Action : " + identifier.getLocator());255 actionExecution.addFileList(recorderService.recordPicture(actionExecution, -1, identifier.getLocator(), "1"));256 }257 identifier = identifierService.convertStringToIdentifier(value2);258 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE) && !StringUtil.isNullOrEmpty(identifier.getLocator())) {259 LOG.warn("Saving Image 2 on Action : " + identifier.getLocator());260 actionExecution.addFileList(recorderService.recordPicture(actionExecution, -1, identifier.getLocator(), "2"));261 }262 try {...

Full Screen

Full Screen

Source:ControlService.java Github

copy

Full Screen

...27import org.cerberus.engine.entity.MessageEvent;28import org.cerberus.engine.entity.MessageGeneral;29import org.cerberus.engine.execution.IIdentifierService;30import org.cerberus.engine.execution.IRecorderService;31import org.cerberus.engine.execution.IRobotServerService;32import org.cerberus.engine.execution.impl.RobotServerService;33import org.cerberus.engine.gwt.IControlService;34import org.cerberus.engine.gwt.IVariableService;35import org.cerberus.enums.MessageEventEnum;36import org.cerberus.exception.CerberusEventException;37import org.cerberus.service.json.IJsonService;38import org.cerberus.service.sikuli.ISikuliService;39import org.cerberus.service.sikuli.impl.SikuliService;40import org.cerberus.service.webdriver.IWebDriverService;41import org.cerberus.service.xmlunit.IXmlUnitService;42import org.cerberus.util.ParameterParserUtil;43import org.cerberus.util.StringUtil;44import org.cerberus.util.answer.AnswerItem;45import org.openqa.selenium.NoSuchElementException;46import org.openqa.selenium.TimeoutException;47import org.openqa.selenium.WebDriver;48import org.openqa.selenium.WebDriverException;49import org.openqa.selenium.support.ui.WebDriverWait;50import org.springframework.beans.factory.annotation.Autowired;51import org.springframework.stereotype.Service;52import java.util.*;53import java.util.concurrent.TimeUnit;54import java.util.function.Function;55import java.util.regex.Matcher;56import java.util.regex.Pattern;57import java.util.regex.PatternSyntaxException;58/**59 * {Insert class description here}60 *61 * @author Tiago Bernardes62 * @version 1.0, 24/01/201363 * @since 2.0.064 */65@Service66public class ControlService implements IControlService {67 private static final Logger LOG = LogManager.getLogger(ControlService.class);68 @Autowired69 private IWebDriverService webdriverService;70 @Autowired71 private IXmlUnitService xmlUnitService;72 @Autowired73 private IJsonService jsonService;74 @Autowired75 private IIdentifierService identifierService;76 @Autowired77 private ISikuliService sikuliService;78 @Autowired79 private IRecorderService recorderService;80 @Autowired81 private IVariableService variableService;82 @Autowired83 private IRobotServerService robotServerService;84 @Override85 public TestCaseStepActionControlExecution doControl(TestCaseStepActionControlExecution controlExecution) {86 MessageEvent res;87 TestCaseExecution execution = controlExecution.getTestCaseStepActionExecution().getTestCaseStepExecution().gettCExecution();88 AnswerItem<String> answerDecode = new AnswerItem<>();89 // Decode the step action control description90 try {91 // When starting a new control, we reset the property list that was already calculated.92 execution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());93 answerDecode = variableService.decodeStringCompletly(controlExecution.getDescription(),94 execution, controlExecution.getTestCaseStepActionExecution(), false);95 controlExecution.setDescription(answerDecode.getItem());96 if (!(answerDecode.isCodeStringEquals("OK"))) {97 // If anything wrong with the decode --> we stop here with decode message in the control result.98 controlExecution.setControlResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Description"));99 controlExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));100 controlExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());101 controlExecution.setEnd(new Date().getTime());102 LOG.debug("Control interrupted due to decode 'Description' Error.");103 return controlExecution;104 }105 } catch (CerberusEventException cex) {106 controlExecution.setControlResultMessage(cex.getMessageError());107 controlExecution.setExecutionResultMessage(new MessageGeneral(cex.getMessageError().getMessage()));108 return controlExecution;109 }110 //Decode the 2 fields property and values before doing the control.111 try {112 // for both control property and control value113 //if the getvalue() indicates that the execution should stop then we stop it before the doControl or114 //if the property service was unable to decode the property that is specified in the object,115 //then the execution of this control should not performed116 if (controlExecution.getValue1() == null) {117 controlExecution.setValue1("");118 }119 if (controlExecution.getValue1().contains("%")) {120 // When starting a new control, we reset the property list that was already calculated.121 execution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());122 answerDecode = variableService.decodeStringCompletly(controlExecution.getValue1(), execution,123 controlExecution.getTestCaseStepActionExecution(), false);124 controlExecution.setValue1(answerDecode.getItem());125 if (!(answerDecode.isCodeStringEquals("OK"))) {126 // If anything wrong with the decode --> we stop here with decode message in the control result.127 controlExecution.setControlResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Control Value1"));128 controlExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));129 controlExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());130 controlExecution.setEnd(new Date().getTime());131 LOG.debug("Control interrupted due to decode 'Control Value1' Error.");132 return controlExecution;133 }134 }135 if (controlExecution.getValue2() == null) {136 controlExecution.setValue2("");137 }138 if (controlExecution.getValue2().contains("%")) {139 // When starting a new control, we reset the property list that was already calculated.140 execution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());141 answerDecode = variableService.decodeStringCompletly(controlExecution.getValue2(),142 execution, controlExecution.getTestCaseStepActionExecution(), false);143 controlExecution.setValue2(answerDecode.getItem());144 if (!(answerDecode.isCodeStringEquals("OK"))) {145 // If anything wrong with the decode --> we stop here with decode message in the control result.146 controlExecution.setControlResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Control Value2"));147 controlExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));148 controlExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());149 controlExecution.setEnd(new Date().getTime());150 LOG.debug("Control interrupted due to decode 'Control Value2' Error.");151 return controlExecution;152 }153 }154 if (controlExecution.getValue3() == null) {155 controlExecution.setValue3("");156 }157 if (controlExecution.getValue3().contains("%")) {158 // When starting a new control, we reset the property list that was already calculated.159 execution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());160 answerDecode = variableService.decodeStringCompletly(controlExecution.getValue3(),161 execution, controlExecution.getTestCaseStepActionExecution(), false);162 controlExecution.setValue3(answerDecode.getItem());163 if (!(answerDecode.isCodeStringEquals("OK"))) {164 // If anything wrong with the decode --> we stop here with decode message in the control result.165 controlExecution.setControlResultMessage(answerDecode.getResultMessage().resolveDescription("FIELD", "Control Value3"));166 controlExecution.setExecutionResultMessage(new MessageGeneral(answerDecode.getResultMessage().getMessage()));167 controlExecution.setStopExecution(answerDecode.getResultMessage().isStopTest());168 controlExecution.setEnd(new Date().getTime());169 LOG.debug("Control interrupted due to decode 'Control Value3' Error.");170 return controlExecution;171 }172 }173 } catch (CerberusEventException cex) {174 controlExecution.setControlResultMessage(cex.getMessageError());175 controlExecution.setExecutionResultMessage(new MessageGeneral(cex.getMessageError().getMessage()));176 return controlExecution;177 }178 //Timestamp starts after the decode.179 controlExecution.setStart(new Date().getTime());180 controlExecution.setEnd(new Date().getTime());181 // When starting a new control, we reset the property list that was already calculated.182 execution.setRecursiveAlreadyCalculatedPropertiesList(new ArrayList<>());183 String value1 = controlExecution.getValue1();184 String value2 = controlExecution.getValue2();185 String value3 = controlExecution.getValue3();186 // Define Timeout187 HashMap<String, String> optionsMap = robotServerService.getMapFromOptions(controlExecution.getOptions());188 if (optionsMap.containsKey(RobotServerService.OPTIONS_TIMEOUT_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX).isEmpty()) {189 Optional<Integer> timeoutOptionValue = Optional.ofNullable(Ints.tryParse(optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX)));190 if (timeoutOptionValue.isPresent()) {191 robotServerService.setOptionsTimeout(execution.getSession(), timeoutOptionValue.get());192 } else {193 //TODO return a message alerting about the failed cast194 LOG.debug("failed to parse option value : {}", optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX));195 }196 }197 if (optionsMap.containsKey(RobotServerService.OPTIONS_HIGHLIGHTELEMENT_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_HIGHLIGHTELEMENT_SYNTAX).isEmpty()) {198 Optional<Integer> highlightOptionValue = Optional.ofNullable(Ints.tryParse(optionsMap.get(RobotServerService.OPTIONS_HIGHLIGHTELEMENT_SYNTAX)));199 if (highlightOptionValue.isPresent()) {200 robotServerService.setOptionsHighlightElement(execution.getSession(), highlightOptionValue.get());201 } else {202 //TODO return a message alerting about the failed cast203 LOG.debug("failed to parse option value : {}", optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX));204 }205 }206 if (optionsMap.containsKey(RobotServerService.OPTIONS_MINSIMILARITY_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_MINSIMILARITY_SYNTAX).isEmpty()) {207 String minSimilarity = optionsMap.get(RobotServerService.OPTIONS_MINSIMILARITY_SYNTAX);208 robotServerService.setOptionsMinSimilarity(execution.getSession(), minSimilarity);209 }210 if (optionsMap.containsKey(RobotServerService.OPTIONS_TYPEDELAY_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_TYPEDELAY_SYNTAX).isEmpty()) {211 String typeDelay = optionsMap.get(RobotServerService.OPTIONS_TYPEDELAY_SYNTAX);212 robotServerService.setOptionsTypeDelay(execution.getSession(), typeDelay);213 }214 // Record picture= files at action level.215 Identifier identifier = identifierService.convertStringToIdentifier(value1);216 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE) && !StringUtil.isNullOrEmpty(identifier.getLocator())) {217 LOG.warn("Saving Image 1 on Control : {}", identifier.getLocator());218 controlExecution.addFileList(recorderService.recordPicture(controlExecution.getTestCaseStepActionExecution(), controlExecution.getControlId(), identifier.getLocator(), "1"));219 }220 identifier = identifierService.convertStringToIdentifier(value2);221 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE) && !StringUtil.isNullOrEmpty(identifier.getLocator())) {222 LOG.warn("Saving Image 2 on Control : {}", identifier.getLocator());223 controlExecution.addFileList(recorderService.recordPicture(controlExecution.getTestCaseStepActionExecution(), controlExecution.getControlId(), identifier.getLocator(), "2"));224 }225 try {...

Full Screen

Full Screen

Source:ConditionService.java Github

copy

Full Screen

...24import org.cerberus.engine.entity.Identifier;25import org.cerberus.engine.entity.MessageEvent;26import org.cerberus.engine.execution.IConditionService;27import org.cerberus.engine.execution.IIdentifierService;28import org.cerberus.engine.execution.IRobotServerService;29import org.cerberus.engine.execution.enums.ConditionOperatorEnum;30import org.cerberus.engine.gwt.IControlService;31import org.cerberus.enums.MessageEventEnum;32import org.cerberus.service.json.IJsonService;33import org.cerberus.service.sikuli.ISikuliService;34import org.cerberus.service.webdriver.IWebDriverService;35import org.cerberus.service.xmlunit.IXmlUnitService;36import org.cerberus.util.ParameterParserUtil;37import org.cerberus.util.StringUtil;38import org.cerberus.util.answer.AnswerItem;39import org.json.JSONArray;40import org.openqa.selenium.WebDriverException;41import org.springframework.beans.factory.annotation.Autowired;42import org.springframework.stereotype.Service;43import java.util.HashMap;44import java.util.Objects;45/**46 * @author vertigo1747 */48@Service49public class ConditionService implements IConditionService {50 @Autowired51 private IXmlUnitService xmlUnitService;52 @Autowired53 private IJsonService jsonService;54 @Autowired55 private IIdentifierService identifierService;56 @Autowired57 private ISikuliService sikuliService;58 @Autowired59 private IWebDriverService webdriverService;60 @Autowired61 private IControlService controlService;62 @Autowired63 private IRobotServerService robotServerService;64 // The associated {@link org.apache.logging.log4j.Logger} to this class65 private static final Logger LOG = LogManager.getLogger(ConditionService.class);66 @Override67 public AnswerItem<Boolean> evaluateCondition(String conditionOperator, String conditionValue1, String conditionValue2, String conditionValue3, TestCaseExecution execution, JSONArray options) {68 LOG.debug("Starting Evaluation condition : {}", conditionOperator);69 ConditionOperatorEnum conditionToEvaluate = ConditionOperatorEnum.getConditionOperatorEnumFromString(conditionOperator);70 AnswerItem<Boolean> ans = new AnswerItem<>();71 MessageEvent mes;72 boolean isOperationToBeExecuted = true;73 // Define Options74 HashMap<String, String> optionsMap = robotServerService.getMapFromOptions(options);75 if (optionsMap.containsKey(RobotServerService.OPTIONS_TIMEOUT_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX).isEmpty()) {76 Integer newTimeout = Integer.valueOf(optionsMap.get(RobotServerService.OPTIONS_TIMEOUT_SYNTAX));77 robotServerService.setOptionsTimeout(execution.getSession(), newTimeout);78 }79 if (optionsMap.containsKey(RobotServerService.OPTIONS_HIGHLIGHTELEMENT_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_HIGHLIGHTELEMENT_SYNTAX).isEmpty()) {80 Integer newHighlightElement = Integer.valueOf(optionsMap.get(RobotServerService.OPTIONS_HIGHLIGHTELEMENT_SYNTAX));81 robotServerService.setOptionsHighlightElement(execution.getSession(), newHighlightElement);82 }83 if (optionsMap.containsKey(RobotServerService.OPTIONS_MINSIMILARITY_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_MINSIMILARITY_SYNTAX).isEmpty()) {84 String minSimilarity = optionsMap.get(RobotServerService.OPTIONS_MINSIMILARITY_SYNTAX);85 robotServerService.setOptionsMinSimilarity(execution.getSession(), minSimilarity);86 }87 if (optionsMap.containsKey(RobotServerService.OPTIONS_TYPEDELAY_SYNTAX) && !optionsMap.get(RobotServerService.OPTIONS_TYPEDELAY_SYNTAX).isEmpty()) {88 String typeDelay = optionsMap.get(RobotServerService.OPTIONS_TYPEDELAY_SYNTAX);89 robotServerService.setOptionsTypeDelay(execution.getSession(), typeDelay);90 }91 /*92 * CONDITION Management is treated here. Checking if the93 * action/control/step/execution can be execued here depending on the94 * condition operator and value.95 */96 switch (Objects.requireNonNull(conditionToEvaluate)) {97 case CONDITIONOPERATOR_ALWAYS:98 case CONDITIONOPERATOR_UNDEFINED: // In case condition is not defined, it is considered as always.99 mes = new MessageEvent(MessageEventEnum.CONDITIONEVAL_TRUE_ALWAYS);100 break;101 case CONDITIONOPERATOR_IFELEMENTPRESENT:102 ans = evaluateCondition_ifElementPresent(conditionToEvaluate.getCondition(), conditionValue1, execution);...

Full Screen

Full Screen

RobotServerService

Using AI Code Generation

copy

Full Screen

1package org.cerberus.engine.execution.impl;2import java.net.MalformedURLException;3import java.net.URL;4import java.util.List;5import org.cerberus.engine.entity.MessageEvent;6import org.cerberus.engine.entity.MessageGeneral;7import org.cerberus.engine.entity.SeleniumServer;8import org.cerberus.engine.entity.Session;9import org.cerberus.engine.entity.TestCaseExecution;10import org.cerberus.engine.execution.IRobotServerService;11import org.cerberus.engine.execution.IRobotService;12import org.cerberus.engine.execution.IRobotServiceFactory;13import org.cerberus.engine.execution.impl.RobotServiceFactory;14import org.cerberus.engine.execution.impl.RobotServerService;15import org.cerberus.engine.execution.impl.RobotService;16import org.cerberus.engine.execution.impl.RobotServiceFactory;17import org.cerberus.engine.execution.impl.RobotServerService;18import org.cerberus.engine.execution.impl.RobotService;19import org.cerberus.engine.execution.impl.RobotServiceFactory;20import org.cerberus.engine.execution.impl.RobotServerService;21import org.cerberus.engine.execution.impl.RobotService;22import org.cerberus.engine.execution.impl.RobotServiceFactory;23import org.cerberus.engine.execution.impl.RobotServerService;24import org.cerberus.engine.execution.impl.RobotService;25import org.cerberus.engine.execution.impl.RobotServiceFactory;26import org.cerberus.engine.execution.impl.RobotServerService;27import org.cerberus.engine.execution.impl.RobotService;28import org.cerberus.engine.execution.impl.RobotServiceFactory;29import org.cerberus.engine.execution.impl.RobotServerService;30import org.cerberus.engine.execution.impl.RobotService;31import org.cerberus.engine.execution.impl.RobotServiceFactory;32import org.cerberus.engine.execution.impl.RobotServerService;33import org.cerberus.engine.execution.impl.RobotService;34import org.cerberus.engine.execution.impl.RobotServiceFactory;35import org.cerberus.engine.execution.impl.RobotServerService;36import org.cerberus.engine.execution.impl.RobotService;37import org.cerberus.engine.execution.impl.RobotServiceFactory;38import org.cerberus.engine.execution.impl.RobotServerService;39import org.cerberus.engine.execution.impl.RobotService;40import org.cerberus.engine.execution.impl.R

Full Screen

Full Screen

RobotServerService

Using AI Code Generation

copy

Full Screen

1import java.net.URL;2import java.util.ArrayList;3import java.util.HashMap;4import java.util.List;5import java.util.Map;6import org.cerberus.engine.entity.ExecutionUUID;7import org.cerberus.engine.entity.MessageEvent;8import org.cerberus.engine.execution.impl.RobotServerService;9import org.cerberus.exception.CerberusException;10import org.cerberus.util.answer.AnswerItem;11public class RobotServerServiceTest {12 public static void main(String[] args) throws CerberusException {13 RobotServerService robotServerService = new RobotServerService();14 String robot = "Robot1";15 String robotExecutor = "RobotExecutor1";16 String robotHost = "localhost";17 String robotPort = "4444";18 String robotPlatform = "Firefox";19 String robotBrowser = "firefox";20 String robotBrowserVersion = "45";21 String robotBrowserSize = "1024x768";22 String robotPlatformVersion = "";23 String robotPlatformHost = "";24 String robotPlatformPort = "";25 String robotTimeout = "30000";26 String robotPageSource = "";27 String robotSeleniumLog = "";28 String robotOutputVideo = "";29 String robotOutputVideoURL = "";30 String robotOutputFolder = "";31 String robotScreenshot = "";32 String robotScreenshotURL = "";33 String robotOutputAppiumLogs = "";34 String robotOutputAppiumLogsURL = "";35 String robotActive = "Y";36 String robotDescription = "Robot1 Description";37 String robotVersion = "1.0";38 String robotPicture = "";39 String robotRobot = "";40 String robotRobotExecutor = "";41 String robotRobotHost = "";42 String robotRobotPort = "";43 String robotRobotPlatform = "";44 String robotRobotBrowser = "";45 String robotRobotBrowserVersion = "";46 String robotRobotBrowserSize = "";47 String robotRobotPlatformVersion = "";48 String robotRobotPlatformHost = "";49 String robotRobotPlatformPort = "";50 String robotRobotTimeout = "";51 String robotRobotPageSource = "";52 String robotRobotSeleniumLog = "";53 String robotRobotOutputVideo = "";54 String robotRobotOutputVideoURL = "";55 String robotRobotOutputFolder = "";56 String robotRobotScreenshot = "";57 String robotRobotScreenshotURL = "";58 String robotRobotOutputAppiumLogs = "";59 String robotRobotOutputAppiumLogsURL = "";

Full Screen

Full Screen

RobotServerService

Using AI Code Generation

copy

Full Screen

1package org.cerberus.engine.execution.impl;2import java.io.File;3import java.io.IOException;4import java.util.HashMap;5import java.util.Map;6import org.apache.log4j.Logger;7import org.cerberus.engine.execution.IRobotServerService;8import org.cerberus.engine.execution.IRobotService;9import org.cerberus.engine.execution.IRobotServerService;10import org.cerberus.engine.execution.impl.RobotServerService;11import org.cerberus.engine.execution.impl.RobotService;12import org.cerberus.engine.execution.impl.RobotServerService;13import org.cerberus.exception.CerberusException;14import

Full Screen

Full Screen

RobotServerService

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.execution.impl.RobotServerService;2import org.cerberus.engine.execution.impl.RobotServerServiceFactory;3import org.cerberus.engine.execution.impl.RobotServerServiceFactory.RobotServerServiceType;4public class RobotServer {5 public static void main(String[] args) {6 RobotServerServiceFactory robotServerServiceFactory = new RobotServerServiceFactory();7 RobotServerService robotServerService = robotServerServiceFactory.getRobotServerService(RobotServerServiceType.REMOTE);8 robotServerService.startRobotServer();9 }10}11import org.cerberus.engine.execution.impl.RobotServerService;12import org.cerberus.engine.execution.impl.RobotServerServiceFactory;13import org.cerberus.engine.execution.impl.RobotServerServiceFactory.RobotServerServiceType;14public class RobotServer {15 public static void main(String[] args) {16 RobotServerServiceFactory robotServerServiceFactory = new RobotServerServiceFactory();17 RobotServerService robotServerService = robotServerServiceFactory.getRobotServerService(RobotServerServiceType.REMOTE);18 robotServerService.stopRobotServer();19 }20}

Full Screen

Full Screen

RobotServerService

Using AI Code Generation

copy

Full Screen

1import java.util.HashMap;2import java.util.Map;3import org.cerberus.engine.entity.MessageEvent;4import org.cerberus.engine.execution.impl.RobotServerService;5public class 3 {6 public static void main(String[] args) {7 Map<String, String> test = new HashMap<String, String>();8 test.put("test", "testname");9 test.put("testcase", "testcasename");10 test.put("environment", "envname");11 test.put("country", "countryname");12 test.put("browser", "browsername");13 test.put("version", "versionname");14 test.put("platform", "platformname");15 test.put("manualURL", "manualURLname");16 test.put("manualHost", "manualHostname");17 test.put("manualContextRoot", "manualContextRootname");18 test.put("manualLoginRelativeURL", "manualLoginRelativeURLname");19 test.put("manualEnvData", "manualEnvDataname");20 RobotServerService r = new RobotServerService();21 MessageEvent me = r.executeTestCase(test);22 System.out.println(me.getDescription());23 }24}25import java.util.HashMap;26import java.util.Map;27import org.cerberus.engine.entity.MessageEvent;28import org.cerberus.engine.execution.impl.RobotServerService;29public class 4 {30 public static void main(String[] args) {31 Map<String, String> test = new HashMap<String, String>();32 test.put("test", "testname");33 test.put("testcase", "testcasename");34 test.put("environment", "envname");35 test.put("country", "countryname");36 test.put("browser", "browsername");37 test.put("version", "versionname");38 test.put("platform", "platformname");39 test.put("tag", "tagname");40 test.put("manualURL", "manualURLname");41 test.put("manualHost", "manualHostname");42 test.put("manualContextRoot", "manualContextRootname");43 test.put("manualLoginRelativeURL", "manualLoginRelativeURLname");44 test.put("manualEnvData", "manualEnvDataname");

Full Screen

Full Screen

RobotServerService

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.execution.impl.RobotServerService;2import org.cerberus.engine.execution.impl.RobotServer;3import org.cerberus.engine.execution.impl.RobotServerService;4import org.cerberus.engine.execution.impl.RobotServer;5public class RobotServerTest {6public static void main(String args[]) {7RobotServerService robotServerService = new RobotServerService();8RobotServer robotServer = robotServerService.getRobotServerPort();9System.out.println(robotServer.hello("hello"));10}11}12import org.cerberus.engine.execution.impl.RobotServerService;13import org.cerberus.engine.execution.impl.RobotServer;14import org.cerberus.engine.execution.impl.RobotServerService;15import org.cerberus.engine.execution.impl.RobotServer;16public class RobotServerTest {17public static void main(String args[]) {18RobotServerService robotServerService = new RobotServerService();19RobotServer robotServer = robotServerService.getRobotServerPort();20System.out.println(robotServer.hello("hello"));21}22}23import org.cerberus.engine.execution.impl.RobotServerService;24import org.cerberus.engine.execution.impl.RobotServer;25import org.cerberus.engine.execution.impl.RobotServerService;26import org.cerberus.engine.execution.impl.RobotServer;27public class RobotServerTest {28public static void main(String args[]) {29RobotServerService robotServerService = new RobotServerService();30RobotServer robotServer = robotServerService.getRobotServerPort();31System.out.println(robotServer.hello("hello"));32}33}34import org.cerberus.engine.execution.impl.RobotServerService;35import org.cerberus.engine.execution.impl.RobotServer;36import org.cerberus.engine.execution.impl.RobotServerService;37import org.cerberus.engine.execution.impl.RobotServer;38public class RobotServerTest {39public static void main(String args[]) {

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