use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerServiceTest method testResumeJob.
@Test
public void testResumeJob() throws SchedulerException {
Job job = mock(Job.class);
doReturn(job).when(schedulerService).getJob(anyString());
doReturn(true).when(schedulerService).isScheduleAllowed();
doNothing().when(schedulerService.scheduler).resumeJob(anyString());
doReturn(IScheduler.SchedulerStatus.RUNNING).when(schedulerService.scheduler).getStatus();
schedulerService.resumeJob("job-id");
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerServiceTest method testGetStateException.
@Test
public void testGetStateException() throws SchedulerException {
doThrow(new SchedulerException("")).when(schedulerService.scheduler).getStatus();
try {
schedulerService.getState();
fail();
} catch (SchedulerException e) {
// Should go here
}
verify(schedulerService.scheduler).getStatus();
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerServiceTest method testPauseException.
@Test
public void testPauseException() throws SchedulerException {
doReturn(true).when(schedulerService.policy).isAllowed(SchedulerAction.NAME);
doThrow(new SchedulerException("")).when(schedulerService.scheduler).pause();
try {
schedulerService.pause();
fail();
} catch (SchedulerException e) {
// Should go here
}
verify(schedulerService.policy).isAllowed(SchedulerAction.NAME);
verify(schedulerService.scheduler).pause();
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerServiceTest method testResumeJobException.
@Test
public void testResumeJobException() throws SchedulerException {
Job job = mock(Job.class);
doReturn(job).when(schedulerService).getJob(anyString());
doReturn(true).when(schedulerService).isScheduleAllowed();
doThrow(new SchedulerException("pause-exception")).when(schedulerService.scheduler).resumeJob(anyString());
try {
schedulerService.resumeJob("job-id");
} catch (SchedulerException e) {
assertEquals("pause-exception", e.getMessage());
}
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerServiceTest method testRemoveJobException.
@Test
public void testRemoveJobException() throws SchedulerException {
Job job = mock(Job.class);
doReturn(job).when(schedulerService).getJob(anyString());
doReturn(true).when(schedulerService).isScheduleAllowed();
doThrow(new SchedulerException("pause-exception")).when(schedulerService.scheduler).removeJob(anyString());
try {
schedulerService.removeJob("job-id");
} catch (SchedulerException e) {
assertEquals("pause-exception", e.getMessage());
}
}
Aggregations