qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r821779 [10/11] - in /qpid/branches/java-broker-0-10/qpid: ./ cpp/ cpp/bindings/qmf/ cpp/bindings/qmf/python/ cpp/bindings/qmf/python/qmf/ cpp/bindings/qmf/ruby/ cpp/bindings/qmf/tests/ cpp/examples/messaging/ cpp/include/qmf/ cpp/include/q...
Date Mon, 05 Oct 2009 12:52:10 GMT
Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/management/jmx/ManagementActorLoggingTest.java Mon Oct  5 12:51:57 2009
@@ -20,24 +20,21 @@
  */
 package org.apache.qpid.management.jmx;
 
-import org.apache.qpid.commands.objects.AllObjects;
-import org.apache.qpid.management.common.JMXConnnectionFactory;
 import org.apache.qpid.management.common.mbeans.ManagedBroker;
 import org.apache.qpid.management.common.mbeans.ManagedConnection;
 import org.apache.qpid.management.common.mbeans.ManagedExchange;
 import org.apache.qpid.server.logging.AbstractTestLogging;
 import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject;
+import org.apache.qpid.test.utils.JMXTestUtils;
 
 import javax.jms.Connection;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
 import javax.management.JMException;
-import javax.management.MBeanException;
-import javax.management.MBeanServerConnection;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
-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
@@ -46,33 +43,21 @@
  */
 public class ManagementActorLoggingTest extends AbstractTestLogging
 {
-    MBeanServerConnection _mbsc;
-    JMXConnector _jmxc;
+    private JMXTestUtils _jmxUtils;
     private static final String USER = "admin";
 
     @Override
     public void setUp() throws Exception
     {
-        setConfigurationProperty("management.enabled", "true");
+        _jmxUtils = new JMXTestUtils(this, USER, USER);
+        _jmxUtils.setUp();
         super.setUp();
-
-        if (isExternalBroker())
-        {
-            _jmxc = JMXConnnectionFactory.getJMXConnection(
-                    5000, "127.0.0.1",
-                    getManagementPort(getPort()), USER, USER);
-
-            _mbsc = _jmxc.getMBeanServerConnection();
-        }
     }
 
     @Override
     public void tearDown() throws Exception
     {
-        if (isExternalBroker())
-        {
-            _jmxc.close();
-        }
+        _jmxUtils.close();
         super.tearDown();
     }
 
@@ -103,34 +88,31 @@
      */
     public void testJMXManagementConsoleConnection() throws IOException
     {
-        if (isExternalBroker())
-        {
-            List<String> results = _monitor.findMatches("MNG-1007");
+        List<String> results = _monitor.findMatches("MNG-1007");
 
-            assertEquals("Unexpected Management Connection count", 1, results.size());
+        assertEquals("Unexpected Management Connection count", 1, results.size());
 
-            String log = getLog(results.get(0));
+        String log = getLog(results.get(0));
 
-            validateMessageID("MNG-1007", log);
+        validateMessageID("MNG-1007", log);
 
-            assertTrue("User not in log message:" + log, log.endsWith(USER));
-            // Extract the id from the log string
-            //  MESSAGE [mng:1(rmi://169.24.29.116)] MNG-1007 : Open : User admin
-            int connectionID = Integer.parseInt(fromActor(getLog(results.get(0))).charAt(4) + "");
+        assertTrue("User not in log message:" + log, log.endsWith(USER));
+        // Extract the id from the log string
+        //  MESSAGE [mng:1(rmi://169.24.29.116)] MNG-1007 : Open : User admin
+        int connectionID = Integer.parseInt(fromActor(getLog(results.get(0))).charAt(4) + "");
 
-            results = _monitor.findMatches("MNG-1008");
+        results = _monitor.findMatches("MNG-1008");
 
-            assertEquals("Unexpected Management Connection close count", 0, results.size());
+        assertEquals("Unexpected Management Connection close count", 0, results.size());
 
-            _jmxc.close();
+        _jmxUtils.close();
 
-            results = _monitor.findMatches("MNG-1008");
+        results = _monitor.findMatches("MNG-1008");
 
-            assertEquals("Unexpected Management Connection count", 1, results.size());
+        assertEquals("Unexpected Management Connection count", 1, results.size());
 
-            assertEquals("Close does not have same id as open,", connectionID,
-                         Integer.parseInt(fromActor(getLog(results.get(0))).charAt(4) + ""));
-        }
+        assertEquals("Close does not have same id as open,", connectionID,
+                     Integer.parseInt(fromActor(getLog(results.get(0))).charAt(4) + ""));
     }
 
     /**
@@ -155,38 +137,40 @@
      */
     public void testConnectionCloseViaManagement() throws IOException, Exception
     {
-        if (isExternalBroker())
-        {
-
-            //Create a connection to the broker
-            Connection connection = getConnection();
-
-            // Get all active AMQP connections
-            AllObjects allObject = new AllObjects(_mbsc);
-            allObject.querystring = "org.apache.qpid:type=VirtualHost.Connection,*";
+        //Create a connection to the broker
+        Connection connection = getConnection();
 
-            Set<ObjectName> objectNames = allObject.returnObjects();
+        // 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 a managedConnection
+        ManagedConnection mangedConnection = _jmxUtils.getManagedObject(ManagedConnection.class, "org.apache.qpid:type=VirtualHost.Connection,*");
+
+        //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));
 
-            assertEquals("More than one test connection returned", 1, objectNames.size());
+        //Validate results
+        List<String> results = _monitor.findMatches("CON-1002");
 
-            ObjectName connectionName = objectNames.iterator().next();
-
-            ManagedConnection mangedConnection = MBeanServerInvocationHandler.
-                    newProxyInstance(_mbsc, connectionName,
-                                     ManagedConnection.class, false);
-
-            //Remove the connection close from any 0-10 connections 
-           _monitor.reset();
-
-            //Close the connection
-            mangedConnection.closeConnection();
-
-            //Validate results
-            List<String> results = _monitor.findMatches("CON-1002");
-
-
-            assertEquals("Unexpected Connection Close count", 1, results.size());
-        }
+        assertEquals("Unexpected Connection Close count", 1, results.size());
     }
 
     /**
@@ -212,114 +196,100 @@
      */
     public void testCreateExchangeDirectTransientViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-            //Remove any previous exchange declares
-            _monitor.reset();
-
-            createExchange("direct");
+        _monitor.reset();
 
-            // Validate
+        _jmxUtils.createExchange("test", "direct", null, false);
 
-            //1 - ID is correct
-            List<String> results = _monitor.findMatches("EXH-1001");
+        // Validate
 
-            assertEquals("More than one exchange creation found", 1, results.size());
+        //1 - ID is correct
+        List<String> results = _monitor.findMatches("EXH-1001");
 
-            String log = getLog(results.get(0));
+        assertEquals("More than one exchange creation found", 1, results.size());
 
-            // Validate correct exchange name
-            assertTrue("Incorrect exchange name created:" + log, log.endsWith(getName()));
+        String log = getLog(results.get(0));
 
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
+        // Validate correct exchange name
+        assertTrue("Incorrect exchange name created:" + log, log.endsWith(getName()));
 
-        }
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
     }
 
     public void testCreateExchangeTopicTransientViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-            //Remove any previous exchange declares
-            _monitor.reset();
+        //Remove any previous exchange declares
+        _monitor.reset();
 
-            createExchange("topic");
+        _jmxUtils.createExchange("test", "topic", null, false);
 
-            // Validate
+        // Validate
 
-            //1 - ID is correct
-            List<String> results = _monitor.findMatches("EXH-1001");
+        //1 - ID is correct
+        List<String> results = _monitor.findMatches("EXH-1001");
 
