Package org.fao.geonet.services.harvesting

Examples of org.fao.geonet.services.harvesting.Util$Job


  public Response removeJob( JobRequest jobRequest ) {
    try {
      if ( schedulerService.removeJob( jobRequest.getJobId() ) ) {
        return buildPlainTextOkResponse( "REMOVED" );
      }
      Job job = schedulerService.getJob( jobRequest.getJobId() );
      return buildPlainTextOkResponse( job.getState().name() );
    } catch ( SchedulerException e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here


      @ResponseCode ( code = 200, condition = "Successful operation." ),
      @ResponseCode ( code = 401, condition = "User is not authorized to create blockout." )
  } )
  public Response addBlockout( JobScheduleRequest jobScheduleRequest ) {
    try {
      Job job = schedulerService.addBlockout( jobScheduleRequest );
      return buildPlainTextOkResponse( job.getJobId() );
    } catch ( IOException e ) {
      return buildStatusResponse( UNAUTHORIZED );
    } catch ( SchedulerException e ) {
      return buildStatusResponse( UNAUTHORIZED );
    } catch ( IllegalAccessException e ) {
View Full Code Here

      @ResponseCode ( code = 200, condition = "Successful operation." ),
      @ResponseCode ( code = 401, condition = "User is not authorized to update blockout." )
  } )
  public Response updateBlockout( @QueryParam ( "jobid" ) String jobId, JobScheduleRequest jobScheduleRequest ) {
    try {
      Job job = schedulerService.updateBlockout( jobId, jobScheduleRequest );
      return buildPlainTextOkResponse( job.getJobId() );
    } catch ( IOException e ) {
      return buildStatusResponse( Status.UNAUTHORIZED );
    } catch ( SchedulerException e ) {
      return buildStatusResponse( Status.UNAUTHORIZED );
    } catch ( IllegalAccessException e ) {
View Full Code Here

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

    Job mockJob = mock( Job.class );
    doReturn( mockJob ).when( schedulerResource.schedulerService ).createJob( mockRequest );

    String jobId = "jobId";
    doReturn( jobId ).when( mockJob ).getJobId();
View Full Code Here

    JobRequest mockJobRequest = mock( JobRequest.class );

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

    Job mockJob = mock( Job.class );
    doReturn( mockJob ).when( schedulerResource.schedulerService ).triggerNow( jobId );

    Job.JobState mockJobState = Job.JobState.BLOCKED;
    doReturn( mockJobState ).when( mockJob ).getState();
View Full Code Here

    verify( schedulerResource.schedulerService, times( 1 ) ).triggerNow( jobId );
  }

  @Test
  public void testGetContentCleanerJob() throws Exception {
    Job mockJob = mock( Job.class );
    doReturn( mockJob ).when( schedulerResource.schedulerService ).getContentCleanerJob();

    Job testJob = schedulerResource.getContentCleanerJob();
    assertEquals( mockJob, testJob );

    verify( schedulerResource.schedulerService, times( 1 ) ).getContentCleanerJob();
  }
View Full Code Here

    JobRequest mockJobRequest = mock( JobRequest.class );

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

    Job mockJob = mock( Job.class );
    doReturn( mockJob ).when( schedulerResource.schedulerService ).getJob( jobId );

    Job.JobState mockJobState = Job.JobState.BLOCKED;
    doReturn( mockJobState ).when( mockJob ).getState();
View Full Code Here

  @Test
  public void testGetJob() throws Exception {
    String jobId = "jobId";
    String asCronString = "asCronString";

    Job mockJob = mock( Job.class );
    doReturn( mockJob ).when( schedulerResource.schedulerService ).getJobInfo( jobId );

    Job testJob = schedulerResource.getJob( jobId, asCronString );
    assertEquals( mockJob, testJob );

    verify( schedulerResource.schedulerService, times( 1 ) ).getJobInfo( jobId );
  }
View Full Code Here

  @Test
  public void testAddBlockout() throws Exception {
    JobScheduleRequest mockJobScheduleRequest = mock( JobScheduleRequest.class );

    Job mockJob = mock( Job.class );
    doReturn( mockJob ).when( schedulerResource.schedulerService ).addBlockout( mockJobScheduleRequest );

    String jobId = "jobId";
    doReturn( jobId ).when( mockJob ).getJobId();
View Full Code Here

    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

TOP

Related Classes of org.fao.geonet.services.harvesting.Util$Job

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.