@Test void testGetJmsFactory() { final NotificationsConfiguration c = new NotificationsConfiguration(); c.setConnectionString("localhost:61616"); final ActiveMQConnectionFactory factory1 = AppUtils.getJmsFactory(c); assertNull(factory1.getUserName(), "Unexpected username!"); assertNull(factory1.getPassword(), "Unexpected password!"); assertEquals("localhost:61616", factory1.getBrokerURL(), "Incorrect broker URL!"); c.set("password", "pass"); final ActiveMQConnectionFactory factory2 = AppUtils.getJmsFactory(c); assertNull(factory2.getUserName(), "Unexpected username!"); assertNull(factory2.getPassword(), "Unexpected password!"); assertEquals("localhost:61616", factory2.getBrokerURL(), "Incorrect broker URL!"); c.set("username", "user"); final ActiveMQConnectionFactory factory3 = AppUtils.getJmsFactory(c); assertEquals("user", factory3.getUserName(), "Incorrect username!"); assertEquals("pass", factory3.getPassword(), "Incorrect password!"); assertEquals("localhost:61616", factory3.getBrokerURL(), "Incorrect broker URL!"); }
public static ActiveMQConnectionFactory getJmsFactory(final NotificationsConfiguration config) { final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(config.getConnectionString()); factory.setTrustedPackages(singletonList(String.class.getPackage().getName())); if (config.any().containsKey(PW_KEY) && config.any().containsKey(UN_KEY)) { factory.setUserName(config.any().get(UN_KEY)); factory.setPassword(config.any().get(PW_KEY)); } return factory; }
AppUtils { public static ActiveMQConnectionFactory getJmsFactory(final NotificationsConfiguration config) { final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(config.getConnectionString()); factory.setTrustedPackages(singletonList(String.class.getPackage().getName())); if (config.any().containsKey(PW_KEY) && config.any().containsKey(UN_KEY)) { factory.setUserName(config.any().get(UN_KEY)); factory.setPassword(config.any().get(PW_KEY)); } return factory; } }
AppUtils { public static ActiveMQConnectionFactory getJmsFactory(final NotificationsConfiguration config) { final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(config.getConnectionString()); factory.setTrustedPackages(singletonList(String.class.getPackage().getName())); if (config.any().containsKey(PW_KEY) && config.any().containsKey(UN_KEY)) { factory.setUserName(config.any().get(UN_KEY)); factory.setPassword(config.any().get(PW_KEY)); } return factory; } private  AppUtils(); }
AppUtils { public static ActiveMQConnectionFactory getJmsFactory(final NotificationsConfiguration config) { final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(config.getConnectionString()); factory.setTrustedPackages(singletonList(String.class.getPackage().getName())); if (config.any().containsKey(PW_KEY) && config.any().containsKey(UN_KEY)) { factory.setUserName(config.any().get(UN_KEY)); factory.setPassword(config.any().get(PW_KEY)); } return factory; } private  AppUtils(); static Properties getKafkaProperties(final NotificationsConfiguration config); static ActiveMQConnectionFactory getJmsFactory(final NotificationsConfiguration config); static EventService getNotificationService(final NotificationsConfiguration config,
            final Environment environment); }
AppUtils { public static ActiveMQConnectionFactory getJmsFactory(final NotificationsConfiguration config) { final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(config.getConnectionString()); factory.setTrustedPackages(singletonList(String.class.getPackage().getName())); if (config.any().containsKey(PW_KEY) && config.any().containsKey(UN_KEY)) { factory.setUserName(config.any().get(UN_KEY)); factory.setPassword(config.any().get(PW_KEY)); } return factory; } private  AppUtils(); static Properties getKafkaProperties(final NotificationsConfiguration config); static ActiveMQConnectionFactory getJmsFactory(final NotificationsConfiguration config); static EventService getNotificationService(final NotificationsConfiguration config,
            final Environment environment);  }