How to use SchedulerInit class of org.cerberus.engine.scheduler package

Best Cerberus-source code snippet using org.cerberus.engine.scheduler.SchedulerInit

Source:ScheduledTaskRunner.java Github

copy

Full Screen

...20package org.cerberus.engine.scheduledtasks;21import org.cerberus.crud.service.IParameterService;22import org.cerberus.crud.service.ITestCaseExecutionQueueService;23import org.cerberus.engine.queuemanagement.IExecutionThreadPoolService;24import org.cerberus.engine.scheduler.SchedulerInit;25import org.cerberus.exception.CerberusException;26import org.springframework.beans.factory.annotation.Autowired;27import org.springframework.scheduling.annotation.Scheduled;28import org.springframework.stereotype.Component;29/**30 *31 * @author bcivel32 */33// Component = instancié au déploiement. Singleton. 1 par instance34@Component35public class ScheduledTaskRunner {36 @Autowired37 private IParameterService parameterService;38 @Autowired39 private ITestCaseExecutionQueueService testCaseExecutionQueueService;40 @Autowired41 private IExecutionThreadPoolService executionThreadPoolService;42 @Autowired43 private SchedulerInit schedulerInit;44 private int b1TickNumberTarget = 60;45 private int b1TickNumber = 1;46 private int b2TickNumberTarget = 30;47 private int b2TickNumber = 1;48 private int b3TickNumberTarget = 1;49 private int b3TickNumber = 1;50 private static final org.apache.logging.log4j.Logger LOG = org.apache.logging.log4j.LogManager.getLogger(ScheduledTaskRunner.class);51 @Scheduled(fixedRate = 60000, initialDelay = 30000 /* Every minute */)52 public void nextStep() {53 LOG.debug("Schedule Start. " + b1TickNumber + "/" + b1TickNumberTarget + " - " + b2TickNumber + "/" + b2TickNumberTarget);54 // We get the new period from paarameter and trigger the Queue automatic cancellation job.55 b1TickNumberTarget = parameterService.getParameterIntegerByKey("cerberus_automaticqueuecancellationjob_period", "", 60);56 b2TickNumberTarget = parameterService.getParameterIntegerByKey("cerberus_automaticqueueprocessingjob_period", "", 30);57 if (b1TickNumber < b1TickNumberTarget) {58 b1TickNumber++;59 } else {60 b1TickNumber = 1;61 performBatch1_CancelOldQueueEntries();62 }63 if (b2TickNumber < b2TickNumberTarget) {64 b2TickNumber++;65 } else {66 b2TickNumber = 1;67 // We trigger the Queue Processing job.68 performBatch2_ProcessQueue();69 }70 if (b3TickNumber < b3TickNumberTarget) {71 b3TickNumber++;72 } else {73 b3TickNumber = 1;74 // We trigger the Queue Processing job.75 performBatch3_SchedulerInit();76 }77 LOG.debug("Schedule Stop. " + b1TickNumber + "/" + b1TickNumberTarget + " - " + b2TickNumber + "/" + b2TickNumberTarget);78 }79 private void performBatch1_CancelOldQueueEntries() {80 LOG.info("automaticqueuecancellationjob Task triggered.");81 if (parameterService.getParameterBooleanByKey("cerberus_automaticqueuecancellationjob_active", "", true)) {82 testCaseExecutionQueueService.cancelRunningOldQueueEntries();83 } else {84 LOG.info("automaticqueuecancellationjob Task disabled by config (cerberus_automaticqueuecancellationjob_active).");85 }86 LOG.info("automaticqueuecancellationjob Task ended.");87 }88 private void performBatch2_ProcessQueue() {89 LOG.info("automaticqueueprocessingjob Task triggered.");90 if (parameterService.getParameterBooleanByKey("cerberus_automaticqueueprocessingjob_active", "", true)) {91 try {92 executionThreadPoolService.executeNextInQueue(false);93 } catch (CerberusException ex) {94 LOG.error(ex.toString(), ex);95 }96 } else {97 LOG.info("automaticqueueprocessingjob Task disabled by config (cerberus_automaticqueueprocessingjob_active).");98 }99 LOG.info("automaticqueueprocessingjob Task ended.");100 }101 private void performBatch3_SchedulerInit() {102 try {103 LOG.info("SchedulerInit Task triggered.");104 schedulerInit.init();105 LOG.info("SchedulerInit Task ended.");106 } catch (Exception e) {107 LOG.error("ScheduleEntry init from scheduletaskrunner failed : " + e);108 }109 }110}...

