@Test public void testConfigureDataSourceWhenNoDatabaseInterface() throws KettleDatabaseException { when( dbMeta.getDatabaseInterface() ).thenReturn( null ); ConnectionPoolUtil.configureDataSource( dataSource, dbMeta, "partId", INITIAL_SIZE, MAX_SIZE ); verify( dataSource, never() ).setDriverClassLoader( any( ClassLoader.class ) ); }
@VisibleForTesting static void configureDataSource( BasicDataSource ds, DatabaseMeta databaseMeta, String partitionId, int initialSize, int maximumSize ) throws KettleDatabaseException { Properties connectionPoolProperties = new Properties( databaseMeta.getConnectionPoolingProperties() ); connectionPoolProperties = environmentSubstitute( connectionPoolProperties, databaseMeta ); setPoolProperties( ds, connectionPoolProperties, initialSize, maximumSize ); setCredentials( ds, databaseMeta, partitionId ); String url = databaseMeta.environmentSubstitute( databaseMeta.getURL( partitionId ) ); ds.setUrl( url ); String clazz = databaseMeta.getDriverClass(); if ( databaseMeta.getDatabaseInterface() != null ) { ds.setDriverClassLoader( databaseMeta.getDatabaseInterface().getClass().getClassLoader() ); } ds.setDriverClassName( clazz ); }
ConnectionPoolUtil { @VisibleForTesting static void configureDataSource( BasicDataSource ds, DatabaseMeta databaseMeta, String partitionId, int initialSize, int maximumSize ) throws KettleDatabaseException { Properties connectionPoolProperties = new Properties( databaseMeta.getConnectionPoolingProperties() ); connectionPoolProperties = environmentSubstitute( connectionPoolProperties, databaseMeta ); setPoolProperties( ds, connectionPoolProperties, initialSize, maximumSize ); setCredentials( ds, databaseMeta, partitionId ); String url = databaseMeta.environmentSubstitute( databaseMeta.getURL( partitionId ) ); ds.setUrl( url ); String clazz = databaseMeta.getDriverClass(); if ( databaseMeta.getDatabaseInterface() != null ) { ds.setDriverClassLoader( databaseMeta.getDatabaseInterface().getClass().getClassLoader() ); } ds.setDriverClassName( clazz ); } }
ConnectionPoolUtil { @VisibleForTesting static void configureDataSource( BasicDataSource ds, DatabaseMeta databaseMeta, String partitionId, int initialSize, int maximumSize ) throws KettleDatabaseException { Properties connectionPoolProperties = new Properties( databaseMeta.getConnectionPoolingProperties() ); connectionPoolProperties = environmentSubstitute( connectionPoolProperties, databaseMeta ); setPoolProperties( ds, connectionPoolProperties, initialSize, maximumSize ); setCredentials( ds, databaseMeta, partitionId ); String url = databaseMeta.environmentSubstitute( databaseMeta.getURL( partitionId ) ); ds.setUrl( url ); String clazz = databaseMeta.getDriverClass(); if ( databaseMeta.getDatabaseInterface() != null ) { ds.setDriverClassLoader( databaseMeta.getDatabaseInterface().getClass().getClassLoader() ); } ds.setDriverClassName( clazz ); }  }
ConnectionPoolUtil { @VisibleForTesting static void configureDataSource( BasicDataSource ds, DatabaseMeta databaseMeta, String partitionId, int initialSize, int maximumSize ) throws KettleDatabaseException { Properties connectionPoolProperties = new Properties( databaseMeta.getConnectionPoolingProperties() ); connectionPoolProperties = environmentSubstitute( connectionPoolProperties, databaseMeta ); setPoolProperties( ds, connectionPoolProperties, initialSize, maximumSize ); setCredentials( ds, databaseMeta, partitionId ); String url = databaseMeta.environmentSubstitute( databaseMeta.getURL( partitionId ) ); ds.setUrl( url ); String clazz = databaseMeta.getDriverClass(); if ( databaseMeta.getDatabaseInterface() != null ) { ds.setDriverClassLoader( databaseMeta.getDatabaseInterface().getClass().getClassLoader() ); } ds.setDriverClassName( clazz ); }  static Connection getConnection( LogChannelInterface log, DatabaseMeta dbMeta, String partitionId ); static Connection getConnection( LogChannelInterface log, DatabaseMeta dbMeta, String partitionId,
      int initialSize, int maximumSize ); }
ConnectionPoolUtil { @VisibleForTesting static void configureDataSource( BasicDataSource ds, DatabaseMeta databaseMeta, String partitionId, int initialSize, int maximumSize ) throws KettleDatabaseException { Properties connectionPoolProperties = new Properties( databaseMeta.getConnectionPoolingProperties() ); connectionPoolProperties = environmentSubstitute( connectionPoolProperties, databaseMeta ); setPoolProperties( ds, connectionPoolProperties, initialSize, maximumSize ); setCredentials( ds, databaseMeta, partitionId ); String url = databaseMeta.environmentSubstitute( databaseMeta.getURL( partitionId ) ); ds.setUrl( url ); String clazz = databaseMeta.getDriverClass(); if ( databaseMeta.getDatabaseInterface() != null ) { ds.setDriverClassLoader( databaseMeta.getDatabaseInterface().getClass().getClassLoader() ); } ds.setDriverClassName( clazz ); }  static Connection getConnection( LogChannelInterface log, DatabaseMeta dbMeta, String partitionId ); static Connection getConnection( LogChannelInterface log, DatabaseMeta dbMeta, String partitionId,
      int initialSize, int maximumSize ); static final String DEFAULT_AUTO_COMMIT; static final String DEFAULT_READ_ONLY; static final String DEFAULT_TRANSACTION_ISOLATION; static final String DEFAULT_CATALOG; static final String INITIAL_SIZE; static final String MAX_ACTIVE; static final String MAX_IDLE; static final String MIN_IDLE; static final String MAX_WAIT; static final String VALIDATION_QUERY; static final String TEST_ON_BORROW; static final String TEST_ON_RETURN; static final String TEST_WHILE_IDLE; static final String TIME_BETWEEN_EVICTION_RUNS_MILLIS; static final String POOL_PREPARED_STATEMENTS; static final String MAX_OPEN_PREPARED_STATEMENTS; static final String ACCESS_TO_UNDERLYING_CONNECTION_ALLOWED; static final String REMOVE_ABANDONED; static final String REMOVE_ABANDONED_TIMEOUT; static final String LOG_ABANDONED; static final int defaultInitialNrOfConnections; static final int defaultMaximumNrOfConnections; }