Package org.pentaho.platform.api.scheduler2

Examples of org.pentaho.platform.api.scheduler2.ComplexJobTrigger


    } catch ( org.quartz.SchedulerException e ) {
      throw new SchedulerException( Messages.getInstance().getString(
          "QuartzScheduler.ERROR_0001_FAILED_TO_SCHEDULE_JOB", jobName ), e ); //$NON-NLS-1$
    }

    Job job = new Job();
    job.setJobParams( jobParams );
    job.setJobTrigger( (JobTrigger) trigger );
    job.setNextRun( quartzTrigger.getNextFireTime() );
    job.setLastRun( quartzTrigger.getPreviousFireTime() );
    job.setJobId( jobId.toString() );
    job.setJobName( jobName );
    job.setUserName( curUser );
    job.setState( JobState.NORMAL );

    return job;
  }
View Full Code Here


      @ResponseCode ( code = 200, condition = "Successfully paused the job." ),
      @ResponseCode ( code = 500, condition = "Invalid jobId." )
  } )
  public Response pauseJob( JobRequest jobRequest ) {
    try {
      JobState state = schedulerService.pauseJob( jobRequest.getJobId() );
      return buildPlainTextOkResponse( state.name() );
    } catch ( SchedulerException e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

      @ResponseCode ( code = 200, condition = "Successfully resumed the job." ),
      @ResponseCode ( code = 500, condition = "Invalid jobId." )
  } )
  public Response resumeJob( JobRequest jobRequest ) {
    try {
      JobState state = schedulerService.resumeJob( jobRequest.getJobId() );
      return buildPlainTextOkResponse( state.name() );
    } catch ( SchedulerException e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

  }

  private void scheduleJob( int intervalInSeconds ) throws Exception {

    IScheduler scheduler = PentahoSystem.get( IScheduler.class, "IScheduler2", null ); //$NON-NLS-1$
    JobTrigger trigger = new SimpleJobTrigger( new Date(), null, -1, intervalInSeconds );

    jobMap.put( "transFileName", getTransFileName() );
    scheduler.createJob( GatherStatsListener.JOB_NAME, GatherStatsAction.class, jobMap, trigger );
    logger.info( "Statistics gathering jop has been scheduled." );
  }
View Full Code Here

    deleteJobIfNecessary();

    Map<String, Serializable> parms = new HashMap<String, Serializable>();
    parms.put( VersionCheckerAction.VERSION_REQUEST_FLAGS, new Integer( versionRequestFlags ) );
    JobTrigger trigger = new SimpleJobTrigger( new Date(), null, -1, repeatSeconds );
    scheduler.createJob( EmbeddedVersionCheckSystemListener.VERSION_CHECK_JOBNAME, VersionCheckerAction.class, parms,
        trigger );
  }
View Full Code Here

  @Test
  public void testCreateJobError() throws Exception {
    JobScheduleRequest mockRequest = mock( JobScheduleRequest.class );

    SchedulerException mockSchedulerException = mock( SchedulerException.class );

    Throwable mockSchedulerExceptionCause = mock( Throwable.class );
    doReturn( mockSchedulerExceptionCause ).when( mockSchedulerException ).getCause();

    String schedulerExceptionMessage = "schedulerExceptionMessage";
View Full Code Here

    JobRequest mockJobRequest = mock( JobRequest.class );

    String jobId = "jobId";
    doReturn( jobId ).when( mockJobRequest ).getJobId();

    SchedulerException mockSchedulerException = mock( SchedulerException.class );
    doThrow( mockSchedulerException ).when( schedulerResource.schedulerService ).triggerNow( jobId );

    try {
      schedulerResource.triggerNow( mockJobRequest );
      fail();
View Full Code Here

    verify( schedulerResource.schedulerService, times( 1 ) ).getContentCleanerJob();
  }

  @Test
  public void testGetContentCleanerJobError() throws Exception {
    SchedulerException mockSchedulerException = mock( SchedulerException.class );
    doThrow( mockSchedulerException ).when( schedulerResource.schedulerService ).getContentCleanerJob();

    try {
      schedulerResource.getContentCleanerJob();
      fail();
View Full Code Here

  @Test
  public void testGetJobsError() throws Exception {
    Boolean asCronString = Boolean.FALSE;

    SchedulerException mockSchedulerException = mock( SchedulerException.class );
    doThrow( mockSchedulerException ).when( schedulerResource.schedulerService ).getJobs();

    try {
      schedulerResource.getJobs( asCronString );
      fail();
View Full Code Here

    verify( schedulerResource, times( 1 ) ).buildPlainTextOkResponse( state );
  }

  @Test
  public void testGetStateError() throws Exception {
    SchedulerException mockSchedulerException = mock( SchedulerException.class );
    doThrow( mockSchedulerException ).when( schedulerResource.schedulerService ).getState();

    try {
      schedulerResource.getState();
      fail();
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.scheduler2.ComplexJobTrigger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.