Removed intermittently failing method from DBCPServiceTest
This closes
@@ -40,7 +40,6 @@ import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import java.util.ArrayList;
import java.util.UUID;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -249,58 +248,6 @@ public class DBCPServiceTest {
service.getDataSource().close();
}
- @Test
- public void testGetDataSourceIdleProperties() throws SQLException {
- runner.setProperty(service, DBCPConnectionPool.MAX_WAIT_TIME, "${max.wait.time}");
- runner.setProperty(service, DBCPConnectionPool.MAX_TOTAL_CONNECTIONS, "${max.total.connections}");
- runner.setProperty(service, DBCPConnectionPool.MAX_IDLE, "${max.idle}");
- runner.setProperty(service, DBCPConnectionPool.MIN_IDLE, "${min.idle}");
- runner.setProperty(service, DBCPConnectionPool.MAX_CONN_LIFETIME, "${max.conn.lifetime}");
- runner.setProperty(service, DBCPConnectionPool.EVICTION_RUN_PERIOD, "${eviction.run.period}");
- runner.setProperty(service, DBCPConnectionPool.MIN_EVICTABLE_IDLE_TIME, "${min.evictable.idle.time}");
- runner.setProperty(service, DBCPConnectionPool.SOFT_MIN_EVICTABLE_IDLE_TIME, "${soft.min.evictable.idle.time}");
-
- runner.setVariable("max.wait.time", "1 sec");
- runner.setVariable("max.total.connections", "7");
- runner.setVariable("max.idle", "4");
- runner.setVariable("min.idle", "1");
- runner.setVariable("max.conn.lifetime", "1000 millis");
- runner.setVariable("eviction.run.period", "100 millis");
- runner.setVariable("min.evictable.idle.time", "100 millis");
- runner.setVariable("soft.min.evictable.idle.time", "100 millis");
-
- runner.enableControllerService(service);
-
- ArrayList<Connection> connections = new ArrayList<>();
- for (int i = 0; i < 6; i++) {
- connections.add(service.getConnection());
- }
-
- assertEquals(6, service.getDataSource().getNumActive());
-
- connections.get(0).close();
- assertEquals(5, service.getDataSource().getNumActive());
- assertEquals(1, service.getDataSource().getNumIdle());
-
- connections.get(1).close();
- connections.get(2).close();
- connections.get(3).close();
- //now at max idle
- assertEquals(2, service.getDataSource().getNumActive());
- assertEquals(4, service.getDataSource().getNumIdle());
-
- //now a connection should get closed for real so that numIdle does not exceed maxIdle
- connections.get(4).close();
- assertEquals(4, service.getDataSource().getNumIdle());
- assertEquals(1, service.getDataSource().getNumActive());
-
- connections.get(5).close();
- assertEquals(4, service.getDataSource().getNumIdle());
- assertEquals(0, service.getDataSource().getNumActive());
-
- service.getDataSource().close();
- }
-
private void assertConnectionNotNullDynamicProperty(final String propertyName, final String propertyValue) throws SQLException {
runner.setProperty(service, propertyName, propertyValue);
