SimpleFactoryConfiguration implements ExtraFactoryConfiguration { @Override public void applyConfiguration(Object cf) throws JMSException { if (BooleanUtils .or(new boolean[] {cf instanceof ConnectionFactory, cf instanceof XAConnectionFactory})) { getProperties().stream().forEach((kvp) -> SimpleBeanUtil.callSetter(cf, "set" + kvp.getKey(), kvp.getValue())); } else { throw new JMSException("Object to apply configuration is not a XA/ConnectionFactory."); } } SimpleFactoryConfiguration(); @Override void applyConfiguration(Object cf); KeyValuePairSet getProperties(); void setProperties(KeyValuePairSet extras);  }
@Test public void testApplyTopicConnectionFactoryConfiguration() throws Exception { SimpleFactoryConfiguration extras = createBase(); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doModifiedAssertions(mycf); }
@Test public void testApplyNonConnectionFactoryConfiguration() throws Exception { SimpleFactoryConfiguration extras = createBase(); try { extras.applyConfiguration(new Object()); fail("Should fail, not given a XA/ConnectionFactory."); } catch (Exception ex) { } }
@Test public void testApplyXAConnectionFactoryConfigurationNoError() throws Exception { SimpleFactoryConfiguration extras = createBase(); extras.applyConfiguration(mockXAConnectionFactory); }
@Test public void testApplyQueueConnectionFactoryConfiguration() throws Exception { SimpleFactoryConfiguration extras = createBase(); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doModifiedAssertions(mycf); }
@Test public void testApplyTopicConnectionFactory_NonInteger() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_INT_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyQueueConnectionFactory_NonInteger() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_INT_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyTopicConnectionFactory_NonLong() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_LONG_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyQueueConnectionFactory_NonLong() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_LONG_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyTopicConnectionFactory_NonBoolean() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_BOOLEAN_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyQueueConnectionFactory_NonBoolean() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_BOOLEAN_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyTopicConnectionFactory_NonFloat() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_FLOAT_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyQueueConnectionFactory_NonFloat() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_FLOAT_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyTopicConnectionFactory_NonDouble() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_DOUBLE_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyQueueConnectionFactory_NonDouble() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_DOUBLE_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyTopicConnectionFactory_NoSetter() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair("HelloThere", "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyQueueConnectionFactory_NoSetter() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair("HelloThere", "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyTopicConnectionFactory_Object() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_OBJECT_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyQueueConnectionFactory_Object() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_OBJECT_VALUE, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyTopicConnectionFactory_TwoParams() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(TWO_VALUES_TOGETHER, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }
@Test public void testApplyQueueConnectionFactory_TwoParams() throws Exception { SimpleFactoryConfiguration extras = create(new KeyValuePair(TWO_VALUES_TOGETHER, "fred")); DummyConnectionFactory mycf = new DummyConnectionFactory(); extras.applyConfiguration(mycf); doBaseAssertions(mycf); }