@Test public void testGetTotalConnectionSize() throws SQLException { DBConnectionManager dbcManagerSpy = getDBConnectionManagerSpyWithPooling(); dbcManagerSpy.dbmsPoolTable = getHashTableObject3(); Hashtable<String, PooledDataSourceProvider> providerTableMock = mock(Hashtable.class); PooledDataSourceProvider providerMock = mock(PooledDataSourceProvider.class); doReturn(10).when(providerMock).getAllConnectionNumber(any(DataSource.class)); doReturn(providerMock).when(providerTableMock).get(anyString()); dbcManagerSpy.providerTable = providerTableMock; assertEquals(10, dbcManagerSpy.getTotalConnectionSize()); verifyNumberOfInvocationsOnMockObjects(providerTableMock, providerMock); }
public int getTotalConnectionSize() throws SQLException { int retTotal = 0; Enumeration<String> allDbmsKeys = dbmsPoolTable.keys(); while (allDbmsKeys.hasMoreElements()) { String dbmsPoolKey = allDbmsKeys.nextElement(); Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getAllConnectionNumber(ds); } } } return retTotal; }
DBConnectionManager { public int getTotalConnectionSize() throws SQLException { int retTotal = 0; Enumeration<String> allDbmsKeys = dbmsPoolTable.keys(); while (allDbmsKeys.hasMoreElements()) { String dbmsPoolKey = allDbmsKeys.nextElement(); Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getAllConnectionNumber(ds); } } } return retTotal; } }
DBConnectionManager { public int getTotalConnectionSize() throws SQLException { int retTotal = 0; Enumeration<String> allDbmsKeys = dbmsPoolTable.keys(); while (allDbmsKeys.hasMoreElements()) { String dbmsPoolKey = allDbmsKeys.nextElement(); Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getAllConnectionNumber(ds); } } } return retTotal; } protected  DBConnectionManager(); }
DBConnectionManager { public int getTotalConnectionSize() throws SQLException { int retTotal = 0; Enumeration<String> allDbmsKeys = dbmsPoolTable.keys(); while (allDbmsKeys.hasMoreElements()) { String dbmsPoolKey = allDbmsKeys.nextElement(); Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getAllConnectionNumber(ds); } } } return retTotal; } protected  DBConnectionManager(); static DBConnectionManager getInstance(); void finalize(); synchronized Connection getConnection(DBType aDbType, String aAuthType, String aDbUrl, String aUsername, String aPassword, Properties properties); void cleanDataSources(); synchronized void shutdownDbmsPools(); int getDbmsPoolSize(); int getConnectionSize(DBType aDbType, String aDbUrl); int getCheckedOutConnectionSize(DBType aDbType, String aDbUrl); int getCheckedInConnectionSize(DBType aDbType, String aDbUrl); int getTotalConnectionSize(); int getTotalCheckedOutConnectionSize(); int getTotalCheckedInConnectionSize(); }
DBConnectionManager { public int getTotalConnectionSize() throws SQLException { int retTotal = 0; Enumeration<String> allDbmsKeys = dbmsPoolTable.keys(); while (allDbmsKeys.hasMoreElements()) { String dbmsPoolKey = allDbmsKeys.nextElement(); Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbmsPoolKey); PooledDataSourceProvider provider = this.getProvider(dbmsPoolKey); if (dsTable != null) { for (DataSource ds : dsTable.values()) { retTotal = retTotal + provider.getAllConnectionNumber(ds); } } } return retTotal; } protected  DBConnectionManager(); static DBConnectionManager getInstance(); void finalize(); synchronized Connection getConnection(DBType aDbType, String aAuthType, String aDbUrl, String aUsername, String aPassword, Properties properties); void cleanDataSources(); synchronized void shutdownDbmsPools(); int getDbmsPoolSize(); int getConnectionSize(DBType aDbType, String aDbUrl); int getCheckedOutConnectionSize(DBType aDbType, String aDbUrl); int getCheckedInConnectionSize(DBType aDbType, String aDbUrl); int getTotalConnectionSize(); int getTotalCheckedOutConnectionSize(); int getTotalCheckedInConnectionSize();  }