Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java Sat Oct 22 21:29:55 2011
@@ -47,11 +47,11 @@ public class ConnectionPool extends Noti
* sequence for JMX notifications
*/
protected AtomicInteger sequence = new AtomicInteger(0);
-
+
/**
* Listeners that are local and interested in our notifications, no need for JMX
*/
- protected ConcurrentLinkedQueue<NotificationListener> listeners = new ConcurrentLinkedQueue<NotificationListener>();
+ protected ConcurrentLinkedQueue<NotificationListener> listeners = new ConcurrentLinkedQueue<NotificationListener>();
public ConnectionPool(org.apache.tomcat.jdbc.pool.ConnectionPool pool) {
super();
@@ -61,11 +61,11 @@ public class ConnectionPool extends Noti
public org.apache.tomcat.jdbc.pool.ConnectionPool getPool() {
return pool;
}
-
+
public PoolConfiguration getPoolProperties() {
return pool.getPoolProperties();
}
-
+
//=================================================================
// NOTIFICATION INFO
//=================================================================
@@ -77,23 +77,23 @@ public class ConnectionPool extends Noti
public static final String SUSPECT_ABANDONED_NOTIFICATION = "SUSPECT CONNETION ABANDONED";
@Override
- public MBeanNotificationInfo[] getNotificationInfo() {
+ public MBeanNotificationInfo[] getNotificationInfo() {
MBeanNotificationInfo[] pres = super.getNotificationInfo();
MBeanNotificationInfo[] loc = getDefaultNotificationInfo();
MBeanNotificationInfo[] aug = new MBeanNotificationInfo[pres.length + loc.length];
if (pres.length>0) System.arraycopy(pres, 0, aug, 0, pres.length);
- if (loc.length >0) System.arraycopy(loc, 0, aug, pres.length, loc.length);
- return aug;
- }
-
+ if (loc.length >0) System.arraycopy(loc, 0, aug, pres.length, loc.length);
+ return aug;
+ }
+
public static MBeanNotificationInfo[] getDefaultNotificationInfo() {
- String[] types = new String[] {NOTIFY_INIT, NOTIFY_CONNECT, NOTIFY_ABANDON, SLOW_QUERY_NOTIFICATION, FAILED_QUERY_NOTIFICATION, SUSPECT_ABANDONED_NOTIFICATION};
- String name = Notification.class.getName();
- String description = "A connection pool error condition was met.";
- MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);
+ String[] types = new String[] {NOTIFY_INIT, NOTIFY_CONNECT, NOTIFY_ABANDON, SLOW_QUERY_NOTIFICATION, FAILED_QUERY_NOTIFICATION, SUSPECT_ABANDONED_NOTIFICATION};
+ String name = Notification.class.getName();
+ String description = "A connection pool error condition was met.";
+ MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description);
return new MBeanNotificationInfo[] {info};
}
-
+
/**
* Return true if the notification was sent successfully, false otherwise.
* @param type
@@ -119,17 +119,17 @@ public class ConnectionPool extends Noti
}
return false;
}
-
+
}
-
+
public void addListener(NotificationListener list) {
listeners.add(list);
}
-
+
public boolean removeListener(NotificationListener list) {
return listeners.remove(list);
}
-
+
//=================================================================
// POOL STATS
//=================================================================
@@ -148,17 +148,17 @@ public class ConnectionPool extends Noti
public int getActive() {
return pool.getActive();
}
-
+
@Override
public int getNumIdle() {
return getIdle();
}
-
+
@Override
public int getNumActive() {
return getActive();
}
-
+
@Override
public int getWaitCount() {
return pool.getWaitCount();
@@ -186,7 +186,7 @@ public class ConnectionPool extends Noti
//=================================================================
//=========================================================
// PROPERTIES / CONFIGURATION
- //=========================================================
+ //=========================================================
@Override
@@ -254,11 +254,11 @@ public class ConnectionPool extends Noti
public int getMinIdle() {
return getPoolProperties().getMinIdle();
}
-
+
@Override
public long getMaxAge() {
return getPoolProperties().getMaxAge();
- }
+ }
@Override
public String getName() {
@@ -312,7 +312,7 @@ public class ConnectionPool extends Noti
/**
* {@inheritDoc}
*/
-
+
@Override
public String getValidatorClassName() {
return getPoolProperties().getValidatorClassName();
@@ -321,7 +321,7 @@ public class ConnectionPool extends Noti
/**
* {@inheritDoc}
*/
-
+
@Override
public Validator getValidator() {
return getPoolProperties().getValidator();
@@ -452,12 +452,12 @@ public class ConnectionPool extends Noti
public String getPoolName() {
return getPoolProperties().getName();
}
-
+
@Override
public void setConnectionProperties(String connectionProperties) {
getPoolProperties().setConnectionProperties(connectionProperties);
-
+
}
@Override
@@ -479,192 +479,192 @@ public class ConnectionPool extends Noti
public void setDriverClassName(String driverClassName) {
getPoolProperties().setDriverClassName(driverClassName);
}
-
-
+
+
@Override
public void setFairQueue(boolean fairQueue) {
getPoolProperties().setFairQueue(fairQueue);
}
-
+
@Override
public void setInitialSize(int initialSize) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setInitSQL(String initSQL) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setJdbcInterceptors(String jdbcInterceptors) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setJmxEnabled(boolean jmxEnabled) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setLogAbandoned(boolean logAbandoned) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setMaxActive(int maxActive) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setMaxIdle(int maxIdle) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setMaxWait(int maxWait) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setMinIdle(int minIdle) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setPassword(String password) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setRemoveAbandoned(boolean removeAbandoned) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setTestOnBorrow(boolean testOnBorrow) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setTestOnConnect(boolean testOnConnect) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setTestOnReturn(boolean testOnReturn) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setTestWhileIdle(boolean testWhileIdle) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setUrl(String url) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setUseEquals(boolean useEquals) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setUseLock(boolean useLock) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setUsername(String username) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setValidationInterval(long validationInterval) {
// TODO Auto-generated method stub
-
+
}
-
+
@Override
public void setValidationQuery(String validationQuery) {
// TODO Auto-generated method stub
-
+
}
-
+
/**
* {@inheritDoc}
*/
-
+
@Override
public void setValidatorClassName(String className) {
getPoolProperties().setValidatorClassName(className);
@@ -673,22 +673,22 @@ public class ConnectionPool extends Noti
/**
* {@inheritDoc}
*/
-
+
@Override
public int getSuspectTimeout() {
- return getPoolProperties().getSuspectTimeout();
+ return getPoolProperties().getSuspectTimeout();
}
/**
* {@inheritDoc}
*/
-
+
@Override
public void setSuspectTimeout(int seconds) {
//no op
}
- /**
+ /**
* {@inheritDoc}
*/
@Override
@@ -696,7 +696,7 @@ public class ConnectionPool extends Noti
getPoolProperties().setDataSource(ds);
}
- /**
+ /**
* {@inheritDoc}
*/
@Override
@@ -705,7 +705,7 @@ public class ConnectionPool extends Noti
}
- /**
+ /**
* {@inheritDoc}
*/
@Override
@@ -713,23 +713,23 @@ public class ConnectionPool extends Noti
//noop
}
- /**
+ /**
* {@inheritDoc}
*/
@Override
public String getDataSourceJNDI() {
return getPoolProperties().getDataSourceJNDI();
}
-
- /**
+
+ /**
* {@inheritDoc}
*/
@Override
public boolean isAlternateUsernameAllowed() {
return getPoolProperties().isAlternateUsernameAllowed();
}
-
- /**
+
+ /**
* {@inheritDoc}
*/
@Override
@@ -737,14 +737,14 @@ public class ConnectionPool extends Noti
//noop
}
- /**
+ /**
* {@inheritDoc}
*/
@Override
public void setValidator(Validator validator) {
//noop
}
-
-
+
+
}
Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java Sat Oct 22 21:29:55 2011
@@ -28,13 +28,13 @@ public interface ConnectionPoolMBean ext
public int getIdle();
public int getActive();
-
+
public int getNumIdle();
-
+
public int getNumActive();
-
+
public int getWaitCount();
-
+
//=================================================================
// POOL OPERATIONS
//=================================================================
@@ -48,5 +48,5 @@ public interface ConnectionPoolMBean ext
// POOL NOTIFICATIONS
//=================================================================
-
+
}
Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/mbeans-descriptors.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/mbeans-descriptors.xml?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/mbeans-descriptors.xml (original)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/mbeans-descriptors.xml Sat Oct 22 21:29:55 2011
@@ -25,7 +25,7 @@
description="Fully qualified class name of the managed object"
type="java.lang.String"
writeable="false"/>
-
+
<attribute name="size"
description="The number of established connections in the pool, idle and in use"
type="java.lang.Integer"
@@ -45,7 +45,7 @@
description="The number of established connections in the pool that are in use"
type="java.lang.Integer"
writeable="false"/>
-
+
<attribute name="numActive"
description="Same as the active attribute"
type="java.lang.Integer"
@@ -108,12 +108,12 @@
description="The max number of idle connections"
type="java.lang.Integer"
writeable="false"/>
-
+
<attribute name="minIdle"
description="The minimum number of open connections"
type="java.lang.Integer"
writeable="false"/>
-
+
<attribute name="maxWait"
description="The time to wait in milliseconds before a SQLException is thrown when a connection is requested"
type="java.lang.Integer"
@@ -190,12 +190,12 @@
description="The name of the connection pool, will be used in the ObjectName of the actual pool"
type="java.lang.String"
writeable="false"/>
-
+
<attribute name="password"
description="For security purposes,this doesn't return anything"
type="java.lang.String"
writeable="false"/>
-
+
<attribute name="username"
description="The username used to open connections"
type="java.lang.String"
@@ -222,19 +222,19 @@
type="java.lang.String"
writeable="false"/>
- <operation name="checkIdle"
- description="forces a check of idle connections"
- impact="ACTION"
+ <operation name="checkIdle"
+ description="forces a check of idle connections"
+ impact="ACTION"
returnType="void" />
-
- <operation name="checkAbandoned"
- description="forces a check of abandoned connections"
- impact="ACTION"
+
+ <operation name="checkAbandoned"
+ description="forces a check of abandoned connections"
+ impact="ACTION"
returnType="void" />
-
- <operation name="testIdle"
- description="forces a validation of abandoned connections"
- impact="ACTION"
+
+ <operation name="testIdle"
+ description="forces a validation of abandoned connections"
+ impact="ACTION"
returnType="void" />
</mbean>
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptor.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptor.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptor.java Sat Oct 22 21:29:55 2011
@@ -46,7 +46,7 @@ public class TestInterceptor extends Jdb
@Override
public void reset(ConnectionPool parent, PooledConnection con) {
// TODO Auto-generated method stub
-
+
}
@Override
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AbandonPercentageTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AbandonPercentageTest.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AbandonPercentageTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AbandonPercentageTest.java Sat Oct 22 21:29:55 2011
@@ -25,7 +25,7 @@ public class AbandonPercentageTest exten
public AbandonPercentageTest(String name) {
super(name);
}
-
+
public void testDefaultAbandon() throws Exception {
this.init();
this.datasource.setMaxActive(100);
@@ -41,7 +41,7 @@ public class AbandonPercentageTest exten
assertEquals("Number of connections active/busy should be 0",0,datasource.getPool().getActive());
con.close();
}
-
+
public void testMaxedOutAbandon() throws Exception {
int size = 100;
this.init();
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/AlternateUsernameTest.java Sat Oct 22 21:29:55 2011
@@ -40,7 +40,7 @@ public class AlternateUsernameTest exten
public void testUsernameCompare() throws Exception {
testUsername(true);
}
-
+
private void testUsername(boolean allowUsernameChange) throws Exception {
long start = System.currentTimeMillis();
int withoutuser =10;
@@ -51,7 +51,7 @@ public class AlternateUsernameTest exten
this.datasource.setUrl("jdbc:tomcat:test");
this.datasource.setAlternateUsernameAllowed(allowUsernameChange);
this.datasource.getConnection().close();
-
+
TestRunner[] runners = new TestRunner[withuser+withoutuser];
for (int i=0; i<withuser; i++) {
TestRunner with = new TestRunner("foo","bar",datasource.getPoolProperties().getUsername(),datasource.getPoolProperties().getPassword());
@@ -78,34 +78,34 @@ public class AlternateUsernameTest exten
System.out.println("Nr of iterations:"+total+" over "+(stop-start)+ " ms.");
}
-
+
public void testUsernameCompareAgain() throws Exception {
testUsernameCompare();
}
-
+
public void testUsernameCompareNotAllowed() throws Exception {
testUsername(false);
}
-
+
public static class TestResult {
public int iterations;
public int failures;
public String lastMessage;
}
-
+
public class TestRunner implements Callable<TestResult> {
String username;
String password;
volatile boolean done = false;
TestResult result = null;
boolean useuser = true;
-
+
public TestRunner(String user, String pass, String guser, String gpass) {
username = user==null?guser : user;
password = pass==null?gpass : pass;
useuser = user!=null;
}
-
+
@Override
public TestResult call() {
TestResult test = new TestResult();
@@ -113,13 +113,13 @@ public class AlternateUsernameTest exten
for (int i=0; (!done) && (i<iterations); i++) {
test.iterations = i+1;
try {
-
-
+
+
pcon = useuser ? (PooledConnection)AlternateUsernameTest.this.datasource.getConnection(username, password) :
(PooledConnection)AlternateUsernameTest.this.datasource.getConnection();
-
+
Connection con = (Connection)pcon.getConnection();
-
+
assertTrue("Username mismatch: Requested User:"+username+" Actual user:"+con.getUsername(), con.getUsername().equals(username));
assertTrue("Password mismatch: Requested Password:"+password+" Actual password:"+con.getPassword(), con.getPassword().equals(password));
}catch (SQLException x) {
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Async0IdleTestBug50477.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Async0IdleTestBug50477.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Async0IdleTestBug50477.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Async0IdleTestBug50477.java Sat Oct 22 21:29:55 2011
@@ -30,8 +30,8 @@ public class Async0IdleTestBug50477 exte
public Async0IdleTestBug50477(String name) {
super(name);
}
-
-
+
+
public void testAsync0Idle0Size() throws Exception {
System.out.println("[testPoolThreads20Connections10FairAsync] Starting fairness - Tomcat JDBC - Fair - Async");
init();
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/BorrowWaitTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/BorrowWaitTest.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/BorrowWaitTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/BorrowWaitTest.java Sat Oct 22 21:29:55 2011
@@ -25,7 +25,7 @@ public class BorrowWaitTest extends Defa
public BorrowWaitTest(String name) {
super(name);
}
-
+
public void testWaitTime() throws Exception {
int wait = 10000;
this.init();
@@ -45,7 +45,7 @@ public class BorrowWaitTest extends Defa
}
con.close();
}
-
+
public void testWaitTimeInfinite() throws Exception {
if(true){
System.err.println("testWaitTimeInfinite() test is disabled.");
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Bug50571.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Bug50571.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Bug50571.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Bug50571.java Sat Oct 22 21:29:55 2011
@@ -19,11 +19,11 @@ package org.apache.tomcat.jdbc.test;
import org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
public class Bug50571 extends DefaultTestCase{
-
+
public Bug50571(String name) {
super(name);
}
-
+
@Override
public void setUp() throws Exception {
super.setUp();
@@ -32,7 +32,7 @@ public class Bug50571 extends DefaultTes
this.datasource.setDefaultTransactionIsolation(-55);
this.datasource.setInitialSize(1);
}
-
+
public void testBug50571() throws Exception {
this.datasource.getConnection().close();
}
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Bug50805.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Bug50805.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Bug50805.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/Bug50805.java Sat Oct 22 21:29:55 2011
@@ -23,29 +23,29 @@ public class Bug50805 extends DefaultTes
public Bug50805(String name) {
super(name);
}
-
+
public void test50805() throws Exception {
init();
this.datasource.setInitialSize(0);
this.datasource.setMaxActive(10);
this.datasource.setMinIdle(1);
-
+
assertEquals("Current size should be 0.", 0, this.datasource.getSize());
-
+
this.datasource.getConnection().close();
-
+
assertEquals("Current size should be 1.", 1, this.datasource.getSize());
assertEquals("Idle size should be 1.", 1, this.datasource.getIdle());
assertEquals("Busy size should be 0.", 0, this.datasource.getActive());
-
+
Future<Connection> fc = this.datasource.getConnectionAsync();
-
+
Connection con = fc.get();
-
+
assertEquals("Current size should be 1.", 1, this.datasource.getSize());
assertEquals("Idle size should be 0.", 0, this.datasource.getIdle());
assertEquals("Busy size should be 1.", 1, this.datasource.getActive());
-
+
con.close();
assertEquals("Current size should be 1.", 1, this.datasource.getSize());
assertEquals("Idle size should be 1.", 1, this.datasource.getIdle());
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CheckOutThreadTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CheckOutThreadTest.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CheckOutThreadTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CheckOutThreadTest.java Sat Oct 22 21:29:55 2011
@@ -198,7 +198,7 @@ public class CheckOutThreadTest extends
// System.out.println("[testC3P0Threads20Connections10]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations));
// tearDown();
// }
-
+
public void testDBCPThreads10Connections10Validate() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
@@ -241,7 +241,7 @@ public class CheckOutThreadTest extends
System.out.println("[testPoolThreads10Connections10Validate]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations));
tearDown();
}
-
+
public void testPoolThreads10Connections10ValidateFair() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
@@ -327,7 +327,7 @@ public class CheckOutThreadTest extends
System.out.println("[testPoolThreads20Connections10Validate]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations));
tearDown();
}
-
+
public void testPoolThreads10Connections20ValidateFair() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
@@ -349,7 +349,7 @@ public class CheckOutThreadTest extends
System.out.println("[testPoolThreads20Connections10ValidateFair]Test complete:"+delta+" ms. Iterations:"+(threadcount*this.iterations));
tearDown();
}
-
+
// public void testC3P0Threads10Connections20Validate() throws Exception {
// init();
// this.datasource.getPoolProperties().setMaxActive(10);
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/ConnectCountTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/ConnectCountTest.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/ConnectCountTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/ConnectCountTest.java Sat Oct 22 21:29:55 2011
@@ -36,7 +36,7 @@ public class ConnectCountTest extends De
public ConnectCountTest(String name) {
super(name);
}
-
+
protected boolean run = true;
protected long sleep = Long.getLong("sleep", 10).longValue();
protected long complete = Long.getLong("complete",20000).longValue();
@@ -83,10 +83,10 @@ public class ConnectCountTest extends De
(((float)totalfetch))/(float)threads.length);
System.out.println("["+name+"] Max wait:"+maxwait/1000000f+"ms. Min wait:"+minwait/1000000f+"ms. Average wait:"+(((((float)totalwait))/(float)totalfetch)/1000000f)+" ms.");
System.out.println("["+name+"] Max active:"+active+" Expected Active:"+expected);
-
-
+
+
}
-
+
public void testDBCPThreads20Connections10() throws Exception {
System.out.println("[testDBCPThreads20Connections10] Starting fairness - DBCP");
this.threadcount = 20;
@@ -100,7 +100,7 @@ public class ConnectCountTest extends De
threads[i] = new TestThread();
threads[i].setName("tomcat-dbcp-"+i);
threads[i].d = this.tDatasource;
-
+
}
for (int i=0; i<threadcount; i++) {
threads[i].start();
@@ -128,7 +128,7 @@ public class ConnectCountTest extends De
threads[i] = new TestThread();
threads[i].setName("tomcat-pool-"+i);
threads[i].d = this.datasource;
-
+
}
for (int i=0; i<threadcount; i++) {
threads[i].start();
@@ -158,7 +158,7 @@ public class ConnectCountTest extends De
threads[i] = new TestThread();
threads[i].setName("tomcat-pool-"+i);
threads[i].d = this.datasource;
-
+
}
for (int i=0; i<threadcount; i++) {
threads[i].start();
@@ -172,7 +172,7 @@ public class ConnectCountTest extends De
System.out.println("Test completed in: " + delta + "ms.");
tearDown();
}
-
+
public void testPoolThreads20Connections10FairAsync() throws Exception {
System.out.println("[testPoolThreads20Connections10FairAsync] Starting fairness - Tomcat JDBC - Fair - Async");
init();
@@ -189,7 +189,7 @@ public class ConnectCountTest extends De
threads[i].setName("tomcat-pool-"+i);
threads[i].async = true;
threads[i].d = this.datasource;
-
+
}
for (int i=0; i<threadcount; i++) {
threads[i].start();
@@ -203,7 +203,7 @@ public class ConnectCountTest extends De
System.out.println("Test completed in: " + delta + "ms.");
tearDown();
}
-
+
// public void testC3P0Threads20Connections10() throws Exception {
// System.out.println("[testC3P0Threads20Connections10] Starting fairness - C3P0");
// init();
@@ -217,7 +217,7 @@ public class ConnectCountTest extends De
// threads[i] = new TestThread();
// threads[i].setName("tomcat-pool-"+i);
// threads[i].d = this.c3p0Datasource;
-//
+//
// }
// for (int i=0; i<threadcount; i++) {
// threads[i].start();
@@ -232,7 +232,7 @@ public class ConnectCountTest extends De
//
// }
-
+
public class TestThread extends Thread {
protected DataSource d;
protected String query = null;
@@ -267,8 +267,8 @@ public class ConnectCountTest extends De
rs.close();
st.close();
}
- try {
- if (ConnectCountTest.this.sleep>0) sleep(ConnectCountTest.this.sleep);
+ try {
+ if (ConnectCountTest.this.sleep>0) sleep(ConnectCountTest.this.sleep);
} catch (InterruptedException x) {
interrupted();
}
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CreateTestTable.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CreateTestTable.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CreateTestTable.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/CreateTestTable.java Sat Oct 22 21:29:55 2011
@@ -26,9 +26,9 @@ import java.sql.ResultSet;
import org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer;
public class CreateTestTable extends DefaultTestCase {
-
+
public static volatile boolean recreate = Boolean.getBoolean("recreate");
-
+
public CreateTestTable(String name) {
super(name);
}
@@ -43,7 +43,7 @@ public class CreateTestTable extends Def
st.close();
con.close();
}
-
+
public int testCheckData() throws Exception {
int count = 0;
String check = "select count (*) from test";
@@ -52,7 +52,7 @@ public class CreateTestTable extends Def
Statement st = con.createStatement();
try {
ResultSet rs = st.executeQuery(check);
-
+
if (rs.next())
count = rs.getInt(1);
rs.close();
@@ -62,7 +62,7 @@ public class CreateTestTable extends Def
con.close();
return count;
}
-
+
public void testPopulateData() throws Exception {
int count = 100000;
int actual = testCheckData();
@@ -70,13 +70,13 @@ public class CreateTestTable extends Def
System.out.println("Test tables has "+actual+" rows of data. No need to populate.");
return;
}
-
+
datasource.setJdbcInterceptors(ResetAbandonedTimer.class.getName());
String insert = "insert into test values (?,?,?,?,?)";
this.init();
this.datasource.setRemoveAbandoned(false);
Connection con = datasource.getConnection();
-
+
boolean commit = con.getAutoCommit();
con.setAutoCommit(false);
if (recreate) {
@@ -87,8 +87,8 @@ public class CreateTestTable extends Def
st.execute("create table test(id int not null, val1 varchar(255), val2 varchar(255), val3 varchar(255), val4 varchar(255))");
st.close();
}
-
-
+
+
PreparedStatement ps = con.prepareStatement(insert);
ps.setQueryTimeout(0);
for (int i=actual; i<count; i++) {
@@ -117,7 +117,7 @@ public class CreateTestTable extends Def
con.setAutoCommit(commit);
con.close();
}
-
+
public static Random random = new Random(System.currentTimeMillis());
public static String getRandom() {
StringBuilder s = new StringBuilder(256);
@@ -128,7 +128,7 @@ public class CreateTestTable extends Def
}
return s.toString();
}
-
+
public static void main(String[] args) throws Exception {
recreate = true;
CreateTestTable test = new CreateTestTable("CreateTestTable");
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultProperties.java Sat Oct 22 21:29:55 2011
@@ -28,22 +28,22 @@ import org.apache.tomcat.jdbc.pool.PoolP
public class DefaultProperties extends PoolProperties {
public DefaultProperties() {
dbProperties = new Properties();
-
+
//mysql
- //url = System.getProperty("url","jdbc:mysql://localhost:3306/mysql?autoReconnect=true");
+ //url = System.getProperty("url","jdbc:mysql://localhost:3306/mysql?autoReconnect=true");
//driverClassName = System.getProperty("driverClassName","com.mysql.jdbc.Driver");
-
+
//derby
//url = System.getProperty("url","jdbc:derby:derbyDB;create=true");
//driverClassName = System.getProperty("driverClassName","org.apache.derby.jdbc.EmbeddedDriver");
-
+
url = System.getProperty("url","jdbc:h2:~/.h2/test;QUERY_TIMEOUT=0;DB_CLOSE_ON_EXIT=FALSE");
driverClassName = System.getProperty("driverClassName","org.h2.Driver");
System.setProperty("h2.serverCachedObjects", "10000");
-
+
password = System.getProperty("password","password");
username = System.getProperty("username","root");
-
+
validationQuery = System.getProperty("validationQuery","SELECT 1");
defaultAutoCommit = Boolean.TRUE;
defaultReadOnly = Boolean.FALSE;
@@ -55,7 +55,7 @@ public class DefaultProperties extends P
maxIdle = initialSize;
minIdle = initialSize;
maxWait = 10000;
-
+
testOnBorrow = true;
testOnReturn = false;
testWhileIdle = true;
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java Sat Oct 22 21:29:55 2011
@@ -43,7 +43,7 @@ public class DefaultTestCase extends Tes
public DefaultTestCase(String name) {
super(name);
}
-
+
@Override
public void setUp() throws Exception {
init();
@@ -71,7 +71,7 @@ public class DefaultTestCase extends Tes
datasource.setPoolProperties(p);
return datasource;
}
-
+
protected void init() throws Exception {
this.datasource = createDefaultDataSource();
}
@@ -104,13 +104,13 @@ public class DefaultTestCase extends Tes
x.printStackTrace();
}
}
-
+
protected void transferPropertiesToC3P0() throws Exception {
// System.setProperty("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "WARNING");
// MLog.getLogger().setLevel(MLevel.WARNING);
// MLog.getLogger("com").setLevel(MLevel.WARNING);
// //http://www.mchange.com/projects/c3p0/index.html#automaticTestTable
-// ComboPooledDataSource c3p0 = new ComboPooledDataSource();
+// ComboPooledDataSource c3p0 = new ComboPooledDataSource();
// c3p0.setAcquireIncrement(1);
// c3p0.setAcquireRetryAttempts(2);
// c3p0.setAcquireRetryDelay(datasource.getPoolProperties().getMaxWait());
@@ -132,7 +132,7 @@ public class DefaultTestCase extends Tes
// c3p0.setJdbcUrl(datasource.getPoolProperties().getUrl());
// c3p0.setDriverClass(datasource.getPoolProperties().getDriverClassName());
// this.c3p0Datasource = c3p0;
-
+
/**
acquireIncrement
acquireRetryAttempts
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/FairnessTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/FairnessTest.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/FairnessTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/FairnessTest.java Sat Oct 22 21:29:55 2011
@@ -35,7 +35,7 @@ public class FairnessTest extends Defaul
public FairnessTest(String name) {
super(name);
}
-
+
protected boolean run = true;
protected long sleep = Long.getLong("sleep", 10).longValue();
protected long complete = Long.getLong("complete",20000).longValue();
@@ -59,10 +59,10 @@ public class FairnessTest extends Defaul
(((float)totalfetch))/(float)threads.length);
System.out.println("["+name+"] Max wait:"+maxwait/1000000f+"ms. Min wait:"+minwait/1000000f+"ms. Average wait:"+(((((float)totalwait))/(float)totalfetch)/1000000f)+" ms.");
System.out.println("["+name+"] Max active:"+active+" Expected Active:"+expected);
-
-
+
+
}
-
+
public void testDBCPThreads20Connections10() throws Exception {
System.out.println("[testDBCPThreads20Connections10] Starting fairness - DBCP");
init();
@@ -77,7 +77,7 @@ public class FairnessTest extends Defaul
threads[i] = new TestThread();
threads[i].setName("tomcat-dbcp-"+i);
threads[i].d = this.tDatasource;
-
+
}
for (int i=0; i<threadcount; i++) {
threads[i].start();
@@ -107,7 +107,7 @@ public class FairnessTest extends Defaul
threads[i] = new TestThread();
threads[i].setName("tomcat-pool-"+i);
threads[i].d = this.datasource;
-
+
}
for (int i=0; i<threadcount; i++) {
threads[i].start();
@@ -137,7 +137,7 @@ public class FairnessTest extends Defaul
threads[i] = new TestThread();
threads[i].setName("tomcat-pool-"+i);
threads[i].d = this.datasource;
-
+
}
for (int i=0; i<threadcount; i++) {
threads[i].start();
@@ -151,7 +151,7 @@ public class FairnessTest extends Defaul
System.out.println("Test completed in: " + delta + "ms.");
tearDown();
}
-
+
public void testPoolThreads20Connections10FairAsync() throws Exception {
System.out.println("[testPoolThreads20Connections10FairAsync] Starting fairness - Tomcat JDBC - Fair - Async");
init();
@@ -168,7 +168,7 @@ public class FairnessTest extends Defaul
threads[i].setName("tomcat-pool-"+i);
threads[i].async = true;
threads[i].d = this.datasource;
-
+
}
for (int i=0; i<threadcount; i++) {
threads[i].start();
@@ -182,7 +182,7 @@ public class FairnessTest extends Defaul
System.out.println("Test completed in: " + delta + "ms.");
tearDown();
}
-
+
// public void testC3P0Threads20Connections10() throws Exception {
// System.out.println("[testC3P0Threads20Connections10] Starting fairness - C3P0");
// init();
@@ -198,7 +198,7 @@ public class FairnessTest extends Defaul
// threads[i] = new TestThread();
// threads[i].setName("tomcat-pool-"+i);
// threads[i].d = this.c3p0Datasource;
-//
+//
// }
// for (int i=0; i<threadcount; i++) {
// threads[i].start();
@@ -213,7 +213,7 @@ public class FairnessTest extends Defaul
//
// }
-
+
public class TestThread extends Thread {
protected DataSource d;
protected String query = null;
@@ -248,8 +248,8 @@ public class FairnessTest extends Defaul
rs.close();
st.close();
}
- try {
- if (FairnessTest.this.sleep>0) sleep(FairnessTest.this.sleep);
+ try {
+ if (FairnessTest.this.sleep>0) sleep(FairnessTest.this.sleep);
} catch (InterruptedException x) {
interrupted();
}
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/JmxPasswordTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/JmxPasswordTest.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/JmxPasswordTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/JmxPasswordTest.java Sat Oct 22 21:29:55 2011
@@ -33,11 +33,11 @@ public class JmxPasswordTest extends Def
public static final String password = "password";
public static final String username = "username";
public static ObjectName oname = null;
-
+
public JmxPasswordTest(String s) {
super(s);
}
-
+
@Override
public void setUp() throws Exception {
super.setUp();
@@ -55,9 +55,9 @@ public class JmxPasswordTest extends Def
ConnectionPool pool = datasource.createPool();
org.apache.tomcat.jdbc.pool.jmx.ConnectionPool jmxPool = new org.apache.tomcat.jdbc.pool.jmx.ConnectionPool(pool);
mbs.registerMBean(jmxPool, oname);
-
+
}
-
+
public void testPassword() throws Exception {
assertEquals("Passwords should match when not using JMX.",password,datasource.getPoolProperties().getPassword());
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
@@ -67,5 +67,5 @@ public class JmxPasswordTest extends Def
assertFalse("Passwords should not match.", password.equals(jmxPassword));
assertFalse("Password property should be missing", jmxProperties.containsKey(PoolUtilities.PROP_PASSWORD));
}
-
+
}
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOAsyncExample.java Sat Oct 22 21:29:55 2011
@@ -50,10 +50,10 @@ public class SimplePOJOAsyncExample {
p.setRemoveAbandoned(true);
p.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
DataSource datasource = new DataSource();
- datasource.setPoolProperties(p);
-
+ datasource.setPoolProperties(p);
+
Connection con = null;
- try {
+ try {
Future<Connection> future = datasource.getConnectionAsync();
while (!future.isDone()) {
System.out.println("Connection is not yet available. Do some background work");
@@ -63,7 +63,7 @@ public class SimplePOJOAsyncExample {
Thread.interrupted();
}
}
- con = future.get(); //should return instantly
+ con = future.get(); //should return instantly
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from user");
int cnt = 1;
@@ -74,7 +74,7 @@ public class SimplePOJOAsyncExample {
st.close();
} finally {
if (con!=null) try {con.close();}catch (Exception ignore) {}
- }
+ }
}
}
\ No newline at end of file
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOExample.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOExample.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOExample.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/SimplePOJOExample.java Sat Oct 22 21:29:55 2011
@@ -49,10 +49,10 @@ public class SimplePOJOExample {
p.setLogAbandoned(true);
p.setRemoveAbandoned(true);
DataSource datasource = new DataSource();
- datasource.setPoolProperties(p);
-
+ datasource.setPoolProperties(p);
+
Connection con = null;
- try {
+ try {
con = datasource.getConnection();
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from user");
@@ -64,7 +64,7 @@ public class SimplePOJOExample {
st.close();
} finally {
if (con!=null) try {con.close();}catch (Exception ignore) {}
- }
+ }
}
}
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StarvationTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StarvationTest.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StarvationTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StarvationTest.java Sat Oct 22 21:29:55 2011
@@ -20,9 +20,9 @@ import java.sql.Connection;
import java.sql.SQLException;
/**
- * If a connection is abandoned and closed,
- * then that should free up a spot in the pool, and other threads
- * that are waiting should not time out and throw an error but be
+ * If a connection is abandoned and closed,
+ * then that should free up a spot in the pool, and other threads
+ * that are waiting should not time out and throw an error but be
* able to acquire a connection, since one was just released.
* @author fhanik
*
@@ -32,7 +32,7 @@ public class StarvationTest extends Defa
public StarvationTest(String name) {
super(name);
}
-
+
private void config() {
datasource.getPoolProperties().setMaxActive(1);
datasource.getPoolProperties().setMaxIdle(1);
@@ -43,14 +43,14 @@ public class StarvationTest extends Defa
datasource.getPoolProperties().setMaxWait(10000);
datasource.getPoolProperties().setLogAbandoned(true);
}
-
+
// public void testDBCPConnectionStarvation() throws Exception {
// init();
// config();
// this.transferProperties();
// this.tDatasource.getConnection().close();
// javax.sql.DataSource datasource = this.tDatasource;
-// Connection con1 = datasource.getConnection();
+// Connection con1 = datasource.getConnection();
// Connection con2 = null;
// try {
// con2 = datasource.getConnection();
@@ -67,11 +67,11 @@ public class StarvationTest extends Defa
// }
//
// }
-
+
public void testConnectionStarvation() throws Exception {
init();
config();
- Connection con1 = datasource.getConnection();
+ Connection con1 = datasource.getConnection();
Connection con2 = null;
try {
con2 = datasource.getConnection();
@@ -92,7 +92,7 @@ public class StarvationTest extends Defa
init();
config();
datasource.getPoolProperties().setFairQueue(true);
- Connection con1 = datasource.getConnection();
+ Connection con1 = datasource.getConnection();
Connection con2 = null;
try {
con2 = datasource.getConnection();
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.java Sat Oct 22 21:29:55 2011
@@ -27,7 +27,7 @@ public class StatementFinalizerTest exte
public StatementFinalizerTest(String name) {
super(name);
}
-
+
public void testStatementFinalization() throws Exception {
this.init();
datasource.setJdbcInterceptors(StatementFinalizer.class.getName());
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestAsyncQueue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestAsyncQueue.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestAsyncQueue.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestAsyncQueue.java Sat Oct 22 21:29:55 2011
@@ -38,8 +38,8 @@ public class TestAsyncQueue extends Test
this.queue = null;
super.tearDown();
}
-
-
+
+
public void testAsyncPoll1() throws Exception {
Object item = new Object();
queue.offer(item);
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConcurrency.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConcurrency.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConcurrency.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConcurrency.java Sat Oct 22 21:29:55 2011
@@ -26,13 +26,13 @@ import org.apache.tomcat.jdbc.test.drive
public class TestConcurrency extends DefaultTestCase {
public static final boolean debug = Boolean.getBoolean("jdbc.debug");
-
+
protected volatile DataSource ds = null;
-
+
public TestConcurrency(String name) {
super(name);
}
-
+
@Override
public void setUp() {
// TODO Auto-generated method stub
@@ -57,7 +57,7 @@ public class TestConcurrency extends Def
Driver.reset();
super.tearDown();
}
-
+
public void testSimple() throws Exception {
ds.getConnection().close();
final int iter = 1000 * 10;
@@ -106,9 +106,9 @@ public class TestConcurrency extends Def
assertEquals("Idle comparison:",10, ds.getPool().getIdle());
assertEquals("Used comparison:",0, ds.getPool().getActive());
assertEquals("Connect count",10,Driver.connectCount.get());
-
+
}
-
+
public void testBrutal() throws Exception {
ds.getPoolProperties().setRemoveAbandoned(false);
ds.getPoolProperties().setRemoveAbandonedTimeout(1);
@@ -210,5 +210,5 @@ public class TestConcurrency extends Def
assertEquals("Used comparison:",0, ds.getPool().getActive());
assertEquals("Connect count",10,Driver.connectCount.get());
}
-
+
}
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConnectionState.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConnectionState.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConnectionState.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestConnectionState.java Sat Oct 22 21:29:55 2011
@@ -44,7 +44,7 @@ public class TestConnectionState extends
d1.close(true);
assertTrue("Connection should be closed",c1.isClosed());
}
-
+
public void testAutoCommitTrue() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
@@ -59,7 +59,7 @@ public class TestConnectionState extends
c1 = d1.getConnection();
assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
}
-
+
public void testDefaultCatalog() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestException.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestException.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestException.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestException.java Sat Oct 22 21:29:55 2011
@@ -27,7 +27,7 @@ public class TestException extends Defau
public TestException(String name) {
super(name);
}
-
+
public void testException() throws Exception {
init();
datasource.getPoolProperties().setJdbcInterceptors(TestInterceptor.class.getName());
@@ -35,20 +35,20 @@ public class TestException extends Defau
try {
con.createStatement();
}catch (Exception x) {
-
+
}
}
-
-
+
+
public static class TestInterceptor extends JdbcInterceptor {
@Override
public void reset(ConnectionPool parent, PooledConnection con) {
// TODO Auto-generated method stub
-
+
}
-
+
}
}
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestGCClose.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestGCClose.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestGCClose.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestGCClose.java Sat Oct 22 21:29:55 2011
@@ -24,7 +24,7 @@ public class TestGCClose extends Default
public TestGCClose(String name) {
super(name);
}
-
+
public void testGCStop() throws Exception {
init();
datasource.getConnection();
@@ -32,7 +32,7 @@ public class TestGCClose extends Default
tearDown();
Thread.sleep(20000);
}
-
+
public void testClose() throws Exception {
init();
datasource.getConnection();
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestGetConnection.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestGetConnection.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestGetConnection.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestGetConnection.java Sat Oct 22 21:29:55 2011
@@ -26,7 +26,7 @@ public class TestGetConnection extends D
public TestGetConnection(String name) {
super(name);
}
-
+
public void testGetConnection() throws Exception {
this.init();
Connection con = this.datasource.getConnection();
@@ -34,7 +34,7 @@ public class TestGetConnection extends D
Connection actual = ((PooledConnection)con).getConnection();
assertNotNull("Connection delegate should not be null.",actual);
System.out.println("Actual connection:"+actual.getClass().getName());
-
+
}
}
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestInterceptorShortName.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestInterceptorShortName.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestInterceptorShortName.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestInterceptorShortName.java Sat Oct 22 21:29:55 2011
@@ -26,7 +26,7 @@ public class TestInterceptorShortName ex
public TestInterceptorShortName(String name) {
super(name);
}
-
+
public void testShortInterceptor() throws Exception {
this.datasource = this.createDefaultDataSource();
this.datasource.setJdbcInterceptors("TestInterceptor");
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSizePreservation.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSizePreservation.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSizePreservation.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSizePreservation.java Sat Oct 22 21:29:55 2011
@@ -25,7 +25,7 @@ import org.apache.tomcat.jdbc.pool.DataS
import org.apache.tomcat.jdbc.pool.PoolConfiguration;
import org.apache.tomcat.jdbc.test.driver.Driver;
/**
- *
+ *
* @author Jeremy Norris
* https://issues.apache.org/bugzilla/show_bug.cgi?id=50613
*
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSlowQueryReport.java Sat Oct 22 21:29:55 2011
@@ -37,7 +37,7 @@ public class TestSlowQueryReport extends
public TestSlowQueryReport(String name) {
super(name);
}
-
+
public void testSlowSql() throws Exception {
int count = 3;
this.init();
@@ -57,7 +57,7 @@ public class TestSlowQueryReport extends
String key = map.keySet().iterator().next();
SlowQueryReport.QueryStats stats = map.get(key);
System.out.println("Stats:"+stats);
-
+
for (int i=0; i<count; i++) {
PreparedStatement st = con.prepareStatement(slowSql);
ResultSet rs = st.executeQuery();
@@ -65,7 +65,7 @@ public class TestSlowQueryReport extends
st.close();
}
System.out.println("Stats:"+stats);
-
+
for (int i=0; i<count; i++) {
CallableStatement st = con.prepareCall(slowSql);
ResultSet rs = st.executeQuery();
@@ -102,11 +102,11 @@ public class TestSlowQueryReport extends
ClientListener listener = new ClientListener();
ConnectionPool pool = datasource.getPool();
ManagementFactory.getPlatformMBeanServer().addNotificationListener(
- SlowQueryReportJmx.getObjectName(SlowQueryReportJmx.class, pool.getName()),
+ SlowQueryReportJmx.getObjectName(SlowQueryReportJmx.class, pool.getName()),
listener,
null,
null);
-
+
for (int i=0; i<count; i++) {
PreparedStatement st = con.prepareStatement(slowSql);
ResultSet rs = st.executeQuery();
@@ -114,7 +114,7 @@ public class TestSlowQueryReport extends
st.close();
}
System.out.println("Stats:"+stats);
-
+
for (int i=0; i<count; i++) {
CallableStatement st = con.prepareCall(slowSql);
ResultSet rs = st.executeQuery();
@@ -129,7 +129,7 @@ public class TestSlowQueryReport extends
assertNull(SlowQueryReport.getPoolStats(pool.getName()));
}
-
+
public void testFastSql() throws Exception {
int count = 3;
this.init();
@@ -150,8 +150,8 @@ public class TestSlowQueryReport extends
con.close();
tearDown();
assertNull(SlowQueryReport.getPoolStats(pool.getName()));
- }
-
+ }
+
public void testFailedSql() throws Exception {
int count = 3;
this.init();
@@ -168,7 +168,7 @@ public class TestSlowQueryReport extends
// NO-OP
}
st.close();
-
+
}
Map<String,SlowQueryReport.QueryStats> map = SlowQueryReport.getPoolStats(datasource.getPool().getName());
assertNotNull(map);
@@ -180,9 +180,9 @@ public class TestSlowQueryReport extends
con.close();
tearDown();
assertNull(SlowQueryReport.getPoolStats(pool.getName()));
- }
-
-
+ }
+
+
public class ClientListener implements NotificationListener {
volatile int notificationCount = 0;
@Override
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestStatementCache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestStatementCache.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestStatementCache.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestStatementCache.java Sat Oct 22 21:29:55 2011
@@ -23,14 +23,14 @@ import org.apache.tomcat.jdbc.pool.inter
public class TestStatementCache extends DefaultTestCase {
-
+
public TestStatementCache(String name) {
super(name);
}
-
+
private static volatile TestStatementCacheInterceptor interceptor = null;
-
-
+
+
@Override
protected void tearDown() throws Exception {
interceptor = null;
@@ -42,14 +42,14 @@ public class TestStatementCache extends
datasource.getPoolProperties().setJdbcInterceptors(TestStatementCacheInterceptor.class.getName()+
"(prepared="+cachePrepared+",callable="+cacheCallable+",max="+max+")");
}
-
+
public void testIsCacheEnabled() throws Exception {
init();
config(true,true,50);
datasource.getConnection().close();
assertNotNull("Interceptor was not created.", interceptor);
}
-
+
public void testCacheProperties() throws Exception {
init();
config(true,true,50);
@@ -58,7 +58,7 @@ public class TestStatementCache extends
assertEquals(true, interceptor.isCachePrepared());
assertEquals(50,interceptor.getMaxCacheSize());
}
-
+
public void testCacheProperties2() throws Exception {
init();
config(false,false,100);
@@ -122,7 +122,7 @@ public class TestStatementCache extends
assertEquals(100,interceptor.getCacheSize().get());
}
-
+
public static class TestStatementCacheInterceptor extends StatementCache {
public TestStatementCacheInterceptor() {
TestStatementCache.interceptor = this;
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSuspectTimeout.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSuspectTimeout.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSuspectTimeout.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestSuspectTimeout.java Sat Oct 22 21:29:55 2011
@@ -27,7 +27,7 @@ public class TestSuspectTimeout extends
public TestSuspectTimeout(String name) {
super(name);
}
-
+
public void testSuspect() throws Exception {
this.init();
this.datasource.setMaxActive(100);
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TwoDataSources.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TwoDataSources.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TwoDataSources.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TwoDataSources.java Sat Oct 22 21:29:55 2011
@@ -24,7 +24,7 @@ public class TwoDataSources extends Defa
public TwoDataSources(String name) {
super(name);
}
-
+
public void testTwoDataSources() throws Exception {
org.apache.tomcat.jdbc.pool.DataSource d1 = this.createDefaultDataSource();
org.apache.tomcat.jdbc.pool.DataSource d2 = this.createDefaultDataSource();
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/Connection.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/Connection.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/Connection.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/Connection.java Sat Oct 22 21:29:55 2011
@@ -37,19 +37,19 @@ import org.apache.tomcat.jdbc.pool.Poole
public class Connection implements java.sql.Connection {
Properties info;
-
+
public Connection(Properties info) {
this.info = info;
}
-
+
public String getUsername() {
return info.getProperty(PooledConnection.PROP_USER);
}
-
+
public String getPassword() {
return info.getProperty(PooledConnection.PROP_PASSWORD);
}
-
+
@Override
public void clearWarnings() throws SQLException {
}
@@ -198,7 +198,7 @@ public class Connection implements java.
return new org.apache.tomcat.jdbc.test.driver.Statement();
}
-
+
@Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
return new org.apache.tomcat.jdbc.test.driver.Statement();
@@ -214,7 +214,7 @@ public class Connection implements java.
return new org.apache.tomcat.jdbc.test.driver.Statement();
}
-
+
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
return new org.apache.tomcat.jdbc.test.driver.Statement();
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/Driver.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/Driver.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/Driver.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/Driver.java Sat Oct 22 21:29:55 2011
@@ -32,7 +32,7 @@ public class Driver implements java.sql.
connectCount.set(0);
disconnectCount.set(0);
}
-
+
static {
try {
DriverManager.registerDriver(new Driver());
@@ -41,10 +41,10 @@ public class Driver implements java.sql.
throw new RuntimeException(x);
}
}
-
+
public Driver() {
}
-
+
@Override
public boolean acceptsURL(String url) throws SQLException {
return url!=null && url.equals(Driver.url);
Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/ResultSet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/ResultSet.java?rev=1187811&r1=1187810&r2=1187811&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/ResultSet.java (original)
+++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/driver/ResultSet.java Sat Oct 22 21:29:55 2011
@@ -40,7 +40,7 @@ import java.util.Map;
public class ResultSet implements java.sql.ResultSet {
boolean hasNext = true;
-
+
@Override
public boolean absolute(int row) throws SQLException {
return false;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
|