Search in sources :

Example 11 with CronJobTrigger

use of org.pentaho.platform.api.scheduler2.CronJobTrigger in project pentaho-platform by pentaho.

the class ScheduleExportUtilTest method testCreateJobScheduleRequest_TimeZoneJobParam.

@Test
public void testCreateJobScheduleRequest_TimeZoneJobParam() throws Exception {
    String jobName = "JOB";
    String timeZone = "America/New_York";
    Map<String, Serializable> params = new HashMap<>();
    params.put(IBlockoutManager.TIME_ZONE_PARAM, timeZone);
    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);
    JobScheduleRequest jobScheduleRequest = ScheduleExportUtil.createJobScheduleRequest(job);
    assertEquals(timeZone, jobScheduleRequest.getTimeZone());
    assertEquals(timeZone, jobScheduleRequest.getJobParameters().get(0).getValue());
}
Also used : Serializable(java.io.Serializable) HashMap(java.util.HashMap) Job(org.pentaho.platform.api.scheduler2.Job) JobScheduleRequest(org.pentaho.platform.web.http.api.resources.JobScheduleRequest) CronJobTrigger(org.pentaho.platform.api.scheduler2.CronJobTrigger) Test(org.junit.Test)

Aggregations

CronJobTrigger (org.pentaho.platform.api.scheduler2.CronJobTrigger)11 Test (org.junit.Test)10 Job (org.pentaho.platform.api.scheduler2.Job)8 JobScheduleRequest (org.pentaho.platform.web.http.api.resources.JobScheduleRequest)8 Serializable (java.io.Serializable)7 HashMap (java.util.HashMap)6 JobScheduleParam (org.pentaho.platform.web.http.api.resources.JobScheduleParam)4 IJobTrigger (org.pentaho.platform.api.scheduler2.IJobTrigger)3 SimpleJobTrigger (org.pentaho.platform.api.scheduler2.SimpleJobTrigger)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Map (java.util.Map)2 Matchers.anyString (org.mockito.Matchers.anyString)2 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)2 ComplexJobTrigger (org.pentaho.platform.api.scheduler2.ComplexJobTrigger)2 IBackgroundExecutionStreamProvider (org.pentaho.platform.api.scheduler2.IBackgroundExecutionStreamProvider)2 ComplexJobTriggerProxy (org.pentaho.platform.web.http.api.resources.ComplexJobTriggerProxy)2 RepositoryFileStreamProvider (org.pentaho.platform.web.http.api.resources.RepositoryFileStreamProvider)2 SchedulerOutputPathResolver (org.pentaho.platform.web.http.api.resources.SchedulerOutputPathResolver)2 IJobFilter (org.pentaho.platform.api.scheduler2.IJobFilter)1