diff options
author | Aidan Skinner <aidan@apache.org> | 2009-09-09 13:05:43 +0000 |
---|---|---|
committer | Aidan Skinner <aidan@apache.org> | 2009-09-09 13:05:43 +0000 |
commit | c1ebe66bfab328c5192a35c21ea290b5c45f40f5 (patch) | |
tree | 6e61e50d92442f29287a82c22b54de6beac43b2c /qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java | |
parent | 7b28732091473d93ce7546c70fa1d2dbd685161a (diff) | |
download | qpid-python-c1ebe66bfab328c5192a35c21ea290b5c45f40f5.tar.gz |
Merge from trunk
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/java-network-refactor@812936 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java')
-rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java index 7a2266902b..b4ba6e8156 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java @@ -29,6 +29,8 @@ import org.apache.qpid.server.logging.AbstractTestLogging; import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject; import javax.jms.Connection; +import javax.jms.ExceptionListener; +import javax.jms.JMSException; import javax.management.JMException; import javax.management.MBeanException; import javax.management.MBeanServerConnection; @@ -38,6 +40,8 @@ import javax.management.remote.JMXConnector; import java.io.IOException; import java.util.List; import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; /** * Test class to test if any change in the broker JMX code is affesting the management console @@ -161,6 +165,23 @@ public class ManagementActorLoggingTest extends AbstractTestLogging //Create a connection to the broker Connection connection = getConnection(); + // Monitor the connection for an exception being thrown + // this should be a DisconnectionException but it is not this tests + // job to valiate that. Only use the exception as a synchronisation + // to check the log file for the Close message + final CountDownLatch exceptionReceived = new CountDownLatch(1); + connection.setExceptionListener(new ExceptionListener() + { + public void onException(JMSException e) + { + //Failover being attempted. + exceptionReceived.countDown(); + } + }); + + //Remove the connection close from any 0-10 connections + _monitor.reset(); + // Get all active AMQP connections AllObjects allObject = new AllObjects(_mbsc); allObject.querystring = "org.apache.qpid:type=VirtualHost.Connection,*"; @@ -175,16 +196,17 @@ public class ManagementActorLoggingTest extends AbstractTestLogging newProxyInstance(_mbsc, connectionName, ManagedConnection.class, false); - //Remove the connection close from any 0-10 connections - _monitor.reset(); //Close the connection mangedConnection.closeConnection(); + //Wait for the connection to close + assertTrue("Timed out waiting for conneciton to report close", + exceptionReceived.await(2, TimeUnit.SECONDS)); + //Validate results List<String> results = _monitor.findMatches("CON-1002"); - assertEquals("Unexpected Connection Close count", 1, results.size()); } } |