DataSourceInitializer { void setProperty( final DataSource ds, final DataSourceConnectionProvider.Property property ) { final String name = property.getName(); final String value = property.getValue(); try { BeanUtils.setProperty( ds, name, value ); } catch ( Exception e ) { String msg = "Error setting DataSource property '" + name + "': " + e.getLocalizedMessage(); LOG.warn( msg ); } } DataSourceInitializer( final ClassLoader classLoader );   }
@Test public void testSetPropertyString() { final DataSourceMock ds = new DataSourceMock(); final Property property = new Property(); property.setName( "stringProperty" ); property.setValue( "value" ); initializer.setProperty( ds, property ); Assert.assertEquals( "value", ds.getStringProperty() ); }
@Test public void testSetPropertyInt() { final DataSourceMock ds = new DataSourceMock(); final Property property = new Property(); property.setName( "intProperty" ); property.setValue( "4711" ); initializer.setProperty( ds, property ); Assert.assertEquals( 4711, ds.getIntProperty() ); }