[jboss-cvs] JBossAS SVN: r61592 - trunk/testsuite/src/main/org/jboss/test/jca/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 22 12:21:10 EDT 2007


Author: weston.price at jboss.com
Date: 2007-03-22 12:21:10 -0400 (Thu, 22 Mar 2007)
New Revision: 61592

Modified:
   trunk/testsuite/src/main/org/jboss/test/jca/test/BackgroundValidationUnitTestCase.java
Log:
Fixed incorrect lookup of getServer() to correct NPE. 

Modified: trunk/testsuite/src/main/org/jboss/test/jca/test/BackgroundValidationUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jca/test/BackgroundValidationUnitTestCase.java	2007-03-22 15:58:05 UTC (rev 61591)
+++ trunk/testsuite/src/main/org/jboss/test/jca/test/BackgroundValidationUnitTestCase.java	2007-03-22 16:21:10 UTC (rev 61592)
@@ -1,7 +1,6 @@
 package org.jboss.test.jca.test;
 
 import java.net.URL;
-import java.sql.Connection;
 
 import javax.management.ObjectName;
 import javax.naming.InitialContext;
@@ -19,7 +18,6 @@
 import org.jboss.resource.connectionmanager.NoTxConnectionManager;
 import org.jboss.resource.connectionmanager.PreFillPoolSupport;
 import org.jboss.test.JBossTestCase;
-import org.jboss.test.jca.jdbc.TestDriver;
 import org.jboss.test.jca.support.PoolHelper;
 
 public class BackgroundValidationUnitTestCase extends JBossTestCase
@@ -31,12 +29,10 @@
    private static ObjectName INVALID_MATCH_POOL = ObjectNameFactory.create("jboss.jca:name=TestNonMatchDS,service=ManagedConnectionPool");
    private static ObjectName VALID_MATCH_POOL = ObjectNameFactory.create("jboss.jca:name=TestValidationMatchDS,service=ManagedConnectionPool");
 
-   private PoolHelper helper;
    
    public BackgroundValidationUnitTestCase(String name) throws Exception
    {
       super(name);
-      helper = PoolHelper.getInstance(getServer(), INVALID_BACKGROUND_POOL);
       
    }
    
@@ -62,29 +58,29 @@
       DataSource ds = (DataSource) ctx.lookup("TestFailedBackgroundDS");
       ds.getConnection("sa", "").close();
       
-      Integer minCount = helper.getMinSize();
-      Long backMin = helper.getBackgroundValMinutes();
+      Integer minCount = PoolHelper.getMinSize(getServer(), INVALID_BACKGROUND_POOL);
+         
+      Long backMin = PoolHelper.getBackgroundValMinutes(getServer(), INVALID_BACKGROUND_POOL);
       
       PoolHelper.sleepForValidation(backMin.intValue() * 1000 * 60);
     
-      Integer destroyedCount = helper.getDestroyed();
-      
+      Integer destroyedCount = PoolHelper.getDestroyed(getServer(), INVALID_BACKGROUND_POOL); 
+         
       assertTrue("Background validation ran. Destroyed count should exceed zero.", destroyedCount.intValue() > 0);
       
-      Integer connCount = helper.getConnectionCount();
-      
+      Integer connCount = PoolHelper.getConnectionCount(getServer(), INVALID_BACKGROUND_POOL); 
+               
       assertTrue(connCount.intValue() == minCount.intValue());
       
-      helper.setPoolAttributeAndFlush(PoolHelper.POOL_ATT_BACKGROUND_VAL, Boolean.FALSE);
-      
-      
+      PoolHelper.setPoolAttributeAndFlush(getServer(), INVALID_BACKGROUND_POOL, PoolHelper.POOL_ATT_BACKGROUND_VAL, Boolean.FALSE);
+            
       //Reprime the pool
       ds.getConnection().close();
       
       PoolHelper.sleepForValidation(backMin.intValue() * 1000 * 60);
 
-      destroyedCount = helper.getDestroyed();
-      connCount = helper.getConnectionCount();
+      destroyedCount = PoolHelper.getDestroyed(getServer(), INVALID_BACKGROUND_POOL); 
+      connCount = PoolHelper.getConnectionCount(getServer(), INVALID_BACKGROUND_POOL); 
       
       assertTrue("Background validation is disabled. Destroyed count should be zero", destroyedCount.intValue() == 0);
       assertTrue("Background validation is disabled. Pool should be filled to min", connCount.intValue() == minCount.intValue());
@@ -294,6 +290,7 @@
    }
    
    public static Test suite() throws Exception{
+      
       Test test1 = getDeploySetup(BackgroundValidationUnitTestCase.class, "jca-support.sar");
       ClassLoader loader = Thread.currentThread().getContextClassLoader();
       URL resURL = loader.getResource("jca/validation/test-background-failed-validation-ds.xml");
@@ -307,5 +304,16 @@
       
            
    }
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+   }
    
+   @Override
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+   }
+
 }




More information about the jboss-cvs-commits mailing list