How to use processEvent_TESTCASE method of org.cerberus.event.impl.EventService class

Best Cerberus-source code snippet using org.cerberus.event.impl.EventService.processEvent_TESTCASE

Source:EventService.java Github

copy

Full Screen

...160 String originalTestcase = (String) object3;161 if (eval_NoFilter(eventHook.getObjectKey1(), eventHook.getObjectKey2())162 || eval_TestFolder_Filter(eventHook.getObjectKey1(), eventHook.getObjectKey2(), testCase1.getTest())163 || eval_Testcase_Filter(eventHook.getObjectKey1(), eventHook.getObjectKey2(), testCase1.getTest(), testCase1.getTestcase())) {164 processEvent_TESTCASE(eventHook, testCase1, originalTest, originalTestcase, ceberusEventMessage);165 }166 break;167 }168 }169 }170 } catch (CerberusException | JSONException | ParseException ex) {171 LOG.error(ex, ex);172 }173 return new MessageEvent(MessageEventEnum.GENERIC_OK);174 }175 private boolean eval_NoFilter(String obj1, String obj2) {176 if (StringUtil.isNullOrEmpty(obj2) && StringUtil.isNullOrEmpty(obj1)) {177 return true;178 }179 return false;180 }181 private boolean eval_TestFolder_Filter(String obj1, String obj2, String testFolder) {182 if (!StringUtil.isNullOrEmpty(obj2)) {183 return false;184 }185 if (!StringUtil.isNullOrEmpty(obj1) && obj1.equals(testFolder)) {186 return true;187 }188 return false;189 }190 private boolean eval_Testcase_Filter(String obj1, String obj2, String testFolder, String testcase) {191 if (StringUtil.isNullOrEmpty(obj1) || StringUtil.isNullOrEmpty(obj2)) {192 return false;193 }194 if (obj1.equals(testFolder) && obj2.equals(testcase)) {195 return true;196 }197 return false;198 }199 private boolean eval_Campaign_Filter(String obj1, String obj2, String campaign) {200 if (!StringUtil.isNullOrEmpty(obj2)) {201 return false;202 }203 if (!StringUtil.isNullOrEmpty(obj1) && obj1.equals(campaign)) {204 return true;205 }206 return false;207 }208 private void processEvent_CAMPAIGN_START(EventHook eventHook, Tag tag, JSONObject ceberusEventMessage) {209 LOG.debug("EventHook Processing '" + eventHook.getEventReference() + "' with connector '" + eventHook.getHookConnector() + "' to '" + eventHook.getHookRecipient() + "'");210 switch (eventHook.getHookConnector()) {211 case EventHook.HOOKCONNECTOR_EMAIL:212 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {213 LOG.debug("Generating and Sending an EMail Notification to : " + eventHook.getHookRecipient());214 Email email = null;215 try {216 email = emailGenerationService.generateNotifyStartTagExecution(tag, eventHook.getHookRecipient());217 emailService.sendHtmlMail(email);218 } catch (Exception ex) {219 LOG.warn("Exception generating email for '" + eventHook.getEventReference() + "'", ex);220 }221 }222 break;223 case EventHook.HOOKCONNECTOR_SLACK:224 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {225 LOG.debug("Generating and Sending a Slack Notification to : '" + eventHook.getHookRecipient() + "'");226 try {227 JSONObject slackMessage = slackGenerationService.generateNotifyStartTagExecution(tag, eventHook.getHookChannel());228 slackService.sendSlackMessage(slackMessage, eventHook.getHookRecipient());229 } catch (Exception ex) {230 LOG.warn("Exception generating slack notification for '" + eventHook.getEventReference() + "'", ex);231 }232 }233 break;234 case EventHook.HOOKCONNECTOR_GENERIC:235 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {236 LOG.debug("Generating and Sending a Generic Notification to : '" + eventHook.getHookRecipient() + "'");237 try {238 JSONObject message = webCallGenerationService.generateNotifyStartTagExecution(tag, ceberusEventMessage);239 webcallService.sendWebcallMessage(message, eventHook.getHookRecipient());240 } catch (Exception ex) {241 LOG.warn("Exception Generic notification for '" + eventHook.getEventReference() + "'", ex);242 }243 }244 break;245 case EventHook.HOOKCONNECTOR_TEAMS:246 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {247 LOG.debug("Generating and Sending a Teams Notification to : '" + eventHook.getHookRecipient() + "'");248 try {249 JSONObject message = teamsGenerationService.generateNotifyStartTagExecution(tag);250 teamsService.sendTeamsMessage(message, eventHook.getHookRecipient());251 } catch (Exception ex) {252 LOG.warn("Exception generating slack notification for '" + eventHook.getEventReference() + "'", ex);253 }254 }255 break;256 case EventHook.HOOKCONNECTOR_GOOGLECHAT:257 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {258 LOG.debug("Generating and Sending a Google Chat Notification to : '" + eventHook.getHookRecipient() + "'");259 try {260 JSONObject message = chatGenerationService.generateNotifyStartTagExecution(tag);261 chatService.sendGoogleChatMessage(message, eventHook.getHookRecipient(), tag.getTag());262 } catch (Exception ex) {263 LOG.warn("Exception generating Google Chat notification for '" + eventHook.getEventReference() + "'", ex);264 }265 }266 break;267 default:268 LOG.warn("Event Hook Connector '" + eventHook.getHookConnector() + "' Not implemented for Event '" + eventHook.getEventReference() + "'");269 break;270 }271 }272 private void processEvent_CAMPAIGN_END(EventHook eventHook, Tag tag, JSONObject ceberusEventMessage, List<Invariant> prioritiesList, List<Invariant> countriesList, List<Invariant> environmentsList) {273 LOG.debug("EventHook Processing '" + eventHook.getEventReference() + "' with connector '" + eventHook.getHookConnector() + "' to '" + eventHook.getHookRecipient() + "'");274 switch (eventHook.getHookConnector()) {275 case EventHook.HOOKCONNECTOR_EMAIL:276 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {277 LOG.debug("Generating and Sending an EMail Notification to : " + eventHook.getHookRecipient());278 Email email = null;279 try {280 email = emailGenerationService.generateNotifyEndTagExecution(tag, eventHook.getHookRecipient());281 emailService.sendHtmlMail(email);282 } catch (Exception ex) {283 LOG.warn("Exception generating email for '" + eventHook.getEventReference() + "'", ex);284 }285 }286 break;287 case EventHook.HOOKCONNECTOR_SLACK:288 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {289 LOG.debug("Generating and Sending a Slack Notification to : '" + eventHook.getHookRecipient() + "'");290 try {291 JSONObject slackMessage = slackGenerationService.generateNotifyEndTagExecution(tag, eventHook.getHookChannel());292 slackService.sendSlackMessage(slackMessage, eventHook.getHookRecipient());293 } catch (Exception ex) {294 LOG.warn("Exception slack notification for '" + eventHook.getEventReference() + "'", ex);295 }296 }297 break;298 case EventHook.HOOKCONNECTOR_GENERIC:299 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {300 LOG.debug("Generating and Sending a Generic Notification to : '" + eventHook.getHookRecipient() + "'");301 try {302 JSONObject message = webCallGenerationService.generateNotifyEndTagExecution(tag, ceberusEventMessage, prioritiesList, countriesList, environmentsList);303 webcallService.sendWebcallMessage(message, eventHook.getHookRecipient());304 } catch (Exception ex) {305 LOG.warn("Exception Generic notification for '" + eventHook.getEventReference() + "'", ex);306 }307 }308 break;309 case EventHook.HOOKCONNECTOR_TEAMS:310 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {311 LOG.debug("Generating and Sending a Teams Notification to : '" + eventHook.getHookRecipient() + "'");312 try {313 JSONObject message = teamsGenerationService.generateNotifyEndTagExecution(tag);314 teamsService.sendTeamsMessage(message, eventHook.getHookRecipient());315 } catch (Exception ex) {316 LOG.warn("Exception Teams notification for '" + eventHook.getEventReference() + "'", ex);317 }318 }319 break;320 case EventHook.HOOKCONNECTOR_GOOGLECHAT:321 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {322 LOG.debug("Generating and Sending a Google Chat Notification to : '" + eventHook.getHookRecipient() + "'");323 try {324 JSONObject message = chatGenerationService.generateNotifyEndTagExecution(tag);325 chatService.sendGoogleChatMessage(message, eventHook.getHookRecipient(), tag.getTag());326 } catch (Exception ex) {327 LOG.warn("Exception Google Chat notification for '" + eventHook.getEventReference() + "'", ex);328 }329 }330 break;331 default:332 LOG.warn("Event Hook Connector '" + eventHook.getHookConnector() + "' Not implemented for Event '" + eventHook.getEventReference() + "'");333 break;334 }335 }336 private void processEvent_EXECUTION_START(EventHook eventHook, TestCaseExecution exe, JSONObject ceberusEventMessage) {337 LOG.debug("EventHook Processing '" + eventHook.getEventReference() + "' with connector '" + eventHook.getHookConnector() + "' to '" + eventHook.getHookRecipient() + "'");338 switch (eventHook.getHookConnector()) {339 case EventHook.HOOKCONNECTOR_EMAIL:340 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {341 LOG.debug("Generating and Sending an EMail Notification to : " + eventHook.getHookRecipient());342 Email email = null;343 try {344 email = emailGenerationService.generateNotifyStartExecution(exe, eventHook.getHookRecipient());345 emailService.sendHtmlMail(email);346 } catch (Exception ex) {347 LOG.warn("Exception generating email for '" + eventHook.getEventReference() + "'", ex);348 }349 }350 break;351 case EventHook.HOOKCONNECTOR_SLACK:352 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {353 LOG.debug("Generating and Sending a Slack Notification to : '" + eventHook.getHookRecipient() + "'");354 try {355 JSONObject slackMessage = slackGenerationService.generateNotifyStartExecution(exe, eventHook.getHookChannel());356 slackService.sendSlackMessage(slackMessage, eventHook.getHookRecipient());357 } catch (Exception ex) {358 LOG.warn("Exception slack notification for '" + eventHook.getEventReference() + "'", ex);359 }360 }361 break;362 case EventHook.HOOKCONNECTOR_GENERIC:363 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {364 LOG.debug("Generating and Sending a Generic Notification to : '" + eventHook.getHookRecipient() + "'");365 try {366 JSONObject message = webCallGenerationService.generateNotifyStartExecution(exe, ceberusEventMessage);367 webcallService.sendWebcallMessage(message, eventHook.getHookRecipient());368 } catch (Exception ex) {369 LOG.warn("Exception Generic notification for '" + eventHook.getEventReference() + "'", ex);370 }371 }372 break;373 case EventHook.HOOKCONNECTOR_TEAMS:374 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {375 LOG.debug("Generating and Sending a Teams Notification to : '" + eventHook.getHookRecipient() + "'");376 try {377 JSONObject message = teamsGenerationService.generateNotifyStartExecution(exe);378 teamsService.sendTeamsMessage(message, eventHook.getHookRecipient());379 } catch (Exception ex) {380 LOG.warn("Exception Teams notification for '" + eventHook.getEventReference() + "'", ex);381 }382 }383 break;384 case EventHook.HOOKCONNECTOR_GOOGLECHAT:385 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {386 LOG.debug("Generating and Sending a Google Chat Notification to : '" + eventHook.getHookRecipient() + "'");387 try {388 JSONObject message = chatGenerationService.generateNotifyStartExecution(exe);389 chatService.sendGoogleChatMessage(message, eventHook.getHookRecipient(), String.valueOf(exe.getId()));390 } catch (Exception ex) {391 LOG.warn("Exception Google Chat notification for '" + eventHook.getEventReference() + "'", ex);392 }393 }394 break;395 default:396 LOG.warn("Event Hook Connector '" + eventHook.getHookConnector() + "' Not implemented for Event '" + eventHook.getEventReference() + "'");397 break;398 }399 }400 private void processEvent_EXECUTION_END(EventHook eventHook, TestCaseExecution exe, JSONObject ceberusEventMessage) {401 LOG.debug("EventHook Processing '" + eventHook.getEventReference() + "' with connector '" + eventHook.getHookConnector() + "' to '" + eventHook.getHookRecipient() + "'");402 switch (eventHook.getHookConnector()) {403 case EventHook.HOOKCONNECTOR_EMAIL:404 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {405 LOG.debug("Generating and Sending an EMail Notification to : " + eventHook.getHookRecipient());406 Email email = null;407 try {408 email = emailGenerationService.generateNotifyEndExecution(exe, eventHook.getHookRecipient());409 emailService.sendHtmlMail(email);410 } catch (Exception ex) {411 LOG.warn("Exception generating email for '" + eventHook.getEventReference() + "'", ex);412 }413 }414 break;415 case EventHook.HOOKCONNECTOR_SLACK:416 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {417 LOG.debug("Generating and Sending a Slack Notification to : '" + eventHook.getHookRecipient() + "'");418 try {419 JSONObject slackMessage = slackGenerationService.generateNotifyEndExecution(exe, eventHook.getHookChannel());420 slackService.sendSlackMessage(slackMessage, eventHook.getHookRecipient());421 } catch (Exception ex) {422 LOG.warn("Exception slack notification for '" + eventHook.getEventReference() + "'", ex);423 }424 }425 break;426 case EventHook.HOOKCONNECTOR_GENERIC:427 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {428 LOG.debug("Generating and Sending a Generic Notification to : '" + eventHook.getHookRecipient() + "'");429 try {430 JSONObject message = webCallGenerationService.generateNotifyEndExecution(exe, ceberusEventMessage);431 webcallService.sendWebcallMessage(message, eventHook.getHookRecipient());432 } catch (Exception ex) {433 LOG.warn("Exception Generic notification for '" + eventHook.getEventReference() + "'", ex);434 }435 }436 break;437 case EventHook.HOOKCONNECTOR_TEAMS:438 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {439 LOG.debug("Generating and Sending a Teams Notification to : '" + eventHook.getHookRecipient() + "'");440 try {441 JSONObject message = teamsGenerationService.generateNotifyEndExecution(exe);442 teamsService.sendTeamsMessage(message, eventHook.getHookRecipient());443 } catch (Exception ex) {444 LOG.warn("Exception Teams notification for '" + eventHook.getEventReference() + "'", ex);445 }446 }447 break;448 case EventHook.HOOKCONNECTOR_GOOGLECHAT:449 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {450 LOG.debug("Generating and Sending a Google chat Notification to : '" + eventHook.getHookRecipient() + "'");451 try {452 JSONObject message = chatGenerationService.generateNotifyEndExecution(exe);453 chatService.sendGoogleChatMessage(message, eventHook.getHookRecipient(), String.valueOf(exe.getId()));454 } catch (Exception ex) {455 LOG.warn("Exception Google Chat notification for '" + eventHook.getEventReference() + "'", ex);456 }457 }458 break;459 default:460 LOG.warn("Event Hook Connector '" + eventHook.getHookConnector() + "' Not implemented for Event '" + eventHook.getEventReference() + "'");461 break;462 }463 }464 private void processEvent_TESTCASE(EventHook eventHook, TestCase testCase, String originalTest, String originalTestcase, JSONObject ceberusEventMessage) {465 LOG.debug("EventHook Processing '" + eventHook.getEventReference() + "' with connector '" + eventHook.getHookConnector() + "' to '" + eventHook.getHookRecipient() + "'");466 switch (eventHook.getHookConnector()) {467 case EventHook.HOOKCONNECTOR_EMAIL:468 if (!StringUtil.isNullOrEmpty(eventHook.getHookRecipient())) {469 LOG.debug("Generating and Sending an EMail Notification to : " + eventHook.getHookRecipient());470 Email email = null;471 try {472 email = emailGenerationService.generateNotifyTestCaseChange(testCase, eventHook.getHookRecipient(), eventHook.getEventReference());473 emailService.sendHtmlMail(email);474 } catch (Exception ex) {475 LOG.warn("Exception generating email for '" + eventHook.getEventReference() + "'", ex);476 }477 }478 break;...

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