-            assertEquals("More than one exchange creation found", 1, results.size());
+        assertEquals("More than one exchange creation found", 1, results.size());
 
-            String log = getLog(results.get(0));
+        String log = getLog(results.get(0));
 
-            // Validate correct exchange name
-            assertTrue("Incorrect exchange name created:" + log, log.endsWith(getName()));
+        // Validate correct exchange name
+        assertTrue("Incorrect exchange name created:" + log, log.endsWith(getName()));
 
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
 
-        }
     }
 
     public void testCreateExchangeFanoutTransientViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-            //Remove any previous exchange declares
-            _monitor.reset();
+        //Remove any previous exchange declares
+        _monitor.reset();
 
-            createExchange("fanout");
+        _jmxUtils.createExchange("test", "fanout", null, false);
 
-            // Validate
+        // Validate
 
-            //1 - ID is correct
-            List<String> results = _monitor.findMatches("EXH-1001");
+        //1 - ID is correct
+        List<String> results = _monitor.findMatches("EXH-1001");
 
-            assertEquals("More than one exchange creation found", 1, results.size());
+        assertEquals("More than one exchange creation found", 1, results.size());
 
-            String log = getLog(results.get(0));
+        String log = getLog(results.get(0));
 
-            // Validate correct exchange name
-            assertTrue("Incorrect exchange name created:" + log, log.endsWith(getName()));
+        // Validate correct exchange name
+        assertTrue("Incorrect exchange name created:" + log, log.endsWith(getName()));
 
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
 
-        }
     }
 
     public void testCreateExchangeHeadersTransientViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-            //Remove any previous exchange declares
-            _monitor.reset();
+        //Remove any previous exchange declares
+        _monitor.reset();
 
-            createExchange("headers");
+        _jmxUtils.createExchange("test", "headers", null, false);
 
-            // Validate
+        // Validate
 
-            //1 - ID is correct
-            List<String> results = _monitor.findMatches("EXH-1001");
+        //1 - ID is correct
+        List<String> results = _monitor.findMatches("EXH-1001");
 
-            assertEquals("More than one exchange creation found", 1, results.size());
+        assertEquals("More than one exchange creation found", 1, results.size());
 
-            String log = getLog(results.get(0));
+        String log = getLog(results.get(0));
 
-            // Validate correct exchange name
-            assertTrue("Incorrect exchange name created:" + log, log.endsWith(getName()));
+        // Validate correct exchange name
+        assertTrue("Incorrect exchange name created:" + log, log.endsWith(getName()));
 
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
 
-        }
     }
 
     /**
@@ -343,29 +313,26 @@
      */
     public void testCreateQueueTransientViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-            //Remove any previous queue declares
-            _monitor.reset();
+        //Remove any previous queue declares
+        _monitor.reset();
 
-            createQueue();
+        _jmxUtils.createQueue("test", getName(), null, false);
 
-            // Validate
+        // Validate
 
-            List<String> results = _monitor.findMatches("QUE-1001");
+        List<String> results = _monitor.findMatches("QUE-1001");
 
-            assertEquals("More than one queue creation found", 1, results.size());
+        assertEquals("More than one queue creation found", 1, results.size());
 
-            String log = getLog(results.get(0));
+        String log = getLog(results.get(0));
 
-            // Validate correct queue name
-            String subject = fromSubject(log);
-            assertEquals("Incorrect queue name created", getName(), AbstractTestLogSubject.getSlice("qu", subject));
+        // Validate correct queue name
+        String subject = fromSubject(log);
+        assertEquals("Incorrect queue name created", getName(), AbstractTestLogSubject.getSlice("qu", subject));
 
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
-        }
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
     }
 
     /**
@@ -389,34 +356,29 @@
      */
     public void testQueueDeleteViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-            //Remove any previous queue declares
-            _monitor.reset();
+        //Remove any previous queue declares
+        _monitor.reset();
 
-            createQueue();
+        _jmxUtils.createQueue("test", getName(), null, false);
 
-            ManagedBroker managedBroker = MBeanServerInvocationHandler.
-                    newProxyInstance(_mbsc, getVirtualHostManagerObjectName(),
-                                     ManagedBroker.class, false);
+        ManagedBroker managedBroker = _jmxUtils.getManagedBroker("test");
 
-            managedBroker.deleteQueue(getName());
+        managedBroker.deleteQueue(getName());
 
-            List<String> results = _monitor.findMatches("QUE-1002");
+        List<String> results = _monitor.findMatches("QUE-1002");
 
-            assertEquals("More than one queue deletion found", 1, results.size());
+        assertEquals("More than one queue deletion found", 1, results.size());
 
-            String log = getLog(results.get(0));
+        String log = getLog(results.get(0));
 
-            // Validate correct binding
-            String subject = fromSubject(log);
-            assertEquals("Incorrect queue named in delete", getName(), AbstractTestLogSubject.getSlice("qu", subject));
+        // Validate correct binding
+        String subject = fromSubject(log);
+        assertEquals("Incorrect queue named in delete", getName(), AbstractTestLogSubject.getSlice("qu", subject));
 
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
 
-        }
     }
 
     /**
@@ -440,98 +402,83 @@
      */
     public void testBindingCreateOnDirectViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-            //Remove any previous queue declares
-            _monitor.reset();
+        //Remove any previous queue declares
+        _monitor.reset();
 
-            createQueue();
+        _jmxUtils.createQueue("test", getName(), null, false);
 
-            ManagedExchange managedExchange = MBeanServerInvocationHandler.
-                    newProxyInstance(_mbsc, getExchange("amq.direct"),
-                                     ManagedExchange.class, false);
+        ManagedExchange managedExchange = _jmxUtils.getManagedExchange("amq.direct");
 
-            managedExchange.createNewBinding(getName(), getName());
+        managedExchange.createNewBinding(getName(), getName());
 
-            List<String> results = _monitor.findMatches("BND-1001");
+        List<String> results = _monitor.findMatches("BND-1001");
 
-            assertEquals("More than one bind creation found", 1, results.size());
+        assertEquals("More than one bind creation found", 1, results.size());
 
-            String log = getLog(results.get(0));
+        String log = getLog(results.get(0));
 
-            // Validate correct binding
-            String subject = fromSubject(log);
-            assertEquals("Incorrect queue named in create", getName(), AbstractTestLogSubject.getSlice("qu", subject));
-            assertEquals("Incorrect routing key in create", getName(), AbstractTestLogSubject.getSlice("rk", subject));
+        // Validate correct binding
+        String subject = fromSubject(log);
+        assertEquals("Incorrect queue named in create", getName(), AbstractTestLogSubject.getSlice("qu", subject));
+        assertEquals("Incorrect routing key in create", getName(), AbstractTestLogSubject.getSlice("rk", subject));
 
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
-        }
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
     }
 
     public void testBindingCreateOnTopicViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-            //Remove any previous queue declares
-            _monitor.reset();
+        //Remove any previous queue declares
+        _monitor.reset();
 
-            createQueue();
+        _jmxUtils.createQueue("test", getName(), null, false);
 
-            ManagedExchange managedExchange = MBeanServerInvocationHandler.
-                    newProxyInstance(_mbsc, getExchange("amq.topic"),
-                                     ManagedExchange.class, false);
+        ManagedExchange managedExchange = _jmxUtils.getManagedExchange("amq.topic");
 
-            managedExchange.createNewBinding(getName(), getName());
+        managedExchange.createNewBinding(getName(), getName());
 
-            List<String> results = _monitor.findMatches("BND-1001");
+        List<String> results = _monitor.findMatches("BND-1001");
 
