Best Cerberus-source code snippet using org.cerberus.engine.queuemanagement.entity.TestCaseExecutionQueueToTreat.getManualExecution
Source:ExecutionThreadPoolService.java
...386 } else {387 constMatch04 = (const04_current >= robothost_poolsize_final);388 }389 if ((!constMatch01 && !constMatch02 && !constMatch03 && !constMatch04)390 || (!constMatch01 && exe.getManualExecution().equals("Y"))) {391 // None of the constrains match or exe is manual so we can trigger the execution.392 // Execution could already been triggered on a different executor.393 if (triggerExe == false) {394 // Adding execution to queue.395 if (queueService.updateToWaiting(exe.getId())) {396 try {397 ExecutionQueueWorkerThread task = new ExecutionQueueWorkerThread();398 // Flag on database that execution has been selected.399 robotExecutorService.updateLastExe(robot, robotExecutor);400 // Update robot_executor HasMap for next queued executions in the current batch. If Algo is based on Ranking, nothing needs to be changed.401 if ((robot_header.get(robot) != null)402 && (Robot.LOADBALANCINGEXECUTORMETHOD_ROUNDROBIN.equals(robot_header.get(robot).getLbexemethod()))403 && (exelist.size() > 1)) {404 tmpExelist = robot_executor.get(robot);405 newTmpExelist = new ArrayList<>();406 RobotExecutor lastRobotExecutor = null;407 for (RobotExecutor robotExecutor2 : tmpExelist) {408 // Update new List with RobotExecutor.LOADBALANCINGMETHOD_ROUNDROBIN Algo puting the Executor that has just been inserted at the end.409 if (robotExecutor2.getExecutor().equals(robotExecutor)) {410 lastRobotExecutor = robotExecutor2;411 } else {412 newTmpExelist.add(robotExecutor2);413 }414 }415 newTmpExelist.add(lastRobotExecutor);416 robot_executor.put(robot, newTmpExelist);417 }418 task.setCerberusExecutionUrl(parameterService.getParameterStringByKey("cerberus_url", exe.getSystem(), ""));419 task.setQueueId(exe.getId());420 task.setRobotExecutor(robotExecutor);421 task.setSelectedRobotHost(robotHost);422 task.setToExecuteTimeout(queueTimeout);423 task.setQueueService(queueService);424 task.setQueueDepService(queueDepService);425 task.setRetriesService(retriesService);426 task.setExecThreadPool(threadQueuePool);427 Future<?> future = threadQueuePool.getExecutor().submit(task);428 task.setFuture(future);429 triggerExe = true;430 nbqueuedexe++;431 // Debug messages.432 LOG.debug("RESULT : Execution triggered. Const1 " + constMatch01 + " Const2 " + constMatch02 + " Const3 " + constMatch03 + " Const4 " + constMatch04 + " Manual " + exe.getManualExecution());433 LOG.debug(" CurConst1 " + const01_current + " CurConst2 " + const02_current + " CurConst3 " + const03_current + " CurConst4 " + const04_current);434 // Constrains Counter increase435 constrains_current.put(const01_key, const01_current + 1);436 if (!exe.getManualExecution().equals("Y")) {437 // Specific increment only if automatic execution.438 constrains_current.put(const02_key, const02_current + 1);439 constrains_current.put(const03_key, const03_current + 1);440 constrains_current.put(const04_key, const04_current + 1);441 }442 } catch (Exception e) {443 LOG.error("Failed to add Queueid : " + exe.getId() + " into the queue : " + e.getMessage(), e);444 }445 }446 } else {447 LOG.debug("RESULT : Execution Not triggered. Queueid : " + exe.getId() + " already inserted (on a previous Executor).");448 }449 } else {450 if (constMatch04) {451 notTriggeredExeMessage += "Robot Host contrain on '" + const04_key + "' reached. " + robothost_poolsize_final + " Execution(s) already in pool. ";452 }453 if (constMatch03) {454 notTriggeredExeMessage += "Application contrain on '" + const03_key + "' reached . " + exe.getPoolSizeApplication() + " Execution(s) already in pool. ";455 }456 if (constMatch02) {457 notTriggeredExeMessage += "Application Environment contrain on '" + const02_key + "' reached . " + exe.getPoolSizeAppEnvironment() + " Execution(s) already in pool. ";458 }459 if (constMatch01) {460 notTriggeredExeMessage += "Global contrain reached. " + poolSizeGeneral + " Execution(s) already in pool. ";461 }462 LOG.debug("RESULT : Execution not triggered. Const1 " + constMatch01 + " Const2 " + constMatch02 + " Const3 " + constMatch03 + " Const4 " + constMatch04 + " Manual " + exe.getManualExecution());463 LOG.debug(" CurConst1 " + const01_current + " CurConst2 " + const02_current + " CurConst3 " + const03_current + " CurConst4 " + const04_current);464 }465 }466// End of Queue entry analysis accross all Executors.467 if ((exe.getDebugFlag() != null) && (exe.getDebugFlag().equalsIgnoreCase("Y"))) {468 if (triggerExe == false) {469 queueService.updateComment(exe.getId(), notTriggeredExeMessage);470 }471 LOG.debug("Debug Message : " + notTriggeredExeMessage);472 }473 }474 LOG.debug("Stopping Queue_Processing_Job - TOTAL Released execution(s) : " + nbqueuedexe);475 } while (nbqueuedexe > 0);476 } else {...
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!!