@Test public void testOpenPooledDataSource() throws Exception { PowerMockito.mockStatic(DataSources.class); DataSource unPooledDSMock = mock(DataSource.class); DataSource retPooledDSMock = mock(DataSource.class); PowerMockito.doReturn(unPooledDSMock).when(DataSources.class, "unpooledDataSource" , anyString(), anyString(), anyString()); PowerMockito.doReturn(retPooledDSMock).when(DataSources.class, "pooledDataSource" , any(DataSource.class), anyMap()); assertEquals(retPooledDSMock, provider.openPooledDataSource(DBConnectionManager.DBType.MYSQL , "url", USERNAME, "password")); PowerMockito.verifyStatic(); DataSources.unpooledDataSource(anyString(), anyString(), anyString()); DataSources.pooledDataSource(any(DataSource.class), anyMap()); }
public DataSource openPooledDataSource(DBType aDbType, String aDbUrl, String aUsername, String aPassword) throws SQLException { final DataSource unPooledDS = DataSources.unpooledDataSource(aDbUrl, aUsername, aPassword); final Map<String, String> props = this.getPoolingProperties(aDbType); return DataSources.pooledDataSource(unPooledDS, props); }
C3P0PooledDataSourceProvider extends PooledDataSourceProvider { public DataSource openPooledDataSource(DBType aDbType, String aDbUrl, String aUsername, String aPassword) throws SQLException { final DataSource unPooledDS = DataSources.unpooledDataSource(aDbUrl, aUsername, aPassword); final Map<String, String> props = this.getPoolingProperties(aDbType); return DataSources.pooledDataSource(unPooledDS, props); } }
C3P0PooledDataSourceProvider extends PooledDataSourceProvider { public DataSource openPooledDataSource(DBType aDbType, String aDbUrl, String aUsername, String aPassword) throws SQLException { final DataSource unPooledDS = DataSources.unpooledDataSource(aDbUrl, aUsername, aPassword); final Map<String, String> props = this.getPoolingProperties(aDbType); return DataSources.pooledDataSource(unPooledDS, props); } C3P0PooledDataSourceProvider(Properties aDBPoolingProperties); }
C3P0PooledDataSourceProvider extends PooledDataSourceProvider { public DataSource openPooledDataSource(DBType aDbType, String aDbUrl, String aUsername, String aPassword) throws SQLException { final DataSource unPooledDS = DataSources.unpooledDataSource(aDbUrl, aUsername, aPassword); final Map<String, String> props = this.getPoolingProperties(aDbType); return DataSources.pooledDataSource(unPooledDS, props); } C3P0PooledDataSourceProvider(Properties aDBPoolingProperties); String getProviderName(); void closePooledDataSource(DataSource aPooledDataSource); DataSource openPooledDataSource(DBType aDbType, String aDbUrl, String aUsername, String aPassword); int getAllConnectionNumber(DataSource aPooledDataSource); int getCheckedInConnectionNumber(DataSource aPooledDataSource); int getCheckedOutConnectionNumber(DataSource aPooledDataSource); }
C3P0PooledDataSourceProvider extends PooledDataSourceProvider { public DataSource openPooledDataSource(DBType aDbType, String aDbUrl, String aUsername, String aPassword) throws SQLException { final DataSource unPooledDS = DataSources.unpooledDataSource(aDbUrl, aUsername, aPassword); final Map<String, String> props = this.getPoolingProperties(aDbType); return DataSources.pooledDataSource(unPooledDS, props); } C3P0PooledDataSourceProvider(Properties aDBPoolingProperties); String getProviderName(); void closePooledDataSource(DataSource aPooledDataSource); DataSource openPooledDataSource(DBType aDbType, String aDbUrl, String aUsername, String aPassword); int getAllConnectionNumber(DataSource aPooledDataSource); int getCheckedInConnectionNumber(DataSource aPooledDataSource); int getCheckedOutConnectionNumber(DataSource aPooledDataSource); final static String C3P0_DATASOURCE_PROVIDER_NAME; }