-            assertEquals("More than one bind creation found", 1, results.size());
+        assertEquals("More than one bind creation found", 1, results.size());
 
-            String log = getLog(results.get(0));
+        String log = getLog(results.get(0));
 
-            // Validate correct binding
-            String subject = fromSubject(log);
-            assertEquals("Incorrect queue named in create", getName(), AbstractTestLogSubject.getSlice("qu", subject));
-            assertEquals("Incorrect routing key in create", getName(), AbstractTestLogSubject.getSlice("rk", subject));
+        // Validate correct binding
+        String subject = fromSubject(log);
+        assertEquals("Incorrect queue named in create", getName(), AbstractTestLogSubject.getSlice("qu", subject));
+        assertEquals("Incorrect routing key in create", getName(), AbstractTestLogSubject.getSlice("rk", subject));
 
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
-        }
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
     }
 
     public void testBindingCreateOnFanoutViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-            //Remove any previous queue declares
-            _monitor.reset();
+        //Remove any previous queue declares
+        _monitor.reset();
 
-            createQueue();
+        _jmxUtils.createQueue("test", getName(), null, false);
 
-            ManagedExchange managedExchange = MBeanServerInvocationHandler.
-                    newProxyInstance(_mbsc, getExchange("amq.fanout"),
-                                     ManagedExchange.class, false);
+        ManagedExchange managedExchange = _jmxUtils.getManagedExchange("amq.fanout");
 
-            managedExchange.createNewBinding(getName(), getName());
+        managedExchange.createNewBinding(getName(), getName());
 
-            List<String> results = _monitor.findMatches("BND-1001");
+        List<String> results = _monitor.findMatches("BND-1001");
 
-            assertEquals("More than one bind creation found", 1, results.size());
+        assertEquals("More than one bind creation found", 1, results.size());
 
-            String log = getLog(results.get(0));
+        String log = getLog(results.get(0));
 
-            // Validate correct binding
-            String subject = fromSubject(log);
-            assertEquals("Incorrect queue named in create", getName(), AbstractTestLogSubject.getSlice("qu", subject));
-            assertEquals("Incorrect routing key in create", "*", AbstractTestLogSubject.getSlice("rk", subject));
+        // Validate correct binding
+        String subject = fromSubject(log);
+        assertEquals("Incorrect queue named in create", getName(), AbstractTestLogSubject.getSlice("qu", subject));
+        assertEquals("Incorrect routing key in create", "*", AbstractTestLogSubject.getSlice("rk", subject));
 
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
-        }
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
     }
 
     /**
@@ -556,114 +503,28 @@
      */
     public void testUnRegisterExchangeViaManagementConsole() throws IOException, JMException
     {
-        if (isExternalBroker())
-        {
-
-            //Remove any previous queue declares
-            _monitor.reset();
-
-            createExchange("direct");
-
-            ManagedBroker managedBroker = MBeanServerInvocationHandler.
-                    newProxyInstance(_mbsc, getVirtualHostManagerObjectName(),
-                                     ManagedBroker.class, false);
+        //Remove any previous queue declares
+        _monitor.reset();
 
-            managedBroker.unregisterExchange(getName());
+        _jmxUtils.createExchange("test", "direct", null, false);
 
-            List<String> results = _monitor.findMatches("EXH-1002");
+        ManagedBroker managedBroker = _jmxUtils.getManagedBroker("test");
 
-            assertEquals("More than one exchange deletion found", 1, results.size());
+        managedBroker.unregisterExchange(getName());
 
-            String log = getLog(results.get(0));
-
-            // Validate correct binding
-            String subject = fromSubject(log);
-            assertEquals("Incorrect exchange named in delete", "direct/" + getName(), AbstractTestLogSubject.getSlice("ex", subject));
-
-            // Validate it was a management actor.
-            String actor = fromActor(log);
-            assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
-        }
-    }
+        List<String> results = _monitor.findMatches("EXH-1002");
 
-    /**
-     * Create a non-durable test exchange with the current test name
-     *
-     * @throws JMException - is thrown if a exchange with this testName already exists
-     * @throws IOException - if there is a problem with the JMX Connection
-     * @throws javax.management.MBeanException
-     *                     - if there is another problem creating the exchange
-     */
-    private void createExchange(String type)
-            throws JMException, IOException, MBeanException
-    {
-        ManagedBroker managedBroker = MBeanServerInvocationHandler.
-                newProxyInstance(_mbsc, getVirtualHostManagerObjectName(),
-                                 ManagedBroker.class, false);
-
-        managedBroker.createNewExchange(getName(), type, false);
-    }
-
-    /**
-     * Create a non-durable queue (with no owner) that is named after the
-     * creating test.
-     *
-     * @throws JMException - is thrown if a queue with this testName already exists
-     * @throws IOException - if there is a problem with the JMX Connection
-     */
-    private void createQueue()
-            throws JMException, IOException
-    {
-        ManagedBroker managedBroker = MBeanServerInvocationHandler.
-                newProxyInstance(_mbsc, getVirtualHostManagerObjectName(),
-                                 ManagedBroker.class, false);
-
-        managedBroker.createNewQueue(getName(), null, false);
-    }
-
-    /**
-     * Retrive the ObjectName for the test Virtualhost.
-     *
-     * This is then use to create aproxy to the ManagedBroker MBean.
-     *
-     * @return the ObjectName for the 'test' VirtualHost.
-     */
-    private ObjectName getVirtualHostManagerObjectName()
-    {
-        // Get the name of the test manager
-        AllObjects allObject = new AllObjects(_mbsc);
-        allObject.querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=test,*";
-
-        Set<ObjectName> objectNames = allObject.returnObjects();
-
-        assertEquals("Incorrect number test vhosts returned", 1, objectNames.size());
-
-        // We have verified we have only one value in objectNames so return it
-        return objectNames.iterator().next();
-    }
-
-    /**
-     * Retrive the ObjectName for the given Exchange on the test Virtualhost.
-     *
-     * This is then use to create aproxy to the ManagedExchange MBean.
-     *
-     * @param exchange The exchange to retireve e.g. 'direct'
-     *
-     * @return the ObjectName for the given exchange on the test VirtualHost.
-     */
-    private ObjectName getExchange(String exchange)
-    {
-        // Get the name of the test manager
-        AllObjects allObject = new AllObjects(_mbsc);
-        allObject.querystring = "org.apache.qpid:type=VirtualHost.Exchange,VirtualHost=test,name=" + exchange + ",*";
+        assertEquals("More than one exchange deletion found", 1, results.size());
 
-        Set<ObjectName> objectNames = allObject.returnObjects();
+        String log = getLog(results.get(0));
 
-        assertEquals("Incorrect number of exchange with name '" + exchange +
-                     "' returned", 1, objectNames.size());
+        // Validate correct binding
+        String subject = fromSubject(log);
+        assertEquals("Incorrect exchange named in delete", "direct/" + getName(), AbstractTestLogSubject.getSlice("ex", subject));
 
-        // We have verified we have only one value in objectNames so return it
-        return objectNames.iterator().next();
+        // Validate it was a management actor.
+        String actor = fromActor(log);
+        assertTrue("Actor is not a manangement actor:" + actor, actor.startsWith("mng"));
     }
 
 }

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/configuration/ServerConfigurationFileTest.java Mon Oct  5 12:51:57 2009
@@ -40,6 +40,8 @@
         {
             fail("Unable to test without config file:" + _configFile);
         }
