Package org.pentaho.platform.api.scheduler2

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


    doReturn( true ).when( schedulerResource.schedulerService ).isScheduleAllowed();

    JobRequest mockJobRequest = mock( JobRequest.class );
    doReturn( mockJobRequest ).when( schedulerResource ).getJobRequest();

    Job mockJob = mock( Job.class );
    doReturn( mockJob ).when( schedulerResource.schedulerService ).updateBlockout( jobId, mockJobScheduleRequest );

    doReturn( jobId ).when( mockJob ).getJobId();

    Response mockResponse = mock( Response.class );
View Full Code Here


  public Job unmarshal( JaxbSafeJob jaxbSafeJob ) throws Exception {
    if ( jaxbSafeJob == null ) {
      return null;
    }

    Job job = new Job();
    try {
      job.setJobTrigger( jaxbSafeJob.jobTrigger );
      job.setJobParams( toProperMap( jaxbSafeJob.jobParams ) );
      job.setLastRun( jaxbSafeJob.lastRun );
      job.setNextRun( jaxbSafeJob.nextRun );
      job.setSchedulableClass( jaxbSafeJob.schedulableClass );
      job.setJobId( jaxbSafeJob.jobId );
      job.setUserName( jaxbSafeJob.userName );
      job.setJobName( jaxbSafeJob.jobName );
      job.setState( jaxbSafeJob.state );
    } catch ( Throwable t ) {
      // no message bundle since this is a development error case
      logger.error( "Error unmarshalling job", t ); //$NON-NLS-1$
      return null;
    }
View Full Code Here

  }

  @Override
  public IJobTrigger getBlockOut( String blockOutJobId ) {
    try {
      Job blockOutJob = this.scheduler.getJob( blockOutJobId );
      IJobTrigger blockOutJobTrigger = blockOutJob.getJobTrigger();
      blockOutJobTrigger.setDuration( ( (Number) blockOutJob.getJobParams().get( DURATION_PARAM ) ).longValue() );
      return blockOutJobTrigger;
    } catch ( SchedulerException e ) {
      throw new RuntimeException( e );
    }
  }
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

TOP

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

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.