@Test public void testContentTrackerSchedule() throws SchedulerException { String exp = "0/5 * * * * ? *"; props.put("alfresco.content.tracker.cron", exp); ContentTracker contentTracker = new ContentTracker(props, client, coreName, informationServer); this.trackerScheduler.schedule(contentTracker, CORE_NAME, props); verify(spiedQuartzScheduler).scheduleJob(any(JobDetail.class), any(Trigger.class)); checkCronExpression(exp); }
public void schedule(Tracker tracker, String coreName, Properties props) { String jobName = this.getJobName(tracker, coreName); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(TrackerJob.JOBDATA_TRACKER_KEY, tracker); JobDetail job = JobBuilder.newJob(TrackerJob.class) .withIdentity(jobName, SOLR_JOB_GROUP) .withDescription(jobName) .setJobData(jobDataMap).build(); Trigger trigger; try { String cron; switch (tracker.getType()) { case ACL: cron = getCron(props,"alfresco.acl.tracker.cron"); break; case MODEL: cron = getCron(props,"alfresco.model.tracker.cron"); break; case CONTENT: cron = getCron(props,"alfresco.content.tracker.cron"); break; case METADATA: cron = getCron(props,"alfresco.metadata.tracker.cron"); break; case CASCADE: cron = getCron(props,"alfresco.cascade.tracker.cron"); break; case COMMIT: cron = getCron(props,"alfresco.commit.tracker.cron"); break; case NODE_STATE_PUBLISHER: cron = getCron(props,"alfresco.nodestate.tracker.cron"); break; default: cron = props.getProperty("alfresco.cron",DEFAULT_CRON); break; } trigger = TriggerBuilder.newTrigger().withIdentity(jobName, SOLR_JOB_GROUP).withSchedule(CronScheduleBuilder.cronSchedule(cron)).build(); log.info("Scheduling job " + jobName); scheduler.scheduleJob(job, trigger); } catch (SchedulerException e) { logError("Tracker", e); } }
SolrTrackerScheduler { public void schedule(Tracker tracker, String coreName, Properties props) { String jobName = this.getJobName(tracker, coreName); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(TrackerJob.JOBDATA_TRACKER_KEY, tracker); JobDetail job = JobBuilder.newJob(TrackerJob.class) .withIdentity(jobName, SOLR_JOB_GROUP) .withDescription(jobName) .setJobData(jobDataMap).build(); Trigger trigger; try { String cron; switch (tracker.getType()) { case ACL: cron = getCron(props,"alfresco.acl.tracker.cron"); break; case MODEL: cron = getCron(props,"alfresco.model.tracker.cron"); break; case CONTENT: cron = getCron(props,"alfresco.content.tracker.cron"); break; case METADATA: cron = getCron(props,"alfresco.metadata.tracker.cron"); break; case CASCADE: cron = getCron(props,"alfresco.cascade.tracker.cron"); break; case COMMIT: cron = getCron(props,"alfresco.commit.tracker.cron"); break; case NODE_STATE_PUBLISHER: cron = getCron(props,"alfresco.nodestate.tracker.cron"); break; default: cron = props.getProperty("alfresco.cron",DEFAULT_CRON); break; } trigger = TriggerBuilder.newTrigger().withIdentity(jobName, SOLR_JOB_GROUP).withSchedule(CronScheduleBuilder.cronSchedule(cron)).build(); log.info("Scheduling job " + jobName); scheduler.scheduleJob(job, trigger); } catch (SchedulerException e) { logError("Tracker", e); } } }
SolrTrackerScheduler { public void schedule(Tracker tracker, String coreName, Properties props) { String jobName = this.getJobName(tracker, coreName); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(TrackerJob.JOBDATA_TRACKER_KEY, tracker); JobDetail job = JobBuilder.newJob(TrackerJob.class) .withIdentity(jobName, SOLR_JOB_GROUP) .withDescription(jobName) .setJobData(jobDataMap).build(); Trigger trigger; try { String cron; switch (tracker.getType()) { case ACL: cron = getCron(props,"alfresco.acl.tracker.cron"); break; case MODEL: cron = getCron(props,"alfresco.model.tracker.cron"); break; case CONTENT: cron = getCron(props,"alfresco.content.tracker.cron"); break; case METADATA: cron = getCron(props,"alfresco.metadata.tracker.cron"); break; case CASCADE: cron = getCron(props,"alfresco.cascade.tracker.cron"); break; case COMMIT: cron = getCron(props,"alfresco.commit.tracker.cron"); break; case NODE_STATE_PUBLISHER: cron = getCron(props,"alfresco.nodestate.tracker.cron"); break; default: cron = props.getProperty("alfresco.cron",DEFAULT_CRON); break; } trigger = TriggerBuilder.newTrigger().withIdentity(jobName, SOLR_JOB_GROUP).withSchedule(CronScheduleBuilder.cronSchedule(cron)).build(); log.info("Scheduling job " + jobName); scheduler.scheduleJob(job, trigger); } catch (SchedulerException e) { logError("Tracker", e); } } SolrTrackerScheduler(AlfrescoCoreAdminHandler adminHandler); }
SolrTrackerScheduler { public void schedule(Tracker tracker, String coreName, Properties props) { String jobName = this.getJobName(tracker, coreName); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(TrackerJob.JOBDATA_TRACKER_KEY, tracker); JobDetail job = JobBuilder.newJob(TrackerJob.class) .withIdentity(jobName, SOLR_JOB_GROUP) .withDescription(jobName) .setJobData(jobDataMap).build(); Trigger trigger; try { String cron; switch (tracker.getType()) { case ACL: cron = getCron(props,"alfresco.acl.tracker.cron"); break; case MODEL: cron = getCron(props,"alfresco.model.tracker.cron"); break; case CONTENT: cron = getCron(props,"alfresco.content.tracker.cron"); break; case METADATA: cron = getCron(props,"alfresco.metadata.tracker.cron"); break; case CASCADE: cron = getCron(props,"alfresco.cascade.tracker.cron"); break; case COMMIT: cron = getCron(props,"alfresco.commit.tracker.cron"); break; case NODE_STATE_PUBLISHER: cron = getCron(props,"alfresco.nodestate.tracker.cron"); break; default: cron = props.getProperty("alfresco.cron",DEFAULT_CRON); break; } trigger = TriggerBuilder.newTrigger().withIdentity(jobName, SOLR_JOB_GROUP).withSchedule(CronScheduleBuilder.cronSchedule(cron)).build(); log.info("Scheduling job " + jobName); scheduler.scheduleJob(job, trigger); } catch (SchedulerException e) { logError("Tracker", e); } } SolrTrackerScheduler(AlfrescoCoreAdminHandler adminHandler); void schedule(Tracker tracker, String coreName, Properties props); void shutdown(); void deleteTrackerJobs(String coreName, Collection<Tracker> trackers); void deleteJobForTrackerInstance(String coreName, Tracker tracker); void deleteTrackerJob(String coreName, Tracker tracker); boolean isShutdown(); void pauseAll(); int getJobsCount(); }
SolrTrackerScheduler { public void schedule(Tracker tracker, String coreName, Properties props) { String jobName = this.getJobName(tracker, coreName); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(TrackerJob.JOBDATA_TRACKER_KEY, tracker); JobDetail job = JobBuilder.newJob(TrackerJob.class) .withIdentity(jobName, SOLR_JOB_GROUP) .withDescription(jobName) .setJobData(jobDataMap).build(); Trigger trigger; try { String cron; switch (tracker.getType()) { case ACL: cron = getCron(props,"alfresco.acl.tracker.cron"); break; case MODEL: cron = getCron(props,"alfresco.model.tracker.cron"); break; case CONTENT: cron = getCron(props,"alfresco.content.tracker.cron"); break; case METADATA: cron = getCron(props,"alfresco.metadata.tracker.cron"); break; case CASCADE: cron = getCron(props,"alfresco.cascade.tracker.cron"); break; case COMMIT: cron = getCron(props,"alfresco.commit.tracker.cron"); break; case NODE_STATE_PUBLISHER: cron = getCron(props,"alfresco.nodestate.tracker.cron"); break; default: cron = props.getProperty("alfresco.cron",DEFAULT_CRON); break; } trigger = TriggerBuilder.newTrigger().withIdentity(jobName, SOLR_JOB_GROUP).withSchedule(CronScheduleBuilder.cronSchedule(cron)).build(); log.info("Scheduling job " + jobName); scheduler.scheduleJob(job, trigger); } catch (SchedulerException e) { logError("Tracker", e); } } SolrTrackerScheduler(AlfrescoCoreAdminHandler adminHandler); void schedule(Tracker tracker, String coreName, Properties props); void shutdown(); void deleteTrackerJobs(String coreName, Collection<Tracker> trackers); void deleteJobForTrackerInstance(String coreName, Tracker tracker); void deleteTrackerJob(String coreName, Tracker tracker); boolean isShutdown(); void pauseAll(); int getJobsCount(); static final String SOLR_JOB_GROUP; }