From fc090555387efbf914278ae27941e5c73e50b6da Mon Sep 17 00:00:00 2001 From: Nitin Date: Wed, 2 Dec 2015 17:45:38 +0530 Subject: [PATCH] minor cleanup --- src/test/java/com/zaxxer/hikari/pool/ExceptionTest.java | 2 +- src/test/java/com/zaxxer/hikari/pool/RampUpDown.java | 6 +++--- src/test/java/com/zaxxer/hikari/pool/StatementTest.java | 6 ++---- .../com/zaxxer/hikari/pool/TestConnectionTimeoutRetry.java | 2 +- src/test/java/com/zaxxer/hikari/pool/TestConnections.java | 3 ++- src/test/java/com/zaxxer/hikari/pool/UnwrapTest.java | 6 ++---- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/test/java/com/zaxxer/hikari/pool/ExceptionTest.java b/src/test/java/com/zaxxer/hikari/pool/ExceptionTest.java index 40474ff6..b7ff5e44 100644 --- a/src/test/java/com/zaxxer/hikari/pool/ExceptionTest.java +++ b/src/test/java/com/zaxxer/hikari/pool/ExceptionTest.java @@ -59,7 +59,7 @@ public class ExceptionTest connection.close(); - Assert.assertTrue("Totals (3) connections not as expected", TestElf.getPool(ds).getTotalConnections() >= 0); + Assert.assertTrue("Total (3) connections not as expected", TestElf.getPool(ds).getTotalConnections() >= 0); Assert.assertTrue("Idle (3) connections not as expected", TestElf.getPool(ds).getIdleConnections() >= 0); } diff --git a/src/test/java/com/zaxxer/hikari/pool/RampUpDown.java b/src/test/java/com/zaxxer/hikari/pool/RampUpDown.java index c9186e5f..32be18c2 100644 --- a/src/test/java/com/zaxxer/hikari/pool/RampUpDown.java +++ b/src/test/java/com/zaxxer/hikari/pool/RampUpDown.java @@ -26,7 +26,7 @@ public class RampUpDown try (HikariDataSource ds = new HikariDataSource(config)) { ds.setIdleTimeout(1000); - Assert.assertSame("Totals connections not as expected", 5, TestElf.getPool(ds).getTotalConnections()); + Assert.assertSame("Total connections not as expected", 5, TestElf.getPool(ds).getTotalConnections()); Connection[] connections = new Connection[ds.getMaximumPoolSize()]; for (int i = 0; i < connections.length; i++) @@ -34,7 +34,7 @@ public class RampUpDown connections[i] = ds.getConnection(); } - Assert.assertSame("Totals connections not as expected", 60, TestElf.getPool(ds).getTotalConnections()); + Assert.assertSame("Total connections not as expected", 60, TestElf.getPool(ds).getTotalConnections()); for (Connection connection : connections) { @@ -43,7 +43,7 @@ public class RampUpDown Thread.sleep(2500); - Assert.assertSame("Totals connections not as expected", 5, TestElf.getPool(ds).getTotalConnections()); + Assert.assertSame("Total connections not as expected", 5, TestElf.getPool(ds).getTotalConnections()); } } } diff --git a/src/test/java/com/zaxxer/hikari/pool/StatementTest.java b/src/test/java/com/zaxxer/hikari/pool/StatementTest.java index bf1c7e12..dc0a9dd5 100644 --- a/src/test/java/com/zaxxer/hikari/pool/StatementTest.java +++ b/src/test/java/com/zaxxer/hikari/pool/StatementTest.java @@ -37,14 +37,12 @@ public class StatementTest @Test public void testStatementClose() throws SQLException { - Connection connection = ds.getConnection(); - Assert.assertNotNull(connection); - connection.close(); + ds.getConnection().close(); Assert.assertTrue("Total connections not as expected", TestElf.getPool(ds).getTotalConnections() >= 1); Assert.assertTrue("Idle connections not as expected", TestElf.getPool(ds).getIdleConnections() >= 1); - connection = ds.getConnection(); + Connection connection = ds.getConnection(); Assert.assertNotNull(connection); Assert.assertTrue("Total connections not as expected", TestElf.getPool(ds).getTotalConnections() >= 1); diff --git a/src/test/java/com/zaxxer/hikari/pool/TestConnectionTimeoutRetry.java b/src/test/java/com/zaxxer/hikari/pool/TestConnectionTimeoutRetry.java index 9cdb2238..bed0c1e6 100644 --- a/src/test/java/com/zaxxer/hikari/pool/TestConnectionTimeoutRetry.java +++ b/src/test/java/com/zaxxer/hikari/pool/TestConnectionTimeoutRetry.java @@ -261,7 +261,7 @@ public class TestConnectionTimeoutRetry connection6.close(); connection7.close(); - Assert.assertSame("Totals connections not as expected", 10, TestElf.getPool(ds).getTotalConnections()); + Assert.assertSame("Total connections not as expected", 10, TestElf.getPool(ds).getTotalConnections()); Assert.assertSame("Idle connections not as expected", 10, TestElf.getPool(ds).getIdleConnections()); } } diff --git a/src/test/java/com/zaxxer/hikari/pool/TestConnections.java b/src/test/java/com/zaxxer/hikari/pool/TestConnections.java index db6f0f1f..2fddbf72 100644 --- a/src/test/java/com/zaxxer/hikari/pool/TestConnections.java +++ b/src/test/java/com/zaxxer/hikari/pool/TestConnections.java @@ -324,9 +324,10 @@ public class TestConnections try (final HikariDataSource ds = new HikariDataSource(config)) { + TestElf.setSlf4jLogLevel(HikariPool.class, Level.DEBUG); + final HikariPool pool = TestElf.getPool(ds); ds.getConnection().close(); - TestElf.setSlf4jLogLevel(HikariPool.class, Level.DEBUG); Thread[] threads = new Thread[20]; for (int i = 0; i < threads.length; i++) { diff --git a/src/test/java/com/zaxxer/hikari/pool/UnwrapTest.java b/src/test/java/com/zaxxer/hikari/pool/UnwrapTest.java index 99287435..0aff8ab5 100644 --- a/src/test/java/com/zaxxer/hikari/pool/UnwrapTest.java +++ b/src/test/java/com/zaxxer/hikari/pool/UnwrapTest.java @@ -45,12 +45,10 @@ public class UnwrapTest HikariDataSource ds = new HikariDataSource(config); try { - Connection connection = ds.getConnection(); - Assert.assertNotNull(connection); - connection.close(); + ds.getConnection().close(); Assert.assertSame("Idle connections not as expected", 1, TestElf.getPool(ds).getIdleConnections()); - connection = ds.getConnection(); + Connection connection = ds.getConnection(); Assert.assertNotNull(connection); StubConnection unwrapped = connection.unwrap(StubConnection.class);