use of org.pentaho.platform.web.http.api.resources.proxies.BlockStatusProxy in project pentaho-platform by pentaho.
the class SchedulerResourceTest method testGetBlockStatus.
@Test
public void testGetBlockStatus() throws Exception {
JobScheduleRequest mockJobScheduleRequest = mock(JobScheduleRequest.class);
BlockStatusProxy mockBlockStatusProxy = mock(BlockStatusProxy.class);
doReturn(mockBlockStatusProxy).when(schedulerResource.schedulerService).getBlockStatus(mockJobScheduleRequest);
Response mockResponse = mock(Response.class);
doReturn(mockResponse).when(schedulerResource).buildOkResponse(mockBlockStatusProxy);
Response testResponse = schedulerResource.getBlockStatus(mockJobScheduleRequest);
assertEquals(mockResponse, testResponse);
verify(schedulerResource.schedulerService, times(1)).getBlockStatus(mockJobScheduleRequest);
verify(schedulerResource, times(1)).buildOkResponse(mockBlockStatusProxy);
}
use of org.pentaho.platform.web.http.api.resources.proxies.BlockStatusProxy in project pentaho-platform by pentaho.
the class SchedulerServiceTest method testGetBlockStatus.
@Test
public void testGetBlockStatus() throws Exception {
JobScheduleRequest jobScheduleRequestMock = mock(JobScheduleRequest.class);
BlockStatusProxy blockStatusProxyMock = mock(BlockStatusProxy.class);
IJobTrigger jobTrigger = mock(IJobTrigger.class);
doReturn(jobTrigger).when(schedulerService).convertScheduleRequestToJobTrigger(jobScheduleRequestMock);
doReturn(true).when(schedulerService.blockoutManager).isPartiallyBlocked(jobTrigger);
doReturn(true).when(schedulerService.blockoutManager).willFire(jobTrigger);
doReturn(blockStatusProxyMock).when(schedulerService).getBlockStatusProxy(anyBoolean(), anyBoolean());
// Test 1
BlockStatusProxy blockStatusProxy = schedulerService.getBlockStatus(jobScheduleRequestMock);
assertNotNull(blockStatusProxy);
// Test 2
doReturn(false).when(schedulerService.blockoutManager).isPartiallyBlocked(jobTrigger);
blockStatusProxy = schedulerService.getBlockStatus(jobScheduleRequestMock);
assertNotNull(blockStatusProxy);
verify(schedulerService, times(2)).convertScheduleRequestToJobTrigger(jobScheduleRequestMock);
verify(schedulerService.blockoutManager, times(2)).isPartiallyBlocked(jobTrigger);
verify(schedulerService, times(2)).getBlockStatusProxy(anyBoolean(), anyBoolean());
verify(schedulerService.blockoutManager, times(1)).willFire(jobTrigger);
}
Aggregations