From 655e52b228ca233027f32ba54f7e94c88754a5c8 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Mon, 3 Mar 2008 17:44:03 +0000 Subject: QPID-107 : Updated two test cases that can fail due to the session being closed before we can attempt to use the connection. Also there is no way to get any exception that has occurred on the connection git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@633201 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/server/security/acl/SimpleACLTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'java') diff --git a/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java b/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java index 8ed3605723..a643230bc2 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java @@ -31,6 +31,7 @@ import org.apache.qpid.jms.ConnectionListener; import org.apache.qpid.url.URLSyntaxException; import javax.jms.*; +import javax.jms.IllegalStateException; import java.io.File; @@ -288,6 +289,7 @@ public class SimpleACLTest extends TestCase implements ConnectionListener DeliveryMode.NON_PERSISTENT, 0, 0L, false, false, true); // Test the connection with a valid consumer + // This may fail as the session may be closed before the queue or the consumer created. session.createConsumer(session.createTemporaryQueue()).close(); //Connection should now be closed and will throw the exception caused by the above send @@ -295,6 +297,11 @@ public class SimpleACLTest extends TestCase implements ConnectionListener fail("Close is not expected to succeed."); } + catch (IllegalStateException ise) + { + System.err.println("QPID-826 : WARNING : Unable to determine cause of failure due to closure as we don't " + + "record it for reporting after connection closed asynchronously"); + } catch (JMSException e) { Throwable cause = e.getLinkedException(); @@ -540,6 +547,9 @@ public class SimpleACLTest extends TestCase implements ConnectionListener DeliveryMode.NON_PERSISTENT, 0, 0L, false, false, true); // Test the connection with a valid consumer + // This may not work as the session may be closed before the queue or consumer creation can occur. + // The correct JMSexception with linked error will only occur when the close method is recevied whilst in + // the failover safe block session.createConsumer(session.createQueue("example.RequestQueue")).close(); //Connection should now be closed and will throw the exception caused by the above send @@ -547,6 +557,11 @@ public class SimpleACLTest extends TestCase implements ConnectionListener fail("Close is not expected to succeed."); } + catch (IllegalStateException ise) + { + System.err.println("QPID-826 : WARNING : Unable to determine cause of failure due to closure as we don't " + + "record it for reporting after connection closed asynchronously"); + } catch (JMSException e) { Throwable cause = e.getLinkedException(); -- cgit v1.2.1