@Test(expected = IllegalArgumentException.class) public void initJobEmptyPathTest() throws Exception { new BatchImportJob().initJob( scheduler, "JobX", getConfig( "0 0 12 * * ?", "", "default")); }
@Override public void initJob(Scheduler scheduler, String jobId, Configuration jobConfig) throws SchedulerException { if (jobId == null || jobId.isEmpty()) { throw new IllegalArgumentException("JobId must be set"); } String schedule = jobConfig.getString(JobHandler.JOB_SCHEDULE); if (schedule == null || schedule.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, schedule missing"); } String importPath = jobConfig.getString(BATCH_IMPORT_JOB_PATH); if (importPath == null || importPath.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, path missing"); } List<String> jobProfiles = Arrays.asList(jobConfig.getStringArray(BATCH_IMPORT_JOB_PROFILES)); if (jobProfiles.isEmpty() || jobProfiles.contains("")) { throw new IllegalArgumentException("Job: " + jobId + "is not set properly, profiles missing"); } JobDetail importJobDetail = newJob(BatchImportJob.class) .withIdentity(jobId + BATCH_IMPORT_JOB_DETAIL_SUFFIX, BATCH_IMPORT_JOB_GROUP) .build(); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PATH, importPath); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PROFILES, jobProfiles); Trigger importJobTrigger = newTrigger() .withIdentity(jobId + BATCH_IMPORT_JOB_TRIGGER_SUFFIX, BATCH_IMPORT_JOB_GROUP) .withSchedule(cronSchedule(schedule)) .build(); scheduler.scheduleJob(importJobDetail, importJobTrigger); }
BatchImportJob implements Job, ProArcJob { @Override public void initJob(Scheduler scheduler, String jobId, Configuration jobConfig) throws SchedulerException { if (jobId == null || jobId.isEmpty()) { throw new IllegalArgumentException("JobId must be set"); } String schedule = jobConfig.getString(JobHandler.JOB_SCHEDULE); if (schedule == null || schedule.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, schedule missing"); } String importPath = jobConfig.getString(BATCH_IMPORT_JOB_PATH); if (importPath == null || importPath.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, path missing"); } List<String> jobProfiles = Arrays.asList(jobConfig.getStringArray(BATCH_IMPORT_JOB_PROFILES)); if (jobProfiles.isEmpty() || jobProfiles.contains("")) { throw new IllegalArgumentException("Job: " + jobId + "is not set properly, profiles missing"); } JobDetail importJobDetail = newJob(BatchImportJob.class) .withIdentity(jobId + BATCH_IMPORT_JOB_DETAIL_SUFFIX, BATCH_IMPORT_JOB_GROUP) .build(); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PATH, importPath); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PROFILES, jobProfiles); Trigger importJobTrigger = newTrigger() .withIdentity(jobId + BATCH_IMPORT_JOB_TRIGGER_SUFFIX, BATCH_IMPORT_JOB_GROUP) .withSchedule(cronSchedule(schedule)) .build(); scheduler.scheduleJob(importJobDetail, importJobTrigger); } }
BatchImportJob implements Job, ProArcJob { @Override public void initJob(Scheduler scheduler, String jobId, Configuration jobConfig) throws SchedulerException { if (jobId == null || jobId.isEmpty()) { throw new IllegalArgumentException("JobId must be set"); } String schedule = jobConfig.getString(JobHandler.JOB_SCHEDULE); if (schedule == null || schedule.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, schedule missing"); } String importPath = jobConfig.getString(BATCH_IMPORT_JOB_PATH); if (importPath == null || importPath.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, path missing"); } List<String> jobProfiles = Arrays.asList(jobConfig.getStringArray(BATCH_IMPORT_JOB_PROFILES)); if (jobProfiles.isEmpty() || jobProfiles.contains("")) { throw new IllegalArgumentException("Job: " + jobId + "is not set properly, profiles missing"); } JobDetail importJobDetail = newJob(BatchImportJob.class) .withIdentity(jobId + BATCH_IMPORT_JOB_DETAIL_SUFFIX, BATCH_IMPORT_JOB_GROUP) .build(); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PATH, importPath); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PROFILES, jobProfiles); Trigger importJobTrigger = newTrigger() .withIdentity(jobId + BATCH_IMPORT_JOB_TRIGGER_SUFFIX, BATCH_IMPORT_JOB_GROUP) .withSchedule(cronSchedule(schedule)) .build(); scheduler.scheduleJob(importJobDetail, importJobTrigger); }  }
BatchImportJob implements Job, ProArcJob { @Override public void initJob(Scheduler scheduler, String jobId, Configuration jobConfig) throws SchedulerException { if (jobId == null || jobId.isEmpty()) { throw new IllegalArgumentException("JobId must be set"); } String schedule = jobConfig.getString(JobHandler.JOB_SCHEDULE); if (schedule == null || schedule.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, schedule missing"); } String importPath = jobConfig.getString(BATCH_IMPORT_JOB_PATH); if (importPath == null || importPath.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, path missing"); } List<String> jobProfiles = Arrays.asList(jobConfig.getStringArray(BATCH_IMPORT_JOB_PROFILES)); if (jobProfiles.isEmpty() || jobProfiles.contains("")) { throw new IllegalArgumentException("Job: " + jobId + "is not set properly, profiles missing"); } JobDetail importJobDetail = newJob(BatchImportJob.class) .withIdentity(jobId + BATCH_IMPORT_JOB_DETAIL_SUFFIX, BATCH_IMPORT_JOB_GROUP) .build(); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PATH, importPath); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PROFILES, jobProfiles); Trigger importJobTrigger = newTrigger() .withIdentity(jobId + BATCH_IMPORT_JOB_TRIGGER_SUFFIX, BATCH_IMPORT_JOB_GROUP) .withSchedule(cronSchedule(schedule)) .build(); scheduler.scheduleJob(importJobDetail, importJobTrigger); }  @Override String getType(); @Override void initJob(Scheduler scheduler, String jobId, Configuration jobConfig); @Override void execute(JobExecutionContext jobExecutionContext); }
BatchImportJob implements Job, ProArcJob { @Override public void initJob(Scheduler scheduler, String jobId, Configuration jobConfig) throws SchedulerException { if (jobId == null || jobId.isEmpty()) { throw new IllegalArgumentException("JobId must be set"); } String schedule = jobConfig.getString(JobHandler.JOB_SCHEDULE); if (schedule == null || schedule.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, schedule missing"); } String importPath = jobConfig.getString(BATCH_IMPORT_JOB_PATH); if (importPath == null || importPath.isEmpty()) { throw new IllegalArgumentException("Job: "+jobId+" is not set properly, path missing"); } List<String> jobProfiles = Arrays.asList(jobConfig.getStringArray(BATCH_IMPORT_JOB_PROFILES)); if (jobProfiles.isEmpty() || jobProfiles.contains("")) { throw new IllegalArgumentException("Job: " + jobId + "is not set properly, profiles missing"); } JobDetail importJobDetail = newJob(BatchImportJob.class) .withIdentity(jobId + BATCH_IMPORT_JOB_DETAIL_SUFFIX, BATCH_IMPORT_JOB_GROUP) .build(); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PATH, importPath); importJobDetail.getJobDataMap().put(BATCH_IMPORT_JOB_PROFILES, jobProfiles); Trigger importJobTrigger = newTrigger() .withIdentity(jobId + BATCH_IMPORT_JOB_TRIGGER_SUFFIX, BATCH_IMPORT_JOB_GROUP) .withSchedule(cronSchedule(schedule)) .build(); scheduler.scheduleJob(importJobDetail, importJobTrigger); }  @Override String getType(); @Override void initJob(Scheduler scheduler, String jobId, Configuration jobConfig); @Override void execute(JobExecutionContext jobExecutionContext); static final String BATCH_IMPORT_JOB_TYPE; static final String BATCH_IMPORT_JOB_PATH; static final String BATCH_IMPORT_JOB_PROFILES; static final String BATCH_IMPORT_JOB_DETAIL_SUFFIX; static final String BATCH_IMPORT_JOB_TRIGGER_SUFFIX; static final String BATCH_IMPORT_JOB_GROUP; }