+
+        saveTestConfiguration();
         _serverConfig = new ServerConfiguration(_configFile);
     }
 

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java Mon Oct  5 12:51:57 2009
@@ -94,7 +94,7 @@
     {
         _connection = getConnection();
         _session = _connection.createSession(true, Session.SESSION_TRANSACTED);
-        _destination = _session.createQueue("testQueue");
+        _destination = _session.createQueue(getTestQueueName());
 
         // Consumer is only used to actually create the destination
         _session.createConsumer(_destination).close();
@@ -116,14 +116,12 @@
             // Add the current contents of the log file to test output
             message.append(_monitor.readFile());
 
-            // Write the server config file to test output
-            message.append("Server configuration file in use:\n");
-            message.append(FileUtils.readFileAsString(_configFile));
-
-            // Write the virtualhost config file to test output
-            message.append("\nVirtualhost configuration file in use:\n");
-            message.append(FileUtils.readFileAsString(ServerConfiguration.
-                    flatConfig(_configFile).getString("virtualhosts")));
+            // Write the test config file to test output
+            message.append("Server configuration overrides in use:\n");
+            message.append(FileUtils.readFileAsString(getTestConfigFile()));
+
+            message.append("\nVirtualhost maxMessageCount:\n");                        
+            message.append((new ServerConfiguration(_configFile)).getConfig().getString("virtualhosts.virtualhost." + VIRTUALHOST + ".queues.maximumMessageCount"));
 
             fail(message.toString());
         }

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/DerbyMessageStoreLoggingTest.java Mon Oct  5 12:51:57 2009
@@ -28,6 +28,7 @@
 import javax.jms.Queue;
 import javax.jms.Session;
 import java.util.List;
