You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2006/04/10 08:11:20 UTC

svn commit: r392895 - in /geronimo/branches/1.1/modules/connector-builder: ./ src/java/org/apache/geronimo/connector/deployment/ src/test-data/connector_1_5_localtx/ src/test-data/connector_1_5_notx/ src/test/org/apache/geronimo/connector/deployment/

Author: djencks
Date: Sun Apr  9 23:11:18 2006
New Revision: 392895

URL: http://svn.apache.org/viewcvs?rev=392895&view=rev
Log:
GERONIMO-1822 add some checks for consistency of ra.xml and geronimo plan transaction support settings

Added:
    geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_localtx/
      - copied from r392471, geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/
    geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_localtx/geronimo-ra.xml
      - copied unchanged from r392876, geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml
    geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_localtx/ra.xml
      - copied, changed from r392876, geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/ra.xml
    geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/
      - copied from r392471, geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/
    geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/geronimo-ra.xml
      - copied, changed from r392876, geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml
    geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/ra.xml
      - copied, changed from r392876, geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/ra.xml
Modified:
    geronimo/branches/1.1/modules/connector-builder/maven.xml
    geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java

Modified: geronimo/branches/1.1/modules/connector-builder/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/maven.xml?rev=392895&r1=392894&r2=392895&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/maven.xml (original)
+++ geronimo/branches/1.1/modules/connector-builder/maven.xml Sun Apr  9 23:11:18 2006
@@ -55,6 +55,22 @@
         <ant:jar destfile="${basedir}/target/test-rar-15.rar"
             basedir="${basedir}/target/test-rar-15"/>
 
+        <ant:mkdir dir="${basedir}/target/test-rar-15-notx/META-INF"/>
+        <copy todir="${basedir}/target/test-rar-15-notx/META-INF">
+            <fileset dir="${basedir}/src/test-data/connector_1_5_notx"/>
+        </copy>
+
+        <ant:jar destfile="${basedir}/target/test-rar-15-notx.rar"
+            basedir="${basedir}/target/test-rar-15-notx"/>
+
+        <ant:mkdir dir="${basedir}/target/test-rar-15-localtx/META-INF"/>
+        <copy todir="${basedir}/target/test-rar-15-localtx/META-INF">
+            <fileset dir="${basedir}/src/test-data/connector_1_5_localtx"/>
+        </copy>
+
+        <ant:jar destfile="${basedir}/target/test-rar-15-localtx.rar"
+            basedir="${basedir}/target/test-rar-15-localtx"/>
+
         <!-- Build test-ear -->
         <ant:jar destfile="${basedir}/target/test-ear.ear">
             <fileset dir="${basedir}/target">

Modified: geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=392895&r1=392894&r2=392895&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Sun Apr  9 23:11:18 2006
@@ -638,10 +638,22 @@
         if (connectionManager.isSetNoTransaction()) {
             transactionSupport = NoTransactions.INSTANCE;
         } else if (connectionManager.isSetLocalTransaction()) {
+            if ("NoTransaction".equals(ddTransactionSupport)) {
+                throw new DeploymentException("You are requesting local transaction support for a connector that does not support transactions: named: " + connectionfactoryInstance.getName().trim());
+            }
             transactionSupport = LocalTransactions.INSTANCE;
         } else if (connectionManager.isSetTransactionLog()) {
+            if ("NoTransaction".equals(ddTransactionSupport)) {
+                throw new DeploymentException("You are requesting local transaction support for a connector that does not support transactions: named: " + connectionfactoryInstance.getName().trim());
+            }
             transactionSupport = TransactionLog.INSTANCE;
         } else if (connectionManager.isSetXaTransaction()) {
+            if ("NoTransaction".equals(ddTransactionSupport)) {
+                throw new DeploymentException("You are requesting xa transaction support for a connector that does not support transactions: named: " + connectionfactoryInstance.getName().trim());
+            }
+            if ("LocalTransaction".equals(ddTransactionSupport)) {
+                throw new DeploymentException("You are requesting xa transaction support for a connector that supports only local transactions: named: " + connectionfactoryInstance.getName().trim());
+            }
             transactionSupport = new XATransactions(connectionManager.getXaTransaction().isSetTransactionCaching(),
                     connectionManager.getXaTransaction().isSetThreadCaching());
         } else if ("NoTransaction".equals(ddTransactionSupport)) {
@@ -652,7 +664,7 @@
             transactionSupport = new XATransactions(defaultXATransactionCaching, defaultXAThreadCaching);
         } else {
             //this should not happen
-            throw new DeploymentException("Unexpected transaction support element");
+            throw new DeploymentException("Unexpected transaction support element in connector named: " + connectionfactoryInstance.getName().trim());
         }
         PoolingSupport pooling;
         if (connectionManager.getSinglePool() != null) {
@@ -679,7 +691,7 @@
         } else if (connectionManager.getNoPool() != null) {
             pooling = new NoPool();
         } else {
-            throw new DeploymentException("Unexpected pooling support element");
+            throw new DeploymentException("Unexpected pooling support element in connector named " + connectionfactoryInstance.getName().trim());
         }
         try {
             connectionManagerGBean.setAttribute("transactionSupport", transactionSupport);
@@ -688,13 +700,13 @@
             connectionManagerGBean.setAttribute("containerManagedSecurity", Boolean.valueOf(connectionManager.isSetContainerManagedSecurity()));
             connectionManagerGBean.setReferencePattern("TransactionContextManager", earContext.getTransactionContextManagerObjectName());
         } catch (Exception e) {
-            throw new DeploymentException("Problem setting up ConnectionManager", e);
+            throw new DeploymentException("Problem setting up ConnectionManager named " + connectionfactoryInstance.getName().trim(), e);
         }
 
         try {
             earContext.addGBean(connectionManagerGBean);
         } catch (GBeanAlreadyExistsException e) {
-            throw new DeploymentException("Could not add connection manager gbean to context", e);
+            throw new DeploymentException("Could not add connection manager gbean to context: name: " + connectionfactoryInstance.getName().trim(), e);
         }
         return connectionManagerAbstractName;
     }
