use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerResourceTest method testGetContentCleanerJobError.
@Test
public void testGetContentCleanerJobError() throws Exception {
SchedulerException mockSchedulerException = mock(SchedulerException.class);
doThrow(mockSchedulerException).when(schedulerResource.schedulerService).getContentCleanerJob();
try {
schedulerResource.getContentCleanerJob();
fail();
} catch (RuntimeException e) {
// correct
}
verify(schedulerResource.schedulerService, times(1)).getContentCleanerJob();
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerResourceTest method testPauseError.
@Test
public void testPauseError() throws Exception {
SchedulerException mockSchedulerException = mock(SchedulerException.class);
doThrow(mockSchedulerException).when(schedulerResource.schedulerService).pause();
try {
schedulerResource.pause();
fail();
} catch (RuntimeException e) {
// correct
}
verify(schedulerResource.schedulerService, times(1)).pause();
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerResourceTest method updateJob_Returns500_WhenSchedulerFails.
@Test
public void updateJob_Returns500_WhenSchedulerFails() throws Exception {
JobScheduleRequest request = new JobScheduleRequest();
when(schedulerResource.schedulerService.updateJob(request)).thenThrow(new SchedulerException(new RuntimeException("error")));
assertUpdateJob(request, INTERNAL_SERVER_ERROR, "error");
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerServiceTest method testStartException.
@Test
public void testStartException() throws SchedulerException {
doReturn(true).when(schedulerService.policy).isAllowed(SchedulerAction.NAME);
doThrow(new SchedulerException("")).when(schedulerService.scheduler).start();
try {
schedulerService.start();
fail();
} catch (SchedulerException e) {
// Should go here
}
verify(schedulerService.policy).isAllowed(SchedulerAction.NAME);
verify(schedulerService.scheduler).start();
}
use of org.pentaho.platform.api.scheduler2.SchedulerException in project pentaho-platform by pentaho.
the class SchedulerServiceTest method testGetBlockStatusException.
@Test
public void testGetBlockStatusException() throws Exception {
JobScheduleRequest jobScheduleRequestMock = mock(JobScheduleRequest.class);
doThrow(new SchedulerException("")).when(schedulerService).convertScheduleRequestToJobTrigger(jobScheduleRequestMock);
try {
schedulerService.getBlockStatus(jobScheduleRequestMock);
fail();
} catch (SchedulerException e) {
// Should catch the exception
}
verify(schedulerService).convertScheduleRequestToJobTrigger(jobScheduleRequestMock);
}
Aggregations