activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1454422 - in /activemq/trunk: activemq-client/src/main/java/org/apache/activemq/ActiveMQXASession.java activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java
Date Fri, 08 Mar 2013 15:22:17 GMT
Author: gtully
Date: Fri Mar  8 15:22:17 2013
New Revision: 1454422

URL: http://svn.apache.org/r1454422
Log:
fix up tck violation on xasession interface after close expectations

Modified:
    activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQXASession.java
    activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java

Modified: activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQXASession.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQXASession.java?rev=1454422&r1=1454421&r2=1454422&view=diff
==============================================================================
--- activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQXASession.java
(original)
+++ activemq/trunk/activemq-client/src/main/java/org/apache/activemq/ActiveMQXASession.java
Fri Mar  8 15:22:17 2013
@@ -69,14 +69,17 @@ public class ActiveMQXASession extends A
     }
 
     public boolean getTransacted() throws JMSException {
+        checkClosed();
         return getTransactionContext().isInXATransaction();
     }
 
     public void rollback() throws JMSException {
+        checkClosed();
         throw new TransactionInProgressException("Cannot rollback() inside an XASession");
     }
 
     public void commit() throws JMSException {
+        checkClosed();
         throw new TransactionInProgressException("Cannot commit() inside an XASession");
     }
 

Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java?rev=1454422&r1=1454421&r2=1454422&view=diff
==============================================================================
--- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java
(original)
+++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionFactoryTest.java
Fri Mar  8 15:22:17 2013
@@ -387,6 +387,30 @@ public class ActiveMQXAConnectionFactory
         broker.stop();
     }
 
+    public void testExceptionAfterClose() throws Exception {
+
+        ActiveMQXAConnectionFactory cf1 = new ActiveMQXAConnectionFactory("vm://localhost?broker.persistent=false");
+        XAConnection connection1 = (XAConnection)cf1.createConnection();
+        connection1.start();
+
+        XASession session = connection1.createXASession();
+        session.close();
+        try {
+            session.commit();
+            fail("expect exception after close");
+        } catch (javax.jms.IllegalStateException expected) {}
+
+        try {
+            session.rollback();
+            fail("expect exception after close");
+        } catch (javax.jms.IllegalStateException expected) {}
+
+        try {
+            session.getTransacted();
+            fail("expect exception after close");
+        } catch (javax.jms.IllegalStateException expected) {}
+    }
+
     private void assertTransactionGoneFromFailoverState(
             ActiveMQXAConnection connection1, Xid tid) throws Exception {
 



Mime
View raw message