use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class EmbeddedVersionCheckSystemListenerIT method init.
@Before
public void init() throws SchedulerException, PlatformInitializationException {
MicroPlatform mp = new MicroPlatform();
mp.define(IPluginManager.class, TstPluginManager.class);
mp.define("IScheduler2", TestQuartzScheduler.class);
mp.define(IUserRoleListService.class, StubUserRoleListService.class);
mp.define(UserDetailsService.class, StubUserDetailsService.class);
mp.start();
scheduler = PentahoSystem.get(IScheduler.class, "IScheduler2", null);
scheduler.start();
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class JaxWsSchedulerServiceIT method testGetJobs.
@SuppressWarnings("unchecked")
@Test
public void testGetJobs() throws SchedulerException {
scheduler.pause();
schedulerSvc.createSimpleJob("testGetJobsJob", generateFullJobParams(), JobTrigger.ONCE_NOW);
Job[] serviceJobs = schedulerSvc.getJobs();
//
// First make sure the actual scheduler engine can find the newly created job
//
List<Job> engineJobs = scheduler.getJobs(new IJobFilter() {
public boolean accept(Job job) {
return job.getJobName().contains("testGetJobsJob");
}
});
Assert.assertEquals("The scheduler engine does not know about the job.", 1, engineJobs.size());
Job engineJob = engineJobs.get(0);
//
// Now make sure we have the same job available on the webservice client side
//
Assert.assertEquals("The scheduler service does not know about the job.", 1, serviceJobs.length);
Job serviceJob = schedulerSvc.getJobs()[0];
Assert.assertEquals("jobName is wrong", engineJob.getJobName(), serviceJob.getJobName());
Map<String, Serializable> params = serviceJob.getJobParams();
Assert.assertTrue("string job parameter is wrong", "testStringValue".equals(params.get("stringParam")));
Assert.assertTrue("list job parameter is missing", params.containsKey("listParam"));
Assert.assertTrue("map job parameter is missing", params.containsKey("mapParam"));
Assert.assertTrue("list job parameter is wrong type. Expected List but is " + params.get("listParam").getClass().getName(), params.get("listParam") instanceof List);
Assert.assertTrue("map job parameter is wrong type. Expected Map but is " + params.get("mapParam").getClass().getName(), params.get("mapParam") instanceof Map);
List<String> listParam = (List<String>) params.get("listParam");
Assert.assertTrue("list job parameter has wrong value", "testListVal0".equals(listParam.get(0)));
Assert.assertTrue("list job parameter has wrong value", "testListVal1".equals(listParam.get(1)));
Map<String, String> mapParam = (Map<String, String>) params.get("mapParam");
Assert.assertTrue("map job parameter has wrong value", "testMapVal0".equals(mapParam.get("testMapKey0")));
Assert.assertTrue("map job parameter has wrong value", "testMapVal1".equals(mapParam.get("testMapKey1")));
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class QuartzScheduler method shutdown.
/**
* {@inheritDoc}
*/
public void shutdown() throws SchedulerException {
try {
boolean waitForJobsToComplete = true;
getQuartzScheduler().shutdown(waitForJobsToComplete);
setQuartzScheduler(null);
} catch (org.quartz.SchedulerException e) {
throw new SchedulerException(e);
}
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class QuartzScheduler method removeJob.
/**
* {@inheritDoc}
*/
public void removeJob(String jobId) throws SchedulerException {
try {
Scheduler scheduler = getQuartzScheduler();
scheduler.deleteJob(jobId, QuartzJobKey.parse(jobId).getUserName());
} catch (org.quartz.SchedulerException e) {
throw new SchedulerException(Messages.getInstance().getString("QuartzScheduler.ERROR_0005_FAILED_TO_PAUSE_JOBS"), // $NON-NLS-1$
e);
}
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class QuartzScheduler method pauseJob.
/**
* {@inheritDoc}
*/
public void pauseJob(String jobId) throws SchedulerException {
try {
Scheduler scheduler = getQuartzScheduler();
scheduler.pauseJob(jobId, QuartzJobKey.parse(jobId).getUserName());
} catch (org.quartz.SchedulerException e) {
throw new SchedulerException(Messages.getInstance().getString("QuartzScheduler.ERROR_0005_FAILED_TO_PAUSE_JOBS"), // $NON-NLS-1$
e);
}
}
Aggregations