{
XAConnection xaConn0 = null;
XAConnection xaConn1 = null;
XAConnectionFactory xaCF = (XAConnectionFactory)cf;
TextMessage sent0 = null;
TextMessage sent1 = null;
// Sending two messages.. on each server
{
Connection conn0 = null;
Connection conn1 = null;
conn0 = this.createConnectionOnServer(cf, 0);
assertEquals(0, ((JBossConnection)conn0).getServerID());
conn1 = this.createConnectionOnServer(cf, 1);
assertEquals(1, ((JBossConnection)conn1).getServerID());
//Send a message to each queue
Session sess = conn0.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer prod = sess.createProducer(queue[0]);
sent0 = sess.createTextMessage("plop0");
prod.send(sent0);
sess.close();
sess = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
prod = sess.createProducer(queue[1]);
sent1 = sess.createTextMessage("plop1");
prod.send(sent1);
sess.close();
conn0.close();
conn1.close();
}
try
{
xaConn0 = xaCF.createXAConnection();
assertEquals(0, ((JBossConnection)xaConn0).getServerID());
xaConn1 = xaCF.createXAConnection();
assertEquals(1, ((JBossConnection)xaConn1).getServerID());
xaConn0.start();