Full Screen

Full Screen

SchedulerInit

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.scheduler.SchedulerInit;2import org.quartz.Scheduler;3import org.quartz.SchedulerException;4import org.quartz.JobBuilder;5import org.quartz.JobDetail;6import org.quartz.TriggerBuilder;7import org.quartz.Trigger;8import org.quartz.TriggerKey;9import org.quartz.JobKey;10import org.quartz.DateBuilder;11import org.quartz.DateBuilder.IntervalUnit;12import java.util.Date;13import org.quartz.SimpleTrigger;14import org.quartz.JobDataMap;15import org.quartz.JobDataMap;16import org.cerberus.engine.scheduler.SchedulerInit;17import org.quartz.Scheduler;18import org.quartz.SchedulerException;19import org.quartz.JobBuilder;20import org.quartz.JobDetail;21import org.quartz.TriggerBuilder;22import org.quartz.Trigger;23import org.quartz.TriggerKey;24import org.quartz.JobKey;

Full Screen

Full Screen

SchedulerInit

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.scheduler.SchedulerInit;2import org.cerberus.engine.scheduler.Scheduler;3import org.cerberus.engine.scheduler.SchedulerException;4import org.cerberus.engine.scheduler.SchedulerFactory;5import org.cerberus.engine.scheduler.SchedulerFactoryException;6import org.cerberus.engine.scheduler.SchedulerFactoryInit;7import org.cerberus.engine.scheduler.SchedulerInitException;8import org.cerberus.engine.scheduler.SchedulerJob;9import org.cerberus.engine.scheduler.SchedulerJobException;10import org.cerberus.engine.scheduler.SchedulerJobFactory;11import org.cerberus.engine.scheduler.SchedulerJobFactoryException;12import org.cerberus.engine.scheduler.SchedulerJobInit;13import org.cerberus.engine.scheduler.SchedulerJobInitException;14import org.cerberus.engine.scheduler.SchedulerJobLog;15import org.cerberus.engine.scheduler.SchedulerJobLogException;16import org.cerberus.engine.scheduler.SchedulerJobLogFactory;17import org.c

Full Screen

Full Screen

SchedulerInit

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.scheduler.SchedulerInit;2import org.cerberus.engine.scheduler.SchedulerInitException;3try {4 SchedulerInit.getInstance().startScheduler();5} catch (SchedulerInitException ex) {6 LOG.error(ex.getMessage(), ex);7}8import org.cerberus.engine.scheduler.SchedulerInit;9import org.cerberus.engine.scheduler.SchedulerInitException;10try {11 SchedulerInit.getInstance().stopScheduler();12} catch (SchedulerInitException ex) {13 LOG.error(ex.getMessage(), ex);14}15import org.cerberus.engine.scheduler.SchedulerInit;16import org.cerberus.engine.scheduler.SchedulerInitException;17try {18 SchedulerInit.getInstance().pauseScheduler();19} catch (SchedulerInitException ex) {20 LOG.error(ex.getMessage(), ex);21}22import org.cerberus.engine.scheduler.SchedulerInit;23import org.cerberus.engine.scheduler.SchedulerInitException;24try {25 SchedulerInit.getInstance().resumeScheduler();26} catch (SchedulerInitException ex) {27 LOG.error(ex.getMessage(), ex);28}29import org.cerberus.engine.scheduler.SchedulerInit;30import org.cerberus.engine.scheduler.SchedulerInitException;31try {32 SchedulerInit.getInstance().restartScheduler();33} catch (SchedulerInitException ex) {34 LOG.error(ex.getMessage(), ex);35}36import org.cerberus.engine.scheduler.SchedulerInit;37import org.cerberus.engine.scheduler.SchedulerInitException;38try {39 SchedulerInit.getInstance().isStarted();40} catch (SchedulerInitException ex) {41 LOG.error(ex.getMessage(), ex);42}43import org.cerberus.engine.scheduler.SchedulerInit;44import org.cerberus.engine.scheduler.SchedulerInitException;45try {46 SchedulerInit.getInstance().isPaused();47} catch (SchedulerInitException ex) {48 LOG.error(ex.getMessage(), ex);49}50import org.cerberus.engine.scheduler

