/** * Sets the given properties on the {@link DatabaseConfig} instance using the given String values. * This is useful to set properties configured as strings by a build tool like ant or maven. If * the required property type is an object it uses reflection to create an instance of the class * specified as string. * * @param stringProperties The properties as strings. The key of the properties can be either the * long or the short name. * @throws DatabaseUnitException */ public void setPropertiesByString(Properties stringProperties) throws DatabaseUnitException { for (Iterator iterator = stringProperties.entrySet().iterator(); iterator.hasNext(); ) { Map.Entry entry = (Map.Entry) iterator.next(); String propKey = (String) entry.getKey(); String propValue = (String) entry.getValue(); ConfigProperty dbunitProp = DatabaseConfig.findByName(propKey); if (dbunitProp == null) { logger.debug("Did not find long name property {} - trying short name...", entry); dbunitProp = DatabaseConfig.findByShortName(propKey); } if (dbunitProp == null) { logger.info( "Could not set property '" + entry + "' - not found in the list of known properties."); } else { String fullPropName = dbunitProp.getProperty(); Object obj = createObjectFromString(dbunitProp, propValue); this.setProperty(fullPropName, obj); } } }