@Test public void testGetJobDetails_notFound() { Response resp = this.resource.findJobProperties( "job" ); Assert.assertEquals( Status.NOT_FOUND.getStatusCode(), resp.getStatus()); }
@Override public Response findJobProperties( String jobName ) { Response result; this.logger.fine( "Request: get the details of job " + jobName + "." ); try { ScheduledJob job = this.scheduler.findJobProperties( jobName ); if( job == null ) { result = handleError( Status.NOT_FOUND, new RestError( ErrorCode.REST_INEXISTING, ErrorDetails.name( jobName )), lang( this.manager )).build(); } else { result = Response.ok( job ).build(); } } catch( NullPointerException e ) { result = handleError( Status.FORBIDDEN, new RestError( ErrorCode.REST_SCHEDULER_IS_UNAVAILABLE, e, ErrorDetails.name( jobName )), lang( this.manager )).build(); } return result; }
SchedulerResource implements ISchedulerResource { @Override public Response findJobProperties( String jobName ) { Response result; this.logger.fine( "Request: get the details of job " + jobName + "." ); try { ScheduledJob job = this.scheduler.findJobProperties( jobName ); if( job == null ) { result = handleError( Status.NOT_FOUND, new RestError( ErrorCode.REST_INEXISTING, ErrorDetails.name( jobName )), lang( this.manager )).build(); } else { result = Response.ok( job ).build(); } } catch( NullPointerException e ) { result = handleError( Status.FORBIDDEN, new RestError( ErrorCode.REST_SCHEDULER_IS_UNAVAILABLE, e, ErrorDetails.name( jobName )), lang( this.manager )).build(); } return result; } }
SchedulerResource implements ISchedulerResource { @Override public Response findJobProperties( String jobName ) { Response result; this.logger.fine( "Request: get the details of job " + jobName + "." ); try { ScheduledJob job = this.scheduler.findJobProperties( jobName ); if( job == null ) { result = handleError( Status.NOT_FOUND, new RestError( ErrorCode.REST_INEXISTING, ErrorDetails.name( jobName )), lang( this.manager )).build(); } else { result = Response.ok( job ).build(); } } catch( NullPointerException e ) { result = handleError( Status.FORBIDDEN, new RestError( ErrorCode.REST_SCHEDULER_IS_UNAVAILABLE, e, ErrorDetails.name( jobName )), lang( this.manager )).build(); } return result; } SchedulerResource( Manager manager ); }
SchedulerResource implements ISchedulerResource { @Override public Response findJobProperties( String jobName ) { Response result; this.logger.fine( "Request: get the details of job " + jobName + "." ); try { ScheduledJob job = this.scheduler.findJobProperties( jobName ); if( job == null ) { result = handleError( Status.NOT_FOUND, new RestError( ErrorCode.REST_INEXISTING, ErrorDetails.name( jobName )), lang( this.manager )).build(); } else { result = Response.ok( job ).build(); } } catch( NullPointerException e ) { result = handleError( Status.FORBIDDEN, new RestError( ErrorCode.REST_SCHEDULER_IS_UNAVAILABLE, e, ErrorDetails.name( jobName )), lang( this.manager )).build(); } return result; } SchedulerResource( Manager manager ); @Override Response saveJob( String jobId, String jobName, String appName, String cmdName, String cron ); @Override Response deleteJob( String jobName ); @Override Response findJobProperties( String jobName ); @Override List<ScheduledJob> listJobs( String appName, String cmdName ); void setScheduler( IScheduler scheduler ); }
SchedulerResource implements ISchedulerResource { @Override public Response findJobProperties( String jobName ) { Response result; this.logger.fine( "Request: get the details of job " + jobName + "." ); try { ScheduledJob job = this.scheduler.findJobProperties( jobName ); if( job == null ) { result = handleError( Status.NOT_FOUND, new RestError( ErrorCode.REST_INEXISTING, ErrorDetails.name( jobName )), lang( this.manager )).build(); } else { result = Response.ok( job ).build(); } } catch( NullPointerException e ) { result = handleError( Status.FORBIDDEN, new RestError( ErrorCode.REST_SCHEDULER_IS_UNAVAILABLE, e, ErrorDetails.name( jobName )), lang( this.manager )).build(); } return result; } SchedulerResource( Manager manager ); @Override Response saveJob( String jobId, String jobName, String appName, String cmdName, String cron ); @Override Response deleteJob( String jobName ); @Override Response findJobProperties( String jobName ); @Override List<ScheduledJob> listJobs( String appName, String cmdName ); void setScheduler( IScheduler scheduler );  }