DatabaseHelper { public DataNode databaseConnectionToDataNode( final IDatabaseConnection databaseConnection ) { DataNode rootNode = new DataNode( NODE_ROOT ); if ( databaseConnection.getDatabaseType() != null ) { rootNode.setProperty( PROP_TYPE, databaseConnection.getDatabaseType().getShortName() ); } String port = ( "".equals( setNull( databaseConnection.getDatabasePort() ) ) ) ? "0" : databaseConnection.getDatabasePort(); rootNode.setProperty( PROP_CONTYPE, setNull( databaseConnection.getAccessType().getName() ) ); rootNode.setProperty( PROP_HOST_NAME, setNull( databaseConnection.getHostname() ) ); rootNode.setProperty( PROP_DATABASE_NAME, setNull( databaseConnection.getDatabaseName() ) ); rootNode.setProperty( PROP_PORT, new Long( port ) ); rootNode.setProperty( PROP_USERNAME, setNull( databaseConnection.getUsername() ) ); rootNode.setProperty( PROP_PASSWORD, encryptPassword( databaseConnection.getPassword() ) ); rootNode.setProperty( PROP_SERVERNAME, setNull( databaseConnection.getInformixServername() ) ); rootNode.setProperty( PROP_DATA_TBS, setNull( databaseConnection.getDataTablespace() ) ); rootNode.setProperty( PROP_INDEX_TBS, setNull( databaseConnection.getIndexTablespace() ) ); rootNode.setProperty( PROP_CONNECT_SQL, setNull( databaseConnection.getConnectSql() ) ); rootNode.setProperty( PROP_INITIAL_POOL_SIZE, databaseConnection.getInitialPoolSize() ); rootNode.setProperty( PROP_MAX_POOL_SIZE, databaseConnection.getMaximumPoolSize() ); rootNode.setProperty( PROP_IS_POOLING, databaseConnection.isUsingConnectionPool() ); rootNode.setProperty( PROP_IS_FORCING_TO_LOWER, databaseConnection.isForcingIdentifiersToLowerCase() ); rootNode.setProperty( PROP_IS_FORCING_TO_UPPER, databaseConnection.isForcingIdentifiersToUpperCase() ); rootNode.setProperty( PROP_IS_QUOTE_FIELDS, databaseConnection.isQuoteAllFields() ); rootNode.setProperty( PROP_IS_DECIMAL_SEPERATOR, databaseConnection.isUsingDoubleDecimalAsSchemaTableSeparator() ); DataNode attrNode = rootNode.addNode( NODE_ATTRIBUTES ); Map<String, String> attributes = databaseConnection.getAttributes(); Set<String> keys = attributes.keySet(); for ( String key : keys ) { String value = attributes.get( key ); attrNode.setProperty( key, value ); } attrNode.setProperty( ATTRIBUTE_PORT_NUMBER, new Long( port ).longValue() ); attrNode = rootNode.addNode( NODE_POOLING_PROPS ); attributes = databaseConnection.getConnectionPoolingProperties(); keys = attributes.keySet(); for ( String key : keys ) { String value = attributes.get( key ); attrNode.setProperty( key, value ); } attrNode = rootNode.addNode( NODE_EXTRA_OPTIONS ); attributes = databaseConnection.getExtraOptions(); for ( String key : attributes.keySet() ) { String value = attributes.get( key ); attrNode.setProperty( key, value ); } attrNode = rootNode.addNode( NODE_EXTRA_OPTIONS_ORDER ); Map<String, String> extraOptionsOrder = databaseConnection.getExtraOptionsOrder(); for ( String key : extraOptionsOrder.keySet() ) { String value = extraOptionsOrder.get( key ); attrNode.setProperty( key, value ); } return rootNode; } DatabaseHelper( IDatabaseDialectService databaseDialectService ); DataNode databaseConnectionToDataNode( final IDatabaseConnection databaseConnection ); IDatabaseConnection databaseMetaToDatabaseConnection( final DatabaseMeta databaseMeta ); IDatabaseConnection dataNodeToDatabaseConnection( final Serializable id, final String name,
      final DataNode rootNode );  }
@Test public void testDatabaseConnectionToDataNodeAddsExtraOptions() { DataNode dataNode = databaseHelper.databaseConnectionToDataNode( createDatabaseConnection() ); DataNode extraOptionsNode = dataNode.getNode( NODE_EXTRA_OPTIONS_ORDER ); assertNotNull( extraOptionsNode ); assertNotNull( extraOptionsNode.getProperties().iterator() ); assertTrue( extraOptionsNode.getProperties().iterator().hasNext() ); }