JobListenerFeService extends CommonJobConfigurationFeService { public MapJobListenerConfigurationModel getMapJobConfigurationModel(final String applicationInstanceId) { final LightminClientApplication lightminClientApplication = this.findLightminClientApplicatonById(applicationInstanceId); final Map<String, JobConfigurations> jobConfigurations = this.adminServerService.getJobConfigurationsMap(lightminClientApplication); final MapJobListenerConfigurationModel mapJobListenerConfigurationModel = new MapJobListenerConfigurationModel(); for (final Map.Entry<String, JobConfigurations> entry : jobConfigurations.entrySet()) { for (final JobConfiguration jobConfiguration : entry.getValue().getJobConfigurations()) { if (jobConfiguration.getJobListenerConfiguration() != null) { final ListenerJobConfigurationModel model = this.map(jobConfiguration); mapJobListenerConfigurationModel.add(entry.getKey(), model); } else { log.trace("No Scheduler configuration, nothing to map"); } } } return mapJobListenerConfigurationModel; } JobListenerFeService(final RegistrationBean registrationBean, final AdminServerService adminServerService); MapJobListenerConfigurationModel getMapJobConfigurationModel(final String applicationInstanceId); ListenerJobConfigurationModel getJobConfigurationModel(final Long jobConfigurationId,
                                                                  final String applicationInstanceId); void startListener(final Long jobConfigurationId, final String applicationInstanceId); void stopListener(final Long jobConfigurationId, final String applicationInstanceId); void deleteListenerConfiguration(final Long jobConfigurationId, final String applicationInstanceId); void addListenerConfiguration(final ListenerJobConfigurationModel listenerModel,
                                         final String applicationInstanceId); void updateListenerConfiguration(final ListenerJobConfigurationModel listenerModel,
                                            final String applicationInstanceId);  }
@Test public void testGetMapJobConfigurationModel() { final LightminClientApplication lightminClientApplication = ServiceTestHelper.createLightminClientApplication(); when(this.registrationBean.findById(APPLICATION_INSTANCE_ID)).thenReturn(lightminClientApplication); final Map<String, JobConfigurations> jobConfigurationsMap = new HashMap<>(); ApiTestHelper.addJobConfigurations(jobConfigurationsMap, APPLICATION_INSTANCE_ID, ApiTestHelper.createJobListenerConfigurations(5)); when(this.adminServerService.getJobConfigurationsMap(lightminClientApplication)).thenReturn(jobConfigurationsMap); final MapJobListenerConfigurationModel result = this.jobListenerFeService.getMapJobConfigurationModel(APPLICATION_INSTANCE_ID); BDDAssertions.then(result).isNotNull(); BDDAssertions.then(result.getJobConfigurations()).isNotNull(); BDDAssertions.then(result.getJobConfigurations().size()).isEqualTo(1); }