@Test public void testBooleanArguments() throws Exception { JmsConfiguration jmsConfiguration = aJmsConfigurationBuilder() .withImplementation("org.apache.activemq.ActiveMQConnectionFactory") .addConstructorArg(aConstructorArg().argType(ArgType.BOOLEAN).argValue("true").build()) .addProperty(aSetterProperty().argType(ArgType.BOOLEAN).argValue("FALSE").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(1, jmsConfig.getConstructorArgs().size()); ConstructorArgument arg1 = jmsConfig.getConstructorArgs().get(0); assertEquals(BOOLEAN, arg1.getArgumentType()); assertEquals(Boolean.TRUE, arg1.getValue()); SetterArgument arg2 = jmsConfig.getSetterArgs().get(0); assertEquals(BOOLEAN, arg2.getArgumentType()); assertEquals(Boolean.FALSE, 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);  }