+import java.io.File;
 
 /**
  * The MessageStore test suite validates that the follow log messages as
@@ -56,9 +57,9 @@
         //We call super.setUp but this will not start the broker as that is
         //part of the test case.
 
-        // Load current configuration file to get the list of defined vhosts
-        Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-        List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+        // Load the default configuration file to get the list of defined vhosts
+        ServerConfiguration configuration = new ServerConfiguration(new File(_configFile.getParent() + "/config.xml"));
+        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
         // Make them all persistent i.e. Use DerbyMessageStore and
         // test that it logs correctly.
@@ -97,8 +98,8 @@
         assertTrue("MST messages not logged", results.size() > 0);
 
         // Load VirtualHost list from file.
-        Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-        List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+        ServerConfiguration configuration = new ServerConfiguration(_configFile);
+        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
         //Validate each vhost logs a creation
         results = _monitor.findMatches("MST-1002");
@@ -117,7 +118,7 @@
             // the virtualhost name, found above. AND
             // the index that the virtualhost is within the configuration.
             // we can retrive that from the vhosts list previously extracted.
-            String fullStoreName = configuration.getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+            String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
 
             // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
             String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);
@@ -160,8 +161,8 @@
         assertTrue("MST messages not logged", results.size() > 0);
 
         // Load VirtualHost list from file.
-        Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-        List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+        ServerConfiguration configuration = new ServerConfiguration(_configFile);
+        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
         //Validate each vhost logs a creation
         results = _monitor.findMatches("MST-1004");
@@ -186,7 +187,7 @@
             // the virtualhost name, found above. AND
             // the index that the virtualhost is within the configuration.
             // we can retrive that from the vhosts list previously extracted.
-            String fullStoreName = configuration.getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+            String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
 
             // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
             String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);
@@ -227,8 +228,8 @@
         assertTrue("MST messages not logged", results.size() > 0);
 
         // Load VirtualHost list from file.
-        Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-        List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+        ServerConfiguration configuration = new ServerConfiguration(_configFile);
+        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
         //Validate each vhost logs a creation
         results = _monitor.findMatches("MST-1006");
@@ -253,7 +254,7 @@
             // the virtualhost name, found above. AND
             // the index that the virtualhost is within the configuration.
             // we can retrive that from the vhosts list previously extracted.
-            String fullStoreName = configuration.getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+            String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
 
             // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
             String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);
@@ -293,8 +294,8 @@
         assertTrue("MST messages not logged", results.size() > 0);
 
         // Load VirtualHost list from file.
-        Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-        List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+        ServerConfiguration configuration = new ServerConfiguration(_configFile);
+        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
         //Validate each vhost logs a creation
         results = _monitor.findMatches("MST-1004 : Recovery Start :");
@@ -316,7 +317,7 @@
         // the virtualhost name, found above. AND
         // the index that the virtualhost is within the configuration.
         // we can retrive that from the vhosts list previously extracted.
-        String fullStoreName = configuration.getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+        String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
 
         // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
         String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);
@@ -358,8 +359,8 @@
         assertTrue("MST messages not logged", results.size() > 0);
 
         // Load VirtualHost list from file.
-        Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-        List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+        ServerConfiguration configuration = new ServerConfiguration(_configFile);
+        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
         //Validate each vhost logs a creation
         results = _monitor.findMatches("MST-1006 : Recovery Complete :");
@@ -381,7 +382,7 @@
         // the virtualhost name, found above. AND
         // the index that the virtualhost is within the configuration.
         // we can retrive that from the vhosts list previously extracted.
-        String fullStoreName = configuration.getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+        String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
 
         // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
         String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);
@@ -500,8 +501,8 @@
             assertTrue("MST messages not logged", results.size() > 0);
 
             // Load VirtualHost list from file.
-            Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-            List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+            ServerConfiguration configuration = new ServerConfiguration(_configFile);
+            List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
             //Validate each vhost logs a creation
             results = _monitor.findMatches("MST-1004 : Recovery Start : " + queueName);
@@ -542,7 +543,7 @@
             // the virtualhost name, found above. AND
             // the index that the virtualhost is within the configuration.
             // we can retrive that from the vhosts list previously extracted.
-            String fullStoreName = configuration.getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+            String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
 
             // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
             String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/ManagementLoggingTest.java Mon Oct  5 12:51:57 2009
@@ -24,6 +24,7 @@
 import org.apache.qpid.util.LogMonitor;
 
 import java.util.List;
+import java.io.File;
 
 /**
  * Management Console Test Suite
@@ -308,9 +309,8 @@
 
                 // We expect the RMIConnector Server port to be 100 higher than
                 // the RMI Server Port
-                int mPort = getPort() + (DEFAULT_MANAGEMENT_PORT - DEFAULT_PORT) + 100;
-                assertTrue("SSL Keystore entry expected(" + mPort + ").:" + getMessageString(log),
-                           getMessageString(log).endsWith(getConfigurationStringProperty("management.ssl.keyStorePath")));
+                assertTrue("SSL Keystore entry expected.:" + getMessageString(log),
+                           getMessageString(log).endsWith(new File(getConfigurationStringProperty("management.ssl.keyStorePath")).getName()));
             }
             catch (AssertionFailedError afe)
             {

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/MemoryMessageStoreLoggingTest.java Mon Oct  5 12:51:57 2009
@@ -89,8 +89,8 @@
         assertEquals("MST-1001 is not the first MST message", "MST-1001", getMessageID(fromMessage(log)));
 
         // Load VirtualHost list from file.
-        Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-        List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+        ServerConfiguration configuration = new ServerConfiguration(_configFile);
+        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
         //Validate each vhost logs a creation
         results = _monitor.findMatches("MST-1001");
@@ -109,7 +109,7 @@
             // the virtualhost name, found above. AND
             // the index that the virtualhost is within the configuration.
             // we can retrive that from the vhosts list previously extracted.
-            String fullStoreName = configuration.getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+            String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
 
             // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
             String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);
@@ -156,8 +156,8 @@
         assertTrue("MST messages not logged", results.size() > 0);
 
         // Load VirtualHost list from file.
-        Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-        List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+        ServerConfiguration configuration = new ServerConfiguration(_configFile);
+        List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
         //Validate each vhost logs a creation
         results = _monitor.findMatches("MST-1003");
@@ -176,7 +176,7 @@
             // the virtualhost name, found above. AND
             // the index that the virtualhost is within the configuration.
             // we can retrive that from the vhosts list previously extracted.
-            String fullStoreName = configuration.getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
+            String fullStoreName = configuration.getConfig().getString("virtualhosts.virtualhost(" + vhosts.indexOf(vhostName) + ")." + vhostName + ".store.class");
 
             // Get the Simple class name from the expected class name of o.a.q.s.s.MMS
             String storeName = fullStoreName.substring(fullStoreName.lastIndexOf(".") + 1);

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/SubscriptionLoggingTest.java Mon Oct  5 12:51:57 2009
@@ -29,6 +29,7 @@
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.Topic;
+import javax.jms.Message;
 import java.io.IOException;
 import java.util.List;
 
@@ -327,51 +328,59 @@
         int PREFETCH = 15;
 
         //Create new session with small prefetch
-        _session = ((AMQConnection) _connection).createSession(true, Session.AUTO_ACKNOWLEDGE, PREFETCH);
+        _session = ((AMQConnection) _connection).createSession(true, Session.SESSION_TRANSACTED, PREFETCH);
 
         MessageConsumer consumer = _session.createConsumer(_queue);
 
         _connection.start();
 
+        //Start the dispatcher & Unflow the channel.
+        consumer.receiveNoWait();
+
         //Fill the prefetch and two extra so that our receive bellow allows the
-        // subscription to become active then return to a suspended state.
-        sendMessage(_session, _queue, 17);
+        // subscription to become active
+        // Previously we set this to 17 so that it would return to a suspended
+        // state. However, testing has shown that the state change can occur
+        // sufficiently quickly that logging does not occur consistently enough
+        // for testing.
+        int SEND_COUNT = 16;
+        sendMessage(_session, _queue, SEND_COUNT);
         _session.commit();
         // Retreive the first message, and start the flow of messages
-        assertNotNull("First message not retreived", consumer.receive(1000));
+        Message msg = consumer.receive(1000);
+        assertNotNull("First message not retreived", msg);
         _session.commit();
         
-        
-        //Validate
-        List<String> results = _monitor.findMatches("SUB-1003");
-        
-        int i = 0;
-        while (results.size() != 3 && i < 10)
+        // Drain the queue to ensure there is time for the ACTIVE log message
+        // Check that we can received all the messages
+        int receivedCount = 0;
+        while (msg != null)
         {
-            try
-            {
-                Thread.sleep(1500);
-            }
-            catch (InterruptedException e)
-            {
-                
-            }
-            results = _monitor.findMatches("SUB-1003");
-            i++;
+            receivedCount++;
+            msg = consumer.receive(1000);
+            _session.commit();
         }
 
+        //Validate we received all the messages
+        assertEquals("Not all sent messages received.", SEND_COUNT, receivedCount);
+
+        // Fill the queue again to suspend the consumer
+        sendMessage(_session, _queue, SEND_COUNT);
+        _session.commit();
+
+        //Validate
+        List<String> results = _monitor.findMatches("SUB-1003");
+
         try
         {
             // Validation expects three messages.
-            // The first will be logged by the QueueActor as part of the processQueue thread
-// INFO - MESSAGE [vh(/test)/qu(example.queue)] [sub:6(qu(example.queue))] SUB-1003 : State : SUSPENDED 
-            // The second will be by the connnection as it acknowledges and activates the subscription
-// INFO - MESSAGE [con:6(guest@anonymous(26562441)/test)/ch:3] [sub:6(qu(example.queue))] SUB-1003 : State : ACTIVE
-            // The final one can be the subscription suspending as part of the SubFlushRunner or the processQueue thread
-            // As a result validating the actor is more complicated and doesn't add anything. The goal of this test is
-            // to ensure the State is correct not that a particular Actor performs the logging.
-// INFO - MESSAGE [sub:6(vh(test)/qu(example.queue))] [sub:6(qu(example.queue))] SUB-1003 : State : SUSPENDED
-// INFO - MESSAGE [vh(/test)/qu(example.queue)] [sub:6(qu(example.queue))] SUB-1003 : State : SUSPENDED
+            // The Actor can be any one of the following depending on the exactly what is going on on the broker.
+            // Ideally we would test that we can get all of them but setting up
+            // the timing to do this in a consistent way is not benefitial.
+            // Ensuring the State is as expected is sufficient.
+// INFO - MESSAGE [vh(/test)/qu(example.queue)] [sub:6(qu(example.queue))] SUB-1003 : State :
+// INFO - MESSAGE [con:6(guest@anonymous(26562441)/test)/ch:3] [sub:6(qu(example.queue))] SUB-1003 : State :
+// INFO - MESSAGE [sub:6(vh(test)/qu(example.queue))] [sub:6(qu(example.queue))] SUB-1003 : State :
 
             assertEquals("Result set not expected size:", 3, results.size());
 
@@ -380,19 +389,10 @@
             String log = getLog(results.get(0));
             validateSubscriptionState(log, expectedState);
 
-            // Validate that the logActor is the the queue
-            String actor = fromActor(log);
-            assertTrue("Actor string does not contain expected queue("
-                       + _queue.getQueueName() + ") name." + actor,
-                       actor.contains("qu(" + _queue.getQueueName() + ")"));
-
             // After being suspended the subscription should become active.
             expectedState = "ACTIVE";
             log = getLog(results.get(1));
             validateSubscriptionState(log, expectedState);
-            // Validate we have a connection Actor
-            actor = fromActor(log);
-            assertTrue("The actor is not a connection actor:" + actor, actor.startsWith("con:"));
 
             // Validate that it was re-suspended
             expectedState = "SUSPENDED";
@@ -411,6 +411,9 @@
         }
         _connection.close();
 
+        //Ensure the queue is drained before the test ends
+        drainQueue(_queue);
+
     }
 
     /**

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java Mon Oct  5 12:51:57 2009
@@ -64,8 +64,8 @@
         try
         {
             // Validation
-            Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-            List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+            ServerConfiguration configuration = new ServerConfiguration(_configFile);
+            List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
             //Validate each vhost logs a creation
             results = _monitor.findMatches("VHT-1001");
@@ -117,8 +117,8 @@
         {
             // Validation
 
-            Configuration configuration = ServerConfiguration.flatConfig(_configFile);
-            List<String> vhosts = configuration.getList("virtualhosts.virtualhost.name");
+            ServerConfiguration configuration = new ServerConfiguration(_configFile);
+            List<String> vhosts = configuration.getConfig().getList("virtualhosts.virtualhost.name");
 
             //Validate each vhost logs a creation
             results = _monitor.findMatches("VHT-1002");

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java Mon Oct  5 12:51:57 2009
@@ -21,67 +21,57 @@
 
 package org.apache.qpid.server.security.acl;
 
-import junit.framework.TestCase;
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.client.*;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry;
 import org.apache.qpid.AMQException;
-import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.AMQConnectionFailureException;
+import org.apache.qpid.client.AMQAuthenticationException;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.jms.ConnectionListener;
+import org.apache.qpid.test.utils.QpidTestCase;
 import org.apache.qpid.url.URLSyntaxException;
 
-import javax.jms.*;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
 import javax.jms.IllegalStateException;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.NamingException;
 import java.io.File;
 
 public class SimpleACLTest extends QpidTestCase implements ConnectionListener
 {
-    private String BROKER = "vm://:"+ApplicationRegistry.DEFAULT_INSTANCE;//"tcp://localhost:5672";
-
     public void setUp() throws Exception
     {
-        //Shutdown the QTC broker
-        stopBroker();
-
-        // Initialise ACLs.
-        final String QpidExampleHome = System.getProperty("QPID_EXAMPLE_HOME");
-        final File defaultaclConfigFile = new File(QpidExampleHome, "etc/acl.config.xml");
+        final String QPID_HOME = System.getProperty("QPID_HOME");
 
-        if (!defaultaclConfigFile.exists())
-        {
-            System.err.println("Configuration file not found:" + defaultaclConfigFile);
-            fail("Configuration file not found:" + defaultaclConfigFile);
-        }
-
-        if (System.getProperty("QPID_HOME") == null)                                                                                            
+        if (QPID_HOME == null)
         {
             fail("QPID_HOME not set");
         }
 
-        ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(defaultaclConfigFile);
-        ApplicationRegistry.initialise(config, ApplicationRegistry.DEFAULT_INSTANCE);
-        TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
-    }
+        // Initialise ACLs.
+        _configFile = new File(QPID_HOME, "etc/config-systests-acl.xml");
 
-    public void tearDown()
-    {
-        TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
-        ApplicationRegistry.remove(ApplicationRegistry.DEFAULT_INSTANCE);
+        super.setUp();
     }
 
-    public String createConnectionString(String username, String password, String broker)
+    public String createConnectionString(String username, String password)
     {
 
-        return "amqp://" + username + ":" + password + "@clientid/test?brokerlist='" + broker + "?retries='0''";
+        return "amqp://" + username + ":" + password + "@clientid/test?brokerlist='" + getBroker() + "?retries='0''";
     }
 
     public void testAccessAuthorized() throws AMQException, URLSyntaxException
     {
         try
         {
-            Connection conn = createConnection("client", "guest");
+            Connection conn = getConnection("client", "guest");
 
             Session sesh = conn.createSession(true, Session.SESSION_TRANSACTED);
 
@@ -94,28 +84,32 @@
         }
         catch (Exception e)
         {
-            fail("Connection was not created due to:" + e.getMessage());
+            fail("Connection was not created due to:" + e);
         }
     }
 
-    public void testAccessNoRights() throws URLSyntaxException, JMSException
+    public void testAccessNoRights() throws Exception
     {
         try
         {
-            Connection conn = createConnection("guest", "guest");
+            Connection conn = getConnection("guest", "guest");
 
             //Attempt to do do things to test connection.
             Session sesh = conn.createSession(true, Session.SESSION_TRANSACTED);
             conn.start();
             sesh.rollback();
 
-            conn.close();
             fail("Connection was created.");
         }
-        catch (AMQException amqe)
+        catch (JMSException jmse)
         {
-            Throwable cause = amqe.getCause();
-            assertEquals("Exception was wrong type", AMQAuthenticationException.class, cause.getClass());
+            Throwable linkedException = jmse.getLinkedException();
+            assertNotNull("Cause was null", linkedException);
+
+            assertEquals("Linked Exception was wrong type", AMQConnectionFailureException.class, linkedException.getClass());
+
+            Throwable cause = linkedException.getCause();
+            assertEquals("Cause was wrong type", AMQAuthenticationException.class, cause.getClass());
             assertEquals("Incorrect error code thrown", 403, ((AMQAuthenticationException) cause).getErrorCode().getCode());
         }
     }
@@ -124,7 +118,7 @@
     {
         try
         {
-            Connection conn = createConnection("client", "guest");
+            Connection conn = getConnection("client", "guest");
 
             Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
@@ -140,11 +134,11 @@
         }
     }
 
-    public void testClientConsumeFromNamedQueueInvalid() throws AMQException, URLSyntaxException
+    public void testClientConsumeFromNamedQueueInvalid() throws NamingException
     {
         try
         {
-            Connection conn = createConnection("client", "guest");
+            Connection conn = getConnection("client", "guest");
 
             //Prevent Failover
             ((AMQConnection) conn).setConnectionListener(this);
@@ -171,7 +165,7 @@
     {
         try
         {
-            Connection conn = createConnection("client", "guest");
+            Connection conn = getConnection("client", "guest");
 
             Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
@@ -189,11 +183,11 @@
         }
     }
 
-    public void testClientCreateNamedQueue() throws JMSException, URLSyntaxException, AMQException
+    public void testClientCreateNamedQueue() throws NamingException, JMSException, AMQException
     {
         try
         {
-            Connection conn = createConnection("client", "guest");
+            Connection conn = getConnection("client", "guest");
 
             Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
@@ -207,6 +201,7 @@
         }
         catch (AMQAuthenticationException amqe)
         {
+            amqe.printStackTrace();
             assertEquals("Incorrect error code thrown", 403, ((AMQAuthenticationException) amqe).getErrorCode().getCode());
         }
     }
@@ -215,7 +210,7 @@
     {
         try
         {
-            Connection conn = createConnection("client", "guest");
+            Connection conn = getConnection("client", "guest");
 
             ((AMQConnection) conn).setConnectionListener(this);
 
@@ -242,7 +237,7 @@
     {
         try
         {
-            Connection conn = createConnection("client", "guest");
+            Connection conn = getConnection("client", "guest");
 
             ((AMQConnection) conn).setConnectionListener(this);
 
@@ -268,11 +263,11 @@
         }
     }
 
-    public void testClientPublishInvalidQueueSuccess() throws AMQException, URLSyntaxException, JMSException
+    public void testClientPublishInvalidQueueSuccess() throws AMQException, URLSyntaxException, JMSException, NamingException
     {
         try
         {
-            Connection conn = createConnection("client", "guest");
+            Connection conn = getConnection("client", "guest");
 
             ((AMQConnection) conn).setConnectionListener(this);
 
@@ -317,7 +312,7 @@
     {
         try
         {
-            Connection conn = createConnection("server", "guest");
+            Connection conn = getConnection("server", "guest");
 
             Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
@@ -333,11 +328,11 @@
         }
     }
 
-    public void testServerConsumeFromNamedQueueInvalid() throws AMQException, URLSyntaxException
+    public void testServerConsumeFromNamedQueueInvalid() throws AMQException, URLSyntaxException, NamingException
     {
         try
-        {                                                      
-            Connection conn = createConnection("client", "guest");
+        {
+            Connection conn = getConnection("client", "guest");
 
             Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
@@ -358,11 +353,11 @@
         }
     }
 
-    public void testServerConsumeFromTemporaryQueue() throws AMQException, URLSyntaxException
+    public void testServerConsumeFromTemporaryQueue() throws AMQException, URLSyntaxException, NamingException
     {
         try
         {
-            Connection conn = createConnection("server","guest");
+            Connection conn = getConnection("server", "guest");
 
             Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
@@ -382,30 +377,22 @@
         }
     }
 
-    private Connection createConnection(String username, String password) throws AMQException
+    @Override
+    public Connection getConnection(String username, String password) throws NamingException, JMSException
     {
-        AMQConnection connection = null;
-        try
-        {
-            connection = new AMQConnection(createConnectionString(username, password, BROKER));
-        }
-        catch (URLSyntaxException e)
-        {
-            // This should never happen as we generate the URLs.
-            fail(e.getMessage());
-        }
+        AMQConnection connection = (AMQConnection) super.getConnection(username, password);
 
         //Prevent Failover
         connection.setConnectionListener(this);
 
-        return (Connection)connection;
+        return (Connection) connection;
     }
 
     public void testServerCreateNamedQueueValid() throws JMSException, URLSyntaxException
     {
         try
         {
-            Connection conn = createConnection("server", "guest");
+            Connection conn = getConnection("server", "guest");
 
             Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
@@ -422,11 +409,11 @@
         }
     }
 
-    public void testServerCreateNamedQueueInvalid() throws JMSException, URLSyntaxException, AMQException
+    public void testServerCreateNamedQueueInvalid() throws JMSException, URLSyntaxException, AMQException, NamingException
     {
         try
         {
-            Connection conn = createConnection("server", "guest");
+            Connection conn = getConnection("server", "guest");
 
             Session sesh = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
@@ -444,18 +431,18 @@
         }
     }
 
-    public void testServerCreateTemporaryQueueInvalid() throws JMSException, URLSyntaxException, AMQException
+    public void testServerCreateTemporaryQueueInvalid() throws NamingException
     {
         try
         {
-            Connection conn = createConnection("server", "guest");
+            Connection conn = getConnection("server", "guest");
 
             Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
             conn.start();
 
             session.createTemporaryQueue();
-                    
+
             fail("Test failed as creation succeded.");
             //conn will be automatically closed
         }
@@ -469,19 +456,19 @@
         }
     }
 
-    public void testServerCreateAutoDeleteQueueInvalid() throws JMSException, URLSyntaxException, AMQException
+    public void testServerCreateAutoDeleteQueueInvalid() throws NamingException, JMSException, AMQException
     {
         Connection connection = null;
         try
         {
-            connection = createConnection("server", "guest");
+            connection = getConnection("server", "guest");
 
             Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
             connection.start();
 
             ((AMQSession) session).createQueue(new AMQShortString("again_ensure_auto_delete_queue_for_temporary"),
-                                            true, false, false);
+                                               true, false, false);
 
             fail("Test failed as creation succeded.");
             //connection will be automatically closed
@@ -489,7 +476,7 @@
         catch (AMQAuthenticationException amqe)
         {
             assertEquals("Incorrect error code thrown", 403, amqe.getErrorCode().getCode());
-        }       
+        }
     }
 
     /**
@@ -500,10 +487,10 @@
      * @throws URLSyntaxException
      * @throws JMSException
      */
