DefaultAdminService implements AdminService { @Override public Collection<JobConfiguration> getJobConfigurations(final Collection<String> jobNames) { Collection<JobConfiguration> allJobConfigurationsByJobNames = this.jobConfigurationRepository.getAllJobConfigurationsByJobNames(jobNames, this.springBatchLightminCoreConfigurationProperties.getApplicationName()); allJobConfigurationsByJobNames = allJobConfigurationsByJobNames.stream().filter(DefaultAdminService::validateJobConfiguration).collect(Collectors.toCollection(LinkedList::new)); return allJobConfigurationsByJobNames; } DefaultAdminService(final JobConfigurationRepository jobConfigurationRepository,
                               final SchedulerService schedulerService,
                               final ListenerService listenerService,
                               final SpringBatchLightminCoreConfigurationProperties springBatchLightminCoreConfigurationProperties
    ); @Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") void saveJobConfiguration(@Valid final JobConfiguration jobConfiguration); @Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") void updateJobConfiguration(final JobConfiguration jobConfiguration); @Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") void deleteJobConfiguration(final Long jobConfigurationId); @Override Collection<JobConfiguration> getJobConfigurationsByJobName(final String jobName); @Override Map<String, Collection<JobConfiguration>> getJobConfigurationMap(final Collection<String> jobNames); @Override Collection<JobConfiguration> getJobConfigurations(final Collection<String> jobNames); @Override JobConfiguration getJobConfigurationById(final Long jobConfigurationId); @Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") void stopJobConfiguration(final Long jobConfigurationId); @Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") void startJobConfiguration(final Long jobConfigurationId); @Override void afterPropertiesSet();  }
@Test public void getJobConfigurationsTest() { when(this.properties.getApplicationName()).thenReturn(APPLICATION_NAME); final JobSchedulerConfiguration jobSchedulerConfiguration = DomainTestHelper.createJobSchedulerConfiguration( "0 0/5 * * * ?", null, null, JobSchedulerType.CRON); final JobConfiguration jobConfiguration = DomainTestHelper.createJobConfiguration(jobSchedulerConfiguration); jobConfiguration.setJobConfigurationId(1L); final JobConfiguration jobConfigurationSecond = DomainTestHelper.createJobConfiguration(jobSchedulerConfiguration); jobConfigurationSecond.setJobConfigurationId(2L); final Collection<JobConfiguration> jobConfigurations = new LinkedList<>(); jobConfigurations.add(jobConfiguration); jobConfigurations.add(jobConfigurationSecond); final Collection<String> jobNames = new LinkedList<>(); jobNames.add("sampleJob"); when(this.jobConfigurationRepository.getAllJobConfigurationsByJobNames(jobNames, APPLICATION_NAME)).thenReturn(jobConfigurations); final Collection<JobConfiguration> result = this.defaultAdminService.getJobConfigurations(jobNames); assertThat(result).hasSize(2); }