SchedulerResourceUtil { public static void updateStartDateForTimeZone( JobScheduleRequest request ) { if ( request.getSimpleJobTrigger() != null ) { if ( request.getSimpleJobTrigger().getStartTime() != null ) { Date origStartDate = request.getSimpleJobTrigger().getStartTime(); Date serverTimeZoneStartDate = convertDateToServerTimeZone( origStartDate, request.getTimeZone() ); request.getSimpleJobTrigger().setStartTime( serverTimeZoneStartDate ); } } else if ( request.getComplexJobTrigger() != null ) { if ( request.getComplexJobTrigger().getStartTime() != null ) { Date origStartDate = request.getComplexJobTrigger().getStartTime(); Date serverTimeZoneStartDate = convertDateToServerTimeZone( origStartDate, request.getTimeZone() ); request.getComplexJobTrigger().setStartTime( serverTimeZoneStartDate ); } } else if ( request.getCronJobTrigger() != null ) { if ( request.getCronJobTrigger().getStartTime() != null ) { Date origStartDate = request.getCronJobTrigger().getStartTime(); Date serverTimeZoneStartDate = convertDateToServerTimeZone( origStartDate, request.getTimeZone() ); request.getCronJobTrigger().setStartTime( serverTimeZoneStartDate ); } } }  static IJobTrigger convertScheduleRequestToJobTrigger( JobScheduleRequest scheduleRequest,
                                                                IScheduler scheduler ); static void updateStartDateForTimeZone( JobScheduleRequest request ); static Date convertDateToServerTimeZone( Date dateTime, String timeZone ); static HashMap<String, Serializable> handlePDIScheduling( RepositoryFile file,
                                                                   HashMap<String, Serializable> parameterMap, Map<String, String> pdiParameters ); static boolean isPdiFile( RepositoryFile file ); static boolean isTransformation( RepositoryFile file ); static boolean isJob( RepositoryFile file ); static String resolveActionId( final String inputFile ); static String getExtension( final String filename ); static final String RESERVEDMAPKEY_LINEAGE_ID; static final String RESERVED_BACKGROUND_EXECUTION_ACTION_ID; }
@Test public void testUpdateStartDateForTimeZone_simple() throws Exception { SimpleJobTrigger sjt = new SimpleJobTrigger(); sjt.setStartTime( now ); when( scheduleRequest.getSimpleJobTrigger() ).thenReturn( sjt ); when( scheduleRequest.getTimeZone() ).thenReturn( "GMT" ); long gmtTime = now.getTime() + TimeZone.getTimeZone( "EST" ).getRawOffset(); SchedulerResourceUtil.updateStartDateForTimeZone( scheduleRequest ); assertEquals( gmtTime, scheduleRequest.getSimpleJobTrigger().getStartTime().getTime() ); }
@Test public void testUpdateStartDateForTimeZone_complex() throws Exception { ComplexJobTriggerProxy t = new ComplexJobTriggerProxy(); t.setStartTime( now ); when( scheduleRequest.getComplexJobTrigger() ).thenReturn( t ); when( scheduleRequest.getTimeZone() ).thenReturn( "GMT" ); long gmtTime = now.getTime() + TimeZone.getTimeZone( "EST" ).getRawOffset(); SchedulerResourceUtil.updateStartDateForTimeZone( scheduleRequest ); assertEquals( gmtTime, scheduleRequest.getComplexJobTrigger().getStartTime().getTime() ); }
@Test public void testUpdateStartDateForTimeZone_cron() throws Exception { CronJobTrigger t = new CronJobTrigger(); t.setStartTime( now ); when( scheduleRequest.getCronJobTrigger() ).thenReturn( t ); when( scheduleRequest.getTimeZone() ).thenReturn( "GMT" ); long gmtTime = now.getTime() + TimeZone.getTimeZone( "EST" ).getRawOffset(); SchedulerResourceUtil.updateStartDateForTimeZone( scheduleRequest ); assertEquals( gmtTime, scheduleRequest.getCronJobTrigger().getStartTime().getTime() ); }