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 28
28
<name >Apache Log4j JDBC DBCP 2</name >
29
29
<description >Connection source for the JDBC Appender using Apache Commons DBCP2.</description >
30
30
<properties >
31
- <log4jParentDir >${basedir}/..</log4jParentDir >
32
31
33
32
<!--
34
33
~ OSGi and JPMS options
75
74
<artifactId >h2</artifactId >
76
75
<scope >test</scope >
77
76
</dependency >
78
- <dependency >
79
- <groupId >org.hamcrest</groupId >
80
- <artifactId >hamcrest</artifactId >
81
- <scope >test</scope >
82
- </dependency >
83
77
<dependency >
84
78
<groupId >org.junit.jupiter</groupId >
85
79
<artifactId >junit-jupiter-engine</artifactId >
Original file line number Diff line number Diff line change 25
25
26
26
public class PoolingDriverConnectionSourceTest {
27
27
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
-
36
28
@ Test
37
29
public void testH2Properties () throws SQLException {
38
30
final Property [] properties = new Property [] {
@@ -47,6 +39,7 @@ public void testH2Properties() throws SQLException {
47
39
.setConnectionString (JdbcH2TestHelper .CONNECTION_STRING_IN_MEMORY )
48
40
.setProperties (properties )
49
41
.build ();
42
+ // @formatter:on
50
43
openAndClose (source );
51
44
}
52
45
@@ -78,9 +71,19 @@ public void testH2UserAndPassword() throws SQLException {
78
71
.setUserName (JdbcH2TestHelper .USER_NAME .toCharArray ())
79
72
.setPassword (JdbcH2TestHelper .PASSWORD .toCharArray ())
80
73
.build ();
74
+ // @formatter:on
81
75
openAndClose (source );
82
76
}
83
77
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
+
84
87
@ Test
85
88
public void testH2UserPasswordAndPoolName () throws SQLException {
86
89
// @formatter:off
@@ -91,6 +94,7 @@ public void testH2UserPasswordAndPoolName() throws SQLException {
91
94
.setPassword (JdbcH2TestHelper .PASSWORD .toCharArray ())
92
95
.setPoolName ("MyPoolName" )
93
96
.build ();
97
+ // @formatter:on
94
98
openAndClose (source );
95
99
}
96
100
Original file line number Diff line number Diff line change 39
39
rollbackOnReturn =" true"
40
40
validationQuery =" "
41
41
validationQueryTimeoutSeconds =" -1" >
42
+ <DisconnectionSqlCodes >
43
+ <String >1</String >
44
+ <String >2</String >
45
+ </DisconnectionSqlCodes >
42
46
</PoolableConnectionFactory >
43
47
</PoolingDriver >
44
48
<ColumnMapping name =" ColumnA" />
You can’t perform that action at this time.
0 commit comments