[jboss-cvs] JBossAS SVN: r107000 - in projects/jboss-jca/trunk: core/src/main/java/org/jboss/jca/core/connectionmanager/ccm and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 21 15:25:20 EDT 2010
Author: jesper.pedersen
Date: 2010-07-21 15:25:19 -0400 (Wed, 21 Jul 2010)
New Revision: 107000
Added:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/package.html
Removed:
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/TxConnectionManagerTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/XATxConnectionManagerTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/package.html
projects/jboss-jca/trunk/core/src/test/resources/connectionmanager-jboss-beans.xml
Modified:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManager.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManager.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManager.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/nontx/NonTxConnectionManagerTestCase.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
Log:
[JBJCA-384] Refactor connection manager (Part 5)
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -138,6 +138,14 @@
this.cachedConnectionManager = cachedConnectionManager;
}
+ /**
+ * Gets cached connection manager.
+ * @return cached connection manager
+ */
+ public CachedConnectionManager getCachedConnectionManager()
+ {
+ return cachedConnectionManager;
+ }
/**
* Sets shut down flag.
@@ -149,15 +157,6 @@
}
/**
- * Gets cached connection manager.
- * @return cached connection manager
- */
- public CachedConnectionManager getCachedConnectionManager()
- {
- return cachedConnectionManager;
- }
-
- /**
* Gets jndi name.
* @return jndi name
*/
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManager.java 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManager.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -65,6 +65,12 @@
public Pool getPool();
/**
+ * Sets cached connection manager.
+ * @param cachedConnectionManager cached connection manager
+ */
+ public void setCachedConnectionManager(CachedConnectionManager cachedConnectionManager);
+
+ /**
* Gets cached connection manager
* @return The cached connection manager
*/
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ConnectionManagerFactory.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.core.connectionmanager;
+
+import org.jboss.jca.core.connectionmanager.ConnectionManager;
+import org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManager;
+import org.jboss.jca.core.connectionmanager.notx.NoTxConnectionManager;
+import org.jboss.jca.core.connectionmanager.tx.TxConnectionManager;
+import org.jboss.jca.core.connectionmanager.pool.api.Pool;
+
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.transaction.TransactionManager;
+
+/**
+ * The connection manager factory.
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ConnectionManagerFactory
+{
+ /**
+ * Constructor
+ */
+ public ConnectionManagerFactory()
+ {
+ }
+
+ /**
+ * Create a connection manager
+ * @param tsl The transaction support level
+ * @param pool The pool for the connection manager
+ * @param tm The transaction manager
+ * @return The connection manager instance
+ */
+ public ConnectionManager create(final TransactionSupportLevel tsl,
+ final Pool pool,
+ final TransactionManager tm)
+ {
+ if (tsl == null)
+ throw new IllegalArgumentException("TransactionSupportLevel is null");
+
+ if (pool == null)
+ throw new IllegalArgumentException("Pool is null");
+
+ ConnectionManager cm = null;
+
+ switch (tsl)
+ {
+ case NoTransaction:
+ cm = new NoTxConnectionManager();
+ break;
+
+ case LocalTransaction:
+ if (tm == null)
+ throw new IllegalStateException("TransactionManager is null");
+
+ cm = new TxConnectionManager(tm, true);
+ break;
+
+ case XATransaction:
+ if (tm == null)
+ throw new IllegalStateException("TransactionManager is null");
+
+ cm = new TxConnectionManager(tm, false);
+ break;
+
+ default:
+ throw new IllegalArgumentException("Unknown transaction support level " + tsl);
+ }
+
+ pool.setConnectionListenerFactory(cm);
+ cm.setPool(pool);
+
+ CachedConnectionManager ccm = new CachedConnectionManager(tm);
+ cm.setCachedConnectionManager(ccm);
+
+ return cm;
+ }
+}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManager.java 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManager.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -106,9 +106,11 @@
/**
* Creates a new instance.
+ * @param transactionManager The transaction manager
*/
- public CachedConnectionManager()
+ public CachedConnectionManager(final TransactionManager transactionManager)
{
+ this.transactionManager = transactionManager;
this.trace = log.isTraceEnabled();
}
@@ -120,17 +122,7 @@
{
return transactionManager;
}
-
- /**
- * Sets transaction manager.
- * @param transactionManager transaction manager
- */
- public void setTransactionManager(TransactionManager transactionManager)
- {
- this.transactionManager = transactionManager;
- }
-
/**
* {@inheritDoc}
*/
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManager.java 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManager.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -155,10 +155,15 @@
private boolean trace = getLog().isTraceEnabled();
/**
- * Default managed TxConnectionManager constructor for mbean instances.
+ * Constructor
+ * @param tm The transaction manager
+ * @param localTransactions Is local transactions enabled
*/
- public TxConnectionManager()
+ public TxConnectionManager(final TransactionManager tm, final boolean localTransactions)
{
+ this.transactionManager = tm;
+
+ setLocalTransactions(localTransactions);
}
/**
@@ -171,15 +176,6 @@
}
/**
- * Set the transaction manager.
- * @param tm The transaction manager
- */
- public void setTransactionManager(TransactionManager tm)
- {
- transactionManager = tm;
- }
-
- /**
* Gets interleaving flag.
* @return interleaving flag
*/
@@ -192,7 +188,7 @@
* Sets interleaving flag.
* @param value interleaving
*/
- public void setInterleaving(boolean value)
+ private void setInterleaving(boolean value)
{
this.interleaving = value;
}
@@ -207,13 +203,14 @@
}
/**
- * Sets local transaction or not.
- * @param localTransactions local transaction flag
+ * Set the local transaction
+ * @param v The value
*/
- public void setLocalTransactions(boolean localTransactions)
+ void setLocalTransactions(boolean v)
{
- this.localTransactions = localTransactions;
- if (localTransactions)
+ this.localTransactions = v;
+
+ if (v)
setInterleaving(false);
}
Copied: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java (from rev 106978, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/TxConnectionManagerTestCase.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/TxConnectionManagerTestCase.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -0,0 +1,246 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.connectionmanager.tx;
+
+import org.jboss.jca.core.api.ConnectionManager;
+import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.common.MockConnectionRequestInfo;
+import org.jboss.jca.core.connectionmanager.common.MockHandle;
+import org.jboss.jca.core.connectionmanager.common.MockManagedConnectionFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.Pool;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer;
+import org.jboss.jca.core.connectionmanager.tx.TxConnectionManager;
+import org.jboss.jca.core.workmanager.unit.WorkManagerTestCase;
+import org.jboss.jca.embedded.EmbeddedJCA;
+
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.transaction.TransactionManager;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+import static org.junit.Assert.*;
+
+/**
+ * TxConnectionManagerTestCase.
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class TxConnectionManagerTestCase
+{
+ /**Embedded JCA*/
+ private static EmbeddedJCA embedded = null;
+
+ /**
+ * testTxAllocateConnection.
+ * @throws Throwable for exception
+ */
+ @Test
+ public void testAllocateConnection() throws Throwable
+ {
+ TransactionManager tm = embedded.lookup("RealTransactionManager", TransactionManager.class);
+ assertNotNull(tm);
+
+ ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+ PoolConfiguration pc = new PoolConfiguration();
+ PoolFactory pf = new PoolFactory();
+
+ Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ConnectionManager connectionManager = cmf.create(TransactionSupportLevel.LocalTransaction, pool, tm);
+ assertNotNull(connectionManager);
+
+ assertTrue(connectionManager instanceof TxConnectionManager);
+
+ TxConnectionManager txConnectionManager = (TxConnectionManager)connectionManager;
+
+ assertNotNull(txConnectionManager.getCachedConnectionManager());
+
+ TransactionManager transactionManager = txConnectionManager.getTransactionManager();
+ TransactionSynchronizer.setTransactionManager(transactionManager);
+
+ assertNotNull(transactionManager);
+
+ transactionManager.begin();
+
+ Object handle = connectionManager.allocateConnection(mcf, new MockConnectionRequestInfo());
+ assertNotNull(handle);
+
+ assertTrue(handle instanceof MockHandle);
+
+ transactionManager.commit();
+ }
+
+ /**
+ * testConnectionEventListenerConnectionClosed.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testConnectionEventListenerConnectionClosed() throws Exception
+ {
+
+ }
+
+ /**
+ * testSynchronizationAfterCompletion.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testSynchronizationAfterCompletion() throws Exception
+ {
+
+ }
+
+ /**
+ * testSynchronizationAfterCompletionTxTimeout.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testSynchronizationAfterCompletionTxTimeout() throws Exception
+ {
+
+ }
+
+ /**
+ * testGetManagedConnection.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testGetManagedConnection() throws Exception
+ {
+
+ }
+
+ /**
+ * testGetManagedConnectionTimeout.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testGetManagedConnectionTimeout() throws Exception
+ {
+
+ }
+
+ /**
+ * testGetManagedConnectionTrackByTx.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testGetManagedConnectionTrackByTx() throws Exception
+ {
+
+ }
+
+ /**
+ * testGetManagedConnectionTimeoutTrackByTx.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testGetManagedConnectionTimeoutTrackByTx() throws Exception
+ {
+
+ }
+
+ /**
+ * testConnectionError.
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testConnectionError() throws Exception
+ {
+
+ }
+
+ /**
+ * testConnectionErrorTrackByTx.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testConnectionErrorTrackByTx() throws Exception
+ {
+
+ }
+
+ /**
+ * testSimulateConnectionError.
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testSimulateConnectionError() throws Exception
+ {
+
+ }
+
+ /**
+ * testSimulateConnectionErrorTrackByTx.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testSimulateConnectionErrorTrackByTx() throws Exception
+ {
+
+ }
+
+ /**
+ * Lifecycle start, before the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @BeforeClass
+ public static void beforeClass() throws Throwable
+ {
+ // Create and set an embedded JCA instance
+ embedded = new EmbeddedJCA(false);
+
+ // Startup
+ embedded.startup();
+
+ // Deploy Naming and Transaction
+ embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+ embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+ }
+
+ /**
+ * Lifecycle stop, after the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @AfterClass
+ public static void afterClass() throws Throwable
+ {
+ // Undeploy Transaction and Naming
+ embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+ embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+ // Shutdown embedded
+ embedded.shutdown();
+
+ // Set embedded to null
+ embedded = null;
+ }
+
+}
Copied: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java (from rev 106978, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/XATxConnectionManagerTestCase.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/XATxConnectionManagerTestCase.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -0,0 +1,205 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.connectionmanager.tx;
+
+import org.jboss.jca.core.api.ConnectionManager;
+import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.common.MockConnectionRequestInfo;
+import org.jboss.jca.core.connectionmanager.common.MockHandle;
+import org.jboss.jca.core.connectionmanager.common.MockManagedConnectionFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.Pool;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer;
+import org.jboss.jca.core.connectionmanager.tx.TxConnectionManager;
+import org.jboss.jca.core.workmanager.unit.WorkManagerTestCase;
+import org.jboss.jca.embedded.EmbeddedJCA;
+
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.transaction.TransactionManager;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+import static org.junit.Assert.*;
+
+/**
+ * XATxConnectionManagerTestCase.
+ * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class XATxConnectionManagerTestCase
+{
+ /**Embedded JCA*/
+ private static EmbeddedJCA embedded = null;
+
+ /**
+ * testTxAllocateConnection.
+ * @throws Throwable for exception
+ */
+ @Test
+ public void testAllocateConnection() throws Throwable
+ {
+ TransactionManager tm = embedded.lookup("RealTransactionManager", TransactionManager.class);
+ assertNotNull(tm);
+
+ ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+ PoolConfiguration pc = new PoolConfiguration();
+ PoolFactory pf = new PoolFactory();
+
+ Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ConnectionManager connectionManager = cmf.create(TransactionSupportLevel.XATransaction, pool, tm);
+ assertNotNull(connectionManager);
+
+ assertTrue(connectionManager instanceof TxConnectionManager);
+
+ TxConnectionManager txConnectionManager = (TxConnectionManager)connectionManager;
+
+ TransactionManager transactionManager = txConnectionManager.getTransactionManager();
+ assertNotNull(transactionManager);
+
+ TransactionSynchronizer.setTransactionManager(transactionManager);
+
+ transactionManager.begin();
+
+ Object handle = connectionManager.allocateConnection(mcf, new MockConnectionRequestInfo());
+ assertNotNull(handle);
+
+ assertTrue(handle instanceof MockHandle);
+
+ transactionManager.commit();
+ }
+
+ /**
+ * testEnlistInExistingTx.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testEnlistInExistingTx() throws Exception
+ {
+
+ }
+
+ /**
+ * testEnlistCheckedOutConnectionInNewTx.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testEnlistCheckedOutConnectionInNewTx() throws Exception
+ {
+
+ }
+
+ /**
+ * testReconnectConnectionHandlesOnNotification.
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testReconnectConnectionHandlesOnNotification() throws Exception
+ {
+
+ }
+
+ /**
+ * testEnlistAfterMarkRollback.
+ * @throws Exception for exception
+ */
+ @Test
+ public void testEnlistAfterMarkRollback() throws Exception
+ {
+
+ }
+
+ /**
+ * testBrokenConnectionAndTrackByTx.
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testBrokenConnectionAndTrackByTx() throws Exception
+ {
+
+ }
+
+ /**
+ * testFailedStartTx.
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testFailedStartTx() throws Exception
+ {
+
+ }
+
+ /**
+ * testFailedEndTx.
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testFailedEndTx() throws Exception
+ {
+
+ }
+
+
+ /**
+ * Lifecycle start, before the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @BeforeClass
+ public static void beforeClass() throws Throwable
+ {
+ // Create and set an embedded JCA instance
+ embedded = new EmbeddedJCA(false);
+
+ // Startup
+ embedded.startup();
+
+ // Deploy Naming and Transaction
+ embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+ embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+ }
+
+ /**
+ * Lifecycle stop, after the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @AfterClass
+ public static void afterClass() throws Throwable
+ {
+ // Undeploy Transaction and Naming
+ embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
+ embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
+
+ // Shutdown embedded
+ embedded.shutdown();
+
+ // Set embedded to null
+ embedded = null;
+ }
+
+}
Copied: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/package.html (from rev 106978, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/package.html)
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/package.html (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/tx/package.html 2010-07-21 19:25:19 UTC (rev 107000)
@@ -0,0 +1,3 @@
+<body>
+Unit Test cases covering the Tx Connection Manager implementation.
+</body>
Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/AbstractConnectionManagerTestCase.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -77,7 +77,7 @@
{
AbstractConnectionManager connectionManager = new MockConnectionManager();
assertNull(connectionManager.getCachedConnectionManager());
- connectionManager.setCachedConnectionManager(new CachedConnectionManager());
+ connectionManager.setCachedConnectionManager(new CachedConnectionManager(null));
assertNotNull(connectionManager.getCachedConnectionManager());
}
Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/nontx/NonTxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/nontx/NonTxConnectionManagerTestCase.java 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/nontx/NonTxConnectionManagerTestCase.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -22,7 +22,7 @@
package org.jboss.jca.core.connectionmanager.unit.nontx;
import org.jboss.jca.core.api.ConnectionManager;
-
+import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
import org.jboss.jca.core.connectionmanager.common.MockConnectionRequestInfo;
import org.jboss.jca.core.connectionmanager.common.MockHandle;
import org.jboss.jca.core.connectionmanager.common.MockManagedConnectionFactory;
@@ -34,6 +34,8 @@
import javax.resource.ResourceException;
import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.transaction.TransactionManager;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -44,8 +46,7 @@
/**
* NonTxConnectionManagerTestCase.
* @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
- * @version $Rev:93321 $ $Date:2009-09-09 20:36:35 +0300 (Wed, 09 Sep 2009) $
- *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
public class NonTxConnectionManagerTestCase
{
@@ -59,18 +60,21 @@
@BeforeClass
public static void init()
{
- NoTxConnectionManager noTxCm = new NoTxConnectionManager();
+ TransactionManager tm = null;
+ assertNull(tm);
+
mcf = new MockManagedConnectionFactory();
PoolConfiguration pc = new PoolConfiguration();
PoolFactory pf = new PoolFactory();
Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
- pool.setConnectionListenerFactory(noTxCm);
- noTxCm.setPool(pool);
-
- connectionManager = noTxCm;
- }
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ connectionManager = cmf.create(TransactionSupportLevel.NoTransaction, pool, tm);
+ assertNotNull(connectionManager);
+
+ assertTrue(connectionManager instanceof NoTxConnectionManager);
+ }
/**
* Test allocate connection.
Deleted: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/TxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/TxConnectionManagerTestCase.java 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/TxConnectionManagerTestCase.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -1,248 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jca.core.connectionmanager.unit.tx;
-
-import org.jboss.jca.core.api.ConnectionManager;
-import org.jboss.jca.core.connectionmanager.common.MockConnectionRequestInfo;
-import org.jboss.jca.core.connectionmanager.common.MockHandle;
-import org.jboss.jca.core.connectionmanager.common.MockManagedConnectionFactory;
-import org.jboss.jca.core.connectionmanager.pool.api.Pool;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
-import org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer;
-import org.jboss.jca.core.connectionmanager.tx.TxConnectionManager;
-import org.jboss.jca.core.workmanager.unit.WorkManagerTestCase;
-import org.jboss.jca.embedded.EmbeddedJCA;
-
-import javax.resource.spi.ManagedConnectionFactory;
-import javax.transaction.TransactionManager;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-import static org.junit.Assert.*;
-
-/**
- * TxConnectionManagerTestCase.
- * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
- * @version $Rev$ $Date$
- *
- */
-public class TxConnectionManagerTestCase
-{
- /**Embedded JCA*/
- private static EmbeddedJCA embedded = null;
-
- /**
- * testTxAllocateConnection.
- * @throws Throwable for exception
- */
- @Test
- public void testAllocateConnection() throws Throwable
- {
- ConnectionManager connectionManager = embedded.lookup("ConnectionManagerTx", ConnectionManager.class);
- assertNotNull(connectionManager);
-
- assertTrue(connectionManager instanceof TxConnectionManager);
-
- TxConnectionManager txConnectionManager = (TxConnectionManager)connectionManager;
- txConnectionManager.setLocalTransactions(true);
-
- assertNotNull(txConnectionManager.getCachedConnectionManager());
-
- TransactionManager transactionManager = txConnectionManager.getTransactionManager();
- TransactionSynchronizer.setTransactionManager(transactionManager);
-
- assertNotNull(transactionManager);
-
- transactionManager.begin();
-
- ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
- PoolConfiguration pc = new PoolConfiguration();
- PoolFactory pf = new PoolFactory();
-
- Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
- pool.setConnectionListenerFactory(txConnectionManager);
-
- txConnectionManager.setPool(pool);
-
- Object handle = connectionManager.allocateConnection(mcf, new MockConnectionRequestInfo());
- assertNotNull(handle);
-
- assertTrue(handle instanceof MockHandle);
-
- transactionManager.commit();
-
- }
-
- /**
- * testConnectionEventListenerConnectionClosed.
- * @throws Exception for exception
- */
- @Test
- public void testConnectionEventListenerConnectionClosed() throws Exception
- {
-
- }
-
- /**
- * testSynchronizationAfterCompletion.
- * @throws Exception for exception
- */
- @Test
- public void testSynchronizationAfterCompletion() throws Exception
- {
-
- }
-
- /**
- * testSynchronizationAfterCompletionTxTimeout.
- * @throws Exception for exception
- */
- @Test
- public void testSynchronizationAfterCompletionTxTimeout() throws Exception
- {
-
- }
-
- /**
- * testGetManagedConnection.
- * @throws Exception for exception
- */
- @Test
- public void testGetManagedConnection() throws Exception
- {
-
- }
-
- /**
- * testGetManagedConnectionTimeout.
- * @throws Exception for exception
- */
- @Test
- public void testGetManagedConnectionTimeout() throws Exception
- {
-
- }
-
- /**
- * testGetManagedConnectionTrackByTx.
- * @throws Exception for exception
- */
- @Test
- public void testGetManagedConnectionTrackByTx() throws Exception
- {
-
- }
-
- /**
- * testGetManagedConnectionTimeoutTrackByTx.
- * @throws Exception for exception
- */
- @Test
- public void testGetManagedConnectionTimeoutTrackByTx() throws Exception
- {
-
- }
-
- /**
- * testConnectionError.
- * @throws Exception for exception.
- */
- @Test
- public void testConnectionError() throws Exception
- {
-
- }
-
- /**
- * testConnectionErrorTrackByTx.
- * @throws Exception for exception
- */
- @Test
- public void testConnectionErrorTrackByTx() throws Exception
- {
-
- }
-
- /**
- * testSimulateConnectionError.
- * @throws Exception for exception.
- */
- @Test
- public void testSimulateConnectionError() throws Exception
- {
-
- }
-
- /**
- * testSimulateConnectionErrorTrackByTx.
- * @throws Exception for exception
- */
- @Test
- public void testSimulateConnectionErrorTrackByTx() throws Exception
- {
-
- }
-
- /**
- * Lifecycle start, before the suite is executed
- * @throws Throwable throwable exception
- */
- @BeforeClass
- public static void beforeClass() throws Throwable
- {
- // Create and set an embedded JCA instance
- embedded = new EmbeddedJCA(false);
-
- // Startup
- embedded.startup();
-
- // Deploy Naming, Transaction and WorkManager
- embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
- embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
- embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "connectionmanager-jboss-beans.xml");
- }
-
- /**
- * Lifecycle stop, after the suite is executed
- * @throws Throwable throwable exception
- */
- @AfterClass
- public static void afterClass() throws Throwable
- {
- // Undeploy WorkManager, Transaction and Naming
- embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "connectionmanager-jboss-beans.xml");
- embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
- embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
-
- // Shutdown embedded
- embedded.shutdown();
-
- // Set embedded to null
- embedded = null;
- }
-
-}
Deleted: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/XATxConnectionManagerTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/XATxConnectionManagerTestCase.java 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/XATxConnectionManagerTestCase.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -1,207 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jca.core.connectionmanager.unit.tx;
-
-import org.jboss.jca.core.api.ConnectionManager;
-import org.jboss.jca.core.connectionmanager.common.MockConnectionRequestInfo;
-import org.jboss.jca.core.connectionmanager.common.MockHandle;
-import org.jboss.jca.core.connectionmanager.common.MockManagedConnectionFactory;
-import org.jboss.jca.core.connectionmanager.pool.api.Pool;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
-import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
-import org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer;
-import org.jboss.jca.core.connectionmanager.tx.TxConnectionManager;
-import org.jboss.jca.core.workmanager.unit.WorkManagerTestCase;
-import org.jboss.jca.embedded.EmbeddedJCA;
-
-import javax.resource.spi.ManagedConnectionFactory;
-import javax.transaction.TransactionManager;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-import static org.junit.Assert.*;
-
-/**
- * XATxConnectionManagerTestCase.
- * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
- * @version $Rev$ $Date$
- *
- */
-public class XATxConnectionManagerTestCase
-{
- /**Embedded JCA*/
- private static EmbeddedJCA embedded = null;
-
- /**
- * testTxAllocateConnection.
- * @throws Throwable for exception
- */
- @Test
- public void testAllocateConnection() throws Throwable
- {
- ConnectionManager connectionManager = embedded.lookup("ConnectionManagerTx", ConnectionManager.class);
- assertNotNull(connectionManager);
-
- assertTrue(connectionManager instanceof TxConnectionManager);
-
- TxConnectionManager txConnectionManager = (TxConnectionManager)connectionManager;
- txConnectionManager.setLocalTransactions(false);
-
- TransactionManager transactionManager = txConnectionManager.getTransactionManager();
- assertNotNull(transactionManager);
-
- TransactionSynchronizer.setTransactionManager(transactionManager);
-
- transactionManager.begin();
-
- ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
- PoolConfiguration pc = new PoolConfiguration();
- PoolFactory pf = new PoolFactory();
-
- Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
- pool.setConnectionListenerFactory(txConnectionManager);
-
- txConnectionManager.setPool(pool);
-
- Object handle = connectionManager.allocateConnection(mcf, new MockConnectionRequestInfo());
- assertNotNull(handle);
-
- assertTrue(handle instanceof MockHandle);
-
- transactionManager.commit();
-
- }
-
- /**
- * testEnlistInExistingTx.
- * @throws Exception for exception
- */
- @Test
- public void testEnlistInExistingTx() throws Exception
- {
-
- }
-
- /**
- * testEnlistCheckedOutConnectionInNewTx.
- * @throws Exception for exception
- */
- @Test
- public void testEnlistCheckedOutConnectionInNewTx() throws Exception
- {
-
- }
-
- /**
- * testReconnectConnectionHandlesOnNotification.
- * @throws Exception for exception.
- */
- @Test
- public void testReconnectConnectionHandlesOnNotification() throws Exception
- {
-
- }
-
- /**
- * testEnlistAfterMarkRollback.
- * @throws Exception for exception
- */
- @Test
- public void testEnlistAfterMarkRollback() throws Exception
- {
-
- }
-
- /**
- * testBrokenConnectionAndTrackByTx.
- * @throws Exception for exception.
- */
- @Test
- public void testBrokenConnectionAndTrackByTx() throws Exception
- {
-
- }
-
- /**
- * testFailedStartTx.
- * @throws Exception for exception.
- */
- @Test
- public void testFailedStartTx() throws Exception
- {
-
- }
-
- /**
- * testFailedEndTx.
- * @throws Exception for exception.
- */
- @Test
- public void testFailedEndTx() throws Exception
- {
-
- }
-
-
- /**
- * Lifecycle start, before the suite is executed
- * @throws Throwable throwable exception
- */
- @BeforeClass
- public static void beforeClass() throws Throwable
- {
- // Create and set an embedded JCA instance
- embedded = new EmbeddedJCA(false);
-
- // Startup
- embedded.startup();
-
- // Deploy Naming, Transaction and WorkManager
- embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
- embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
- embedded.deploy(WorkManagerTestCase.class.getClassLoader(), "connectionmanager-jboss-beans.xml");
- }
-
- /**
- * Lifecycle stop, after the suite is executed
- * @throws Throwable throwable exception
- */
- @AfterClass
- public static void afterClass() throws Throwable
- {
- // Undeploy WorkManager, Transaction and Naming
- embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "connectionmanager-jboss-beans.xml");
- embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "transaction-jboss-beans.xml");
- embedded.undeploy(WorkManagerTestCase.class.getClassLoader(), "naming-jboss-beans.xml");
-
- // Shutdown embedded
- embedded.shutdown();
-
- // Set embedded to null
- embedded = null;
- }
-
-}
Deleted: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/package.html 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/tx/package.html 2010-07-21 19:25:19 UTC (rev 107000)
@@ -1,3 +0,0 @@
-<body>
-Unit Test cases covering the Tx Connection Manager implementation.
-</body>
Deleted: projects/jboss-jca/trunk/core/src/test/resources/connectionmanager-jboss-beans.xml
===================================================================
--- projects/jboss-jca/trunk/core/src/test/resources/connectionmanager-jboss-beans.xml 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/core/src/test/resources/connectionmanager-jboss-beans.xml 2010-07-21 19:25:19 UTC (rev 107000)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment>
-
- <bean name="ConnectionManagerTx"
- interface="org.jboss.jca.core.connectionmanager.AbstractConnectionManager"
- class="org.jboss.jca.core.connectionmanager.tx.TxConnectionManager">
- <property name="transactionManager"><inject bean="TransactionManager" property="TransactionManager"/></property>
- <property name="cachedConnectionManager"><inject bean="CachedConnectionManager"/></property>
- </bean>
-
- <bean name="ConnectionManagerNoTx"
- interface="org.jboss.jca.core.connectionmanager.AbstractConnectionManager"
- class="org.jboss.jca.core.connectionmanager.notx.NoTxConnectionManager">
- </bean>
-
- <bean name="CachedConnectionManager"
- class="org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManager">
- </bean>
-
-</deployment>
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-07-21 18:52:18 UTC (rev 106999)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-07-21 19:25:19 UTC (rev 107000)
@@ -26,12 +26,11 @@
import org.jboss.jca.common.metadata.Metadata;
import org.jboss.jca.core.api.CloneableBootstrapContext;
import org.jboss.jca.core.connectionmanager.ConnectionManager;
-import org.jboss.jca.core.connectionmanager.notx.NoTxConnectionManager;
+import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
import org.jboss.jca.core.connectionmanager.pool.api.Pool;
import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
-import org.jboss.jca.core.connectionmanager.tx.TxConnectionManager;
import org.jboss.jca.core.spi.naming.JndiStrategy;
import org.jboss.jca.validator.Failure;
import org.jboss.jca.validator.FailureHelper;
@@ -482,6 +481,12 @@
beanValidationObjects.add(mcf);
associateResourceAdapter(resourceAdapter, mcf);
+ // Create the pool
+ PoolConfiguration pc = new PoolConfiguration();
+ PoolFactory pf = new PoolFactory();
+
+ Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
+
// Add a connection manager
ConnectionManager cm = null;
TransactionSupportLevel tsl = TransactionSupportLevel.NoTransaction;
@@ -514,38 +519,9 @@
tsl = ((TransactionSupport)mcf).getTransactionSupport();
// Select the correct connection manager
- if (tsl == TransactionSupportLevel.NoTransaction)
- {
- NoTxConnectionManager noTxCm = new NoTxConnectionManager();
- cm = noTxCm;
- }
- else if (tsl == TransactionSupportLevel.LocalTransaction)
- {
- if (transactionManager == null)
- throw new IllegalStateException("TransactionManager is null");
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ cm = cmf.create(tsl, pool, transactionManager);
- TxConnectionManager txCm = new TxConnectionManager();
- txCm.setTransactionManager(transactionManager);
- txCm.setLocalTransactions(true);
- cm = txCm;
- }
- else if (tsl == TransactionSupportLevel.XATransaction)
- {
- if (transactionManager == null)
- throw new IllegalStateException("TransactionManager is null");
-
- TxConnectionManager txCm = new TxConnectionManager();
- txCm.setTransactionManager(transactionManager);
- cm = txCm;
- }
-
- PoolConfiguration pc = new PoolConfiguration();
- PoolFactory pf = new PoolFactory();
-
- Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true);
- pool.setConnectionListenerFactory(cm);
- cm.setPool(pool);
-
// ConnectionFactory
Object cf = mcf.createConnectionFactory(cm);
More information about the jboss-cvs-commits
mailing list