BoneCP implements Serializable, Closeable { public int getTotalCreatedConnections(){ int total=0; for (int i=0; i < this.partitionCount && this.partitions[i] != null; i++){ total+=this.partitions[i].getCreatedConnections(); } return total; } BoneCP(BoneCPConfig config); synchronized void shutdown(); void close(); Connection getConnection(); ListenableFuture<Connection> getAsyncConnection(); boolean isConnectionHandleAlive(ConnectionHandle connection); int getTotalLeased(); int getTotalFree(); int getTotalCreatedConnections(); BoneCPConfig getConfig(); Statistics getStatistics(); AtomicBoolean getDbIsDown(); static final String MBEAN_CONFIG; static final String MBEAN_BONECP; }
@Test public void testGetTotalCreatedConnections() { expect(mockPartition.getCreatedConnections()).andReturn(5).anyTimes(); replay(mockPartition); assertEquals(10, testClass.getTotalCreatedConnections()); testClass.partitions[1] = null; assertEquals(5, testClass.getTotalCreatedConnections()); verify(mockPartition); }