Added test case to trunk showing that AMQ-1438 is no longer an issue on the trunk.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@647882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2008-04-14 16:24:07 +00:00
parent 931ed7673d
commit 08393aa269
1 changed files with 21 additions and 0 deletions

View File

@ -23,7 +23,10 @@ import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.XAConnection;
import javax.jms.XAQueueConnection;
import javax.jms.XASession;
import javax.jms.XATopicConnection;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import org.apache.activemq.broker.BrokerRegistry;
import org.apache.activemq.broker.BrokerService;
@ -96,6 +99,24 @@ public class ActiveMQXAConnectionFactoryTest extends CombinationTestSupport {
assertCreateConnection("tcp://localhost:61610?wireFormat.tcpNoDelayEnabled=true");
}
public void testIsSameRM() throws URISyntaxException, JMSException, XAException {
ActiveMQXAConnectionFactory cf1 = new ActiveMQXAConnectionFactory("vm://localhost?broker.persistent=false");
XAConnection connection1 = (XAConnection)cf1.createConnection();
XASession session1 = connection1.createXASession();
XAResource resource1 = session1.getXAResource();
ActiveMQXAConnectionFactory cf2 = new ActiveMQXAConnectionFactory("vm://localhost?broker.persistent=false");
XAConnection connection2 = (XAConnection)cf2.createConnection();
XASession session2 = connection2.createXASession();
XAResource resource2 = session2.getXAResource();
assertTrue(resource1.isSameRM(resource2));
connection1.close();
connection2.close();
}
protected void assertCreateConnection(String uri) throws Exception {
// Start up a broker with a tcp connector.
BrokerService broker = new BrokerService();