File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed
java/org/apache/logging/log4j/dbcp2/appender Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 2828 <name >Apache Log4j JDBC DBCP 2</name >
2929 <description >Connection source for the JDBC Appender using Apache Commons DBCP2.</description >
3030 <properties >
31- <log4jParentDir >${basedir}/..</log4jParentDir >
3231
3332 <!--
3433 ~ OSGi and JPMS options
7574 <artifactId >h2</artifactId >
7675 <scope >test</scope >
7776 </dependency >
78- <dependency >
79- <groupId >org.hamcrest</groupId >
80- <artifactId >hamcrest</artifactId >
81- <scope >test</scope >
82- </dependency >
8377 <dependency >
8478 <groupId >org.junit.jupiter</groupId >
8579 <artifactId >junit-jupiter-engine</artifactId >
Original file line number Diff line number Diff line change 2525
2626public class PoolingDriverConnectionSourceTest {
2727
28- private void openAndClose (final PoolingDriverConnectionSource source ) throws SQLException {
29- try (final Connection conn = source .getConnection ()) {
30- Assert .assertFalse (conn .isClosed ());
31- } finally {
32- source .stop ();
33- }
34- }
35-
3628 @ Test
3729 public void testH2Properties () throws SQLException {
3830 final Property [] properties = new Property [] {
@@ -47,6 +39,7 @@ public void testH2Properties() throws SQLException {
4739 .setConnectionString (JdbcH2TestHelper .CONNECTION_STRING_IN_MEMORY )
4840 .setProperties (properties )
4941 .build ();
42+ // @formatter:on
5043 openAndClose (source );
5144 }
5245
@@ -78,9 +71,19 @@ public void testH2UserAndPassword() throws SQLException {
7871 .setUserName (JdbcH2TestHelper .USER_NAME .toCharArray ())
7972 .setPassword (JdbcH2TestHelper .PASSWORD .toCharArray ())
8073 .build ();
74+ // @formatter:on
8175 openAndClose (source );
8276 }
8377
78+ private void openAndClose (final PoolingDriverConnectionSource source ) throws SQLException {
79+ Assert .assertNotNull ("PoolingDriverConnectionSource is null" , source );
80+ try (final Connection conn = source .getConnection ()) {
81+ Assert .assertFalse (conn .isClosed ());
82+ } finally {
83+ source .stop ();
84+ }
85+ }
86+
8487 @ Test
8588 public void testH2UserPasswordAndPoolName () throws SQLException {
8689 // @formatter:off
@@ -91,6 +94,7 @@ public void testH2UserPasswordAndPoolName() throws SQLException {
9194 .setPassword (JdbcH2TestHelper .PASSWORD .toCharArray ())
9295 .setPoolName ("MyPoolName" )
9396 .build ();
97+ // @formatter:on
9498 openAndClose (source );
9599 }
96100
Original file line number Diff line number Diff line change 3939 rollbackOnReturn =" true"
4040 validationQuery =" "
4141 validationQueryTimeoutSeconds =" -1" >
42+ <DisconnectionSqlCodes >
43+ <String >1</String >
44+ <String >2</String >
45+ </DisconnectionSqlCodes >
4246 </PoolableConnectionFactory >
4347 </PoolingDriver >
4448 <ColumnMapping name =" ColumnA" />
You can’t perform that action at this time.
0 commit comments