-    public void testServerPublishUsingTransactionSuccess() throws AMQException, URLSyntaxException, JMSException
+    public void testServerPublishUsingTransactionSuccess() throws AMQException, URLSyntaxException, JMSException, NamingException
     {
         //Set up the Server
-        Connection serverConnection = createConnection("server", "guest");
+        Connection serverConnection = getConnection("server", "guest");
 
         ((AMQConnection) serverConnection).setConnectionListener(this);
 
@@ -516,7 +503,7 @@
         serverConnection.start();
 
         //Set up the consumer
-        Connection clientConnection = createConnection("client", "guest");
+        Connection clientConnection = getConnection("client", "guest");
 
         //Send a test mesage
         Session clientSession = clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -557,8 +544,6 @@
             //Send the message using a transaction as this will allow us to retrieve any errors that occur on the broker.
             serverSession.commit();
 
-
-
             //Ensure Response is received.
             Message clientResponseMsg = clientResponse.receive(2000);
             assertNotNull("Client did not receive response message,", clientResponseMsg);
@@ -582,11 +567,11 @@
         }
     }
 
-    public void testServerPublishInvalidQueueSuccess() throws AMQException, URLSyntaxException, JMSException
+    public void testServerPublishInvalidQueueSuccess() throws AMQException, URLSyntaxException, JMSException, NamingException
     {
         try
         {
-            Connection conn = createConnection("server", "guest");
+            Connection conn = getConnection("server", "guest");
 
             ((AMQConnection) conn).setConnectionListener(this);
 

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/SelectorTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/SelectorTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/SelectorTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/message/SelectorTest.java Mon Oct  5 12:51:57 2009
@@ -1,31 +1,300 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
 package org.apache.qpid.test.client.message;
 
+import java.util.concurrent.CountDownLatch;
+
 import javax.jms.Connection;
+import javax.jms.DeliveryMode;
 import javax.jms.Destination;
+import javax.jms.InvalidSelectorException;
+import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 
 import junit.framework.Assert;
 
-import org.apache.log4j.Logger;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.qpid.AMQException;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQDestination;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.client.BasicMessageProducer;
 import org.apache.qpid.test.utils.QpidTestCase;
+import org.apache.qpid.url.URLSyntaxException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-public class SelectorTest extends QpidTestCase
+public class SelectorTest extends QpidTestCase implements MessageListener
 {
-    private static final Logger _logger = Logger.getLogger(SelectorTest.class);
+    private static final Logger _logger = LoggerFactory.getLogger(SelectorTest.class);
+
+    private AMQConnection _connection;
+    private AMQDestination _destination;
+    private AMQSession _session;
+    private int count;
+    public String _connectionString = "vm://:1";
+    private static final String INVALID_SELECTOR = "Cost LIKE 5";
+    CountDownLatch _responseLatch = new CountDownLatch(1);
+
+    private static final String BAD_MATHS_SELECTOR = " 1 % 5";
+
+    private static final long RECIEVE_TIMEOUT = 1000;
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        BasicConfigurator.configure();
+        init((AMQConnection) getConnection("guest", "guest"));
+    }
+
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+        if (_session != null)
+        {
+            try
+            {
+                _session.close();
+            }
+            catch (JMSException e)
+            {
+                fail("Error cleaning up:" + e.getMessage());
+            }
+        }
+        if (_connection != null)
+        {
+            try
+            {
+                _connection.close();
+            }
+            catch (JMSException e)
+            {
+                fail("Error cleaning up:" + e.getMessage());
+            }
+        }
+    }
+
+    private void init(AMQConnection connection) throws JMSException
+    {
+        init(connection, new AMQQueue(connection, randomize("SessionStartTest"), true));
+    }
+
+    private void init(AMQConnection connection, AMQDestination destination) throws JMSException
+    {
+        _connection = connection;
+        _destination = destination;
+        connection.start();
+
+        String selector = null;
+        selector = "Cost = 2 AND \"property-with-hyphen\" = 'wibble'";
+        // selector = "JMSType = Special AND Cost = 2 AND AMQMessageID > 0 AND JMSDeliveryMode=" + DeliveryMode.NON_PERSISTENT;
+
+        _session = (AMQSession) connection.createSession(false, AMQSession.NO_ACKNOWLEDGE);
+        // _session.createConsumer(destination).setMessageListener(this);
+        _session.createConsumer(destination, selector).setMessageListener(this);
+    }
+
+    public void test() throws Exception
+    {
+        try
+        {
+            init((AMQConnection) getConnection("guest", "guest", randomize("Client")));
+
+            Message msg = _session.createTextMessage("Message");
+            msg.setJMSPriority(1);
+            msg.setIntProperty("Cost", 2);
+            msg.setStringProperty("property-with-hyphen", "wibble");
+            msg.setJMSType("Special");
+
+            _logger.info("Sending Message:" + msg);
+
+            ((BasicMessageProducer) _session.createProducer(_destination)).send(msg, DeliveryMode.NON_PERSISTENT);
+            _logger.info("Message sent, waiting for response...");
+
+            _responseLatch.await();
+
+            if (count > 0)
+            {
+                _logger.info("Got message");
+            }
+
+            if (count == 0)
+            {
+                fail("Did not get message!");
+                // throw new RuntimeException("Did not get message!");
+            }
+        }
+        catch (JMSException e)
+        {
+            _logger.debug("JMS:" + e.getClass().getSimpleName() + ":" + e.getMessage());
+            if (!(e instanceof InvalidSelectorException))
+            {
+                fail("Wrong exception:" + e.getMessage());
+            }
+            else
+            {
+                System.out.println("SUCCESS!!");
+            }
+        }
+        catch (InterruptedException e)
+        {
+            _logger.debug("IE :" + e.getClass().getSimpleName() + ":" + e.getMessage());
+        }
+        catch (URLSyntaxException e)
+        {
+            _logger.debug("URL:" + e.getClass().getSimpleName() + ":" + e.getMessage());
+            fail("Wrong exception");
+        }
+        catch (AMQException e)
+        {
+            _logger.debug("AMQ:" + e.getClass().getSimpleName() + ":" + e.getMessage());
+            fail("Wrong exception");
+        }
+
+        finally
+        {
+            if (_session != null)
+            {
+                _session.close();
+            }
+            if (_connection != null)
+            {
+                _connection.close();
+            }
+        }
+    }
+
+    public void testUnparsableSelectors() throws Exception
+    {
+        Connection connection = getConnection("guest", "guest", randomize("Client"));
+        _session = (AMQSession) connection.createSession(false, AMQSession.NO_ACKNOWLEDGE);
+        boolean caught = false;
 
+        //Try Creating a Browser
+        try
+        {
+            _session.createBrowser(_session.createQueue("Ping"), INVALID_SELECTOR);
+        }
+        catch (JMSException e)
+        {
+            _logger.debug("JMS:" + e.getClass().getSimpleName() + ":" + e.getMessage());
+            if (!(e instanceof InvalidSelectorException))
+            {
+                fail("Wrong exception:" + e.getMessage());
+            }
+            caught = true;
+        }
+        assertTrue("No exception thrown!", caught);
+        caught = false;
+
+        //Try Creating a Consumer
+        try
+        {
+            _session.createConsumer(_session.createQueue("Ping"), INVALID_SELECTOR);
+        }
+        catch (JMSException e)
+        {
+            _logger.debug("JMS:" + e.getClass().getSimpleName() + ":" + e.getMessage());
+            if (!(e instanceof InvalidSelectorException))
+            {
+                fail("Wrong exception:" + e.getMessage());
+            }
+            caught = true;
+        }
+        assertTrue("No exception thrown!", caught);
+        caught = false;
+
+        //Try Creating a Receiever
+        try
+        {
+            _session.createReceiver(_session.createQueue("Ping"), INVALID_SELECTOR);
+        }
+        catch (JMSException e)
+        {
+            _logger.debug("JMS:" + e.getClass().getSimpleName() + ":" + e.getMessage());
+            if (!(e instanceof InvalidSelectorException))
+            {
+                fail("Wrong exception:" + e.getMessage());
+            }
+            caught = true;
+        }
+        assertTrue("No exception thrown!", caught);
+        caught = false;
+
+        try
+        {
+            _session.createReceiver(_session.createQueue("Ping"), BAD_MATHS_SELECTOR);
+        }
+        catch (JMSException e)
+        {
+            _logger.debug("JMS:" + e.getClass().getSimpleName() + ":" + e.getMessage());
+            if (!(e instanceof InvalidSelectorException))
+            {
+                fail("Wrong exception:" + e.getMessage());
+            }
+            caught = true;
+        }
+        assertTrue("No exception thrown!", caught);
+        caught = false;
+        
+    }
+    
+    public void testRuntimeSelectorError() throws JMSException
+    {
+        MessageConsumer consumer = _session.createConsumer(_destination , "testproperty % 5 = 1");
+        MessageProducer producer = _session.createProducer(_destination);
+        Message sentMsg = _session.createTextMessage();
+        
+        sentMsg.setIntProperty("testproperty", 1); // 1 % 5
+        producer.send(sentMsg);
+        Message recvd = consumer.receive(RECIEVE_TIMEOUT);
+        assertNotNull(recvd);
+        
+        sentMsg.setStringProperty("testproperty", "hello"); // "hello" % 5 makes no sense
+        producer.send(sentMsg);
+        try
+        {
+            recvd = consumer.receive(RECIEVE_TIMEOUT);
+            assertNull(recvd);
+        }
+        catch (Exception e)
+        {
+            
+        }
+        assertTrue("Connection should be closed", _connection.isClosed());
+    }
+        
     public void testSelectorWithJMSMessageID() throws Exception
     {
         Connection conn = getConnection();
         conn.start();
         Session session = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
-
-        Destination dest = session.createQueue("SelectorQueue");
         
-        MessageProducer prod = session.createProducer(dest);
-        MessageConsumer consumer = session.createConsumer(dest,"JMSMessageID IS NOT NULL");
+        MessageProducer prod = session.createProducer(_destination);
+        MessageConsumer consumer = session.createConsumer(_destination,"JMSMessageID IS NOT NULL");
         
         for (int i=0; i<2; i++)
         {
@@ -54,7 +323,7 @@
         Message msg3 = consumer.receive(1000);        
         Assert.assertNull("Msg3 should be null", msg3);
         session.commit();
-        consumer = session.createConsumer(dest,"JMSMessageID IS NULL");
+        consumer = session.createConsumer(_destination,"JMSMessageID IS NULL");
         
         Message msg4 = consumer.receive(1000);
         Message msg5 = consumer.receive(1000);
@@ -62,4 +331,49 @@
         Assert.assertNotNull("Msg4 should not be null", msg4);
         Assert.assertNotNull("Msg5 should not be null", msg5);
     }
+
+    public void onMessage(Message message)
+    {
+        count++;
+        _logger.info("Got Message:" + message);
+        _responseLatch.countDown();
+    }
+
+    private static String randomize(String in)
+    {
+        return in + System.currentTimeMillis();
+    }
+
+    public static void main(String[] argv) throws Exception
+    {
+        SelectorTest test = new SelectorTest();
+        test._connectionString = (argv.length == 0) ? "localhost:3000" : argv[0];
+
+        try
+        {
+            while (true)
+            {
+                if (test._connectionString.contains("vm://:1"))
+                {
+                    test.setUp();
+                }
+                test.test();
+
+                if (test._connectionString.contains("vm://:1"))
+                {
+                    test.tearDown();
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            System.err.println(e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    public static junit.framework.Test suite()
+    {
+        return new junit.framework.TestSuite(SelectorTest.class);
+    }
 }

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java Mon Oct  5 12:51:57 2009
@@ -57,26 +57,13 @@
 
     public void setUp() throws Exception
     {
-        super.setUp();
-        stopBroker();
-        if (!_configFile.exists())
-        {
-            fail("Unable to test without config file:" + _configFile);
-        }
 
-        XMLConfiguration configuration = new XMLConfiguration(_configFile); 
-        configuration.setProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.class", "org.apache.qpid.server.store.SlowMessageStore");
-        configuration.setProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.delays.commitTran.post", POST_COMMIT_DELAY);
-        configuration.setProperty("management.enabled", "false");
+        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.class", "org.apache.qpid.server.store.SlowMessageStore");
+        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.delays.commitTran.post", String.valueOf(POST_COMMIT_DELAY));
+        setConfigurationProperty("management.enabled", "false");
 
         
-        File tmpFile = File.createTempFile("configFile", "test");
-        tmpFile.deleteOnExit();
-        configuration.save(tmpFile);
-        
-        _configFile = tmpFile;
-
-        startBroker(1);
+        super.setUp();
 
         //Set the syncWrite timeout to be just larger than the delay on the commitTran.
         setSystemProperty("amqj.default_syncwrite_timeout", String.valueOf(SYNC_WRITE_TIMEOUT));

Modified: qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java (original)
+++ qpid/branches/java-broker-0-10/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java Mon Oct  5 12:51:57 2009
@@ -479,7 +479,7 @@
         _publisher.send(_pubSession.createTextMessage(MESSAGE_TEXT));
         _pubSession.commit();
 
-        assertNotNull(_consumer.receive(100));
+        assertNotNull(_consumer.receive(1000));
 
         _publisher.send(_pubSession.createTextMessage(MESSAGE_TEXT));
 



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message