@@ -767,7 +779,7 @@
 
     public GBeanData locateActivationSpecInfo(AbstractNameQuery resourceAdapterInstanceQuery, String messageListenerInterface, Configuration configuration) throws DeploymentException {
         //First, locate the module gbean from the JCAResourceAdapter instance
-        AbstractName instanceName = null;
+        AbstractName instanceName;
         try {
             instanceName = configuration.findGBean(resourceAdapterInstanceQuery);
         } catch (GBeanNotFoundException e) {

Copied: geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_localtx/ra.xml (from r392876, geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/ra.xml)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_localtx/ra.xml?p2=geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_localtx/ra.xml&p1=geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/ra.xml&r1=392876&r2=392895&rev=392895&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/ra.xml (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_localtx/ra.xml Sun Apr  9 23:11:18 2006
@@ -75,7 +75,7 @@
                 <connection-impl-class>org.apache.geronimo.connector.mock.MockConnection</connection-impl-class>
 
             </connection-definition>
-            <transaction-support>XATransaction</transaction-support>
+            <transaction-support>LocalTransaction</transaction-support>
             <authentication-mechanism>
                 <description>description</description>
                 <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>

Copied: geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/geronimo-ra.xml (from r392876, geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/geronimo-ra.xml?p2=geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/geronimo-ra.xml&p1=geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml&r1=392876&r2=392895&rev=392895&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/geronimo-ra.xml (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/geronimo-ra.xml Sun Apr  9 23:11:18 2006
@@ -43,9 +43,7 @@
                     <config-property-setting name="OutboundStringProperty3">newvalue2</config-property-setting>
                     <connectionmanager>
                         <container-managed-security/>
-                        <xa-transaction>
-                            <transaction-caching/>
-                        </xa-transaction>
+                        <local-transaction/>
                         <partitioned-pool>
                             <max-size>10</max-size>
                             <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
@@ -113,22 +111,10 @@
            class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean">
     </gbean>
 
-    <gbean name="DefaultThreadPool" class="org.apache.geronimo.pool.ThreadPool">
-        <attribute name="keepAliveTime">5000</attribute>
-        <attribute name="poolSize">300</attribute>
-        <attribute name="poolName">DefaultThreadPool</attribute>
-    </gbean>
-
     <gbean name="DefaultWorkManager" class="org.apache.geronimo.connector.work.GeronimoWorkManagerGBean">
-        <reference name="SyncPool">
-            <name>DefaultThreadPool</name>
-        </reference>
-        <reference name="StartPool">
-            <name>DefaultThreadPool</name>
-        </reference>
-        <reference name="ScheduledPool">
-            <name>DefaultThreadPool</name>
-        </reference>
+        <attribute name="syncMaximumPoolSize">10</attribute>
+        <attribute name="startMaximumPoolSize">10</attribute>
+        <attribute name="scheduledMaximumPoolSize">10</attribute>
         <reference name="TransactionContextManager">
             <name>TransactionContextManager</name>
         </reference>

Copied: geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/ra.xml (from r392876, geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/ra.xml)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/ra.xml?p2=geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/ra.xml&p1=geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/ra.xml&r1=392876&r2=392895&rev=392895&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5/ra.xml (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test-data/connector_1_5_notx/ra.xml Sun Apr  9 23:11:18 2006
@@ -75,7 +75,7 @@
                 <connection-impl-class>org.apache.geronimo.connector.mock.MockConnection</connection-impl-class>
 
             </connection-definition>
-            <transaction-support>XATransaction</transaction-support>
+            <transaction-support>NoTransaction</transaction-support>
             <authentication-mechanism>
                 <description>description</description>
                 <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>

Modified: geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=392895&r1=392894&r2=392895&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Sun Apr  9 23:11:18 2006
@@ -285,6 +285,40 @@
         };
         executeTestBuildModule(action, true);
     }
+    
+    public void testBuildPackedModule15LocalTx() throws Exception {
+        InstallAction action = new InstallAction() {
+            private File rarFile = new File(basedir, "target/test-rar-15-localtx.rar");
+
+            public File getRARFile() {
+                return rarFile;
+            }
+
+        };
+        try {
+            executeTestBuildModule(action, true);
+            fail("transaction setting mismatch not detected");
+        } catch (DeploymentException e) {
+
+        }
+    }
+
+    public void testBuildPackedModule15NoTx() throws Exception {
+        InstallAction action = new InstallAction() {
+            private File rarFile = new File(basedir, "target/test-rar-15-notx.rar");
+
+            public File getRARFile() {
+                return rarFile;
+            }
+
+        };
+        try {
+            executeTestBuildModule(action, true);
+            fail("transaction setting mismatch not detected");
+        } catch (DeploymentException e) {
+
+        }
+    }
 
 
     private void executeTestBuildModule(InstallAction action, boolean is15) throws Exception {