@Test public void testRegisterListenerForJob() throws NoSuchJobException { final JobListenerConfiguration jobListenerConfiguration = DomainTestHelper.createJobListenerConfiguration ("src/test/", "*.txt", JobListenerType.LOCAL_FOLDER_LISTENER); jobListenerConfiguration.setBeanName("testBean"); final JobConfiguration jobConfiguration = DomainTestHelper.createJobConfiguration(jobListenerConfiguration); this.listenerService.registerListenerForJob(jobConfiguration); verify(this.jobRegistry, times(1)).getJob(anyString()); verify(this.beanRegistrar, times(1)).registerBean( eq(FolderListener.class), eq("testBean"), anySet(), eq(null), eq(null), eq(null), eq(null)); }
@Override public String registerListenerForJob(final JobConfiguration jobConfiguration) { final JobListenerType jobListenerType = jobConfiguration.getJobListenerConfiguration().getJobListenerType(); final String beanName; switch (jobListenerType) { case LOCAL_FOLDER_LISTENER: beanName = this.registerFolderListener(jobConfiguration); break; default: throw new SpringBatchLightminApplicationException("Unknown ListenerType: " + jobListenerType); } return beanName; }
DefaultListenerService implements ListenerService, InitializingBean { @Override public String registerListenerForJob(final JobConfiguration jobConfiguration) { final JobListenerType jobListenerType = jobConfiguration.getJobListenerConfiguration().getJobListenerType(); final String beanName; switch (jobListenerType) { case LOCAL_FOLDER_LISTENER: beanName = this.registerFolderListener(jobConfiguration); break; default: throw new SpringBatchLightminApplicationException("Unknown ListenerType: " + jobListenerType); } return beanName; } }
DefaultListenerService implements ListenerService, InitializingBean { @Override public String registerListenerForJob(final JobConfiguration jobConfiguration) { final JobListenerType jobListenerType = jobConfiguration.getJobListenerConfiguration().getJobListenerType(); final String beanName; switch (jobListenerType) { case LOCAL_FOLDER_LISTENER: beanName = this.registerFolderListener(jobConfiguration); break; default: throw new SpringBatchLightminApplicationException("Unknown ListenerType: " + jobListenerType); } return beanName; } DefaultListenerService(final BeanRegistrar beanRegistrar, final JobRegistry jobRegistry, final JobRepository jobRepository); }
DefaultListenerService implements ListenerService, InitializingBean { @Override public String registerListenerForJob(final JobConfiguration jobConfiguration) { final JobListenerType jobListenerType = jobConfiguration.getJobListenerConfiguration().getJobListenerType(); final String beanName; switch (jobListenerType) { case LOCAL_FOLDER_LISTENER: beanName = this.registerFolderListener(jobConfiguration); break; default: throw new SpringBatchLightminApplicationException("Unknown ListenerType: " + jobListenerType); } return beanName; } DefaultListenerService(final BeanRegistrar beanRegistrar, final JobRegistry jobRegistry, final JobRepository jobRepository); @Autowired void setApplicationContext(final ApplicationContext applicationContext); @Override String registerListenerForJob(final JobConfiguration jobConfiguration); @Override void unregisterListenerForJob(final String beanName); @Override void refreshListenerForJob(final JobConfiguration jobConfiguration); @Override void activateListener(final String beanName, final Boolean forceActivation); @Override void terminateListener(final String beanName); @Override JobLauncher createLobLauncher(final TaskExecutorType taskExecutorType, final JobRepository jobRepository); @Override void afterPropertiesSet(); }
DefaultListenerService implements ListenerService, InitializingBean { @Override public String registerListenerForJob(final JobConfiguration jobConfiguration) { final JobListenerType jobListenerType = jobConfiguration.getJobListenerConfiguration().getJobListenerType(); final String beanName; switch (jobListenerType) { case LOCAL_FOLDER_LISTENER: beanName = this.registerFolderListener(jobConfiguration); break; default: throw new SpringBatchLightminApplicationException("Unknown ListenerType: " + jobListenerType); } return beanName; } DefaultListenerService(final BeanRegistrar beanRegistrar, final JobRegistry jobRegistry, final JobRepository jobRepository); @Autowired void setApplicationContext(final ApplicationContext applicationContext); @Override String registerListenerForJob(final JobConfiguration jobConfiguration); @Override void unregisterListenerForJob(final String beanName); @Override void refreshListenerForJob(final JobConfiguration jobConfiguration); @Override void activateListener(final String beanName, final Boolean forceActivation); @Override void terminateListener(final String beanName); @Override JobLauncher createLobLauncher(final TaskExecutorType taskExecutorType, final JobRepository jobRepository); @Override void afterPropertiesSet();  }