+ TestConstants.HYPERSONIC_TEST_URL;
ProxoolFacade.registerConnectionPool(url, info);
Connection[] connections = new Connection[6];
SnapshotResultMonitor srm = new SnapshotResultMonitor(alias) {
public boolean check(SnapshotIF snapshot) throws Exception {
SnapshotIF s = ProxoolFacade.getSnapshot(alias);
return (s.getActiveConnectionCount() == 0
&& s.getAvailableConnectionCount() >= 2);
}
};
assertEquals("Timeout", ResultMonitor.SUCCESS, srm.getResult());
assertEquals("activeConnectionCount", 0, srm.getSnapshot().getActiveConnectionCount());
assertEquals("availableConnectionCount", 2, srm.getSnapshot().getAvailableConnectionCount());
connections[0] = DriverManager.getConnection(url);
srm = new SnapshotResultMonitor(alias) {
public boolean check(SnapshotIF snapshot) throws Exception {
SnapshotIF s = ProxoolFacade.getSnapshot(alias);
return (s.getActiveConnectionCount() == 1
&& s.getAvailableConnectionCount() >= 2);
}
};
assertEquals("Timeout", ResultMonitor.SUCCESS, srm.getResult());
assertEquals("activeConnectionCount", 1, srm.getSnapshot().getActiveConnectionCount());
assertEquals("availableConnectionCount", 2, srm.getSnapshot().getAvailableConnectionCount());
connections[1] = DriverManager.getConnection(url);
connections[2] = DriverManager.getConnection(url);
connections[3] = DriverManager.getConnection(url);
srm = new SnapshotResultMonitor(alias) {
public boolean check(SnapshotIF snapshot) throws Exception {
SnapshotIF s = ProxoolFacade.getSnapshot(alias);
return (s.getActiveConnectionCount() == 4
&& s.getAvailableConnectionCount() == 1);
}
};
assertEquals("Timeout", ResultMonitor.SUCCESS, srm.getResult());
assertEquals("activeConnectionCount", 4, srm.getSnapshot().getActiveConnectionCount());
assertEquals("availableConnectionCount", 1, srm.getSnapshot().getAvailableConnectionCount());
}