Fix max connections in DruidAvaticaHandlerTest (#5188)

* Fix max connections in DruidAvaticaHandlerTest

* Fix additional tests

* Added comment
This commit is contained in:
Jonathan Wei 2017-12-21 13:32:14 -08:00 committed by Himanshu
parent 6582b16a81
commit ba873c614b
1 changed files with 11 additions and 3 deletions

View File

@ -96,7 +96,8 @@ public class DruidAvaticaHandlerTest
@Override
public int getMaxConnections()
{
return 2;
// This must match the number of Connection objects created in setUp()
return 3;
}
@Override
@ -667,9 +668,13 @@ public class DruidAvaticaHandlerTest
final Connection connection2 = DriverManager.getConnection(url);
final Statement statement2 = connection2.createStatement();
expectedException.expect(AvaticaClientRuntimeException.class);
expectedException.expectMessage("Too many connections, limit is[2]");
final Connection connection3 = DriverManager.getConnection(url);
final Statement statement3 = connection3.createStatement();
expectedException.expect(AvaticaClientRuntimeException.class);
expectedException.expectMessage("Too many connections, limit is[3]");
final Connection connection4 = DriverManager.getConnection(url);
}
@Test
@ -682,6 +687,9 @@ public class DruidAvaticaHandlerTest
connection2.createStatement().close();
final Connection connection3 = DriverManager.getConnection(url);
connection3.createStatement().close();
final Connection connection4 = DriverManager.getConnection(url);
Assert.assertTrue(true);
}