mirror of https://github.com/apache/activemq.git
fix up tck violation on xasession interface after close expectations
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1454422 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c6c3b2351a
commit
885b8c9775
|
@ -69,14 +69,17 @@ public class ActiveMQXASession extends ActiveMQSession implements QueueSession,
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getTransacted() throws JMSException {
|
public boolean getTransacted() throws JMSException {
|
||||||
|
checkClosed();
|
||||||
return getTransactionContext().isInXATransaction();
|
return getTransactionContext().isInXATransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rollback() throws JMSException {
|
public void rollback() throws JMSException {
|
||||||
|
checkClosed();
|
||||||
throw new TransactionInProgressException("Cannot rollback() inside an XASession");
|
throw new TransactionInProgressException("Cannot rollback() inside an XASession");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void commit() throws JMSException {
|
public void commit() throws JMSException {
|
||||||
|
checkClosed();
|
||||||
throw new TransactionInProgressException("Cannot commit() inside an XASession");
|
throw new TransactionInProgressException("Cannot commit() inside an XASession");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -387,6 +387,30 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
|
||||||
broker.stop();
|
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(
|
private void assertTransactionGoneFromFailoverState(
|
||||||
ActiveMQXAConnection connection1, Xid tid) throws Exception {
|
ActiveMQXAConnection connection1, Xid tid) throws Exception {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue