You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/05/19 01:52:31 UTC
[1/2] activemq-artemis git commit: ARTEMIS-525 Adding test on
interrupted exception and regular receivers
Repository: activemq-artemis
Updated Branches:
refs/heads/master 1dcdc26d7 -> ab5471c57
ARTEMIS-525 Adding test on interrupted exception and regular receivers
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/37bc511f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/37bc511f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/37bc511f
Branch: refs/heads/master
Commit: 37bc511f969fb5c2389e6dd7041c6a7217e3c5d1
Parents: 1dcdc26
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed May 18 21:43:21 2016 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed May 18 21:43:21 2016 -0400
----------------------------------------------------------------------
.../client/InterruptedLargeMessageTest.java | 63 ++++++++++++++++++++
1 file changed, 63 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/37bc511f/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java
index b9bdc3f..62e24fa 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java
@@ -16,6 +16,10 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.io.IOException;
@@ -37,6 +41,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.StoreConfiguration;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.largemessage.LargeMessageTestBase;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
@@ -203,6 +208,64 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
server.stop();
}
+
+
+ @Test
+ public void testForcedInterruptUsingJMS() throws Exception {
+ ActiveMQServer server = createServer(true, isNetty());
+
+ server.start();
+
+
+ SimpleString jmsAddress = new SimpleString("jms.queue.Test");
+
+ server.createQueue(jmsAddress, jmsAddress, null, true, false);
+
+ final AtomicInteger unexpectedErrors = new AtomicInteger(0);
+ final AtomicInteger expectedErrors = new AtomicInteger(0);
+ ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://0");
+ Connection connection = cf.createConnection();
+ Session session = connection.createSession(Session.SESSION_TRANSACTED);
+ connection.start();
+ final MessageConsumer consumer = session.createConsumer(session.createQueue(jmsAddress.toString()));
+
+ Thread t = new Thread() {
+ @Override
+ public void run() {
+ try {
+ System.out.println("Receiving message");
+ javax.jms.Message msg = consumer.receive(5000);
+ if (msg == null) {
+ System.err.println("Message not received");
+ unexpectedErrors.incrementAndGet();
+ return;
+ }
+ }
+ catch (JMSException e) {
+ log.debug("This exception was ok as it was expected", e);
+ expectedErrors.incrementAndGet();
+ }
+ catch (Throwable e) {
+ log.warn("Captured unexpected exception", e);
+ unexpectedErrors.incrementAndGet();
+ }
+ }
+ };
+
+ t.start();
+ t.interrupt();
+
+ t.join();
+
+ Assert.assertEquals(0, unexpectedErrors.get());
+ Assert.assertEquals(1, expectedErrors.get());
+
+ session.close();
+
+ server.stop();
+ }
+
+
@Test
public void testSendNonPersistentQueue() throws Exception {
[2/2] activemq-artemis git commit: This closes #524
Posted by cl...@apache.org.
This closes #524
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/ab5471c5
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ab5471c5
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ab5471c5
Branch: refs/heads/master
Commit: ab5471c57f2de589de72d4ad0e8486dcb6ecdace
Parents: 1dcdc26 37bc511
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed May 18 21:49:59 2016 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed May 18 21:49:59 2016 -0400
----------------------------------------------------------------------
.../client/InterruptedLargeMessageTest.java | 63 ++++++++++++++++++++
1 file changed, 63 insertions(+)
----------------------------------------------------------------------