Best Cerberus-source code snippet using org.cerberus.engine.entity.MessageGeneral.MessageGeneral
Source:ExecutionStartService.java
...25import org.cerberus.crud.entity.CountryEnvParam;26import org.cerberus.crud.entity.CountryEnvironmentParameters;27import org.cerberus.engine.entity.ExecutionUUID;28import org.cerberus.crud.entity.Invariant;29import org.cerberus.engine.entity.MessageGeneral;30import org.cerberus.enums.MessageGeneralEnum;31import org.cerberus.crud.entity.TestCase;32import org.cerberus.crud.entity.TestCaseExecution;33import org.cerberus.exception.CerberusException;34import org.cerberus.crud.service.IApplicationService;35import org.cerberus.crud.service.ICountryEnvParamService;36import org.cerberus.crud.service.IInvariantService;37import org.cerberus.crud.service.ITestCaseExecutionService;38import org.cerberus.crud.service.ITestCaseService;39import org.cerberus.crud.service.ITestService;40import org.cerberus.engine.execution.IExecutionCheckService;41import org.cerberus.engine.execution.IExecutionStartService;42import org.cerberus.engine.execution.ISeleniumServerService;43import org.cerberus.util.StringUtil;44import org.springframework.beans.factory.annotation.Autowired;45import org.springframework.stereotype.Service;46import org.cerberus.crud.service.ICountryEnvironmentParametersService;47import org.cerberus.crud.factory.IFactoryCountryEnvironmentParameters;48import org.cerberus.crud.service.IParameterService;49import org.cerberus.crud.service.ITestCaseExecutionQueueService;50/**51 *52 * @author bcivel53 */54@Service55public class ExecutionStartService implements IExecutionStartService {56 @Autowired57 private IExecutionCheckService executionCheckService;58 @Autowired59 private ITestCaseService testCaseService;60 @Autowired61 private ITestService testService;62 @Autowired63 private ITestCaseExecutionService testCaseExecutionService;64 @Autowired65 private ICountryEnvParamService countryEnvParamService;66 @Autowired67 private ICountryEnvironmentParametersService countryEnvironmentParametersService;68 @Autowired69 private IApplicationService applicationService;70 @Autowired71 private IFactoryCountryEnvironmentParameters factorycountryEnvironmentParameters;72 @Autowired73 private IInvariantService invariantService;74 @Autowired75 ExecutionUUID executionUUIDObject;76 @Autowired77 private ISeleniumServerService serverService;78 @Autowired79 private IParameterService parameterService;80 @Autowired81 private ITestCaseExecutionQueueService inQueueService;82 private static final Logger LOG = LogManager.getLogger(ExecutionStartService.class);83 @Override84 public TestCaseExecution startExecution(TestCaseExecution tCExecution) throws CerberusException {85 /**86 * Start timestamp.87 */88 long executionStart = new Date().getTime();89 LOG.debug("Initializing Start Timestamp : " + executionStart);90 tCExecution.setStart(executionStart);91 /**92 * Checking the parameters.93 */94 LOG.debug("Checking the parameters.");95 Invariant myInvariant;96 try {97 myInvariant = invariantService.convert(invariantService.readByKey("OUTPUTFORMAT", tCExecution.getOutputFormat()));98 } catch (CerberusException ex) {99 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_OUTPUTFORMAT_INVALID);100 mes.setDescription(mes.getDescription().replace("%PARAM%", tCExecution.getOutputFormat()));101 LOG.debug(mes.getDescription());102 throw new CerberusException(mes);103 }104 try {105 myInvariant = invariantService.convert(invariantService.readByKey("VERBOSE", String.valueOf(tCExecution.getVerbose())));106 } catch (CerberusException ex) {107 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_VERBOSE_INVALID);108 mes.setDescription(mes.getDescription().replace("%PARAM%", String.valueOf(tCExecution.getVerbose())));109 LOG.debug(mes.getDescription());110 throw new CerberusException(mes);111 }112 try {113 myInvariant = invariantService.convert(invariantService.readByKey("SCREENSHOT", String.valueOf(tCExecution.getScreenshot())));114 } catch (CerberusException ex) {115 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_SCREENSHOT_INVALID);116 mes.setDescription(mes.getDescription().replace("%PARAM%", String.valueOf(tCExecution.getScreenshot())));117 LOG.debug(mes.getDescription());118 throw new CerberusException(mes);119 }120 LOG.debug("Parameters checked.");121 /**122 * Load TestCase information and set TCase to the TestCaseExecution123 * object.124 */125 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_LOADINGDATA));126 LOG.debug("Loading Test Case Information. " + tCExecution.getTest() + "-" + tCExecution.getTestCase());127 // Integrate this.loadTestCaseService.loadTestCase(tCExecution); inside with Dependency.128 try {129// TestCase tCase = testCaseService.findTestCaseByKey(tCExecution.getTest(), tCExecution.getTestCase());130 TestCase tCase = testCaseService.convert(testCaseService.readByKey(tCExecution.getTest(), tCExecution.getTestCase()));131 if (tCase != null) {132 tCExecution.setTestCaseObj(tCase);133 tCExecution.setDescription(tCase.getDescription());134 tCExecution.setConditionOper(tCase.getConditionOper());135 tCExecution.setConditionVal1(tCase.getConditionVal1());136 tCExecution.setConditionVal1Init(tCase.getConditionVal1());137 tCExecution.setConditionVal2(tCase.getConditionVal2());138 tCExecution.setConditionVal2Init(tCase.getConditionVal2());139 tCExecution.setTestCaseVersion(tCase.getTestCaseVersion());140 } else {141 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.NO_DATA_FOUND));142 }143 /**144 * Copy the status of the testcase to the status column of the145 * Execution. This is done to know how stable was the testcase at146 * the time of the execution.147 */148 tCExecution.setStatus(tCase.getStatus());149 } catch (CerberusException ex) {150 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_TESTCASE_NOT_FOUND);151 mes.setDescription(mes.getDescription().replace("%TEST%", tCExecution.getTest()));152 mes.setDescription(mes.getDescription().replace("%TESTCASE%", tCExecution.getTestCase()));153 LOG.debug(mes.getDescription());154 throw new CerberusException(mes);155 }156 LOG.debug("Test Case Information Loaded - " + tCExecution.getTest() + "-" + tCExecution.getTestCase());157 /**158 * Load Test information and Set TestObject to the TestCaseExecution159 * object.160 */161 LOG.debug("Loading Test Information");162 try {163 tCExecution.setTestObj(this.testService.convert(this.testService.readByKey(tCExecution.getTest())));164 } catch (CerberusException ex) {165 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_TEST_NOT_FOUND);166 mes.setDescription(mes.getDescription().replace("%TEST%", tCExecution.getTest()));167 LOG.debug(mes.getDescription());168 throw new CerberusException(mes);169 }170 LOG.debug("Test Information Loaded - " + tCExecution.getTest());171 /**172 * Load Application information and Set Application to the173 * TestCaseExecution object.174 */175 LOG.debug("Loading Application Information");176 try {177 tCExecution.setApplication(tCExecution.getTestCaseObj().getApplication());178 tCExecution.setApplicationObj(applicationService.convert(this.applicationService.readByKey(tCExecution.getTestCaseObj().getApplication())));179 } catch (CerberusException ex) {180 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_APPLICATION_NOT_FOUND);181 mes.setDescription(mes.getDescription().replace("%APPLI%", tCExecution.getTestCaseObj().getApplication()));182 LOG.debug(mes.getDescription());183 throw new CerberusException(mes);184 }185 LOG.debug("Application Information Loaded - " + tCExecution.getApplicationObj().getApplication() + " - " + tCExecution.getApplicationObj().getDescription());186 /**187 * Init System from Application.188 */189 tCExecution.setSystem(tCExecution.getApplicationObj().getSystem());190 /**191 * Load Country information and Set it to the TestCaseExecution object.192 */193 LOG.debug("Loading Country Information");194 try {195 tCExecution.setCountryObj(invariantService.convert(invariantService.readByKey("COUNTRY", tCExecution.getCountry())));196 } catch (CerberusException ex) {197 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COUNTRY_NOT_FOUND);198 mes.setDescription(mes.getDescription().replace("%COUNTRY%", tCExecution.getCountry()));199 LOG.debug(mes.getDescription());200 throw new CerberusException(mes);201 }202 LOG.debug("Country Information Loaded - " + tCExecution.getCountryObj().getValue() + " - " + tCExecution.getCountryObj().getDescription());203 /**204 * Checking if execution is manual or automaticaly configured. If205 * Manual, CountryEnvironmentParameters object is manually created with206 * the servlet parameters. If automatic, parameters are build from the207 * CountryEnvironmentParameters. table in the database. Environmentdata208 * will always be filled with the environment. Environment will be209 * forced to MANUAL if execution is manual.210 *211 */212 LOG.debug("Checking if connectivity parameters are manual or automatic from the database. '" + tCExecution.isManualURL() + "'");213 if (tCExecution.isManualURL()) {214 LOG.debug("Execution will be done with manual application connectivity setting.");215 if (StringUtil.isNullOrEmpty(tCExecution.getMyHost())) {216 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_MANUALURL_INVALID);217 LOG.debug(mes.getDescription());218 throw new CerberusException(mes);219 } else {220 CountryEnvironmentParameters cea;221 cea = this.factorycountryEnvironmentParameters.create(tCExecution.getApplicationObj().getSystem(), tCExecution.getCountry(), tCExecution.getEnvironment(), tCExecution.getApplicationObj().getApplication(), tCExecution.getMyHost(), "", tCExecution.getMyContextRoot(), tCExecution.getMyLoginRelativeURL(), "", "", "", "", CountryEnvironmentParameters.DEFAULT_POOLSIZE);222 cea.setIp(tCExecution.getMyHost());223 cea.setUrl(tCExecution.getMyContextRoot());224 tCExecution.setUrl(StringUtil.getURLFromString(cea.getIp(), cea.getUrl(), "", ""));225 cea.setUrlLogin(tCExecution.getMyLoginRelativeURL());226 tCExecution.setCountryEnvironmentParameters(cea);227 LOG.debug(" -> Execution will be done with manual application connectivity setting. IP/URL/LOGIN : " + cea.getIp() + "-" + cea.getUrl() + "-" + cea.getUrlLogin());228 }229 /**230 * If execution is manual, we force the env at 'MANUAL-ENVDATA'231 * string. We keep envData information in order to trace the env232 * data that has been used.233 */234 tCExecution.setEnvironment("MANUAL-" + tCExecution.getEnvironmentData());235 } else {236 /**237 * Automatic application configuration execution.238 */239 LOG.debug("Execution will be done with automatic application connectivity setting.");240 /**241 * Load Country/Environment/Application information and set them to242 * the TestCaseExecution object243 */244 LOG.debug("Loading Country/Environment/Application Information. " + tCExecution.getCountry() + "-" + tCExecution.getEnvironment() + "-" + tCExecution.getApplicationObj().getApplication());245 CountryEnvironmentParameters cea;246 try {247 cea = this.countryEnvironmentParametersService.convert(this.countryEnvironmentParametersService.readByKey(248 tCExecution.getApplicationObj().getSystem(), tCExecution.getCountry(), tCExecution.getEnvironment(), tCExecution.getApplicationObj().getApplication()));249 if (cea != null) {250 tCExecution.setCountryEnvironmentParameters(cea);251// tCExecution.setUrl(cea.getIp()+ cea.getUrl());252 tCExecution.setUrl(StringUtil.getURLFromString(cea.getIp(), cea.getUrl(), "", ""));253 } else {254 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COUNTRYENVAPP_NOT_FOUND);255 mes.setDescription(mes.getDescription().replace("%COUNTRY%", tCExecution.getCountry()));256 mes.setDescription(mes.getDescription().replace("%ENV%", tCExecution.getEnvironment()));257 mes.setDescription(mes.getDescription().replace("%APPLI%", tCExecution.getTestCaseObj().getApplication()));258 LOG.error(mes.getDescription());259 throw new CerberusException(mes);260 }261 /**262 * Forcing the IP URL and Login config from DevIP, DevURL and263 * DevLogin parameter only if DevURL is defined.264 */265 } catch (CerberusException ex) {266 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COUNTRYENVAPP_NOT_FOUND);267 mes.setDescription(mes.getDescription().replace("%COUNTRY%", tCExecution.getCountry()));268 mes.setDescription(mes.getDescription().replace("%ENV%", tCExecution.getEnvironment()));269 mes.setDescription(mes.getDescription().replace("%APPLI%", tCExecution.getTestCaseObj().getApplication()));270 LOG.error(mes.getDescription());271 throw new CerberusException(mes);272 }273 LOG.debug("Country/Environment/Application Information Loaded. " + tCExecution.getCountry() + " - " + tCExecution.getEnvironment() + " - " + tCExecution.getApplicationObj().getApplication());274 LOG.debug(" -> Execution will be done with automatic application connectivity setting. IP/URL/LOGIN : " + cea.getIp() + "-" + cea.getUrl() + "-" + cea.getUrlLogin());275 tCExecution.setEnvironmentData(tCExecution.getEnvironment());276 }277 /**278 * Load Environment object from invariant table.279 */280 LOG.debug("Loading Environment Information. " + tCExecution.getEnvironmentData());281 try {282 tCExecution.setEnvironmentDataObj(invariantService.convert(invariantService.readByKey("ENVIRONMENT", tCExecution.getEnvironmentData())));283 } catch (CerberusException ex) {284 if (tCExecution.isManualURL()) {285 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_ENVIRONMENT_DOESNOTEXIST_MAN);286 mes.setDescription(mes.getDescription().replace("%ENV%", tCExecution.getEnvironmentData()));287 LOG.debug(mes.getDescription());288 throw new CerberusException(mes);289 } else {290 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_ENVIRONMENT_DOESNOTEXIST);291 mes.setDescription(mes.getDescription().replace("%ENV%", tCExecution.getEnvironmentData()));292 LOG.debug(mes.getDescription());293 throw new CerberusException(mes);294 }295 }296 LOG.debug("Environment Information Loaded");297 /**298 * Load Country/Environment information and set them to the299 * TestCaseExecution object. Environment considered here is the data300 * environment.301 */302 LOG.debug("Loading Country/Environment Information. " + tCExecution.getCountry() + " - " + tCExecution.getEnvironmentData());303 CountryEnvParam countEnvParam;304 try {305 countEnvParam = this.countryEnvParamService.convert(this.countryEnvParamService.readByKey(tCExecution.getApplicationObj().getSystem(), tCExecution.getCountry(), tCExecution.getEnvironmentData()));306 tCExecution.setCountryEnvParam(countEnvParam);307 /**308 * Copy the Build/Revision of the environment to the Execution. This309 * is done to keep track of all execution done on a specific version310 * of system311 */312 tCExecution.setBuild(countEnvParam.getBuild());313 tCExecution.setRevision(countEnvParam.getRevision());314 } catch (CerberusException ex) {315 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COUNTRYENV_NOT_FOUND);316 mes.setDescription(mes.getDescription().replace("%SYSTEM%", tCExecution.getApplicationObj().getSystem()));317 mes.setDescription(mes.getDescription().replace("%COUNTRY%", tCExecution.getCountry()));318 mes.setDescription(mes.getDescription().replace("%ENV%", tCExecution.getEnvironmentData()));319 LOG.debug(mes.getDescription());320 throw new CerberusException(mes);321 }322 LOG.debug("Country/Environment Information Loaded. " + tCExecution.getCountry() + " - " + tCExecution.getEnvironmentData());323 /**324 * If Timeout is defined at the execution level, set action wait default325 * to this value, else Get the cerberus_action_wait_default parameter.326 * This parameter will be used by tha wait action if no timeout/event is327 * defined.328 */329 try {330 if (!tCExecution.getTimeout().isEmpty()) {331 tCExecution.setCerberus_action_wait_default(Integer.valueOf(tCExecution.getTimeout()));332 } else {333 tCExecution.setCerberus_action_wait_default(parameterService.getParameterIntegerByKey("cerberus_action_wait_default", tCExecution.getApplicationObj().getSystem(), 90000));334 }335 } catch (NumberFormatException ex) {336 LOG.warn("Parameter cerberus_action_wait_default must be an integer, default value set to 90000 milliseconds. " + ex.toString());337 tCExecution.setCerberus_action_wait_default(90000);338 }339 /**340 * Check if test can be executed TODO : Replace Message with try/catch341 * cerberus exception342 */343 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_VALIDATIONSTARTING));344 LOG.debug("Performing the Checks before starting the execution");345 MessageGeneral canExecuteTestCase = this.executionCheckService.checkTestCaseExecution(tCExecution);346 tCExecution.setResultMessage(canExecuteTestCase);347 /**348 * We stop if the result is not OK349 */350 if (!(tCExecution.getResultMessage().equals(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_CHECKINGPARAMETERS)))) {351 return tCExecution;352 }353 LOG.debug("Checks performed -- > OK to continue.");354 /**355 * For GUI application, check if Browser is supported.356 */357 if (!tCExecution.getManualExecution().equals("Y") && tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {358 try {359 myInvariant = invariantService.convert(invariantService.readByKey("BROWSER", tCExecution.getBrowser()));360 } catch (CerberusException ex) {361 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_BROWSER_NOT_SUPPORTED);362 mes.setDescription(mes.getDescription().replace("%BROWSER%", tCExecution.getBrowser()));363 LOG.debug(mes.getDescription());364 throw new CerberusException(mes);365 }366 }367 /**368 * Start server if execution is not manual369 */370 if (!tCExecution.getManualExecution().equals("Y")) {371 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_STARTINGROBOTSERVER));372 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)373 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)374 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)375 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {376 if (tCExecution.getIp().equalsIgnoreCase("")) {377 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_SELENIUM_EMPTYORBADIP);378 mes.setDescription(mes.getDescription().replace("%IP%", tCExecution.getIp()));379 LOG.debug(mes.getDescription());380 throw new CerberusException(mes);381 }382 /**383 * Start Selenium server384 */385 LOG.debug("Starting Server.");386 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_CREATINGRUNID));387 try {388 this.serverService.startServer(tCExecution);389 } catch (CerberusException ex) {390 LOG.debug(ex.getMessageError().getDescription());391 throw new CerberusException(ex.getMessageError());392 }393 LOG.debug("Server Started.");394 }395 }396 /**397 * Register RunID inside database.398 */399 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_CREATINGRUNID));400 LOG.debug("Registering Execution ID on database");401 long runID = 0;402 try {403 runID = this.testCaseExecutionService.registerRunID(tCExecution);404 if (runID != 0) {405 tCExecution.setId(runID);406 executionUUIDObject.setExecutionUUID(tCExecution.getExecutionUUID(), tCExecution);407 // Update Queue Execution here if QueueID =! 0.408 if (tCExecution.getQueueID() != 0) {409 inQueueService.updateToExecuting(tCExecution.getQueueID(), "", runID);410 }411 } else {412 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COULDNOTCREATE_RUNID);413 tCExecution.setResultMessage(mes);414 LOG.fatal("Could not create RunID, or cannot retreive the generated Key");415 throw new CerberusException(mes);416 }417 } catch (CerberusException ex) {418 tCExecution.setResultMessage(new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COULDNOTCREATE_RUNID));419 LOG.warn(ex.getMessageError().getDescription());420 throw new CerberusException(ex.getMessageError());421 }422 LOG.debug("Execution ID registered on database : " + tCExecution.getId());423 /**424 * Stop the browser if executionID is equal to zero (to prevent database425 * instabilities)426 */427 if (!tCExecution.getManualExecution().equals("Y")) {428 try {429 if (tCExecution.getId() == 0) {430 LOG.debug("Starting to Stop the Selenium Server.");431 this.serverService.stopServer(tCExecution.getSession());432 LOG.debug("Selenium Server stopped.");...
Source:ExecutionCheckService.java
...17 * You should have received a copy of the GNU General Public License18 * along with Cerberus. If not, see <http://www.gnu.org/licenses/>.19 */20package org.cerberus.engine.execution.impl;21import org.cerberus.enums.MessageGeneralEnum;22import java.text.ParseException;23import java.text.SimpleDateFormat;24import java.util.Date;25import org.apache.logging.log4j.Logger;26import org.apache.logging.log4j.LogManager;27import org.cerberus.crud.entity.BuildRevisionInvariant;28import org.cerberus.crud.entity.CountryEnvParam;29import org.cerberus.engine.entity.MessageGeneral;30import org.cerberus.crud.entity.TestCase;31import org.cerberus.crud.entity.Test;32import org.cerberus.crud.entity.TestCaseExecution;33import org.cerberus.exception.CerberusException;34import org.cerberus.crud.service.IBuildRevisionInvariantService;35import org.cerberus.crud.service.ITestCaseCountryService;36import org.cerberus.engine.execution.IExecutionCheckService;37import org.cerberus.util.ParameterParserUtil;38import org.springframework.beans.factory.annotation.Autowired;39import org.springframework.stereotype.Service;40/**41 * {Insert class description here}42 *43 * @author Tiago Bernardes44 * @version 1.0, 15/01/201345 * @since 0.9.046 */47@Service48public class ExecutionCheckService implements IExecutionCheckService {49 /**50 * The associated {@link org.apache.logging.log4j.Logger} to this class51 */52 private static final Logger LOG = LogManager.getLogger(ExecutionCheckService.class);53 @Autowired54 private ITestCaseCountryService testCaseCountryService;55 @Autowired56 private IBuildRevisionInvariantService buildRevisionInvariantService;57 private MessageGeneral message;58 @Override59 public MessageGeneral checkTestCaseExecution(TestCaseExecution tCExecution) {60 if (tCExecution.isManualURL()) {61 /**62 * Manual application connectivity parameter63 */64 if (this.checkTestCaseActive(tCExecution.getTestCaseObj())65 && this.checkTestActive(tCExecution.getTestObj())66 && this.checkTestCaseNotManual(tCExecution)67 && this.checkCountry(tCExecution)68 && this.checkMaintenanceTime(tCExecution)) {69 LOG.debug("Execution is checked and can proceed.");70 return new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_CHECKINGPARAMETERS);71 }72 } else /**73 * Automatic application connectivity parameter (from database)74 */75 if (this.checkEnvironmentActive(tCExecution.getCountryEnvParam())76 && this.checkRangeBuildRevision(tCExecution)77 && this.checkTargetBuildRevision(tCExecution)78 && this.checkActiveEnvironmentGroup(tCExecution)79 && this.checkTestCaseActive(tCExecution.getTestCaseObj())80 && this.checkTestActive(tCExecution.getTestObj())81 && this.checkCountry(tCExecution)82 && this.checkMaintenanceTime(tCExecution)) {83 LOG.debug("Execution is checked and can proceed.");84 return new MessageGeneral(MessageGeneralEnum.EXECUTION_PE_CHECKINGPARAMETERS);85 }86 return message;87 }88 private boolean checkEnvironmentActive(CountryEnvParam cep) {89 if (LOG.isDebugEnabled()) {90 LOG.debug("Checking if environment is active");91 }92 if (cep != null && cep.isActive()) {93 return true;94 }95 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_ENVIRONMENT_NOTACTIVE);96 return false;97 }98 private boolean checkTestCaseActive(TestCase testCase) {99 if (LOG.isDebugEnabled()) {100 LOG.debug("Checking if testcase is active");101 }102 if (testCase.getTcActive().equals("Y")) {103 return true;104 }105 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_TESTCASE_NOTACTIVE);106 return false;107 }108 private boolean checkTestActive(Test test) {109 if (LOG.isDebugEnabled()) {110 LOG.debug("Checking if test is active");111 }112 if (test.getActive().equals("Y")) {113 return true;114 }115 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_TEST_NOTACTIVE);116 message.setDescription(message.getDescription().replace("%TEST%", test.getTest()));117 return false;118 }119 private boolean checkTestCaseNotManual(TestCaseExecution tCExecution) {120 if (LOG.isDebugEnabled()) {121 LOG.debug("Checking if testcase is not MANUAL");122 }123 if (!tCExecution.getManualExecution().equals("Y") && tCExecution.getTestCaseObj().getGroup().equals("MANUAL")) {124 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_TESTCASE_ISMANUAL);125 return false;126 }127 return true;128 }129 private boolean checkRangeBuildRevision(TestCaseExecution tCExecution) {130 if (LOG.isDebugEnabled()) {131 LOG.debug("Checking if test can be executed in this build and revision");132 }133 TestCase tc = tCExecution.getTestCaseObj();134 CountryEnvParam env = tCExecution.getCountryEnvParam();135 String tcFromSprint = ParameterParserUtil.parseStringParam(tc.getFromBuild(), "");136 String tcToSprint = ParameterParserUtil.parseStringParam(tc.getToBuild(), "");137 String tcFromRevision = ParameterParserUtil.parseStringParam(tc.getFromRev(), "");138 String tcToRevision = ParameterParserUtil.parseStringParam(tc.getToRev(), "");139 String sprint = ParameterParserUtil.parseStringParam(env.getBuild(), "");140 String revision = ParameterParserUtil.parseStringParam(env.getRevision(), "");141 int dif = -1;142 if (!tcFromSprint.isEmpty() && sprint != null) {143 try {144 if (sprint.isEmpty()) {145 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_NOTDEFINED);146 return false;147 } else {148 dif = this.compareBuild(sprint, tcFromSprint, env.getSystem());149 }150 if (dif == 0) {151 if (!tcFromRevision.isEmpty() && revision != null) {152 if (revision.isEmpty()) {153 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_NOTDEFINED);154 return false;155 } else if (this.compareRevision(revision, tcFromRevision, env.getSystem()) < 0) {156 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_DIFFERENT);157 return false;158 }159 }160 } else if (dif < 0) {161 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_DIFFERENT);162 return false;163 }164 } catch (NumberFormatException exception) {165 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_WRONGFORMAT);166 return false;167 } catch (CerberusException ex) {168 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_BADLYDEFINED);169 return false;170 }171 }172 if (!tcToSprint.isEmpty() && sprint != null) {173 try {174 if (sprint.isEmpty()) {175 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_NOTDEFINED);176 return false;177 } else {178 dif = this.compareBuild(tcToSprint, sprint, env.getSystem());179 }180 if (dif == 0) {181 if (!tcToRevision.isEmpty() && revision != null) {182 if (revision.isEmpty()) {183 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_NOTDEFINED);184 return false;185 } else if (this.compareRevision(tcToRevision, revision, env.getSystem()) < 0) {186 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_DIFFERENT);187 return false;188 }189 }190 } else if (dif < 0) {191 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_DIFFERENT);192 return false;193 }194 } catch (NumberFormatException exception) {195 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_WRONGFORMAT);196 return false;197 } catch (CerberusException ex) {198 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_BADLYDEFINED);199 return false;200 }201 }202 return true;203 }204 private boolean checkTargetBuildRevision(TestCaseExecution tCExecution) {205 if (LOG.isDebugEnabled()) {206 LOG.debug("Checking target build");207 }208 TestCase tc = tCExecution.getTestCaseObj();209 CountryEnvParam env = tCExecution.getCountryEnvParam();210 String tcSprint = ParameterParserUtil.parseStringParam(tc.getTargetBuild(), "");211 String tcRevision = ParameterParserUtil.parseStringParam(tc.getTargetRev(), "");212 String sprint = ParameterParserUtil.parseStringParam(env.getBuild(), "");213 String revision = ParameterParserUtil.parseStringParam(env.getRevision(), "");214 int dif = -1;215 if (!tcSprint.isEmpty() && sprint != null) {216 try {217 if (sprint.isEmpty()) {218 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_NOTDEFINED);219 return false;220 } else {221 dif = this.compareBuild(sprint, tcSprint, env.getSystem());222 }223 if (dif == 0) {224 if (!tcRevision.isEmpty() && revision != null) {225 if (revision.isEmpty()) {226 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_NOTDEFINED);227 return false;228 } else if (this.compareRevision(revision, tcRevision, env.getSystem()) < 0) {229 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_TARGET_DIFFERENT);230 return false;231 }232 }233 } else if (dif < 0) {234 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_TARGET_DIFFERENT);235 return false;236 }237 } catch (NumberFormatException exception) {238 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_TARGET_WRONGFORMAT);239 return false;240 } catch (CerberusException ex) {241 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_BADLYDEFINED);242 return false;243 }244 }245 return true;246 }247 private boolean checkActiveEnvironmentGroup(TestCaseExecution tCExecution) {248 if (LOG.isDebugEnabled()) {249 LOG.debug("Checking environment " + tCExecution.getCountryEnvParam().getEnvironment());250 }251 TestCase tc = tCExecution.getTestCaseObj();252 if (tCExecution.getEnvironmentDataObj().getGp1().equalsIgnoreCase("QA")) {253 return this.checkRunQA(tc, tCExecution.getEnvironmentData());254 } else if (tCExecution.getEnvironmentDataObj().getGp1().equalsIgnoreCase("UAT")) {255 return this.checkRunUAT(tc, tCExecution.getEnvironmentData());256 } else if (tCExecution.getEnvironmentDataObj().getGp1().equalsIgnoreCase("PROD")) {257 return this.checkRunPROD(tc, tCExecution.getEnvironmentData());258 } else if (tCExecution.getEnvironmentDataObj().getGp1().equalsIgnoreCase("DEV")) {259 return true;260 }261 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_ENVIRONMENT_NOTDEFINED);262 message.setDescription(message.getDescription().replace("%ENV%", tCExecution.getEnvironmentData()));263 message.setDescription(message.getDescription().replace("%ENVGP%", tCExecution.getEnvironmentDataObj().getGp1()));264 return false;265 }266 private boolean checkRunQA(TestCase tc, String env) {267 if (tc.getActiveQA().equals("Y")) {268 return true;269 }270 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RUNQA_NOTDEFINED);271 message.setDescription(message.getDescription().replace("%ENV%", env));272 return false;273 }274 private boolean checkRunUAT(TestCase tc, String env) {275 if (tc.getActiveUAT().equals("Y")) {276 return true;277 }278 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RUNUAT_NOTDEFINED);279 message.setDescription(message.getDescription().replace("%ENV%", env));280 return false;281 }282 private boolean checkRunPROD(TestCase tc, String env) {283 if (tc.getActivePROD().equals("Y")) {284 return true;285 }286 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RUNPROD_NOTDEFINED);287 message.setDescription(message.getDescription().replace("%ENV%", env));288 return false;289 }290 private boolean checkCountry(TestCaseExecution tCExecution) {291 if (LOG.isDebugEnabled()) {292 LOG.debug("Checking if country is setup for this testcase. " + tCExecution.getTest() + "-" + tCExecution.getTestCase() + "-" + tCExecution.getCountry());293 }294 try {295 testCaseCountryService.findTestCaseCountryByKey(tCExecution.getTest(), tCExecution.getTestCase(), tCExecution.getCountry());296 } catch (CerberusException e) {297 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COUNTRY_NOTDEFINED);298 return false;299 }300 return true;301 }302 private int compareBuild(String build1, String build2, String system) throws CerberusException {303 BuildRevisionInvariant b1;304 BuildRevisionInvariant b2;305 try {306 b1 = buildRevisionInvariantService.convert(buildRevisionInvariantService.readByKey(system, 1, build1));307 b2 = buildRevisionInvariantService.convert(buildRevisionInvariantService.readByKey(system, 1, build2));308 } catch (CerberusException e) {309 throw new NumberFormatException();310 }311 if (null == b1 || null == b2) {312 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_RANGE_ENVIRONMENT_BUILDREVISION_BADLYDEFINED));313 }314 return b1.getSeq().compareTo(b2.getSeq());315 }316 private int compareRevision(String rev1, String rev2, String system) {317 try {318 BuildRevisionInvariant r1 = buildRevisionInvariantService.convert(buildRevisionInvariantService.readByKey(system, 2, rev1));319 BuildRevisionInvariant r2 = buildRevisionInvariantService.convert(buildRevisionInvariantService.readByKey(system, 2, rev2));320 return r1.getSeq().compareTo(r2.getSeq());321 } catch (CerberusException e) {322 throw new NumberFormatException();323 }324 }325 private boolean checkMaintenanceTime(TestCaseExecution tCExecution) {326 if (tCExecution.getCountryEnvParam().isMaintenanceAct()) {327 SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");328 String nowDate = sdf.format(new Date());329 try {330 long now = sdf.parse(nowDate).getTime();331 long startMaintenance = sdf.parse(nowDate).getTime();332 long endMaintenance = sdf.parse(nowDate).getTime();333 if (tCExecution.getCountryEnvParam() != null) {334 if (tCExecution.getCountryEnvParam().getMaintenanceStr() != null) {335 startMaintenance = sdf.parse(tCExecution.getCountryEnvParam().getMaintenanceStr()).getTime();336 }337 if (tCExecution.getCountryEnvParam().getMaintenanceStr() != null) {338 endMaintenance = sdf.parse(tCExecution.getCountryEnvParam().getMaintenanceEnd()).getTime();339 }340 }341 if (!(now >= startMaintenance && now <= endMaintenance)) {342 return true;343 }344 } catch (ParseException exception) {345 LOG.error("Error when parsing maintenance start and/or end."346 + tCExecution.getCountryEnvParam().getSystem() + tCExecution.getCountryEnvParam().getCountry()347 + tCExecution.getCountryEnvParam().getEnvironment() + " " + tCExecution.getCountryEnvParam().getMaintenanceStr() + tCExecution.getCountryEnvParam().getMaintenanceEnd() + exception.toString());348 } catch (Exception exception) {349 LOG.error("Error when parsing maintenance start and/or end."350 + tCExecution.getCountryEnvParam().getSystem() + tCExecution.getCountryEnvParam().getCountry()351 + tCExecution.getCountryEnvParam().getEnvironment() + " " + tCExecution.getCountryEnvParam().getMaintenanceStr() + tCExecution.getCountryEnvParam().getMaintenanceEnd() + exception.toString());352 }353 message = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_ENVIRONMENT_UNDER_MAINTENANCE);354 message.resolveDescription("START", tCExecution.getCountryEnvParam().getMaintenanceStr())355 .resolveDescription("END", tCExecution.getCountryEnvParam().getMaintenanceEnd())356 .resolveDescription("SYSTEM", tCExecution.getCountryEnvParam().getSystem())357 .resolveDescription("COUNTRY", tCExecution.getCountryEnvParam().getCountry())358 .resolveDescription("ENV", tCExecution.getCountryEnvParam().getEnvironment());359 return false;360 }361 return true;362 }363}...
MessageGeneral
Using AI Code Generation
1package org.cerberus.engine.entity;2public class MessageGeneral {3 private String message;4 public MessageGeneral() {5 }6 public MessageGeneral(String message) {7 this.message = message;8 }9 public String getMessage() {10 return message;11 }12 public void setMessage(String message) {13 this.message = message;14 }15}16package org.cerberus.engine.entity;17public class MessageGeneral {18 private String message;19 public MessageGeneral() {20 }21 public MessageGeneral(String message) {22 this.message = message;23 }24 public String getMessage() {25 return message;26 }27 public void setMessage(String message) {28 this.message = message;29 }30}31package org.cerberus.engine.entity;32public class MessageGeneral {33 private String message;34 public MessageGeneral() {35 }36 public MessageGeneral(String message) {37 this.message = message;38 }39 public String getMessage() {40 return message;41 }42 public void setMessage(String message) {43 this.message = message;44 }45}46package org.cerberus.engine.entity;47public class MessageGeneral {48 private String message;49 public MessageGeneral() {50 }51 public MessageGeneral(String message) {52 this.message = message;53 }54 public String getMessage() {55 return message;56 }57 public void setMessage(String message) {58 this.message = message;59 }60}61package org.cerberus.engine.entity;62public class MessageGeneral {63 private String message;64 public MessageGeneral() {65 }66 public MessageGeneral(String message) {67 this.message = message;68 }69 public String getMessage() {70 return message;71 }72 public void setMessage(String message) {73 this.message = message;74 }75}
MessageGeneral
Using AI Code Generation
1package org.cerberus.engine.test;2import org.cerberus.engine.entity.MessageGeneral;3import org.cerberus.engine.entity.MessageGeneral.MessageGeneralType;4public class TestMessageGeneral {5 public static void main(String[] args) {6 MessageGeneral message = new MessageGeneral(MessageGeneralType.SUCCESS);7 message.setDescription("Test");8 System.out.println(message.toString());9 }10}11package org.cerberus.engine.test;12import org.cerberus.engine.entity.MessageGeneral;13import org.cerberus.engine.entity.MessageGeneral.MessageGeneralType;14public class TestMessageGeneral {15 public static void main(String[] args) {16 MessageGeneral message = new MessageGeneral(MessageGeneralType.SUCCESS);17 message.setDescription("Test");18 System.out.println(message.toString());19 }20}21package org.cerberus.engine.test;22import org.cerberus.engine.entity.MessageGeneral;23import org.cerberus.engine.entity.MessageGeneral.MessageGeneralType;24public class TestMessageGeneral {25 public static void main(String[] args) {26 MessageGeneral message = new MessageGeneral(MessageGeneralType.SUCCESS);27 message.setDescription("Test");28 System.out.println(message.toString());29 }30}31package org.cerberus.engine.test;32import org.cerberus.engine.entity.MessageGeneral;33import org.cerberus.engine.entity.MessageGeneral.MessageGeneralType;34public class TestMessageGeneral {35 public static void main(String[] args) {36 MessageGeneral message = new MessageGeneral(MessageGeneralType.SUCCESS);37 message.setDescription("
MessageGeneral
Using AI Code Generation
1package org.cerberus.engine.entity;2import java.util.Locale;3import java.util.ResourceBundle;4public class TestMessageGeneral {5 public static void main(String[] args) {6 String language = "en";7 String country = "US";8 Locale currentLocale;9 ResourceBundle messages;10 currentLocale = new Locale(language, country);11 messages = ResourceBundle.getBundle("org/cerberus/engine/entity/MessageBundle", currentLocale);12 MessageGeneral msg = new MessageGeneral();13 msg.setMessageGeneral(messages.getString("message_general"));14 System.out.println(msg.getMessageGeneral());15 }16}17package org.cerberus.engine.entity;18import java.util.Locale;19import java.util.ResourceBundle;20public class TestMessageGeneral {21 public static void main(String[] args) {22 String language = "en";23 String country = "US";24 Locale currentLocale;25 ResourceBundle messages;26 currentLocale = new Locale(language, country);27 messages = ResourceBundle.getBundle("org/cerberus/engine/entity/MessageBundle", currentLocale);28 MessageGeneral msg = new MessageGeneral();29 msg.setMessageGeneral(messages.getString("message_general"));30 System.out.println(msg.getMessageGeneral());31 }32}33package org.cerberus.engine.entity;34import java.util.Locale;35import java.util.ResourceBundle;36public class TestMessageGeneral {37 public static void main(String[] args) {38 String language = "en";39 String country = "US";40 Locale currentLocale;41 ResourceBundle messages;42 currentLocale = new Locale(language, country);43 messages = ResourceBundle.getBundle("org/cerberus/engine/entity/MessageBundle", currentLocale);44 MessageGeneral msg = new MessageGeneral();45 msg.setMessageGeneral(messages.getString("message_general"));46 System.out.println(msg.getMessageGeneral());47 }48}49package org.cerberus.engine.entity;50import java.util.Locale;51import java.util.ResourceBundle;52public class TestMessageGeneral {53 public static void main(String[] args) {54 String language = "en";55 String country = "US";56 Locale currentLocale;57 ResourceBundle messages;
MessageGeneral
Using AI Code Generation
1package org.cerberus.engine.entity;2import org.cerberus.engine.entity.MessageGeneral;3public class MessageGeneral {4 private String message;5 private String description;6 private String exception;7 private String stackTrace;8 private String pageSource;9 private String screenshotFile;10 private String screenshotBase64;11 public MessageGeneral() {12 }13 public MessageGeneral(String message, String description, String exception, String stackTrace, String pageSource, String screenshotFile, String screenshotBase64) {14 this.message = message;15 this.description = description;16 this.exception = exception;17 this.stackTrace = stackTrace;18 this.pageSource = pageSource;19 this.screenshotFile = screenshotFile;20 this.screenshotBase64 = screenshotBase64;21 }22 public String getMessage() {23 return message;24 }25 public void setMessage(String message) {26 this.message = message;27 }28 public String getDescription() {29 return description;30 }31 public void setDescription(String description) {32 this.description = description;33 }34 public String getException() {35 return exception;36 }37 public void setException(String exception) {38 this.exception = exception;39 }40 public String getStackTrace() {41 return stackTrace;42 }43 public void setStackTrace(String stackTrace) {44 this.stackTrace = stackTrace;45 }46 public String getPageSource() {47 return pageSource;48 }49 public void setPageSource(String pageSource) {50 this.pageSource = pageSource;51 }52 public String getScreenshotFile() {53 return screenshotFile;54 }55 public void setScreenshotFile(String screenshotFile) {56 this.screenshotFile = screenshotFile;57 }58 public String getScreenshotBase64() {59 return screenshotBase64;60 }61 public void setScreenshotBase64(String screenshotBase64) {62 this.screenshotBase64 = screenshotBase64;63 }64}65package org.cerberus.engine.entity;66import org.cerberus.engine.entity.MessageGeneral;67public class MessageGeneral {68 private String message;69 private String description;70 private String exception;71 private String stackTrace;72 private String pageSource;73 private String screenshotFile;74 private String screenshotBase64;75 public MessageGeneral() {76 }77 public MessageGeneral(String message, String description, String exception, String stackTrace, String pageSource, String screenshotFile, String screenshotBase64)
MessageGeneral
Using AI Code Generation
1package org.cerberus.test;2import org.cerberus.engine.entity.MessageGeneral;3public class 3 {4 public static void main(String[] args) {5 MessageGeneral message = new MessageGeneral();6 message.setMessage("Hello World");7 System.out.println(message.getMessage());8 }9}10package org.cerberus.test;11import org.cerberus.engine.entity.MessageGeneral;12public class 4 {13 public static void main(String[] args) {14 MessageGeneral message = new MessageGeneral();15 message.setMessage("Hello World");16 System.out.println(message.getMessage());17 }18}19package org.cerberus.test;20import org.cerberus.engine.entity.MessageGeneral;21public class 5 {22 public static void main(String[] args) {23 MessageGeneral message = new MessageGeneral();24 message.setMessage("Hello World");25 System.out.println(message.getMessage());26 }27}28package org.cerberus.test;29import org.cerberus.engine.entity.MessageGeneral;30public class 6 {31 public static void main(String[] args) {32 MessageGeneral message = new MessageGeneral();33 message.setMessage("Hello World");34 System.out.println(message.getMessage());35 }36}37package org.cerberus.test;38import org.cerberus.engine.entity.MessageGeneral;39public class 7 {40 public static void main(String[] args) {41 MessageGeneral message = new MessageGeneral();42 message.setMessage("Hello World");43 System.out.println(message.getMessage());44 }45}
MessageGeneral
Using AI Code Generation
1import org.cerberus.engine.entity.MessageGeneral;2public class 3 {3 public static void main(String[] args) {4 MessageGeneral message = new MessageGeneral();5 message.setMessage("This is a test message");6 message.show();7 }8}9import org.cerberus.engine.entity.MessageGeneral;10public class 4 {11 public static void main(String[] args) {12 MessageGeneral message = new MessageGeneral();13 message.setMessage("This is a test message");14 message.setMessageType(MessageGeneral.MessageType.ERROR);15 message.show();16 }17}18import org.cerberus.engine.entity.MessageGeneral;19public class 5 {20 public static void main(String[] args) {21 MessageGeneral message = new MessageGeneral();22 message.setMessage("This is a test message");23 message.setMessageType(MessageGeneral.MessageType.ERROR);24 message.setDuration(10000);25 message.show();26 }27}28import org.cerberus.engine.entity.MessageGeneral;29public class 6 {30 public static void main(String[] args) {31 MessageGeneral message = new MessageGeneral();32 message.setMessage("This is a test message");33 message.setMessageType(MessageGeneral.MessageType.ERROR);34 message.setDuration(10000);35 message.setNewLine(false);36 message.show();37 }38}
MessageGeneral
Using AI Code Generation
1import org.cerberus.engine.entity.MessageGeneral;2public class 3 {3 public static void main(String[] args) {4 MessageGeneral messageGeneral = new MessageGeneral();5 messageGeneral.setMessage("Hello World");6 messageGeneral.setSender("Cerberus");7 messageGeneral.setReceiver("Cerberus");8 messageGeneral.setSubject("Cerberus");9 messageGeneral.setPriority(1);10 messageGeneral.setReadStatus(false);11 messageGeneral.setSendDate("2017-04-01");12 messageGeneral.setReadDate("2017-04-01");13 messageGeneral.setSendTime("12:00:00");14 messageGeneral.setReadTime("12:00:00");15 messageGeneral.setSendDateTime("2017-04-01 12:00:00");16 messageGeneral.setReadDateTime("2017-04-01 12:00:00");17 System.out.println("Message: " + messageGeneral.getMessage());18 System.out.println("Sender: " + messageGeneral.getSender());19 System.out.println("Receiver: " + messageGeneral.getReceiver());20 System.out.println("Subject: " + messageGeneral.getSubject());21 System.out.println("Priority: " + messageGeneral.getPriority());22 System.out.println("ReadStatus: " + messageGeneral.getReadStatus());23 System.out.println("SendDate: " + messageGeneral.getSendDate());24 System.out.println("ReadDate: " + messageGeneral.getReadDate());25 System.out.println("SendTime: " + messageGeneral.getSendTime());26 System.out.println("ReadTime: " + messageGeneral.getReadTime());27 System.out.println("SendDateTime: " + messageGeneral.getSendDateTime());28 System.out.println("ReadDateTime: " + messageGeneral.getReadDateTime());29 }30}
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!