[jboss-cvs] JBossAS SVN: r57142 - trunk/testsuite/src/main/org/jboss/test/jca/adapter
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 25 13:09:31 EDT 2006
Author: weston.price at jboss.com
Date: 2006-09-25 13:09:30 -0400 (Mon, 25 Sep 2006)
New Revision: 57142
Modified:
trunk/testsuite/src/main/org/jboss/test/jca/adapter/TestManagedConnection.java
Log:
[JBAS-3693] Added test case for this condition with changes made in XAManageConnection.
Modified: trunk/testsuite/src/main/org/jboss/test/jca/adapter/TestManagedConnection.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jca/adapter/TestManagedConnection.java 2006-09-25 16:53:02 UTC (rev 57141)
+++ trunk/testsuite/src/main/org/jboss/test/jca/adapter/TestManagedConnection.java 2006-09-25 17:09:30 UTC (rev 57142)
@@ -26,6 +26,7 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import javax.resource.ResourceException;
@@ -79,6 +80,7 @@
private boolean failInPrepare = false;
private boolean failInCommit = false;
private static boolean failInStart = false;
+ private static boolean failInEnd = false;
private static int xaCode;
@@ -89,6 +91,13 @@
failInStart = fis;
xaCode = xa;
}
+ public static void setFailInEnd(boolean fie, int xa)
+ {
+ failInEnd = fie;
+ xaCode = xa;
+
+ }
+
public TestManagedConnection (final TestManagedConnectionFactory mcf, final Subject subject, final TestConnectionRequestInfo cri, final int id)
{
this.mcf = mcf;
@@ -181,7 +190,7 @@
checkDestroyedResourceException();
return this;
}
-
+
public LocalTransaction getLocalTransaction() throws ResourceException
{
return this;
@@ -202,7 +211,19 @@
}
// implementation of javax.transaction.xa.XAResource interface
-
+
+ public List getListeners()
+ {
+ List result = null;
+
+ synchronized (listeners)
+ {
+ result = new ArrayList(listeners);
+ }
+
+ return result;
+
+ }
public void start(Xid xid, int flags) throws XAException
{
long sleepInStart = mcf.getSleepInStart();
@@ -244,6 +265,14 @@
public void end(final Xid xid, final int flags) throws XAException
{
+
+ if(failInEnd)
+ {
+ XAException xaex = new XAException(xaCode + "for" + this);
+ broadcastConnectionError(xaex);
+ throw new XAException(xaCode + "for" + this);
+ }
+
long sleepInEnd = mcf.getSleepInEnd();
if (flags != TMSUCCESS && sleepInEnd != 0)
doSleep(sleepInEnd);
More information about the jboss-cvs-commits
mailing list