Search in sources :

Example 96 with Job

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);
}
Also used : Response(javax.ws.rs.core.Response) Job(org.pentaho.platform.api.scheduler2.Job) Test(org.junit.Test)

Example 97 with Job

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();
}
Also used : Response(javax.ws.rs.core.Response) Job(org.pentaho.platform.api.scheduler2.Job) Test(org.junit.Test)

Example 98 with Job

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);
}
Also used : Response(javax.ws.rs.core.Response) Job(org.pentaho.platform.api.scheduler2.Job) Test(org.junit.Test)

Example 99 with Job

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();
}
Also used : Job(org.pentaho.platform.api.scheduler2.Job) Test(org.junit.Test)

Example 100 with Job

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());
}
Also used : Job(org.pentaho.platform.api.scheduler2.Job) Test(org.junit.Test)

Aggregations

Job (org.pentaho.platform.api.scheduler2.Job)94 Test (org.junit.Test)69 Serializable (java.io.Serializable)25 SimpleJobTrigger (org.pentaho.platform.api.scheduler2.SimpleJobTrigger)21 HashMap (java.util.HashMap)20 ArrayList (java.util.ArrayList)19 JobScheduleRequest (org.pentaho.platform.web.http.api.resources.JobScheduleRequest)19 TranscoderServiceClient (com.google.cloud.video.transcoder.v1.TranscoderServiceClient)18 ComplexJobTrigger (org.pentaho.platform.api.scheduler2.ComplexJobTrigger)18 SchedulerException (org.pentaho.platform.api.scheduler2.SchedulerException)17 Date (java.util.Date)14 IJobFilter (org.pentaho.platform.api.scheduler2.IJobFilter)14 Job (com.google.cloud.video.transcoder.v1.Job)13 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)12 IJobTrigger (org.pentaho.platform.api.scheduler2.IJobTrigger)12 AudioStream (com.google.cloud.video.transcoder.v1.AudioStream)9 JobConfig (com.google.cloud.video.transcoder.v1.JobConfig)9 VideoStream (com.google.cloud.video.transcoder.v1.VideoStream)9 Map (java.util.Map)8 CronJobTrigger (org.pentaho.platform.api.scheduler2.CronJobTrigger)8