Author: jstrachan Date: Tue Nov 28 08:14:28 2006 New Revision: 480111 URL: http://svn.apache.org/viewvc?view=rev&rev=480111 Log: Backported the fix for AMQ-1054 to the 4.1 branch
Added: incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/ - copied from r479726, incubator/activemq/trunk/activemq-test-atomikos/ incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/pom.xml - copied unchanged from r479726, incubator/activemq/trunk/activemq-test-atomikos/pom.xml incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/ - copied from r479726, incubator/activemq/trunk/activemq-test-atomikos/src/ incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/ - copied from r479726, incubator/activemq/trunk/activemq-test-atomikos/src/test/ incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/ - copied from r479726, incubator/activemq/trunk/activemq-test-atomikos/src/test/java/ incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/org/ - copied from r479726, incubator/activemq/trunk/activemq-test-atomikos/src/test/java/org/ incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/org/apache/ - copied from r479726, incubator/activemq/trunk/activemq-test-atomikos/src/test/java/org/apache/ incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/org/apache/activemq/ - copied from r479726, incubator/activemq/trunk/activemq-test-atomikos/src/test/java/org/apache/activemq/ incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/ - copied from r479726, incubator/activemq/trunk/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/ incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/XATest.java - copied, changed from r479726, incubator/activemq/trunk/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/XATest.java Modified: incubator/activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java incubator/activemq/branches/activemq-4.1/pom.xml Modified: incubator/activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java?view=diff&rev=480111&r1=480110&r2=480111 ============================================================================== --- incubator/activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java (original) +++ incubator/activemq/branches/activemq-4.1/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java Tue Nov 28 08:14:28 2006 @@ -35,6 +35,7 @@ import org.apache.activemq.command.TransactionId; import org.apache.activemq.command.TransactionInfo; import org.apache.activemq.command.XATransactionId; +import org.apache.activemq.command.DataStructure; import org.apache.activemq.transaction.Synchronization; import org.apache.activemq.util.JMSExceptionSupport; import org.apache.activemq.util.LongSequenceGenerator; @@ -514,7 +515,16 @@ this.connection.ensureConnectionInfoSent(); DataArrayResponse receipt = (DataArrayResponse) this.connection.syncSendPacket(info); - return (XATransactionId[]) receipt.getData(); + DataStructure[] data = receipt.getData(); + XATransactionId[] answer = null; + if (data instanceof XATransactionId[]) { + answer = (XATransactionId[]) data; + } + else { + answer = new XATransactionId[data.length]; + System.arraycopy(data, 0, answer, 0, data.length); + } + return answer; } catch (JMSException e) { throw toXAException(e); } Copied: incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/XATest.java (from r479726, incubator/activemq/trunk/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/XATest.java) URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/XATest.java?view=diff&rev=480111&p1=incubator/activemq/trunk/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/XATest.java&r1=479726&p2=incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/XATest.java&r2=480111 ============================================================================== --- incubator/activemq/trunk/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/XATest.java (original) +++ incubator/activemq/branches/activemq-4.1/activemq-test-atomikos/src/test/java/org/apache/activemq/atomikos/XATest.java Tue Nov 28 08:14:28 2006 @@ -18,6 +18,7 @@ package org.apache.activemq.atomikos; import com.atomikos.datasource.xa.DefaultXidFactory; +import org.apache.activemq.broker.BrokerService; import org.apache.activemq.ActiveMQXAConnectionFactory; import org.apache.activemq.command.ActiveMQQueue; @@ -36,8 +37,12 @@ public class XATest extends TestCase { public void testXA() throws Exception { - //String url = "tcp://localhost:61616"; - String url = "vm://localhost"; + BrokerService broker = new BrokerService(); + broker.addConnector("tcp://localhost:61616"); + broker.start(); + + + String url = "tcp://localhost:61616"; String qName = "MyQueue"; int timeout = 5; DefaultXidFactory xidFactory = new DefaultXidFactory(); Modified: incubator/activemq/branches/activemq-4.1/pom.xml URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.1/pom.xml?view=diff&rev=480111&r1=480110&r2=480111 ============================================================================== --- incubator/activemq/branches/activemq-4.1/pom.xml (original) +++ incubator/activemq/branches/activemq-4.1/pom.xml Tue Nov 28 08:14:28 2006 @@ -126,17 +126,19 @@ </distributionManagement> <modules> - <module>activemq-jaas</module> <module>activemq-core</module> <module>activemq-console</module> + <module>activemq-jaas</module> + <!-- <module>activemq-jpa-store</module> --> + <module>activemq-openwire-generator</module> + <module>activemq-optional</module> <module>activemq-ra</module> <module>activemq-rar</module> + <module>activemq-test-atomikos</module> + <module>activemq-tooling</module> <module>activemq-web</module> <module>activemq-web-demo</module> <module>activemq-web-console</module> - <module>activemq-optional</module> - <module>activemq-tooling</module> - <module>activemq-openwire-generator</module> <module>activemq-xmpp</module> <module>assembly</module> </modules>