commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r775703 - in /commons/proper/pool/trunk/src/test/org/apache/commons/pool: ./ impl/ performance/
Date Sun, 17 May 2009 16:39:51 GMT
Author: markt
Date: Sun May 17 16:39:51 2009
New Revision: 775703

URL: http://svn.apache.org/viewvc?rev=775703&view=rev
Log:
Fix a bunch of Eclipse warnings in the test cases

Modified:
    commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/PerformanceTest.java

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java?rev=775703&r1=775702&r2=775703&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java Sun May
17 16:39:51 2009
@@ -278,7 +278,7 @@
         assertEquals(3, pool.getNumIdle());
         // passivateObject should swallow exceptions and not add the object to the pool
         obj = pool.borrowObject();
-        Object obj2 = pool.borrowObject();
+        pool.borrowObject();
         assertEquals(1, pool.getNumIdle());
         assertEquals(2, pool.getNumActive());
         clear(factory, expectedMethods);

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java?rev=775703&r1=775702&r2=775703&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java
Sun May 17 16:39:51 2009
@@ -1222,10 +1222,10 @@
         factory.setValidationEnabled(true);
         GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
         pool.setTestOnBorrow(true);
-        Object obj1 = pool.borrowObject("one");
+        pool.borrowObject("one");
         factory.setValid(false); // Make validation fail on next borrow attempt
         try {
-            Object obj2 = pool.borrowObject("one");
+            pool.borrowObject("one");
             fail("Expecting NoSuchElementException");
         } catch (NoSuchElementException ex) {
             // expected
@@ -1243,7 +1243,7 @@
         GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
         pool.setTestOnReturn(true);
         Object obj1 = pool.borrowObject("one");
-        Object obj2 = pool.borrowObject("one");
+        pool.borrowObject("one");
         factory.setValid(false); // Make validation fail
         pool.returnObject("one", obj1);
         assertEquals(1, pool.getNumActive("one"));
@@ -1320,7 +1320,7 @@
             for(int i=0;i<_iter;i++) {
                 String key = String.valueOf(_random.nextInt(3));
                 try {
-                    Thread.sleep((long)_random.nextInt(_delay));
+                    Thread.sleep(_random.nextInt(_delay));
                 } catch(Exception e) {
                     // ignored
                 }
@@ -1335,7 +1335,7 @@
                 }
 
                 try {
-                    Thread.sleep((long)_random.nextInt(_delay));
+                    Thread.sleep(_random.nextInt(_delay));
                 } catch(Exception e) {
                     // ignored
                 }

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java?rev=775703&r1=775702&r2=775703&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java
Sun May 17 16:39:51 2009
@@ -131,7 +131,7 @@
         GenericObjectPool pool = new GenericObjectPool(factory);
         pool.setMaxActive(2);
         pool.setMinIdle(1);
-        Object obj = pool.borrowObject(); // numActive = 1, numIdle = 0
+        pool.borrowObject(); // numActive = 1, numIdle = 0
         // Create a test thread that will run once and try a borrow after
         // 150ms fixed delay
         TestThread borrower = new TestThread(pool, 1, 150, false);
@@ -364,10 +364,10 @@
         factory.setThrowExceptionOnDestroy(true);
         GenericObjectPool pool = new GenericObjectPool(factory);
         pool.setTestOnBorrow(true);
-        Object obj1 = pool.borrowObject();
+        pool.borrowObject();
         factory.setValid(false); // Make validation fail on next borrow attempt
         try {
-            Object obj2 = pool.borrowObject();
+            pool.borrowObject();
             fail("Expecting NoSuchElementException");
         } catch (NoSuchElementException ex) {
             // expected
@@ -382,7 +382,7 @@
         GenericObjectPool pool = new GenericObjectPool(factory);
         pool.setTestOnReturn(true);
         Object obj1 = pool.borrowObject();
-        Object obj2 = pool.borrowObject();
+        pool.borrowObject();
         factory.setValid(false); // Make validation fail
         pool.returnObject(obj1);
         assertEquals(1, pool.getNumActive());

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java?rev=775703&r1=775702&r2=775703&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
Sun May 17 16:39:51 2009
@@ -280,13 +280,13 @@
         }
         // 3, 9, 15 fail passivation.  
         assertEquals(7,pool.getNumIdle());
-        assertEquals(new Integer(19), (Integer) pool.borrowObject("key"));
-        assertEquals(new Integer(17), (Integer) pool.borrowObject("key"));
-        assertEquals(new Integer(13), (Integer) pool.borrowObject("key"));
-        assertEquals(new Integer(11), (Integer) pool.borrowObject("key"));
-        assertEquals(new Integer(7), (Integer) pool.borrowObject("key"));
-        assertEquals(new Integer(5), (Integer) pool.borrowObject("key"));
-        assertEquals(new Integer(1), (Integer) pool.borrowObject("key"));   
+        assertEquals(new Integer(19), pool.borrowObject("key"));
+        assertEquals(new Integer(17), pool.borrowObject("key"));
+        assertEquals(new Integer(13), pool.borrowObject("key"));
+        assertEquals(new Integer(11), pool.borrowObject("key"));
+        assertEquals(new Integer(7), pool.borrowObject("key"));
+        assertEquals(new Integer(5), pool.borrowObject("key"));
+        assertEquals(new Integer(1), pool.borrowObject("key"));   
     }
 
     class SimpleFactory implements KeyedPoolableObjectFactory {

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java?rev=775703&r1=775702&r2=775703&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java
Sun May 17 16:39:51 2009
@@ -196,13 +196,13 @@
         }
         // 3, 9, 15 fail passivation.  
         assertEquals(7,pool.getNumIdle());
-        assertEquals(new Integer(19), (Integer) pool.borrowObject());
-        assertEquals(new Integer(17), (Integer) pool.borrowObject());
-        assertEquals(new Integer(13), (Integer) pool.borrowObject());
-        assertEquals(new Integer(11), (Integer) pool.borrowObject());
-        assertEquals(new Integer(7), (Integer) pool.borrowObject());
-        assertEquals(new Integer(5), (Integer) pool.borrowObject());
-        assertEquals(new Integer(1), (Integer) pool.borrowObject());     
+        assertEquals(new Integer(19), pool.borrowObject());
+        assertEquals(new Integer(17), pool.borrowObject());
+        assertEquals(new Integer(13), pool.borrowObject());
+        assertEquals(new Integer(11), pool.borrowObject());
+        assertEquals(new Integer(7), pool.borrowObject());
+        assertEquals(new Integer(5), pool.borrowObject());
+        assertEquals(new Integer(1), pool.borrowObject());     
     }
     
     public void testBorrowReturnWithSometimesInvalidObjects() throws Exception {

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/PerformanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/PerformanceTest.java?rev=775703&r1=775702&r2=775703&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/PerformanceTest.java
(original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/performance/PerformanceTest.java
Sun May 17 16:39:51 2009
@@ -28,7 +28,6 @@
 public class PerformanceTest {
     private int logLevel = 0;
     private int nrIterations = 5;
-    private int nrThreads = 100;
 
     private GenericObjectPool pool;
     private boolean start = false;
@@ -108,7 +107,6 @@
 
     private void run(int nrIterations, int nrThreads, int maxActive, int maxIdle) {
         this.nrIterations = nrIterations;
-        this.nrThreads = nrThreads;
         init();
         
         SleepingObjectFactory factory = new SleepingObjectFactory();



Mime
View raw message