@Test public void saveJobConfigurationWithListenerTest() { final JobListenerConfiguration jobListenerConfiguration = DomainTestHelper.createJobListenerConfiguration ("src/test/", "*.txt", JobListenerType.LOCAL_FOLDER_LISTENER); jobListenerConfiguration.setBeanName("testBean"); final JobConfiguration jobConfiguration = DomainTestHelper.createJobConfiguration(jobListenerConfiguration); when(this.properties.getApplicationName()).thenReturn(APPLICATION_NAME); when(this.jobConfigurationRepository.add(jobConfiguration, APPLICATION_NAME)).thenReturn(jobConfiguration); try { this.defaultAdminService.saveJobConfiguration(jobConfiguration); verify(this.listenerService, times(1)).registerListenerForJob(any(JobConfiguration.class)); } catch (final SpringBatchLightminApplicationException e) { fail(e.getMessage()); } }
@Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") public void saveJobConfiguration(@Valid final JobConfiguration jobConfiguration) { jobConfiguration.validateForSave(); if (jobConfiguration.getJobSchedulerConfiguration() != null) { saveSchedulerConfiguration(jobConfiguration); } else if (jobConfiguration.getJobListenerConfiguration() != null) { saveListenerConfiguration(jobConfiguration); } }
DefaultAdminService implements AdminService { @Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") public void saveJobConfiguration(@Valid final JobConfiguration jobConfiguration) { jobConfiguration.validateForSave(); if (jobConfiguration.getJobSchedulerConfiguration() != null) { saveSchedulerConfiguration(jobConfiguration); } else if (jobConfiguration.getJobListenerConfiguration() != null) { saveListenerConfiguration(jobConfiguration); } } }
DefaultAdminService implements AdminService { @Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") public void saveJobConfiguration(@Valid final JobConfiguration jobConfiguration) { jobConfiguration.validateForSave(); if (jobConfiguration.getJobSchedulerConfiguration() != null) { saveSchedulerConfiguration(jobConfiguration); } else if (jobConfiguration.getJobListenerConfiguration() != null) { saveListenerConfiguration(jobConfiguration); } } DefaultAdminService(final JobConfigurationRepository jobConfigurationRepository,
                               final SchedulerService schedulerService,
                               final ListenerService listenerService,
                               final SpringBatchLightminCoreConfigurationProperties springBatchLightminCoreConfigurationProperties
    ); }
DefaultAdminService implements AdminService { @Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") public void saveJobConfiguration(@Valid final JobConfiguration jobConfiguration) { jobConfiguration.validateForSave(); if (jobConfiguration.getJobSchedulerConfiguration() != null) { saveSchedulerConfiguration(jobConfiguration); } else if (jobConfiguration.getJobListenerConfiguration() != null) { saveListenerConfiguration(jobConfiguration); } } 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(); }
DefaultAdminService implements AdminService { @Override @Transactional(propagation = Propagation.REQUIRED, transactionManager = "lightminTransactionManager") public void saveJobConfiguration(@Valid final JobConfiguration jobConfiguration) { jobConfiguration.validateForSave(); if (jobConfiguration.getJobSchedulerConfiguration() != null) { saveSchedulerConfiguration(jobConfiguration); } else if (jobConfiguration.getJobListenerConfiguration() != null) { saveListenerConfiguration(jobConfiguration); } } 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();  }