You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2009/10/13 13:40:04 UTC
svn commit: r824706 - in /qpid/trunk/qpid/java:
systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java
test-profiles/010Excludes test-profiles/08StandaloneExcludes
test-profiles/Excludes
Author: robbie
Date: Tue Oct 13 11:40:03 2009
New Revision: 824706
URL: http://svn.apache.org/viewvc?rev=824706&view=rev
Log:
QPID-1204: add temporary workaround for connection close race condition at tearDown() noted in QPID-2081 to allow enabling SimpleACLTest for java brokers. Update exclude lists accordingly, also removing a single-method exclude from the 010Excludes file made redundant by the complete SimpleACLTest exclusion when using cpp brokers
Modified:
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java
qpid/trunk/qpid/java/test-profiles/010Excludes
qpid/trunk/qpid/java/test-profiles/08StandaloneExcludes
qpid/trunk/qpid/java/test-profiles/Excludes
Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java?rev=824706&r1=824705&r2=824706&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java Tue Oct 13 11:40:03 2009
@@ -34,6 +34,7 @@
import javax.jms.Connection;
import javax.jms.DeliveryMode;
+import javax.jms.ExceptionListener;
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import javax.jms.Message;
@@ -45,6 +46,8 @@
import javax.naming.NamingException;
import java.io.File;
import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
public class SimpleACLTest extends QpidTestCase implements ConnectionListener
{
@@ -136,10 +139,23 @@
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
try
{
Connection conn = getConnection("guest", "guest");
+ conn.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
+
+
Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
conn.start();
@@ -155,6 +171,11 @@
assertNotNull("There was no liked exception", cause);
assertEquals("Wrong linked exception type", AMQAuthenticationException.class, cause.getClass());
assertEquals("Incorrect error code received", 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));
}
}
@@ -184,6 +205,10 @@
{
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
try
{
Connection conn = getConnection("client", "guest");
@@ -191,6 +216,14 @@
//Prevent Failover
((AMQConnection) conn).setConnectionListener(this);
+ conn.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
+
Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
conn.start();
@@ -206,6 +239,11 @@
assertNotNull("There was no liked exception", cause);
assertEquals("Wrong linked exception type", AMQAuthenticationException.class, cause.getClass());
assertEquals("Incorrect error code received", 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));
}
}
@@ -237,6 +275,10 @@
{
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
try
{
Connection conn = getConnection("client", "guest");
@@ -245,6 +287,14 @@
conn.start();
+ conn.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
+
//Create a Named Queue
((AMQSession) sesh).createQueue(new AMQShortString("IllegalQueue"), false, false, false);
@@ -255,6 +305,11 @@
{
amqe.printStackTrace();
assertEquals("Incorrect error code thrown", 403, ((AMQAuthenticationException) amqe).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));
}
}
@@ -323,11 +378,23 @@
{
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
try
{
Connection conn = getConnection("client", "guest");
((AMQConnection) conn).setConnectionListener(this);
+
+ conn.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -363,6 +430,11 @@
}
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));
}
}
@@ -392,10 +464,22 @@
{
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
try
{
Connection conn = getConnection("client", "guest");
+ conn.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
+
Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
conn.start();
@@ -412,6 +496,11 @@
assertNotNull("There was no liked exception", cause);
assertEquals("Wrong linked exception type", AMQAuthenticationException.class, cause.getClass());
assertEquals("Incorrect error code received", 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));
}
}
@@ -419,10 +508,22 @@
{
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
try
{
Connection conn = getConnection("server", "guest");
+ conn.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
+
Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
conn.start();
@@ -438,6 +539,11 @@
assertNotNull("There was no liked exception", cause);
assertEquals("Wrong linked exception type", AMQAuthenticationException.class, cause.getClass());
assertEquals("Incorrect error code received", 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));
}
}
@@ -479,10 +585,22 @@
{
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
try
{
Connection conn = getConnection("server", "guest");
+ conn.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
+
Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
conn.start();
@@ -496,6 +614,11 @@
catch (AMQAuthenticationException amqe)
{
assertEquals("Incorrect error code thrown", 403, amqe.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));
}
}
@@ -503,10 +626,22 @@
{
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
try
{
Connection conn = getConnection("server", "guest");
+ conn.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
+
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
conn.start();
@@ -523,6 +658,11 @@
assertNotNull("There was no liked exception", cause);
assertEquals("Wrong linked exception type", AMQAuthenticationException.class, cause.getClass());
assertEquals("Incorrect error code received", 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));
}
}
@@ -530,11 +670,23 @@
{
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
Connection connection = null;
try
{
connection = getConnection("server", "guest");
+ connection.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
+
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
connection.start();
@@ -548,6 +700,11 @@
catch (AMQAuthenticationException amqe)
{
assertEquals("Incorrect error code thrown", 403, amqe.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));
}
}
@@ -645,9 +802,21 @@
{
setUpACLTest();
+ //QPID-2081: use a latch to sync on exception causing connection close, to work
+ //around the connection close race during tearDown() causing sporadic failures
+ final CountDownLatch exceptionReceived = new CountDownLatch(1);
+
try
{
Connection conn = getConnection("server", "guest");
+
+ conn.setExceptionListener(new ExceptionListener()
+ {
+ public void onException(JMSException e)
+ {
+ exceptionReceived.countDown();
+ }
+ });
((AMQConnection) conn).setConnectionListener(this);
@@ -691,6 +860,11 @@
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));
}
}
Modified: qpid/trunk/qpid/java/test-profiles/010Excludes
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/010Excludes?rev=824706&r1=824705&r2=824706&view=diff
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/010Excludes (original)
+++ qpid/trunk/qpid/java/test-profiles/010Excludes Tue Oct 13 11:40:03 2009
@@ -75,9 +75,6 @@
// The C++ server has a totally different persistence mechanism
org.apache.qpid.server.store.PersistentStoreTest#*
-// QPID-1225 : Temporary remove this test until the problem has been addressed
-org.apache.qpid.server.security.acl.SimpleACLTest#testClientPublishInvalidQueueSuccess
-
// CPP Broker does not follow the same Logging convention as the Java broker
org.apache.qpid.server.logging.*
Modified: qpid/trunk/qpid/java/test-profiles/08StandaloneExcludes
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/08StandaloneExcludes?rev=824706&r1=824705&r2=824706&view=diff
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/08StandaloneExcludes (original)
+++ qpid/trunk/qpid/java/test-profiles/08StandaloneExcludes Tue Oct 13 11:40:03 2009
@@ -23,7 +23,6 @@
// InVM Broker tests awaiting resolution of QPID-1103
org.apache.qpid.test.client.timeouts.SyncWaitDelayTest#*
org.apache.qpid.test.client.timeouts.SyncWaitTimeoutDelayTest#*
-org.apache.qpid.server.security.acl.SimpleACLTest#*
// Those tests are written against the 0.10 path
org.apache.qpid.test.unit.message.UTF8Test#*
Modified: qpid/trunk/qpid/java/test-profiles/Excludes
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/Excludes?rev=824706&r1=824705&r2=824706&view=diff
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/Excludes (original)
+++ qpid/trunk/qpid/java/test-profiles/Excludes Tue Oct 13 11:40:03 2009
@@ -17,9 +17,6 @@
// QPID-XXX : Test fails to start external broker due to Derby Exception.
org.apache.qpid.server.logging.DerbyMessageStoreLoggingTest#*
-// QPID-2081 :The configuration changes are now highlighting the close race condition
-org.apache.qpid.server.security.acl.SimpleACLTest#*
-
// QPID-1816 : Client Ack has not been addressed
org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverOnMessageTest#testDirtyClientAck
org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverOnMessageTest#testClientAck
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org