use of com.google.cloud.video.transcoder.v1.Job in project pentaho-platform by pentaho.
the class SchedulerResourceTest method testAddBlockout.
@Test
public void testAddBlockout() throws Exception {
JobScheduleRequest mockJobScheduleRequest = mock(JobScheduleRequest.class);
Job mockJob = mock(Job.class);
doReturn(mockJob).when(schedulerResource.schedulerService).addBlockout(mockJobScheduleRequest);
String jobId = "jobId";
doReturn(jobId).when(mockJob).getJobId();
Response mockJobResponse = mock(Response.class);
doReturn(mockJobResponse).when(schedulerResource).buildPlainTextOkResponse(jobId);
Response testResponse = schedulerResource.addBlockout(mockJobScheduleRequest);
assertEquals(mockJobResponse, testResponse);
verify(schedulerResource.schedulerService, times(1)).addBlockout(mockJobScheduleRequest);
verify(mockJob, times(1)).getJobId();
verify(schedulerResource, times(1)).buildPlainTextOkResponse(jobId);
}
use of com.google.cloud.video.transcoder.v1.Job in project pentaho-platform by pentaho.
the class SchedulerResourceTest method testUpdateBlockout.
@Test
public void testUpdateBlockout() throws Exception {
String jobId = "jobId";
JobScheduleRequest mockJobScheduleRequest = mock(JobScheduleRequest.class);
doReturn(true).when(schedulerResource.schedulerService).isScheduleAllowed();
JobRequest mockJobRequest = mock(JobRequest.class);
doReturn(mockJobRequest).when(schedulerResource).getJobRequest();
Job mockJob = mock(Job.class);
doReturn(mockJob).when(schedulerResource.schedulerService).updateBlockout(jobId, mockJobScheduleRequest);
doReturn(jobId).when(mockJob).getJobId();
Response mockResponse = mock(Response.class);
doReturn(mockResponse).when(schedulerResource).buildPlainTextOkResponse(jobId);
Response testResponse = schedulerResource.updateBlockout(jobId, mockJobScheduleRequest);
assertEquals(mockResponse, testResponse);
verify(schedulerResource.schedulerService, times(1)).updateBlockout(jobId, mockJobScheduleRequest);
verify(mockJob, times(1)).getJobId();
}
use of com.google.cloud.video.transcoder.v1.Job in project pentaho-platform by pentaho.
the class SchedulerResourceTest method testCreateJob.
@Test
public void testCreateJob() throws Exception {
JobScheduleRequest mockRequest = mock(JobScheduleRequest.class);
Job mockJob = mock(Job.class);
doReturn(mockJob).when(schedulerResource.schedulerService).createJob(mockRequest);
String jobId = "jobId";
doReturn(jobId).when(mockJob).getJobId();
Response mockResponse = mock(Response.class);
doReturn(mockResponse).when(schedulerResource).buildPlainTextOkResponse(jobId);
Response testResponse = schedulerResource.createJob(mockRequest);
assertEquals(mockResponse, testResponse);
verify(schedulerResource.schedulerService, times(1)).createJob(mockRequest);
verify(mockJob, times(1)).getJobId();
verify(schedulerResource, times(1)).buildPlainTextOkResponse(jobId);
}
use of com.google.cloud.video.transcoder.v1.Job in project pentaho-platform by pentaho.
the class SchedulerResourceTest method testGetContentCleanerJob.
@Test
public void testGetContentCleanerJob() throws Exception {
Job mockJob = mock(Job.class);
doReturn(mockJob).when(schedulerResource.schedulerService).getContentCleanerJob();
Job testJob = schedulerResource.getContentCleanerJob();
assertEquals(mockJob, testJob);
verify(schedulerResource.schedulerService, times(1)).getContentCleanerJob();
}
use of com.google.cloud.video.transcoder.v1.Job in project pentaho-platform by pentaho.
the class SchedulerResourceTest method updateJob_ReturnsJobId.
@Test
public void updateJob_ReturnsJobId() throws Exception {
JobScheduleRequest request = new JobScheduleRequest();
Job job = new Job();
job.setJobId("job-id");
when(schedulerResource.schedulerService.updateJob(request)).thenReturn(job);
assertUpdateJob(request, OK, job.getJobId());
}
Aggregations