SchedulerService { public List<Job> getJobs() throws SchedulerException { IPentahoSession session = getSession(); final String principalName = session.getName(); final Boolean canAdminister = canAdminister( session ); List<Job> jobs = getScheduler().getJobs( new IJobFilter() { @Override public boolean accept( Job job ) { if ( canAdminister ) { return !IBlockoutManager.BLOCK_OUT_JOB_NAME.equals( job.getJobName() ); } return principalName.equals( job.getUserName() ); } } ); return jobs; }  Job createJob( JobScheduleRequest scheduleRequest ); Job updateJob( JobScheduleRequest scheduleRequest ); Job triggerNow( String jobId ); Job getContentCleanerJob(); List<RepositoryFileDto> doGetGeneratedContentForSchedule( String lineageId ); Job getJob( String jobId ); boolean isScheduleAllowed(); boolean isScheduleAllowed( String id ); IJobFilter getJobFilter( boolean canAdminister, String principalName ); String doGetCanSchedule(); String getState(); String start(); String pause(); String shutdown(); JobState pauseJob( String jobId ); JobState resumeJob( String jobId ); boolean removeJob( String jobId ); Job getJobInfo( String jobId ); List<Job> getBlockOutJobs(); boolean hasBlockouts(); boolean willFire( IJobTrigger trigger ); boolean shouldFireNow(); Job addBlockout( JobScheduleRequest jobScheduleRequest ); Job updateBlockout( String jobId, JobScheduleRequest jobScheduleRequest ); BlockStatusProxy getBlockStatus( JobScheduleRequest jobScheduleRequest ); JobScheduleRequest getJobInfo(); JobState getJobState( JobRequest jobRequest ); Class<IAction> getAction( String actionClass ); IUnifiedRepository getRepository(); IScheduler getScheduler(); IAuthorizationPolicy getPolicy(); boolean getAutoCreateUniqueFilename( final JobScheduleRequest scheduleRequest ); String getAppendDateFormat( final JobScheduleRequest scheduleRequest ); List<Job> getJobs();  }
@Test public void testGetJobs() throws Exception { IPentahoSession mockPentahoSession = mock( IPentahoSession.class ); doReturn( mockPentahoSession ).when( schedulerService ).getSession(); doReturn( "admin" ).when( mockPentahoSession ).getName(); doReturn( true ).when( schedulerService ).canAdminister( mockPentahoSession ); List<Job> mockJobs = new ArrayList<>(); mockJobs.add( mock( Job.class ) ); doReturn( mockJobs ).when( schedulerService.scheduler ).getJobs( any( IJobFilter.class ) ); List<Job> jobs = schedulerService.getJobs(); assertEquals( mockJobs, jobs ); verify( schedulerService, times( 1 ) ).getSession(); verify( mockPentahoSession, times( 1 ) ).getName(); verify( schedulerService, times( 1 ) ).canAdminister( mockPentahoSession ); verify( schedulerService.scheduler, times( 1 ) ).getJobs( any( IJobFilter.class ) ); }