use of com.google.cloud.scheduler.v1beta1.Job in project pentaho-platform by pentaho.
the class SchedulerResourceTest method testGetJob.
@Test
public void testGetJob() throws Exception {
String jobId = "jobId";
String asCronString = "asCronString";
Job mockJob = mock(Job.class);
doReturn(mockJob).when(schedulerResource.schedulerService).getJobInfo(jobId);
Response mockResponse = mock(Response.class);
doReturn(mockResponse).when(schedulerResource).buildOkResponse(mockJob);
Response testResponse = schedulerResource.getJob(jobId, asCronString);
assertEquals(mockResponse, testResponse);
verify(schedulerResource.schedulerService, times(1)).getJobInfo(jobId);
}
use of com.google.cloud.scheduler.v1beta1.Job in project pentaho-platform by pentaho.
the class RepositoryCleanerSystemListenerTest method doesNotRescheduleJob_IfFoundSame.
@Test
public void doesNotRescheduleJob_IfFoundSame() throws Exception {
final String oldJobId = "oldJobId";
Job oldJob = new Job();
oldJob.setJobTrigger(Frequency.WEEKLY.createTrigger());
oldJob.setJobId(oldJobId);
when(scheduler.getJobs(any(IJobFilter.class))).thenReturn(Collections.singletonList(oldJob));
prepareMp();
listener.setExecute(Frequency.WEEKLY.getValue());
assertTrue(listener.startup(null));
verify(scheduler, never()).removeJob(oldJobId);
verifyJobHaveNotCreated();
}
use of com.google.cloud.scheduler.v1beta1.Job in project pentaho-platform by pentaho.
the class RepositoryCleanerSystemListenerTest method removesJobs_WhenDisabled.
@Test
public void removesJobs_WhenDisabled() throws Exception {
final String jobId = "jobId";
Job job = new Job();
job.setJobId(jobId);
when(scheduler.getJobs(any(IJobFilter.class))).thenReturn(Collections.singletonList(job));
prepareMp();
listener.setGcEnabled(false);
assertTrue(listener.startup(null));
verifyJobRemoved(jobId);
}
use of com.google.cloud.scheduler.v1beta1.Job in project pentaho-platform by pentaho.
the class RepositoryCleanerSystemListenerTest method reschedulesJob_IfFoundDifferent.
@Test
public void reschedulesJob_IfFoundDifferent() throws Exception {
final String oldJobId = "oldJobId";
Job oldJob = new Job();
oldJob.setJobTrigger(new CronJobTrigger());
oldJob.setJobId(oldJobId);
when(scheduler.getJobs(any(IJobFilter.class))).thenReturn(Collections.singletonList(oldJob));
prepareMp();
listener.setExecute(Frequency.NOW.getValue());
assertTrue(listener.startup(null));
verifyJobRemoved(oldJobId);
verifyJobCreated(Frequency.NOW);
}
use of com.google.cloud.scheduler.v1beta1.Job 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(nullable(String.class));
doReturn(true).when(schedulerService).isScheduleAllowed();
doNothing().when(schedulerService.scheduler).resumeJob(nullable(String.class));
schedulerService.resumeJob("job-id");
}
Aggregations