commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1567890 - /commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java
Date Thu, 13 Feb 2014 11:45:39 GMT
Author: markt
Date: Thu Feb 13 11:45:39 2014
New Revision: 1567890

URL: http://svn.apache.org/r1567890
Log:
Add some JMX to this test so help with debugging

Modified:
    commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java

Modified: commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java
URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java?rev=1567890&r1=1567889&r2=1567890&view=diff
==============================================================================
--- commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java
(original)
+++ commons/proper/dbcp/trunk/src/test/java/org/apache/commons/dbcp2/TestPStmtPooling.java
Thu Feb 13 11:45:39 2014
@@ -23,6 +23,7 @@ import java.sql.PreparedStatement;
 import java.sql.Statement;
 import java.sql.SQLException;
 
+import javax.management.ObjectName;
 import javax.sql.DataSource;
 
 import junit.framework.Test;
@@ -31,6 +32,7 @@ import junit.framework.TestSuite;
 
 import org.apache.commons.pool2.ObjectPool;
 import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
 import org.junit.Assert;
 
 /**
@@ -79,13 +81,19 @@ public class TestPStmtPooling extends Te
         ConnectionFactory connFactory = new DriverManagerConnectionFactory(
                 "jdbc:apache:commons:testdriver","u1","p1");
 
+        ObjectName oName = new ObjectName("UnitTests:DataSource=test");
         PoolableConnectionFactory pcf =
-            new PoolableConnectionFactory(connFactory, null);
+            new PoolableConnectionFactory(connFactory, oName);
         pcf.setPoolStatements(true);
         pcf.setDefaultReadOnly(Boolean.FALSE);
         pcf.setDefaultAutoCommit(Boolean.TRUE);
 
-        ObjectPool<PoolableConnection> connPool = new GenericObjectPool<>(pcf);
+        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
+        config.setJmxNameBase("UnitTests:DataSource=test,connectionpool=connections");
+        config.setJmxNamePrefix("");
+        ObjectPool<PoolableConnection> connPool =
+                new GenericObjectPool<>(pcf, config);
+        pcf.setPool(connPool);
 
         DataSource ds = new PoolingDataSource<>(connPool);
 



Mime
View raw message