You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2018/01/14 12:14:24 UTC

[7/7] qpid-broker-j git commit: QPID-6933: [System Tests] Move AMQP 0-x ExceptionListenerTest to Qpid JMS 0-X client

QPID-6933: [System Tests] Move AMQP 0-x ExceptionListenerTest to Qpid JMS 0-X client


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/66eec20f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/66eec20f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/66eec20f

Branch: refs/heads/master
Commit: 66eec20ff896f264d4bbf0ff16e7916a0bf49f97
Parents: 588f2ca
Author: Keith Wall <kw...@apache.org>
Authored: Sat Jan 13 23:44:45 2018 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Sat Jan 13 23:44:45 2018 +0000

----------------------------------------------------------------------
 .../connection/ExceptionListenerTest.java       | 152 -------------------
 test-profiles/CPPExcludes                       |   1 -
 test-profiles/Java010Excludes                   |   1 -
 test-profiles/Java10Excludes                    |   4 -
 4 files changed, 158 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/66eec20f/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java b/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java
deleted file mode 100644
index 047c39e..0000000
--- a/systests/src/test/java/org/apache/qpid/test/unit/client/connection/ExceptionListenerTest.java
+++ /dev/null
@@ -1,152 +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.qpid.test.unit.client.connection;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.jms.Connection;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.Queue;
-import javax.jms.Session;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.jms.ConnectionURL;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-/*
- *   AMQP 0.x client specific test
- */
-public class ExceptionListenerTest extends QpidBrokerTestCase
-{
-    private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionListenerTest.class);
-
-    /**
-     * This test reproduces a deadlock that was the subject of a support call. A Spring based
-     * application was using SingleConnectionFactory.  It installed an ExceptionListener that
-     * stops and closes the connection in response to any exception.  On receipt of a message
-     * the application would create a new session then send a response message (within onMessage).
-     * It appears that a misconfiguration in the application meant that some of these messages
-     * were bounced (no-route). Bounces are treated like connection exceptions and are passed
-     * back to the application via the ExceptionListener.  The deadlock occurred between the
-     * ExceptionListener's call to stop() and the MessageListener's attempt to create a new
-     * session.
-     */
-    public void testExceptionListenerConnectionStopDeadlock() throws  Exception
-    {
-        Queue messageQueue = getTestQueue();
-
-        Map<String, String> options = new HashMap<String, String>();
-        options.put(ConnectionURL.OPTIONS_CLOSE_WHEN_NO_ROUTE, Boolean.toString(false));
-
-        final Connection connection = getConnectionWithOptions(options);
-
-        Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
-        session.createConsumer(messageQueue).close(); // Create queue by side-effect
-
-        // Put 10 messages onto messageQueue
-        sendMessage(session, messageQueue, 10);
-
-        // Install an exception listener that stops/closes the connection on receipt of 2nd AMQNoRouteException.
-        // (Triggering on the 2nd (rather than 1st) seems to increase the probability that the test ends in deadlock,
-        // at least on my machine).
-        final CountDownLatch exceptionReceivedLatch = new CountDownLatch(2);
-        final AtomicBoolean doneClosed = new AtomicBoolean();
-        final CountDownLatch connectionClosedAttemptLatch = new CountDownLatch(1);
-        final AtomicReference<Exception> connectionCloseException = new AtomicReference<>();
-        final ExceptionListener listener = new ExceptionListener()
-        {
-            @Override
-            public void onException(JMSException exception)
-            {
-                exceptionReceivedLatch.countDown();
-                if (exceptionReceivedLatch.getCount() == 0)
-                {
-                    try
-                    {
-                        if (doneClosed.compareAndSet(false, true))
-                        {
-                            connection.stop();
-                            connection.close();
-                        }
-                    }
-                    catch (Exception e)
-                    {
-                        // We expect no exception to be caught
-                        connectionCloseException.set(e);
-                    }
-                    finally
-                    {
-                        connectionClosedAttemptLatch.countDown();
-                    }
-
-                }
-            }
-        };
-        connection.setExceptionListener(listener);
-
-        // Create a message listener that receives from testQueue and tries to forward them to unknown queue (thus
-        // provoking AMQNoRouteException exceptions to be delivered to the ExceptionListener).
-        final Queue unknownQueue = session.createQueue(getTestQueueName() + "_unknown");
-        MessageListener redirectingMessageListener = new MessageListener()
-        {
-            @Override
-            public void onMessage(Message msg)
-            {
-                try
-                {
-                    Session mlSession = connection.createSession(true, Session.SESSION_TRANSACTED);  // ** Deadlock
-                    mlSession.createProducer(unknownQueue).send(msg);  // will cause async AMQNoRouteException;
-                    mlSession.commit();
-                }
-                catch (JMSException je)
-                {
-                    // Connection is closed by the listener, so exceptions here are expected.
-                    LOGGER.debug("Expected exception - message listener got exception", je);
-                }
-            }
-        };
-
-        MessageConsumer consumer = session.createConsumer(messageQueue);
-        consumer.setMessageListener(redirectingMessageListener);
-        connection.start();
-
-        // Await an exception
-        boolean exceptionReceived = exceptionReceivedLatch.await(10, TimeUnit.SECONDS);
-        assertTrue("Exception listener did not hear at least one exception within timeout", exceptionReceived);
-
-        // Await the connection listener to close the connection
-        boolean closeAttemptedReceived = connectionClosedAttemptLatch.await(10, TimeUnit.SECONDS);
-        assertTrue("Exception listener did not try to close the exception within timeout", closeAttemptedReceived);
-        assertNull("Exception listener should not have had experienced an exception : " + connectionCloseException.get(), connectionCloseException.get());
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/66eec20f/test-profiles/CPPExcludes
----------------------------------------------------------------------
diff --git a/test-profiles/CPPExcludes b/test-profiles/CPPExcludes
index f79d0a9..61a5e8a 100755
--- a/test-profiles/CPPExcludes
+++ b/test-profiles/CPPExcludes
@@ -29,7 +29,6 @@ org.apache.qpid.test.client.timeouts.SyncWaitDelayTest#*
 // QPID-1262, QPID-1119 : This test fails occasionally due to potential protocol issue.
 org.apache.qpid.test.client.timeouts.SyncWaitTimeoutDelayTest#*
 org.apache.qpid.test.unit.topic.DurableSubscriptionTest#testUnsubscribeWhenUsingSelectorMakesTopicUnreachable
-org.apache.qpid.test.unit.client.connection.ExceptionListenerTest#testExceptionListenerConnectionStopDeadlock
 
 // QPID-1727 , QPID-1726 :c++ broker does not support flow to disk on transient queues. Also it requries a persistent store impl. for Apache
 org.apache.qpid.test.client.QueueBrowsingFlowToDiskTest#*

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/66eec20f/test-profiles/Java010Excludes
----------------------------------------------------------------------
diff --git a/test-profiles/Java010Excludes b/test-profiles/Java010Excludes
index d390a9f..6df36fd 100755
--- a/test-profiles/Java010Excludes
+++ b/test-profiles/Java010Excludes
@@ -18,7 +18,6 @@
 //
 
 // Those tests are testing 0.8..-0-9-1 specific semantics
-org.apache.qpid.test.unit.client.connection.ExceptionListenerTest#testExceptionListenerConnectionStopDeadlock
 org.apache.qpid.systest.rest.BrokerRestTest#testSetCloseOnNoRoute
 org.apache.qpid.test.unit.topic.DurableSubscriptionTest#testUnsubscribeWhenUsingSelectorMakesTopicUnreachable
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/66eec20f/test-profiles/Java10Excludes
----------------------------------------------------------------------
diff --git a/test-profiles/Java10Excludes b/test-profiles/Java10Excludes
index 7ddb229..efb7b97 100644
--- a/test-profiles/Java10Excludes
+++ b/test-profiles/Java10Excludes
@@ -52,10 +52,6 @@ org.apache.qpid.client.failover.FailoverBehaviourTest#*
 org.apache.qpid.client.failover.MultipleBrokersFailoverTest#*
 org.apache.qpid.test.client.failover.FailoverTest#*
 
-
-// Tests the issue of connection exceptions being generated for unroutable messages in the 0-x client
-org.apache.qpid.test.unit.client.connection.ExceptionListenerTest#testExceptionListenerConnectionStopDeadlock
-
 // Message encryption not currently supported by the 1.0 client
 org.apache.qpid.systest.messageencryption.MessageEncryptionTest#*
 // Message compression not currently supported by the 1.0 client


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org