.getConnectionPropertiesAsASemicolonDelimitedString(ds)); Element dataSource = null; if (ds.getTransactionSupport().equals(TransactionSupport.NO_TRANSACTION))
.getConnectionPropertiesAsASemicolonDelimitedString(ds)); Element dataSource = null; if (ds.getTransactionSupport().equals(TransactionSupport.NO_TRANSACTION))
/** * Test the driver properties to string getter. */ public void testGetDriverPropertiesAsString() { String propertyString = "user=APP;CreateDatabase=create"; String driverPropertyString = DatasourcePropertySet.CONNECTION_PROPERTIES + "=" + propertyString; DataSource ds = dataSourceConverter.fromPropertyString(driverPropertyString); try { assertEquals(propertyString, dataSourceConverter .getConnectionPropertiesAsASemicolonDelimitedString(ds)); } catch (ComparisonFailure e) { assertEquals("CreateDatabase=create;user=APP", dataSourceConverter .getConnectionPropertiesAsASemicolonDelimitedString(ds)); } }
/** * Get a properties object containing all of the members of this datasource object. Note that * driver properties will be nested and delimited by a semicolon. * * @param data DataSource to serialize into properties. * @return a properties object corresponding to this datasource */ public Properties toProperties(DataSource data) { Properties properties = new Properties(); PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.JNDI_LOCATION, data .getJndiLocation()); PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.CONNECTION_TYPE, data.getConnectionType()); PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.TRANSACTION_SUPPORT, data.getTransactionSupport()); PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.DRIVER_CLASS, data .getDriverClass()); PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.URL, data.getUrl()); PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.USERNAME, data .getUsername()); PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.PASSWORD, data .getPassword()); PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.ID, data.getId()); PropertyUtils.setPropertyIfNotNull(properties, DatasourcePropertySet.CONNECTION_PROPERTIES, getConnectionPropertiesAsASemicolonDelimitedString(data)); return properties; }