From 065137f8f47e5b0ad14b328c5f69cfd7bb33ac92 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Tue, 19 Jan 2010 20:25:00 +0000 Subject: QPID-2262 : Removed SALCT from from exclude list and added required null check. Updated references to QPID-1204 to QPID-2345 which talks more to the issue of setting exception cause when the connection is closed by the broker. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@900943 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/server/security/acl/SimpleACLTest.java | 46 ++++++++++++++++------ qpid/java/test-profiles/Excludes | 2 - 2 files changed, 35 insertions(+), 13 deletions(-) (limited to 'qpid/java') diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java index 9487f72ac8..08fc047533 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java @@ -438,17 +438,34 @@ public class SimpleACLTest extends QpidTestCase implements ConnectionListener catch (JMSException e) { Throwable cause = e.getLinkedException(); - if (!(cause instanceof AMQAuthenticationException)) + + if (cause == null) { - e.printStackTrace(); + e.printStackTrace(System.out); + if (e instanceof IllegalStateException) + { + System.out.println("QPID-2345: Session became closed and we got that error rather than the authentication error."); + } + else + { + fail("JMS Exception of did not have cause.:" + e.getMessage()); + } } - assertEquals("Incorrect exception", AMQAuthenticationException.class, cause.getClass()); - assertEquals("Incorrect error code thrown", 403, ((AMQAuthenticationException) cause).getErrorCode().getCode()); - - //use the latch to ensure the control thread waits long enough for the exception thread - //to have done enough to mark the connection closed before teardown commences - assertTrue("Timed out waiting for conneciton to report close", - exceptionReceived.await(2, TimeUnit.SECONDS)); + else + { + if (!(cause instanceof AMQAuthenticationException)) + { + e.printStackTrace(); + } + assertEquals("Incorrect exception", AMQAuthenticationException.class, cause.getClass()); + assertEquals("Incorrect error code thrown", 403, ((AMQAuthenticationException) cause).getErrorCode().getCode()); + + //use the latch to ensure the control thread waits long enough for the exception thread + //to have done enough to mark the connection closed before teardown commences + assertTrue("Timed out waiting for connection to report close", + exceptionReceived.await(2, TimeUnit.SECONDS)); + } + } } @@ -876,13 +893,20 @@ public class SimpleACLTest extends QpidTestCase implements ConnectionListener if (cause == null) { e.printStackTrace(System.out); - fail("JMS Exception did not have cause"); + if (e instanceof IllegalStateException) + { + System.out.println("QPID-2345: Session became closed and we got that error rather than the authentication error."); + } + else + { + fail("JMS Exception of did not have cause.:" + e.getMessage()); + } } else if (!(cause instanceof AMQAuthenticationException)) { cause.printStackTrace(System.out); assertEquals("Incorrect exception", IllegalStateException.class, cause.getClass()); - System.out.println("QPID-1204 : Session became closed and we got that error rather than the authentication error."); + System.out.println("QPID-2345: Session became closed and we got that error rather than the authentication error."); } else { diff --git a/qpid/java/test-profiles/Excludes b/qpid/java/test-profiles/Excludes index 5c6308a2d2..b2f438e487 100644 --- a/qpid/java/test-profiles/Excludes +++ b/qpid/java/test-profiles/Excludes @@ -34,5 +34,3 @@ org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverTest#* org.apache.qpid.transport.network.mina.MINANetworkDriverTest#* // QPID-2225 Random Test failures against the in-vm broker. org.apache.qpid.test.unit.ack.FailoverBeforeConsumingRecover#* -// QPID-2262 Random test failures - The test needs to be fixed. -org.apache.qpid.server.security.acl.SimpleACLTest#testClientPublishInvalidQueueSuccess -- cgit v1.2.1