You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by an...@apache.org on 2015/03/12 12:11:53 UTC
[2/5] activemq-6 git commit: Fixing test dependencies
Fixing test dependencies
- removing unused methods
- moving JMSXdeliveryCountTest to /extra-tests
- A few transactions methods that were not being used and creating issues to the release
due to an old dependency to the TM
This closes #173
Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/d36a1d74
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/d36a1d74
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/d36a1d74
Branch: refs/heads/master
Commit: d36a1d74afa8dc59dab129cf65114f141d7cd04f
Parents: 7792195
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Mar 11 19:21:00 2015 -0400
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Thu Mar 12 10:49:17 2015 +0000
----------------------------------------------------------------------
.../extras/jms/xa/JMSXDeliveryCountTest.java | 814 +++++++++++++++++++
.../openwire/SimpleOpenWireTest.java | 4 +-
.../jms/tests/ActiveMQServerTestCase.java | 17 -
.../tests/message/JMSXDeliveryCountTest.java | 789 ------------------
tests/soak-tests/pom.xml | 7 -
5 files changed, 816 insertions(+), 815 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d36a1d74/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/JMSXDeliveryCountTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/JMSXDeliveryCountTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/JMSXDeliveryCountTest.java
new file mode 100644
index 0000000..02ac354
--- /dev/null
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/JMSXDeliveryCountTest.java
@@ -0,0 +1,814 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.tests.extras.jms.xa;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.XAConnection;
+import javax.jms.XAConnectionFactory;
+import javax.jms.XASession;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import com.arjuna.ats.arjuna.coordinator.TransactionReaper;
+import com.arjuna.ats.arjuna.coordinator.TxControl;
+import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
+
+import org.apache.activemq.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.tests.util.JMSTestBase;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * A JMSXDeliveryCountTest
+ */
+public class JMSXDeliveryCountTest extends JMSTestBase
+{
+ Queue queue1;
+ Topic topic1;
+
+ protected XAConnectionFactory xacf;
+
+ @Override
+ @Before
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ xacf = ActiveMQJMSClient.createConnectionFactory("tcp://localhost:61616", "test");
+
+ queue1 = createQueue("queue1");
+ topic1 = createTopic("topic1");
+
+ TxControl.enable();
+ }
+
+ @Override
+ @After
+ public void tearDown() throws Exception
+ {
+ TxControl.disable(true);
+
+ TransactionReaper.terminate(false);
+
+ super.tearDown();
+
+ }
+
+ @Test
+ public void testSimpleJMSXDeliveryCount() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+ Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer p = s.createProducer(queue1);
+ p.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ p.send(s.createTextMessage("xoxo"));
+
+ s.close();
+
+ s = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ MessageConsumer c = s.createConsumer(queue1);
+
+ conn.start();
+
+ TextMessage tm = (TextMessage)c.receive(1000);
+
+ Assert.assertEquals("xoxo", tm.getText());
+ Assert.assertTrue("JMSXDeliveryCount is supposed to exist as a property",
+ tm.propertyExists("JMSXDeliveryCount"));
+ Assert.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
+
+ s.recover();
+
+ tm = (TextMessage)c.receive(1000);
+
+ Assert.assertEquals("xoxo", tm.getText());
+ Assert.assertTrue("JMSXDeliveryCount is supposed to exist as a property",
+ tm.propertyExists("JMSXDeliveryCount"));
+ Assert.assertEquals(2, tm.getIntProperty("JMSXDeliveryCount"));
+
+ tm.acknowledge();
+
+ conn.close();
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ @Test
+ public void testJMSXDeliveryCountNotDeliveredMessagesNotUpdated() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+
+ Session s = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+ MessageProducer p = s.createProducer(queue1);
+
+ p.send(s.createTextMessage("message1"));
+ p.send(s.createTextMessage("message2"));
+ p.send(s.createTextMessage("message3"));
+ p.send(s.createTextMessage("message4"));
+ p.send(s.createTextMessage("message5"));
+
+ MessageConsumer c = s.createConsumer(queue1);
+
+ conn.start();
+
+ TextMessage tm = (TextMessage)c.receive(1000);
+
+ Assert.assertEquals("message1", tm.getText());
+ Assert.assertFalse(tm.getJMSRedelivered());
+ Assert.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
+
+ s.close();
+
+ s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ c = s.createConsumer(queue1);
+
+ tm = (TextMessage)c.receive(1000);
+
+ Assert.assertEquals("message1", tm.getText());
+ Assert.assertTrue(tm.getJMSRedelivered());
+ Assert.assertEquals(2, tm.getIntProperty("JMSXDeliveryCount"));
+
+ tm = (TextMessage)c.receive(1000);
+
+ Assert.assertEquals("message2", tm.getText());
+ Assert.assertFalse(tm.getJMSRedelivered());
+ Assert.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
+
+ tm = (TextMessage)c.receive(1000);
+
+ Assert.assertEquals("message3", tm.getText());
+ Assert.assertFalse(tm.getJMSRedelivered());
+ Assert.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
+
+ tm = (TextMessage)c.receive(1000);
+
+ Assert.assertEquals("message4", tm.getText());
+ Assert.assertFalse(tm.getJMSRedelivered());
+ Assert.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
+
+ tm = (TextMessage)c.receive(1000);
+
+ Assert.assertEquals("message5", tm.getText());
+ Assert.assertFalse(tm.getJMSRedelivered());
+ Assert.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
+
+ tm.acknowledge();
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ @Test
+ public void testRedeliveryOnQueue() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+
+ Session sess1 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = sess1.createProducer(queue1);
+
+ prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ final int NUM_MESSAGES = 100;
+
+ final int NUM_RECOVERIES = 8;
+
+ for (int i = 0; i < NUM_MESSAGES; i++)
+ {
+ TextMessage tm = sess1.createTextMessage();
+ tm.setText("testing" + i);
+ prod.send(tm);
+ }
+
+ Session sess2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+ MessageConsumer cons = sess2.createConsumer(queue1);
+
+ conn.start();
+
+ TextMessage tm = null;
+
+ for (int j = 0; j < NUM_RECOVERIES; j++)
+ {
+ for (int i = 0; i < NUM_MESSAGES; i++)
+ {
+ tm = (TextMessage)cons.receive(3000);
+ Assert.assertNotNull(tm);
+ Assert.assertEquals("testing" + i, tm.getText());
+ Assert.assertTrue("JMSXDeliveryCount is supposed to exist as a property",
+ tm.propertyExists("JMSXDeliveryCount"));
+ Assert.assertEquals(j + 1, tm.getIntProperty("JMSXDeliveryCount"));
+ }
+ if (j != NUM_RECOVERIES - 1)
+ {
+ sess2.recover();
+ }
+ }
+
+ tm.acknowledge();
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ @Test
+ public void testRedeliveryOnTopic() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+
+ conn.setClientID("myclientid");
+
+ Session sess1 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ Session sess2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ Session sess3 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+ MessageConsumer cons1 = sess1.createConsumer(topic1);
+ MessageConsumer cons2 = sess2.createConsumer(topic1);
+ MessageConsumer cons3 = sess3.createDurableSubscriber(topic1, "subxyz");
+
+ conn.start();
+
+ final int NUM_MESSAGES = 100;
+ final int NUM_RECOVERIES = 9;
+
+ Receiver r1 = new Receiver("R1", sess1, cons1, NUM_MESSAGES, NUM_RECOVERIES);
+ Receiver r2 = new Receiver("R2", sess2, cons2, NUM_MESSAGES, NUM_RECOVERIES);
+ Receiver r3 = new Receiver("R3", sess3, cons3, NUM_MESSAGES, NUM_RECOVERIES);
+
+ Thread t1 = new Thread(r1);
+ Thread t2 = new Thread(r2);
+ Thread t3 = new Thread(r3);
+
+ t1.start();
+ t2.start();
+ t3.start();
+
+ Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer prod = sessSend.createProducer(topic1);
+ prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ for (int i = 0; i < NUM_MESSAGES; i++)
+ {
+ TextMessage tm1 = sessSend.createTextMessage("testing" + i);
+ prod.send(tm1);
+ }
+
+ t1.join();
+ t2.join();
+ t3.join();
+
+ Assert.assertFalse(r1.failed);
+ Assert.assertFalse(r2.failed);
+ Assert.assertFalse(r3.failed);
+
+ cons3.close();
+
+ sess3.unsubscribe("subxyz");
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ @Test
+ public void testDeliveryCountUpdatedOnCloseTransacted() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+
+ Session producerSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = producerSess.createProducer(queue1);
+
+ Session consumerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
+ MessageConsumer consumer = consumerSess.createConsumer(queue1);
+ conn.start();
+
+ TextMessage tm = producerSess.createTextMessage("message1");
+
+ producer.send(tm);
+
+ TextMessage rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertTrue("JMSXDeliveryCount is supposed to exist as a property",
+ tm.propertyExists("JMSXDeliveryCount"));
+ Assert.assertEquals(1, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertFalse(rm.getJMSRedelivered());
+
+ consumerSess.rollback();
+
+ rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(2, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertTrue(rm.getJMSRedelivered());
+
+ consumerSess.rollback();
+
+ rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(3, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertTrue(rm.getJMSRedelivered());
+
+ // Now close the session without committing
+
+ consumerSess.close();
+
+ consumerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
+
+ consumer = consumerSess.createConsumer(queue1);
+
+ rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(4, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertTrue(rm.getJMSRedelivered());
+
+ consumerSess.commit();
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ @Test
+ public void testDeliveryCountUpdatedOnCloseClientAck() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+
+ Session producerSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = producerSess.createProducer(queue1);
+
+ Session consumerSess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ MessageConsumer consumer = consumerSess.createConsumer(queue1);
+ conn.start();
+
+ TextMessage tm = producerSess.createTextMessage("message1");
+
+ producer.send(tm);
+
+ TextMessage rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(1, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertFalse(rm.getJMSRedelivered());
+
+ consumerSess.recover();
+
+ rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(2, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertTrue(rm.getJMSRedelivered());
+
+ consumerSess.recover();
+
+ rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(3, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertTrue(rm.getJMSRedelivered());
+
+ // Now close the session without committing
+
+ consumerSess.close();
+
+ consumerSess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+ consumer = consumerSess.createConsumer(queue1);
+
+ rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(4, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertTrue(rm.getJMSRedelivered());
+
+ rm.acknowledge();
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
+ @Test
+ public void testDeliveryCountUpdatedOnCloseXA() throws Exception
+ {
+ XAConnection xaConn = null;
+
+ Connection conn = null;
+ TransactionManager mgr = new TransactionManagerImple();
+
+ Transaction toResume = null;
+
+ Transaction tx = null;
+
+ try
+ {
+ toResume = mgr.suspend();
+
+ conn = cf.createConnection();
+
+ // Send a message
+
+ Session producerSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer producer = producerSess.createProducer(queue1);
+
+ TextMessage tm = producerSess.createTextMessage("message1");
+
+ producer.send(tm);
+
+ xaConn = xacf.createXAConnection();
+
+ XASession consumerSess = xaConn.createXASession();
+ MessageConsumer consumer = consumerSess.createConsumer(queue1);
+ xaConn.start();
+
+ DummyXAResource res = new DummyXAResource();
+
+ mgr.begin();
+
+ tx = mgr.getTransaction();
+
+ tx.enlistResource(res);
+
+ tx.enlistResource(consumerSess.getXAResource());
+
+ TextMessage rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(1, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertFalse(rm.getJMSRedelivered());
+
+ tx.delistResource(res, XAResource.TMSUCCESS);
+
+ tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
+
+ mgr.rollback();
+
+ mgr.begin();
+
+ tx = mgr.getTransaction();
+
+ tx.enlistResource(res);
+
+ tx.enlistResource(consumerSess.getXAResource());
+
+ rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(2, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertTrue(rm.getJMSRedelivered());
+
+ tx.delistResource(res, XAResource.TMSUCCESS);
+
+ tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
+
+ mgr.rollback();
+
+ mgr.begin();
+
+ tx = mgr.getTransaction();
+
+ tx.enlistResource(res);
+
+ tx.enlistResource(consumerSess.getXAResource());
+
+ rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(3, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertTrue(rm.getJMSRedelivered());
+
+ tx.delistResource(res, XAResource.TMSUCCESS);
+
+ tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
+
+ mgr.rollback();
+
+ // Must close consumer first
+
+ consumer.close();
+
+ consumerSess.close();
+
+ consumerSess = xaConn.createXASession();
+
+ consumer = consumerSess.createConsumer(queue1);
+
+ mgr.begin();
+
+ tx = mgr.getTransaction();
+
+ tx.enlistResource(res);
+
+ tx.enlistResource(consumerSess.getXAResource());
+
+ rm = (TextMessage)consumer.receive(1000);
+
+ Assert.assertNotNull(rm);
+
+ Assert.assertEquals(tm.getText(), rm.getText());
+
+ Assert.assertEquals(4, rm.getIntProperty("JMSXDeliveryCount"));
+
+ Assert.assertTrue(rm.getJMSRedelivered());
+
+ tx.delistResource(res, XAResource.TMSUCCESS);
+
+ tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+
+ if (tx != null)
+ {
+ try
+ {
+ mgr.commit();
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+ if (xaConn != null)
+ {
+ xaConn.close();
+ }
+
+ if (toResume != null)
+ {
+ try
+ {
+ mgr.resume(toResume);
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+ }
+ }
+
+ class Receiver implements Runnable
+ {
+ MessageConsumer cons;
+
+ int numMessages;
+
+ int numRecoveries;
+
+ boolean failed;
+
+ Session sess;
+
+ String name;
+
+ Receiver(final String name,
+ final Session sess,
+ final MessageConsumer cons,
+ final int numMessages,
+ final int numRecoveries)
+ {
+ this.sess = sess;
+ this.cons = cons;
+ this.numMessages = numMessages;
+ this.numRecoveries = numRecoveries;
+ this.name = name;
+ }
+
+ public void run()
+ {
+ try
+ {
+ Message lastMessage = null;
+ for (int j = 0; j < numRecoveries; j++)
+ {
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ TextMessage tm = (TextMessage)cons.receive();
+ lastMessage = tm;
+
+ if (tm == null)
+ {
+ failed = true;
+ }
+
+ if (!tm.getText().equals("testing" + i))
+ {
+ failed = true;
+ }
+
+ if (tm.getIntProperty("JMSXDeliveryCount") != j + 1)
+ {
+ failed = true;
+ }
+ }
+ if (j != numRecoveries - 1)
+ {
+ sess.recover();
+ }
+
+ }
+ lastMessage.acknowledge();
+ }
+ catch (Exception e)
+ {
+ failed = true;
+ }
+ }
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+ static class DummyXAResource implements XAResource
+ {
+ DummyXAResource()
+ {
+ }
+
+ public void commit(final Xid arg0, final boolean arg1) throws XAException
+ {
+ }
+
+ public void end(final Xid arg0, final int arg1) throws XAException
+ {
+ }
+
+ public void forget(final Xid arg0) throws XAException
+ {
+ }
+
+ public int getTransactionTimeout() throws XAException
+ {
+ return 0;
+ }
+
+ public boolean isSameRM(final XAResource arg0) throws XAException
+ {
+ return false;
+ }
+
+ public int prepare(final Xid arg0) throws XAException
+ {
+ return XAResource.XA_OK;
+ }
+
+ public Xid[] recover(final int arg0) throws XAException
+ {
+ return null;
+ }
+
+ public void rollback(final Xid arg0) throws XAException
+ {
+ }
+
+ public boolean setTransactionTimeout(final int arg0) throws XAException
+ {
+ return false;
+ }
+
+ public void start(final Xid arg0, final int arg1) throws XAException
+ {
+
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d36a1d74/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/openwire/SimpleOpenWireTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/openwire/SimpleOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/openwire/SimpleOpenWireTest.java
index 87b962c..2adc74b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/openwire/SimpleOpenWireTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/openwire/SimpleOpenWireTest.java
@@ -27,7 +27,6 @@ import javax.jms.Session;
import javax.jms.TemporaryQueue;
import javax.jms.TemporaryTopic;
import javax.jms.TextMessage;
-import javax.jms.Topic;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQQueue;
@@ -40,7 +39,7 @@ import org.junit.rules.ExpectedException;
public class SimpleOpenWireTest extends BasicOpenWireTest
{
@Rule
- public ExpectedException thrown= ExpectedException.none();
+ public ExpectedException thrown = ExpectedException.none();
@Override
@Before
@@ -255,6 +254,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest
/**
* This is the example shipped with the distribution
+ *
* @throws Exception
*/
@Test
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d36a1d74/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java
index 939380f..823d346 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java
@@ -29,7 +29,6 @@ import javax.jms.Topic;
import javax.jms.TopicConnectionFactory;
import javax.jms.XAConnectionFactory;
import javax.naming.InitialContext;
-import javax.transaction.TransactionManager;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
@@ -37,7 +36,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
import org.apache.activemq.api.core.SimpleString;
import org.apache.activemq.api.jms.JMSFactoryType;
import org.apache.activemq.core.postoffice.Binding;
@@ -362,21 +360,6 @@ public abstract class ActiveMQServerTestCase
return (XAConnectionFactory) getInitialContext().lookup("/CF_XA_TRUE");
}
- public InitialContext getInitialContext(final int serverid) throws Exception
- {
- return new InitialContext(ServerManagement.getJNDIEnvironment(serverid));
- }
-
- protected TransactionManager getTransactionManager()
- {
- return new TransactionManagerImple();
- }
-
- public void configureSecurityForDestination(final String destName, final boolean isQueue, final HashSet<Role> roles) throws Exception
- {
- ActiveMQServerTestCase.servers.get(0).configureSecurityForDestination(destName, isQueue, roles);
- }
-
public void createQueue(final String name) throws Exception
{
ActiveMQServerTestCase.servers.get(0).createQueue(name, null);
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d36a1d74/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/message/JMSXDeliveryCountTest.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/message/JMSXDeliveryCountTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/message/JMSXDeliveryCountTest.java
deleted file mode 100644
index 0ba8a0c..0000000
--- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/message/JMSXDeliveryCountTest.java
+++ /dev/null
@@ -1,789 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jms.tests.message;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.XAConnection;
-import javax.jms.XASession;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
-
-import org.apache.activemq.jms.tests.ActiveMQServerTestCase;
-import org.apache.activemq.jms.tests.util.ProxyAssertSupport;
-import org.junit.Test;
-
-/**
- *
- * A JMSXDeliveryCountTest
- */
-public class JMSXDeliveryCountTest extends ActiveMQServerTestCase
-{
- // Constants ------------------------------------------------------------------------------------
-
- // Static ---------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- // Public ---------------------------------------------------------------------------------------
-
- @Test
- public void testSimpleJMSXDeliveryCount() throws Exception
- {
- Connection conn = null;
-
- try
- {
- conn = getConnectionFactory().createConnection();
- Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer p = s.createProducer(queue1);
- p.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-
- p.send(s.createTextMessage("xoxo"));
-
- s.close();
-
- s = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
- MessageConsumer c = s.createConsumer(queue1);
-
- conn.start();
-
- TextMessage tm = (TextMessage)c.receive(1000);
-
- ProxyAssertSupport.assertEquals("xoxo", tm.getText());
- ProxyAssertSupport.assertTrue("JMSXDeliveryCount is supposed to exist as a property",
- tm.propertyExists("JMSXDeliveryCount"));
- ProxyAssertSupport.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
-
- s.recover();
-
- tm = (TextMessage)c.receive(1000);
-
- ProxyAssertSupport.assertEquals("xoxo", tm.getText());
- ProxyAssertSupport.assertTrue("JMSXDeliveryCount is supposed to exist as a property",
- tm.propertyExists("JMSXDeliveryCount"));
- ProxyAssertSupport.assertEquals(2, tm.getIntProperty("JMSXDeliveryCount"));
-
- tm.acknowledge();
-
- conn.close();
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- @Test
- public void testJMSXDeliveryCountNotDeliveredMessagesNotUpdated() throws Exception
- {
- Connection conn = null;
-
- try
- {
- conn = getConnectionFactory().createConnection();
-
- Session s = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
- MessageProducer p = s.createProducer(queue1);
-
- p.send(s.createTextMessage("message1"));
- p.send(s.createTextMessage("message2"));
- p.send(s.createTextMessage("message3"));
- p.send(s.createTextMessage("message4"));
- p.send(s.createTextMessage("message5"));
-
- MessageConsumer c = s.createConsumer(queue1);
-
- conn.start();
-
- TextMessage tm = (TextMessage)c.receive(1000);
-
- ProxyAssertSupport.assertEquals("message1", tm.getText());
- ProxyAssertSupport.assertFalse(tm.getJMSRedelivered());
- ProxyAssertSupport.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
-
- s.close();
-
- s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- c = s.createConsumer(queue1);
-
- tm = (TextMessage)c.receive(1000);
-
- ProxyAssertSupport.assertEquals("message1", tm.getText());
- ProxyAssertSupport.assertTrue(tm.getJMSRedelivered());
- ProxyAssertSupport.assertEquals(2, tm.getIntProperty("JMSXDeliveryCount"));
-
- tm = (TextMessage)c.receive(1000);
-
- ProxyAssertSupport.assertEquals("message2", tm.getText());
- ProxyAssertSupport.assertFalse(tm.getJMSRedelivered());
- ProxyAssertSupport.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
-
- tm = (TextMessage)c.receive(1000);
-
- ProxyAssertSupport.assertEquals("message3", tm.getText());
- ProxyAssertSupport.assertFalse(tm.getJMSRedelivered());
- ProxyAssertSupport.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
-
- tm = (TextMessage)c.receive(1000);
-
- ProxyAssertSupport.assertEquals("message4", tm.getText());
- ProxyAssertSupport.assertFalse(tm.getJMSRedelivered());
- ProxyAssertSupport.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
-
- tm = (TextMessage)c.receive(1000);
-
- ProxyAssertSupport.assertEquals("message5", tm.getText());
- ProxyAssertSupport.assertFalse(tm.getJMSRedelivered());
- ProxyAssertSupport.assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
-
- tm.acknowledge();
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- @Test
- public void testRedeliveryOnQueue() throws Exception
- {
- Connection conn = null;
-
- try
- {
- conn = getConnectionFactory().createConnection();
-
- Session sess1 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageProducer prod = sess1.createProducer(queue1);
-
- prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-
- final int NUM_MESSAGES = 100;
-
- final int NUM_RECOVERIES = 8;
-
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- TextMessage tm = sess1.createTextMessage();
- tm.setText("testing" + i);
- prod.send(tm);
- }
-
- Session sess2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
- MessageConsumer cons = sess2.createConsumer(queue1);
-
- conn.start();
-
- TextMessage tm = null;
-
- for (int j = 0; j < NUM_RECOVERIES; j++)
- {
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- tm = (TextMessage)cons.receive(3000);
- ProxyAssertSupport.assertNotNull(tm);
- ProxyAssertSupport.assertEquals("testing" + i, tm.getText());
- ProxyAssertSupport.assertTrue("JMSXDeliveryCount is supposed to exist as a property",
- tm.propertyExists("JMSXDeliveryCount"));
- ProxyAssertSupport.assertEquals(j + 1, tm.getIntProperty("JMSXDeliveryCount"));
- }
- if (j != NUM_RECOVERIES - 1)
- {
- sess2.recover();
- }
- }
-
- tm.acknowledge();
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- @Test
- public void testRedeliveryOnTopic() throws Exception
- {
- Connection conn = null;
-
- try
- {
- conn = getConnectionFactory().createConnection();
-
- conn.setClientID("myclientid");
-
- Session sess1 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
- Session sess2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
- Session sess3 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
- MessageConsumer cons1 = sess1.createConsumer(ActiveMQServerTestCase.topic1);
- MessageConsumer cons2 = sess2.createConsumer(ActiveMQServerTestCase.topic1);
- MessageConsumer cons3 = sess3.createDurableSubscriber(ActiveMQServerTestCase.topic1, "subxyz");
-
- conn.start();
-
- final int NUM_MESSAGES = 100;
- final int NUM_RECOVERIES = 9;
-
- Receiver r1 = new Receiver("R1", sess1, cons1, NUM_MESSAGES, NUM_RECOVERIES);
- Receiver r2 = new Receiver("R2", sess2, cons2, NUM_MESSAGES, NUM_RECOVERIES);
- Receiver r3 = new Receiver("R3", sess3, cons3, NUM_MESSAGES, NUM_RECOVERIES);
-
- Thread t1 = new Thread(r1);
- Thread t2 = new Thread(r2);
- Thread t3 = new Thread(r3);
-
- t1.start();
- t2.start();
- t3.start();
-
- Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer prod = sessSend.createProducer(ActiveMQServerTestCase.topic1);
- prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-
- for (int i = 0; i < NUM_MESSAGES; i++)
- {
- TextMessage tm1 = sessSend.createTextMessage("testing" + i);
- prod.send(tm1);
- }
-
- t1.join();
- t2.join();
- t3.join();
-
- ProxyAssertSupport.assertFalse(r1.failed);
- ProxyAssertSupport.assertFalse(r2.failed);
- ProxyAssertSupport.assertFalse(r3.failed);
-
- cons3.close();
-
- sess3.unsubscribe("subxyz");
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- @Test
- public void testDeliveryCountUpdatedOnCloseTransacted() throws Exception
- {
- Connection conn = null;
-
- try
- {
- conn = getConnectionFactory().createConnection();
-
- Session producerSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = producerSess.createProducer(queue1);
-
- Session consumerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
- MessageConsumer consumer = consumerSess.createConsumer(queue1);
- conn.start();
-
- TextMessage tm = producerSess.createTextMessage("message1");
-
- producer.send(tm);
-
- TextMessage rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertTrue("JMSXDeliveryCount is supposed to exist as a property",
- tm.propertyExists("JMSXDeliveryCount"));
- ProxyAssertSupport.assertEquals(1, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertFalse(rm.getJMSRedelivered());
-
- consumerSess.rollback();
-
- rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(2, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());
-
- consumerSess.rollback();
-
- rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(3, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());
-
- // Now close the session without committing
-
- consumerSess.close();
-
- consumerSess = conn.createSession(true, Session.SESSION_TRANSACTED);
-
- consumer = consumerSess.createConsumer(queue1);
-
- rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(4, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());
-
- consumerSess.commit();
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- @Test
- public void testDeliveryCountUpdatedOnCloseClientAck() throws Exception
- {
- Connection conn = null;
-
- try
- {
- conn = getConnectionFactory().createConnection();
-
- Session producerSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = producerSess.createProducer(queue1);
-
- Session consumerSess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
- MessageConsumer consumer = consumerSess.createConsumer(queue1);
- conn.start();
-
- TextMessage tm = producerSess.createTextMessage("message1");
-
- producer.send(tm);
-
- TextMessage rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(1, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertFalse(rm.getJMSRedelivered());
-
- consumerSess.recover();
-
- rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(2, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());
-
- consumerSess.recover();
-
- rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(3, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());
-
- // Now close the session without committing
-
- consumerSess.close();
-
- consumerSess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-
- consumer = consumerSess.createConsumer(queue1);
-
- rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(4, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());
-
- rm.acknowledge();
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- @Test
- public void testDeliveryCountUpdatedOnCloseXA() throws Exception
- {
- XAConnection xaConn = null;
-
- Connection conn = null;
- TransactionManager mgr = new TransactionManagerImple();
-
- Transaction toResume = null;
-
- Transaction tx = null;
-
- try
- {
- toResume = mgr.suspend();
-
- conn = getConnectionFactory().createConnection();
-
- // Send a message
-
- Session producerSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = producerSess.createProducer(queue1);
-
- TextMessage tm = producerSess.createTextMessage("message1");
-
- producer.send(tm);
-
- xaConn = getXAConnectionFactory().createXAConnection();
-
- XASession consumerSess = xaConn.createXASession();
- MessageConsumer consumer = consumerSess.createConsumer(queue1);
- xaConn.start();
-
- DummyXAResource res = new DummyXAResource();
-
- mgr.begin();
-
- tx = mgr.getTransaction();
-
- tx.enlistResource(res);
-
- tx.enlistResource(consumerSess.getXAResource());
-
- TextMessage rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(1, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertFalse(rm.getJMSRedelivered());
-
- tx.delistResource(res, XAResource.TMSUCCESS);
-
- tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
-
- mgr.rollback();
-
- mgr.begin();
-
- tx = mgr.getTransaction();
-
- tx.enlistResource(res);
-
- tx.enlistResource(consumerSess.getXAResource());
-
- rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(2, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());
-
- tx.delistResource(res, XAResource.TMSUCCESS);
-
- tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
-
- mgr.rollback();
-
- mgr.begin();
-
- tx = mgr.getTransaction();
-
- tx.enlistResource(res);
-
- tx.enlistResource(consumerSess.getXAResource());
-
- rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(3, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());
-
- tx.delistResource(res, XAResource.TMSUCCESS);
-
- tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
-
- mgr.rollback();
-
- // Must close consumer first
-
- consumer.close();
-
- consumerSess.close();
-
- consumerSess = xaConn.createXASession();
-
- consumer = consumerSess.createConsumer(queue1);
-
- mgr.begin();
-
- tx = mgr.getTransaction();
-
- tx.enlistResource(res);
-
- tx.enlistResource(consumerSess.getXAResource());
-
- rm = (TextMessage)consumer.receive(1000);
-
- ProxyAssertSupport.assertNotNull(rm);
-
- ProxyAssertSupport.assertEquals(tm.getText(), rm.getText());
-
- ProxyAssertSupport.assertEquals(4, rm.getIntProperty("JMSXDeliveryCount"));
-
- ProxyAssertSupport.assertTrue(rm.getJMSRedelivered());
-
- tx.delistResource(res, XAResource.TMSUCCESS);
-
- tx.delistResource(consumerSess.getXAResource(), XAResource.TMSUCCESS);
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
-
- if (tx != null)
- {
- try
- {
- mgr.commit();
- }
- catch (Exception ignore)
- {
- }
- }
- if (xaConn != null)
- {
- xaConn.close();
- }
-
- if (toResume != null)
- {
- try
- {
- mgr.resume(toResume);
- }
- catch (Exception ignore)
- {
- }
- }
- }
- }
-
- class Receiver implements Runnable
- {
- MessageConsumer cons;
-
- int numMessages;
-
- int numRecoveries;
-
- boolean failed;
-
- Session sess;
-
- String name;
-
- Receiver(final String name,
- final Session sess,
- final MessageConsumer cons,
- final int numMessages,
- final int numRecoveries)
- {
- this.sess = sess;
- this.cons = cons;
- this.numMessages = numMessages;
- this.numRecoveries = numRecoveries;
- this.name = name;
- }
-
- public void run()
- {
- try
- {
- Message lastMessage = null;
- for (int j = 0; j < numRecoveries; j++)
- {
-
- for (int i = 0; i < numMessages; i++)
- {
- TextMessage tm = (TextMessage)cons.receive();
- lastMessage = tm;
-
- if (tm == null)
- {
- failed = true;
- }
-
- if (!tm.getText().equals("testing" + i))
- {
- log.error("Out of order!!");
- failed = true;
- }
-
- if (tm.getIntProperty("JMSXDeliveryCount") != j + 1)
- {
- log.error("DeliveryImpl count not expected value:" + (j + 1) +
- " actual:" +
- tm.getIntProperty("JMSXDeliveryCount"));
- failed = true;
- }
- }
- if (j != numRecoveries - 1)
- {
- sess.recover();
- }
-
- }
- lastMessage.acknowledge();
- }
- catch (Exception e)
- {
- failed = true;
- }
- }
- }
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
- static class DummyXAResource implements XAResource
- {
- DummyXAResource()
- {
- }
-
- public void commit(final Xid arg0, final boolean arg1) throws XAException
- {
- }
-
- public void end(final Xid arg0, final int arg1) throws XAException
- {
- }
-
- public void forget(final Xid arg0) throws XAException
- {
- }
-
- public int getTransactionTimeout() throws XAException
- {
- return 0;
- }
-
- public boolean isSameRM(final XAResource arg0) throws XAException
- {
- return false;
- }
-
- public int prepare(final Xid arg0) throws XAException
- {
- return XAResource.XA_OK;
- }
-
- public Xid[] recover(final int arg0) throws XAException
- {
- return null;
- }
-
- public void rollback(final Xid arg0) throws XAException
- {
- }
-
- public boolean setTransactionTimeout(final int arg0) throws XAException
- {
- return false;
- }
-
- public void start(final Xid arg0, final int arg1) throws XAException
- {
-
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d36a1d74/tests/soak-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/soak-tests/pom.xml b/tests/soak-tests/pom.xml
index 91be57a..67e41db 100644
--- a/tests/soak-tests/pom.xml
+++ b/tests/soak-tests/pom.xml
@@ -61,13 +61,6 @@
<type>test-jar</type>
</dependency>
<dependency>
- <groupId>org.apache.activemq.tests</groupId>
- <artifactId>jms-tests</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- <type>test-jar</type>
- </dependency>
- <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-jms-client</artifactId>
<version>${project.version}</version>