@Test public void testSetters() throws Exception { JmsConfiguration jmsConfiguration = aJmsConfigurationBuilder() .withImplementation("org.apache.activemq.ActiveMQConnectionFactory") .addProperty(aSetterProperty().argType(ArgType.STRING).name("username").argValue("USERNAME").build()) .addProperty(aSetterProperty().argType(ArgType.STRING).name("password").argValue("PASSWORD").build()) .build(); when(jmsConfigXmlParser.parse(anyString(), eq(JmsConfiguration.class))).thenReturn(jmsConfiguration); JmsConfigExtractor jmsConfigExtractor = new JmsConfigExtractor(jmsConfigXmlParser); JmsConfig jmsConfig = jmsConfigExtractor.retrieveConfiguration("file"); assertEquals(ActiveMQConnectionFactory.class, jmsConfig.getImplementation()); assertEquals(2, jmsConfig.getSetterArgs().size()); SetterArgument arg1 = jmsConfig.getSetterArgs().get(0); assertEquals(STRING, arg1.getArgumentType()); assertEquals("USERNAME", arg1.getValue()); SetterArgument arg2 = jmsConfig.getSetterArgs().get(1); assertEquals(STRING, arg2.getArgumentType()); assertEquals("PASSWORD", arg2.getValue()); }
public JmsConfig retrieveConfiguration(final String configPath) throws EtiqetException { final JmsConfiguration jmsConfiguration = jmsConfigXmlParser.parse(configPath, JmsConfiguration.class); final Class<?> constructorClass; try { constructorClass = Class.forName(jmsConfiguration.getImplementation()); } catch (ReflectiveOperationException e) { throw new EtiqetException(e); } return new JmsConfig( constructorClass, constructorArguments(jmsConfiguration.getConstructorArgs()), setterArguments(jmsConfiguration.getProperties()), jmsConfiguration.getDefaultTopic(), binaryMessageConverterDelegateClass(jmsConfiguration) ); }
JmsConfigExtractor { public JmsConfig retrieveConfiguration(final String configPath) throws EtiqetException { final JmsConfiguration jmsConfiguration = jmsConfigXmlParser.parse(configPath, JmsConfiguration.class); final Class<?> constructorClass; try { constructorClass = Class.forName(jmsConfiguration.getImplementation()); } catch (ReflectiveOperationException e) { throw new EtiqetException(e); } return new JmsConfig( constructorClass, constructorArguments(jmsConfiguration.getConstructorArgs()), setterArguments(jmsConfiguration.getProperties()), jmsConfiguration.getDefaultTopic(), binaryMessageConverterDelegateClass(jmsConfiguration) ); } }
JmsConfigExtractor { public JmsConfig retrieveConfiguration(final String configPath) throws EtiqetException { final JmsConfiguration jmsConfiguration = jmsConfigXmlParser.parse(configPath, JmsConfiguration.class); final Class<?> constructorClass; try { constructorClass = Class.forName(jmsConfiguration.getImplementation()); } catch (ReflectiveOperationException e) { throw new EtiqetException(e); } return new JmsConfig( constructorClass, constructorArguments(jmsConfiguration.getConstructorArgs()), setterArguments(jmsConfiguration.getProperties()), jmsConfiguration.getDefaultTopic(), binaryMessageConverterDelegateClass(jmsConfiguration) ); } JmsConfigExtractor(final JmsConfigXmlParser jmsConfigXmlParser); }
JmsConfigExtractor { public JmsConfig retrieveConfiguration(final String configPath) throws EtiqetException { final JmsConfiguration jmsConfiguration = jmsConfigXmlParser.parse(configPath, JmsConfiguration.class); final Class<?> constructorClass; try { constructorClass = Class.forName(jmsConfiguration.getImplementation()); } catch (ReflectiveOperationException e) { throw new EtiqetException(e); } return new JmsConfig( constructorClass, constructorArguments(jmsConfiguration.getConstructorArgs()), setterArguments(jmsConfiguration.getProperties()), jmsConfiguration.getDefaultTopic(), binaryMessageConverterDelegateClass(jmsConfiguration) ); } JmsConfigExtractor(final JmsConfigXmlParser jmsConfigXmlParser); JmsConfig retrieveConfiguration(final String configPath); }
JmsConfigExtractor { public JmsConfig retrieveConfiguration(final String configPath) throws EtiqetException { final JmsConfiguration jmsConfiguration = jmsConfigXmlParser.parse(configPath, JmsConfiguration.class); final Class<?> constructorClass; try { constructorClass = Class.forName(jmsConfiguration.getImplementation()); } catch (ReflectiveOperationException e) { throw new EtiqetException(e); } return new JmsConfig( constructorClass, constructorArguments(jmsConfiguration.getConstructorArgs()), setterArguments(jmsConfiguration.getProperties()), jmsConfiguration.getDefaultTopic(), binaryMessageConverterDelegateClass(jmsConfiguration) ); } JmsConfigExtractor(final JmsConfigXmlParser jmsConfigXmlParser); JmsConfig retrieveConfiguration(final String configPath);  }