Full Screen

Full Screen

SchedulerInit

Using AI Code Generation

copy

Full Screen

1SchedulerInit schedulerInit = new SchedulerInit();2schedulerInit.initScheduler();3SchedulerStart schedulerStart = new SchedulerStart();4schedulerStart.startScheduler();5SchedulerStop schedulerStop = new SchedulerStop();6schedulerStop.stopScheduler();7SchedulerRestart schedulerRestart = new SchedulerRestart();8schedulerRestart.restartScheduler();9SchedulerPause schedulerPause = new SchedulerPause();10schedulerPause.pauseScheduler();11SchedulerResume schedulerResume = new SchedulerResume();12schedulerResume.resumeScheduler();13SchedulerStatus schedulerStatus = new SchedulerStatus();14schedulerStatus.getSchedulerStatus();15SchedulerAddJob schedulerAddJob = new SchedulerAddJob();16schedulerAddJob.addJob("jobName", "jobGroup", "triggerName", "triggerGroup", "cronExpression", "className");17SchedulerRemoveJob schedulerRemoveJob = new SchedulerRemoveJob();18schedulerRemoveJob.removeJob("jobName", "jobGroup");19SchedulerUpdateJob schedulerUpdateJob = new SchedulerUpdateJob();20schedulerUpdateJob.updateJob("jobName", "jobGroup", "triggerName", "triggerGroup", "cronExpression", "className");21SchedulerGetJob schedulerGetJob = new SchedulerGetJob();22schedulerGetJob.getJob("jobName", "jobGroup");

Full Screen

Full Screen

SchedulerInit

Using AI Code Generation

copy

Full Screen

1import org.cerberus.engine.scheduler.SchedulerInit;2import java.util.Date;3import java.util.HashMap;4import java.util.Map;5SchedulerInit scheduler = SchedulerInit.getInstance();6Map<String, Object> parameters = new HashMap<String, Object>();7parameters.put("param1", "value1");8parameters.put("param2", "value2");9Trigger trigger = newTrigger()10 .withIdentity("trigger1", "group1")11 .startAt(new Date())12 .build();13JobDetail job = newJob(MyJob.class)14 .withIdentity("job1", "group1")15 .usingJobData(new JobDataMap(parameters))16 .build();17scheduler.scheduleJob(job, trigger);18Scheduler scheduler = SchedulerInit.getInstance();19String group = "group1";20String name = "job1";21String triggerGroup = "group1";22String triggerName = "trigger1";23JobDetail job = scheduler.getJobDetail(new JobKey(name, group));24Trigger trigger = scheduler.getTrigger(new TriggerKey(triggerName, triggerGroup));25JobDataMap map = job.getJobDataMap();26String param1 = map.getString("param1");27String param2 = map.getString("param2");28Class jobClass = job.getJobClass();29String jobName = job.getKey().getName();30String jobGroup = job.getKey().getGroup();31String triggerName = trigger.getKey().getName();32String triggerGroup = trigger.getKey().getGroup();33Date startDate = trigger.getStartTime();34Date endDate = trigger.getEndTime();35Date nextFireDate = trigger.getNextFireTime();36Date previousFireDate = trigger.getPreviousFireTime();37Trigger.TriggerState state = scheduler.getTriggerState(trigger.getKey());38String cronExpression = ((CronTrigger) trigger).getCronExpression();

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.

Run Cerberus-source automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful