portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r736129 - in /portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components: datasource/AtomikosXADatasourceComponent.java util/DatasourceEnabledSpringTestCase.java
Date Tue, 20 Jan 2009 21:59:59 GMT
Author: rwatler
Date: Tue Jan 20 13:59:58 2009
New Revision: 736129

URL: http://svn.apache.org/viewvc?rev=736129&view=rev
Log:
ensure datasources removed from atomikos object registry in case of failed test setup

Modified:
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java
    portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java?rev=736129&r1=736128&r2=736129&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java
(original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/AtomikosXADatasourceComponent.java
Tue Jan 20 13:59:58 2009
@@ -18,11 +18,14 @@
 
 import java.util.Properties;
 
+import javax.naming.NameNotFoundException;
+
 import javax.sql.DataSource;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import com.atomikos.util.IntraVmObjectRegistry;
 import com.atomikos.jdbc.AbstractDataSourceBean;
 import com.atomikos.jdbc.AtomikosDataSourceBean;
 import com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean;
@@ -110,6 +113,14 @@
     {
         try
         {
+            // ensure datasource removed from atomikos registry
+            try
+            {
+                IntraVmObjectRegistry.removeResource(bindName);
+            }
+            catch (NameNotFoundException nnfe)
+            {                
+            }
             // use XA or non-xa datasource as specified
             AbstractDataSourceBean datasourceBean = null;
             if (xatypeClassName != null)
@@ -194,5 +205,13 @@
             AbstractDataSourceBean datasourceBean = (AbstractDataSourceBean)dataSource;
             datasourceBean.close();
         }
+        // ensure datasource removed from atomikos registry
+        try
+        {
+            IntraVmObjectRegistry.removeResource(bindName);
+        }
+        catch (NameNotFoundException nnfe)
+        {                
+        }
     }
 }

Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java?rev=736129&r1=736128&r2=736129&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java
(original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/util/DatasourceEnabledSpringTestCase.java
Tue Jan 20 13:59:58 2009
@@ -41,7 +41,21 @@
     {
         jndiDS = new JetspeedTestJNDIComponent();
         jndiDS.setup();
-        super.setUp();    
+        try
+        {
+            super.setUp();
+        }
+        catch (Exception e)
+        {
+            try
+            {
+                tearDown();
+            }
+            catch (Exception ignore)
+            {                
+            }
+            throw e;
+        }
     }
 
     /**
@@ -49,14 +63,26 @@
      */
     protected void tearDown() throws Exception
     {
-        super.tearDown();
-        jndiDS.tearDown();
+        try
+        {
+            super.tearDown();
+        }
+        catch (Exception e)
+        {
+            try
+            {
+                jndiDS.tearDown();
+            }
+            catch (Exception ignore)
+            {                
+            }
+            throw e;
+        }        
     }
 
     protected String[] getBootConfigurations()
     {
-        return new String[]
-        { "boot/datasource.xml"};
+        return new String[]{"boot/datasource.xml"};
     }
 
     protected String getBeanDefinitionFilterCategoryKey()



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message