@Test public void shouldCreateWithProperties() { Map<String, String> connectionSettings = new LinkedHashMap<>(); connectionSettings.put("brokerUrl", "typ: connectionSettings.put("username", "foo"); connectionSettings.put("password", "secret"); ConnectionFactory connectionFactory = connectionFactoryCreator.create(connectionSettings); Assertions.assertThat(ActiveMQConnectionFactory.class).isEqualTo(connectionFactory.getClass()); Assertions.assertThat("typ: Assertions.assertThat("foo").isEqualTo(((ActiveMQConnectionFactory)connectionFactory).getUserName()); Assertions.assertThat("secret").isEqualTo(((ActiveMQConnectionFactory)connectionFactory).getPassword()); }
@Override public ConnectionFactory create(Map<String, String> properties) { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); if (properties.containsKey("brokerUrl")) { connectionFactory.setBrokerURL(properties.get("brokerUrl")); } if (properties.containsKey("username")) { connectionFactory.setUserName(properties.get("username")); } if (properties.containsKey("password")) { connectionFactory.setPassword(properties.get("password")); } return connectionFactory; }
ActiveMQConnectionFactoryCreator implements ConnectionFactoryCreator { @Override public ConnectionFactory create(Map<String, String> properties) { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); if (properties.containsKey("brokerUrl")) { connectionFactory.setBrokerURL(properties.get("brokerUrl")); } if (properties.containsKey("username")) { connectionFactory.setUserName(properties.get("username")); } if (properties.containsKey("password")) { connectionFactory.setPassword(properties.get("password")); } return connectionFactory; } }
ActiveMQConnectionFactoryCreator implements ConnectionFactoryCreator { @Override public ConnectionFactory create(Map<String, String> properties) { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); if (properties.containsKey("brokerUrl")) { connectionFactory.setBrokerURL(properties.get("brokerUrl")); } if (properties.containsKey("username")) { connectionFactory.setUserName(properties.get("username")); } if (properties.containsKey("password")) { connectionFactory.setPassword(properties.get("password")); } return connectionFactory; }  }
ActiveMQConnectionFactoryCreator implements ConnectionFactoryCreator { @Override public ConnectionFactory create(Map<String, String> properties) { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); if (properties.containsKey("brokerUrl")) { connectionFactory.setBrokerURL(properties.get("brokerUrl")); } if (properties.containsKey("username")) { connectionFactory.setUserName(properties.get("username")); } if (properties.containsKey("password")) { connectionFactory.setPassword(properties.get("password")); } return connectionFactory; }  @Override ConnectionFactory create(Map<String, String> properties); @Override boolean supports(Class<?> type); }
ActiveMQConnectionFactoryCreator implements ConnectionFactoryCreator { @Override public ConnectionFactory create(Map<String, String> properties) { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); if (properties.containsKey("brokerUrl")) { connectionFactory.setBrokerURL(properties.get("brokerUrl")); } if (properties.containsKey("username")) { connectionFactory.setUserName(properties.get("username")); } if (properties.containsKey("password")) { connectionFactory.setPassword(properties.get("password")); } return connectionFactory; }  @Override ConnectionFactory create(Map<String, String> properties); @Override boolean supports(Class<?> type);  }