summaryrefslogtreecommitdiff
path: root/java/systests
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2012-03-21 11:05:26 +0000
committerKeith Wall <kwall@apache.org>2012-03-21 11:05:26 +0000
commit1ef6467fc9434312282ad0c8258f13cac43df8f0 (patch)
treeff5574941ce404319637da7a5a9d8ff5e9e8edb8 /java/systests
parenta4f0bc465b52bf44af19fc6f9091795bb3b0a67c (diff)
downloadqpid-python-1ef6467fc9434312282ad0c8258f13cac43df8f0.tar.gz
QPID-3904: Java client should set AMQConnection#_closed flag on receipt of 0-10 connection.close
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1303360 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java
index 6b83929258..5b3bca7033 100644
--- a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java
@@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.qpid.AMQConnectionClosedException;
import org.apache.qpid.AMQDisconnectedException;
+import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.management.jmx.ManagedConnectionMBeanTest;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.transport.ConnectionException;
@@ -62,10 +63,13 @@ public class BrokerClosesClientConnectionTest extends QpidBrokerTestCase
{
final Class<? extends Exception> expectedLinkedException = isBroker010() ? ConnectionException.class : AMQConnectionClosedException.class;
+ assertConnectionOpen();
+
stopBroker();
JMSException exception = _recordingExceptionListener.awaitException(10000);
assertConnectionCloseWasReported(exception, expectedLinkedException);
+ assertConnectionClosed();
ensureCanCloseWithoutException();
}
@@ -79,10 +83,13 @@ public class BrokerClosesClientConnectionTest extends QpidBrokerTestCase
return;
}
+ assertConnectionOpen();
+
killBroker();
JMSException exception = _recordingExceptionListener.awaitException(10000);
assertConnectionCloseWasReported(exception, expectedLinkedException);
+ assertConnectionClosed();
ensureCanCloseWithoutException();
}
@@ -107,6 +114,16 @@ public class BrokerClosesClientConnectionTest extends QpidBrokerTestCase
assertEquals("Unexpected linked exception", linkedExceptionClass, exception.getLinkedException().getClass());
}
+ private void assertConnectionClosed()
+ {
+ assertTrue("Connection should be marked as closed", ((AMQConnection)_connection).isClosed());
+ }
+
+ private void assertConnectionOpen()
+ {
+ assertFalse("Connection should not be marked as closed", ((AMQConnection)_connection).isClosed());
+ }
+
private final class RecordingExceptionListener implements ExceptionListener
{
private final CountDownLatch _exceptionReceivedLatch = new CountDownLatch(1);