@Test public void testListJobs_noScheduler() { this.resource.scheduler = null; Assert.assertEquals( 0, this.resource.listJobs( null, null ).size()); }
@Override public List<ScheduledJob> listJobs( String appName, String cmdName ) { List<ScheduledJob> result = new ArrayList<> (); this.logger.fine( "Request: get all the scheduled jobs." ); try { if( appName == null && cmdName == null ) { result = this.scheduler.listJobs(); } else if( appName != null ) { for( ScheduledJob job : this.scheduler.listJobs()) { boolean cmdMatch = cmdName == null || cmdName.equals( job.getCmdName()); if( cmdMatch && appName.equals( job.getAppName())) result.add( job ); } } } catch( NullPointerException e ) { this.logger.warning( "Roboconf's scheduler is not available." ); } return result; }
SchedulerResource implements ISchedulerResource { @Override public List<ScheduledJob> listJobs( String appName, String cmdName ) { List<ScheduledJob> result = new ArrayList<> (); this.logger.fine( "Request: get all the scheduled jobs." ); try { if( appName == null && cmdName == null ) { result = this.scheduler.listJobs(); } else if( appName != null ) { for( ScheduledJob job : this.scheduler.listJobs()) { boolean cmdMatch = cmdName == null || cmdName.equals( job.getCmdName()); if( cmdMatch && appName.equals( job.getAppName())) result.add( job ); } } } catch( NullPointerException e ) { this.logger.warning( "Roboconf's scheduler is not available." ); } return result; } }
SchedulerResource implements ISchedulerResource { @Override public List<ScheduledJob> listJobs( String appName, String cmdName ) { List<ScheduledJob> result = new ArrayList<> (); this.logger.fine( "Request: get all the scheduled jobs." ); try { if( appName == null && cmdName == null ) { result = this.scheduler.listJobs(); } else if( appName != null ) { for( ScheduledJob job : this.scheduler.listJobs()) { boolean cmdMatch = cmdName == null || cmdName.equals( job.getCmdName()); if( cmdMatch && appName.equals( job.getAppName())) result.add( job ); } } } catch( NullPointerException e ) { this.logger.warning( "Roboconf's scheduler is not available." ); } return result; } SchedulerResource( Manager manager ); }
SchedulerResource implements ISchedulerResource { @Override public List<ScheduledJob> listJobs( String appName, String cmdName ) { List<ScheduledJob> result = new ArrayList<> (); this.logger.fine( "Request: get all the scheduled jobs." ); try { if( appName == null && cmdName == null ) { result = this.scheduler.listJobs(); } else if( appName != null ) { for( ScheduledJob job : this.scheduler.listJobs()) { boolean cmdMatch = cmdName == null || cmdName.equals( job.getCmdName()); if( cmdMatch && appName.equals( job.getAppName())) result.add( job ); } } } catch( NullPointerException e ) { this.logger.warning( "Roboconf's scheduler is not available." ); } 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 List<ScheduledJob> listJobs( String appName, String cmdName ) { List<ScheduledJob> result = new ArrayList<> (); this.logger.fine( "Request: get all the scheduled jobs." ); try { if( appName == null && cmdName == null ) { result = this.scheduler.listJobs(); } else if( appName != null ) { for( ScheduledJob job : this.scheduler.listJobs()) { boolean cmdMatch = cmdName == null || cmdName.equals( job.getCmdName()); if( cmdMatch && appName.equals( job.getAppName())) result.add( job ); } } } catch( NullPointerException e ) { this.logger.warning( "Roboconf's scheduler is not available." ); } 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 );  }