@Test public void testLoadQueues() throws Exception { watcher.setAuditPropertyEntityAdapter(auditPropertyEntityAdapterMock); watcher.setTxManager(txManagerMock); watcher.setAcmQueueDao(acmQueueDaoMock); auditPropertyEntityAdapterMock.setUserId("SYSTEM_USER"); expectLastCall(); expect(acmQueueDaoMock.getEm()).andReturn(entityManager); entityManager.flush(); expectLastCall(); expect(acmQueueDaoMock.findAll()).andReturn(createStoredQueues()); TransactionTemplate transactionTemplate = new TransactionTemplate(txManagerMock); PowerMock.expectNew(TransactionTemplate.class, txManagerMock).andReturn(transactionTemplate); expect(txManagerMock.getTransaction(transactionTemplate)).andReturn(mockedTransactionStatus); txManagerMock.commit(mockedTransactionStatus); expectLastCall(); Capture<AcmQueue> capturedArgs = Capture.newInstance(CaptureType.ALL); expect(acmQueueDaoMock.save(capture(capturedArgs))).andReturn(null).anyTimes(); replayAll(); Properties properties = createLoadedProperties(); watcher.loadQueues(properties); List<AcmQueue> values = capturedArgs.getValues(); assertTrue(values.stream().map(q -> q.getId()).collect(Collectors.toList()).containsAll(Arrays.asList(3l))); assertTrue( values.stream().map(q -> q.getName()).collect(Collectors.toList()).containsAll(Arrays.asList("Intake", "Hold", "Suspend"))); assertTrue(values.stream().map(q -> q.getDisplayOrder()).collect(Collectors.toList()).containsAll(Arrays.asList(1, 2, 4))); }
private void loadQueues(File configFile) { try (FileInputStream fis = new FileInputStream(configFile)) { log.debug("Loading queues from file {}", configFile.getCanonicalPath()); Properties queueProperties = new Properties(); queueProperties.load(fis); setQueueNamesProperties(queueProperties); loadQueues(queueProperties); } catch (IOException e) { log.error("Could not load queue names: {}", e.getMessage(), e); } }
QueuePropertyFileChangeWatcher implements ApplicationListener<AbstractConfigurationFileEvent> { private void loadQueues(File configFile) { try (FileInputStream fis = new FileInputStream(configFile)) { log.debug("Loading queues from file {}", configFile.getCanonicalPath()); Properties queueProperties = new Properties(); queueProperties.load(fis); setQueueNamesProperties(queueProperties); loadQueues(queueProperties); } catch (IOException e) { log.error("Could not load queue names: {}", e.getMessage(), e); } } }
QueuePropertyFileChangeWatcher implements ApplicationListener<AbstractConfigurationFileEvent> { private void loadQueues(File configFile) { try (FileInputStream fis = new FileInputStream(configFile)) { log.debug("Loading queues from file {}", configFile.getCanonicalPath()); Properties queueProperties = new Properties(); queueProperties.load(fis); setQueueNamesProperties(queueProperties); loadQueues(queueProperties); } catch (IOException e) { log.error("Could not load queue names: {}", e.getMessage(), e); } }  }
QueuePropertyFileChangeWatcher implements ApplicationListener<AbstractConfigurationFileEvent> { private void loadQueues(File configFile) { try (FileInputStream fis = new FileInputStream(configFile)) { log.debug("Loading queues from file {}", configFile.getCanonicalPath()); Properties queueProperties = new Properties(); queueProperties.load(fis); setQueueNamesProperties(queueProperties); loadQueues(queueProperties); } catch (IOException e) { log.error("Could not load queue names: {}", e.getMessage(), e); } }  @Override void onApplicationEvent(AbstractConfigurationFileEvent abstractConfigurationFileEvent); void loadQueues(Properties queueProperties); AcmQueueDao getAcmQueueDao(); void setAcmQueueDao(AcmQueueDao acmQueueDao); PlatformTransactionManager getTxManager(); void setTxManager(PlatformTransactionManager txManager); AuditPropertyEntityAdapter getAuditPropertyEntityAdapter(); void setAuditPropertyEntityAdapter(AuditPropertyEntityAdapter auditPropertyEntityAdapter); Properties getQueueNamesProperties(); void setQueueNamesProperties(Properties queueNamesProperties); }
QueuePropertyFileChangeWatcher implements ApplicationListener<AbstractConfigurationFileEvent> { private void loadQueues(File configFile) { try (FileInputStream fis = new FileInputStream(configFile)) { log.debug("Loading queues from file {}", configFile.getCanonicalPath()); Properties queueProperties = new Properties(); queueProperties.load(fis); setQueueNamesProperties(queueProperties); loadQueues(queueProperties); } catch (IOException e) { log.error("Could not load queue names: {}", e.getMessage(), e); } }  @Override void onApplicationEvent(AbstractConfigurationFileEvent abstractConfigurationFileEvent); void loadQueues(Properties queueProperties); AcmQueueDao getAcmQueueDao(); void setAcmQueueDao(AcmQueueDao acmQueueDao); PlatformTransactionManager getTxManager(); void setTxManager(PlatformTransactionManager txManager); AuditPropertyEntityAdapter getAuditPropertyEntityAdapter(); void setAuditPropertyEntityAdapter(AuditPropertyEntityAdapter auditPropertyEntityAdapter); Properties getQueueNamesProperties(); void setQueueNamesProperties(Properties queueNamesProperties);  }