use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class ScheduleExportUtilTest method testCreateJobScheduleRequest_SimpleJobTrigger.
@Test
public void testCreateJobScheduleRequest_SimpleJobTrigger() throws Exception {
String jobName = "JOB";
Job job = mock(Job.class);
SimpleJobTrigger trigger = mock(SimpleJobTrigger.class);
when(job.getJobTrigger()).thenReturn(trigger);
when(job.getJobName()).thenReturn(jobName);
JobScheduleRequest jobScheduleRequest = ScheduleExportUtil.createJobScheduleRequest(job);
assertNotNull(jobScheduleRequest);
assertEquals(jobName, jobScheduleRequest.getJobName());
assertEquals(trigger, jobScheduleRequest.getSimpleJobTrigger());
}
use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class ScheduleExportUtilTest method testCreateJobScheduleRequest_CronJobTrigger.
@Test
public void testCreateJobScheduleRequest_CronJobTrigger() throws Exception {
String jobName = "JOB";
Job job = mock(Job.class);
CronJobTrigger trigger = mock(CronJobTrigger.class);
when(job.getJobTrigger()).thenReturn(trigger);
when(job.getJobName()).thenReturn(jobName);
JobScheduleRequest jobScheduleRequest = ScheduleExportUtil.createJobScheduleRequest(job);
assertNotNull(jobScheduleRequest);
assertEquals(jobName, jobScheduleRequest.getJobName());
assertEquals(trigger, jobScheduleRequest.getCronJobTrigger());
}
use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class ScheduleExportUtilTest method testCreateJobScheduleRequest_StreamProviderJobParam.
@Test
public void testCreateJobScheduleRequest_StreamProviderJobParam() throws Exception {
String jobName = "JOB";
String inputPath = "/input/path/to/file.ext";
String outputPath = "/output/path/location.*";
Map<String, Serializable> params = new HashMap<>();
RepositoryFileStreamProvider streamProvider = mock(RepositoryFileStreamProvider.class);
params.put(QuartzScheduler.RESERVEDMAPKEY_STREAMPROVIDER, streamProvider);
Job job = mock(Job.class);
CronJobTrigger trigger = mock(CronJobTrigger.class);
when(job.getJobTrigger()).thenReturn(trigger);
when(job.getJobName()).thenReturn(jobName);
when(job.getJobParams()).thenReturn(params);
when(streamProvider.getInputFilePath()).thenReturn(inputPath);
when(streamProvider.getOutputFilePath()).thenReturn(outputPath);
JobScheduleRequest jobScheduleRequest = ScheduleExportUtil.createJobScheduleRequest(job);
assertEquals(inputPath, jobScheduleRequest.getInputFile());
assertEquals(outputPath, jobScheduleRequest.getOutputFile());
assertEquals(0, jobScheduleRequest.getJobParameters().size());
}
use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class GatherStatsListenerTest method testStartUp.
@Test
public void testStartUp() throws Exception {
PentahoSystem.registerObject(scheduler);
Job job = mock(Job.class);
when(scheduler.createJob(eq("Gather Stats"), eq(GatherStatsAction.class), eq(gatherStatsListener.jobMap), any(JobTrigger.class))).thenReturn(job);
boolean startup = gatherStatsListener.startup(session);
assertTrue(startup);
assertEquals(1, gatherStatsListener.jobMap.size());
assertEquals(gatherStatsListener.getTransFileName(), gatherStatsListener.jobMap.get("transFileName"));
assertEquals(101, gatherStatsListener.getIntervalInSeconds());
verify(scheduler).createJob(eq("Gather Stats"), eq(GatherStatsAction.class), eq(gatherStatsListener.jobMap), any(JobTrigger.class));
}
use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.
the class QuartzSchedulerTest method testSetJobNextRunToNullDate.
@Test
public void testSetJobNextRunToNullDate() {
Trigger trigger = Mockito.mock(Trigger.class);
Job job = new Job();
QuartzScheduler quartzScheduler = new QuartzScheduler();
long nowDate = new Date().getTime();
Mockito.when(trigger.getNextFireTime()).thenReturn(null);
Mockito.when(trigger.getFireTimeAfter(any())).thenReturn(new Date(nowDate));
quartzScheduler.setJobNextRun(job, trigger);
assertEquals(null, job.getNextRun());
}
Aggregations