You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2013/02/28 17:14:57 UTC

svn commit: r1451244 [43/45] - in /qpid/branches/asyncstore: ./ bin/ cpp/ cpp/bindings/ cpp/bindings/qmf/ cpp/bindings/qmf/python/ cpp/bindings/qmf/ruby/ cpp/bindings/qmf2/ cpp/bindings/qmf2/examples/cpp/ cpp/bindings/qmf2/python/ cpp/bindings/qmf2/rub...

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/acl/ExternalACLTest.java Thu Feb 28 16:14:30 2013
@@ -319,8 +319,12 @@ public class ExternalACLTest extends Abs
 
     public void setUpRequestResponseSuccess() throws Exception
     {
-        writeACLFile("test", "GROUP messaging-users client server",
-                             "ACL ALLOW-LOG messaging-users ACCESS VIRTUALHOST",
+        // The group "messaging-users", referenced in the ACL below, is currently defined
+        // in broker/etc/groups-systests.
+        // We tolerate a dependency from this test to that file because its
+        // contents are expected to change rarely.
+
+        writeACLFile("test", "ACL ALLOW-LOG messaging-users ACCESS VIRTUALHOST",
                              "# Server side",
                              "ACL ALLOW-LOG server CREATE QUEUE name=\"example.RequestQueue\"" ,
                              "ACL ALLOW-LOG server BIND EXCHANGE",
@@ -389,14 +393,44 @@ public class ExternalACLTest extends Abs
         conn.start();
 
         // create kipper
-        Topic kipper = sess.createTopic("kipper");
-        TopicSubscriber subscriber = sess.createDurableSubscriber(kipper, "kipper");
+        String topicName = "kipper";
+        Topic topic = sess.createTopic(topicName);
+        TopicSubscriber subscriber = sess.createDurableSubscriber(topic, topicName);
 
         subscriber.close();
-        sess.unsubscribe("kipper");
+        sess.unsubscribe(topicName);
 
         //Do something to show connection is active.
         sess.rollback();
         conn.close();
     }
+
+    public void setUpFirewallAllow() throws Exception
+    {
+        writeACLFile("test", "ACL ALLOW client ACCESS VIRTUALHOST from_network=\"127.0.0.1\"");
+    }
+
+    public void testFirewallAllow() throws Exception
+    {
+        getConnection("test", "client", "guest");
+        // test pass because we successfully connected
+    }
+
+    public void setUpFirewallDeny() throws Exception
+    {
+        writeACLFile("test", "ACL DENY client ACCESS VIRTUALHOST from_network=\"127.0.0.1\"");
+    }
+
+    public void testFirewallDeny() throws Exception
+    {
+        try
+        {
+            getConnection("test", "client", "guest");
+            fail("We expected the connection to fail");
+        }
+        catch(JMSException e)
+        {
+            // pass
+        }
+    }
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java Thu Feb 28 16:14:30 2013
@@ -20,28 +20,44 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
+import static org.apache.qpid.test.utils.TestSSLConstants.KEYSTORE;
+import static org.apache.qpid.test.utils.TestSSLConstants.KEYSTORE_PASSWORD;
+import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE;
+import static org.apache.qpid.test.utils.TestSSLConstants.TRUSTSTORE_PASSWORD;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.jms.Connection;
 import javax.jms.JMSException;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.Transport;
+import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
 public class MultipleAuthenticationManagersTest extends QpidBrokerTestCase
 {
-    private static final String KEYSTORE = "test-profiles/test_resources/ssl/java_client_keystore.jks";
-    private static final String KEYSTORE_PASSWORD = "password";
-    private static final String TRUSTSTORE = "test-profiles/test_resources/ssl/java_client_truststore.jks";
-    private static final String TRUSTSTORE_PASSWORD = "password";
-
     @Override
     protected void setUp() throws Exception
     {
-        setConfigurationProperty("connector.ssl.enabled", "true");
-        setConfigurationProperty("connector.ssl.sslOnly", "false");
-        setConfigurationProperty("security.anonymous-auth-manager", "");
-        setConfigurationProperty("security.default-auth-manager", "PrincipalDatabaseAuthenticationManager");
-        setConfigurationProperty("security.port-mappings.port-mapping.port", String.valueOf(QpidBrokerTestCase.DEFAULT_SSL_PORT));
-        setConfigurationProperty("security.port-mappings.port-mapping.auth-manager", "AnonymousAuthenticationManager");
+        TestBrokerConfiguration config = getBrokerConfiguration();
+
+        Map<String, Object> externalAuthProviderAttributes = new HashMap<String, Object>();
+        externalAuthProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE);
+        externalAuthProviderAttributes.put(AuthenticationProvider.NAME, TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER);
+        config.addAuthenticationProviderConfiguration(externalAuthProviderAttributes);
+
+        Map<String, Object> sslPortAttributes = new HashMap<String, Object>();
+        sslPortAttributes.put(Port.TRANSPORTS, Collections.singleton(Transport.SSL));
+        sslPortAttributes.put(Port.PORT, DEFAULT_SSL_PORT);
+        sslPortAttributes.put(Port.NAME, TestBrokerConfiguration.ENTRY_NAME_SSL_PORT);
+        sslPortAttributes.put(Port.AUTHENTICATION_MANAGER, TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER);
+        config.addPortConfiguration(sslPortAttributes);
 
         // set the ssl system properties
         setSystemProperty("javax.net.ssl.keyStore", KEYSTORE);

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/stats/StatisticsReportingTest.java Thu Feb 28 16:14:30 2013
@@ -27,10 +27,13 @@ import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.exchange.ExchangeDefaults;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.util.LogMonitor;
 
 import java.util.List;
+import java.util.Map;
 
 import javax.jms.Connection;
 import javax.jms.Destination;
@@ -45,46 +48,55 @@ import javax.jms.TextMessage;
  */
 public class StatisticsReportingTest extends QpidBrokerTestCase
 {
+    private static final String VHOST_NAME1 = "vhost1";
+    private static final String VHOST_NAME2 = "vhost2";
+    private static final String VHOST_NAME3 = "vhost3";
+    private static long STATISTICS_REPORTING_PERIOD_IN_SECONDS = 10l;
+
     protected LogMonitor _monitor;
     protected static final String USER = "admin";
 
-    protected Connection _test, _dev, _local;
+    protected Connection _conToVhost1, _conToVhost2, _conToVhost3;
     protected String _queueName = "statistics";
     protected Destination _queue;
     protected String _brokerUrl;
+    private long _startTestTime;
 
     @Override
     public void setUp() throws Exception
     {
-        setConfigurationProperty("statistics.generation.broker", "true");
-        setConfigurationProperty("statistics.generation.virtualhosts", "true");
+        createTestVirtualHost(0, VHOST_NAME1);
+        createTestVirtualHost(0, VHOST_NAME2);
+        createTestVirtualHost(0, VHOST_NAME3);
 
         if (getName().equals("testEnabledStatisticsReporting"))
         {
-            setConfigurationProperty("statistics.reporting.period", "10");
+            TestBrokerConfiguration config = getBrokerConfiguration();
+            config.removeObjectConfiguration(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST);
+            config.setBrokerAttribute(Broker.STATISTICS_REPORTING_PERIOD, STATISTICS_REPORTING_PERIOD_IN_SECONDS);
         }
 
         _monitor = new LogMonitor(_outputFile);
+        _startTestTime = System.currentTimeMillis();
 
         super.setUp();
 
         _brokerUrl = getBroker().toString();
-        _test = new AMQConnection(_brokerUrl, USER, USER, "clientid", "test");
-        _dev = new AMQConnection(_brokerUrl, USER, USER, "clientid", "development");
-        _local = new AMQConnection(_brokerUrl, USER, USER, "clientid", "localhost");
-
-        _test.start();
-        _dev.start();
-        _local.start();
-
+        _conToVhost1 = new AMQConnection(_brokerUrl, USER, USER, "clientid", VHOST_NAME1);
+        _conToVhost2 = new AMQConnection(_brokerUrl, USER, USER, "clientid", VHOST_NAME2);
+        _conToVhost3 = new AMQConnection(_brokerUrl, USER, USER, "clientid", VHOST_NAME3);
+
+        _conToVhost1.start();
+        _conToVhost2.start();
+        _conToVhost3.start();
     }
 
     @Override
     public void tearDown() throws Exception
     {
-        _test.close();
-        _dev.close();
-        _local.close();
+        _conToVhost1.close();
+        _conToVhost2.close();
+        _conToVhost3.close();
 
         super.tearDown();
     }
@@ -94,21 +106,30 @@ public class StatisticsReportingTest ext
      */
     public void testEnabledStatisticsReporting() throws Exception
     {
-        sendUsing(_test, 10, 100);
-        sendUsing(_dev, 20, 100);
-        sendUsing(_local, 15, 100);
-
-        Thread.sleep(10 * 1000); // 15s
-
-        List<String> brokerStatsData = _monitor.findMatches("BRK-1008");
-        List<String> brokerStatsMessages = _monitor.findMatches("BRK-1009");
-        List<String> vhostStatsData = _monitor.findMatches("VHT-1003");
-        List<String> vhostStatsMessages = _monitor.findMatches("VHT-1004");
-
-        assertEquals("Incorrect number of broker data stats log messages", 2, brokerStatsData.size());
-        assertEquals("Incorrect number of broker message stats log messages", 2, brokerStatsMessages.size());
-        assertEquals("Incorrect number of virtualhost data stats log messages", 6, vhostStatsData.size());
-        assertEquals("Incorrect number of virtualhost message stats log messages", 6, vhostStatsMessages.size());
+        sendUsing(_conToVhost1, 10, 100);
+        sendUsing(_conToVhost2, 20, 100);
+        sendUsing(_conToVhost3, 15, 100);
+
+        Thread.sleep(STATISTICS_REPORTING_PERIOD_IN_SECONDS * 1000);
+
+        Map<String, List<String>> brokerStatsData = _monitor.findMatches("BRK-1008", "BRK-1009", "VHT-1003", "VHT-1004");
+        long endTestTime = System.currentTimeMillis();
+
+        int maxNumberOfReports = (int)((endTestTime - _startTestTime)/STATISTICS_REPORTING_PERIOD_IN_SECONDS);
+
+        int brk1008LinesNumber = brokerStatsData.get("BRK-1008").size();
+        int brk1009LinesNumber = brokerStatsData.get("BRK-1009").size();
+        int vht1003LinesNumber = brokerStatsData.get("VHT-1003").size();
+        int vht1004LinesNumber = brokerStatsData.get("VHT-1004").size();
+
+        assertTrue("Incorrect number of broker data stats log messages:" + brk1008LinesNumber, 2 <= brk1008LinesNumber
+                && brk1008LinesNumber <= maxNumberOfReports * 2);
+        assertTrue("Incorrect number of broker message stats log messages:" + brk1009LinesNumber, 2 <= brk1009LinesNumber
+                && brk1009LinesNumber <= maxNumberOfReports * 2);
+        assertTrue("Incorrect number of virtualhost data stats log messages:" + vht1003LinesNumber, 6 <= vht1003LinesNumber
+                && vht1003LinesNumber <= maxNumberOfReports * 6);
+        assertTrue("Incorrect number of virtualhost message stats log messages: " + vht1004LinesNumber, 6 <= vht1004LinesNumber
+                && vht1004LinesNumber <= maxNumberOfReports * 6);
     }
 
     /**
@@ -116,9 +137,9 @@ public class StatisticsReportingTest ext
      */
     public void testNotEnabledStatisticsReporting() throws Exception
     {
-        sendUsing(_test, 10, 100);
-        sendUsing(_dev, 20, 100);
-        sendUsing(_local, 15, 100);
+        sendUsing(_conToVhost1, 10, 100);
+        sendUsing(_conToVhost2, 20, 100);
+        sendUsing(_conToVhost3, 15, 100);
 
         Thread.sleep(10 * 1000); // 15s
 
@@ -135,7 +156,7 @@ public class StatisticsReportingTest ext
 
     private void sendUsing(Connection con, int number, int size) throws Exception
     {
-        Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Session session = con.createSession(true, Session.SESSION_TRANSACTED);
         createQueue(session);
         MessageProducer producer = session.createProducer(_queue);
         String content = new String(new byte[size]);
@@ -144,6 +165,8 @@ public class StatisticsReportingTest ext
         {
             producer.send(msg);
         }
+        session.commit();
+        session.close();
     }
 
     private void createQueue(Session session) throws AMQException, JMSException

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/store/SlowMessageStore.java Thu Feb 28 16:14:30 2013
@@ -27,8 +27,6 @@ import org.apache.qpid.AMQStoreException
 import org.apache.qpid.framing.FieldTable;
 import org.apache.qpid.server.binding.Binding;
 import org.apache.qpid.server.exchange.Exchange;
-import org.apache.qpid.server.federation.Bridge;
-import org.apache.qpid.server.federation.BrokerLink;
 import org.apache.qpid.server.message.EnqueableMessage;
 import org.apache.qpid.server.message.ServerMessage;
 import org.apache.qpid.server.queue.AMQQueue;
@@ -322,35 +320,6 @@ public class SlowMessageStore implements
         doPostDelay("updateQueue");
     }
 
-
-    public void createBrokerLink(final BrokerLink link) throws AMQStoreException
-    {
-        doPreDelay("createBrokerLink");
-        _durableConfigurationStore.createBrokerLink(link);
-        doPostDelay("createBrokerLink");
-    }
-
-    public void deleteBrokerLink(final BrokerLink link) throws AMQStoreException
-    {
-        doPreDelay("deleteBrokerLink");
-        _durableConfigurationStore.deleteBrokerLink(link);
-        doPostDelay("deleteBrokerLink");
-    }
-
-    public void createBridge(final Bridge bridge) throws AMQStoreException
-    {
-        doPreDelay("createBridge");
-        _durableConfigurationStore.createBridge(bridge);
-        doPostDelay("createBridge");
-    }
-
-    public void deleteBridge(final Bridge bridge) throws AMQStoreException
-    {
-        doPreDelay("deleteBridge");
-        _durableConfigurationStore.deleteBridge(bridge);
-        doPostDelay("deleteBridge");
-    }
-
     @Override
     public void activate() throws Exception
     {

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/server/store/StoreOverfullTest.java Thu Feb 28 16:14:30 2013
@@ -60,9 +60,9 @@ public class StoreOverfullTest extends Q
 
     public void setUp() throws Exception
     {
-        setConfigurationProperty("virtualhosts.virtualhost.test.store.class", QuotaMessageStore.class.getName());
-        setConfigurationProperty("virtualhosts.virtualhost.test.store.overfull-size", String.valueOf(OVERFULL_SIZE));
-        setConfigurationProperty("virtualhosts.virtualhost.test.store.underfull-size", String.valueOf(UNDERFULL_SIZE));
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.store.class", QuotaMessageStore.class.getName());
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.store.overfull-size", String.valueOf(OVERFULL_SIZE));
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.store.underfull-size", String.valueOf(UNDERFULL_SIZE));
 
         super.setUp();
 

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/RollbackOrderTest.java Thu Feb 28 16:14:30 2013
@@ -40,19 +40,19 @@ import java.util.concurrent.atomic.Atomi
  * Description:
  *
  * The problem that this test is exposing is that the dispatcher used to be capable
- * of holding on to a message when stopped. This ment that when the rollback was
+ * of holding on to a message when stopped. This meant that when the rollback was
  * called and the dispatcher stopped it may have hold of a message. So after all
  * the local queues(preDeliveryQueue, SynchronousQueue, PostDeliveryTagQueue)
  * have been cleared the client still had a single message, the one the
  * dispatcher was holding on to.
  *
  * As a result the TxRollback operation would run and then release the dispatcher.
- * Whilst the dispatcher would then proceed to reject the message it was holiding
+ * Whilst the dispatcher would then proceed to reject the message it was holding
  * the Broker would already have resent that message so the rejection would silently
  * fail.
  *
- * And the client would receieve that single message 'early', depending on the
- * number of messages already recevied when rollback was called.
+ * And the client would receive that single message 'early', depending on the
+ * number of messages already received when rollback was called.
  *
  *
  * Aims:
@@ -78,7 +78,7 @@ import java.util.concurrent.atomic.Atomi
  * as expected.
  *
  * We are testing a race condition here but we can check through the log file if
- * the race condition occured. However, performing that check will only validate
+ * the race condition occurred. However, performing that check will only validate
  * the problem exists and will not be suitable as part of a system test.
  *
  */
@@ -183,18 +183,8 @@ public class RollbackOrderTest extends Q
             }
         }
 
-//        _consumer.close();
         _connection.close();
         
         assertFalse("Exceptions thrown during test run, Check Std.err.", failed.get());
     }
-
-    @Override public void tearDown() throws Exception
-    {
-
-        drainQueue(_queue);
-
-        super.tearDown();
-    }
-
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java Thu Feb 28 16:14:30 2013
@@ -29,8 +29,6 @@ import org.apache.qpid.client.AMQDestina
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.AMQSession_0_10;
 import org.apache.qpid.client.message.QpidMessageProperties;
-import org.apache.qpid.client.messaging.address.Node.ExchangeNode;
-import org.apache.qpid.client.messaging.address.Node.QueueNode;
 import org.apache.qpid.jndi.PropertiesFileInitialContextFactory;
 import org.apache.qpid.messaging.Address;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
@@ -98,7 +96,7 @@ public class AddressBasedDestinationTest
         }
             
         assertFalse("Queue should not be created",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest, (QueueNode)dest.getSourceNode() ,true));
+                (AMQSession_0_10)jmsSession).isQueueExist(dest,false));
         
         
         // create always -------------------------------------------
@@ -107,10 +105,10 @@ public class AddressBasedDestinationTest
         cons = jmsSession.createConsumer(dest); 
         
         assertTrue("Queue not created as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));              
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, true));
         assertTrue("Queue not bound as expected",(
                 (AMQSession_0_10)jmsSession).isQueueBound("", 
-                    dest.getAddressName(),dest.getAddressName(), dest.getSourceNode().getDeclareArgs()));
+                    dest.getAddressName(),dest.getAddressName(), dest.getNode().getDeclareArgs()));
         
         // create receiver -----------------------------------------
         addr1 = "ADDR:testQueue2; { create: receiver }";
@@ -126,16 +124,16 @@ public class AddressBasedDestinationTest
         }
             
         assertFalse("Queue should not be created",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, false));
         
         
         cons = jmsSession.createConsumer(dest); 
         
         assertTrue("Queue not created as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));              
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, true));
         assertTrue("Queue not bound as expected",(
                 (AMQSession_0_10)jmsSession).isQueueBound("", 
-                    dest.getAddressName(),dest.getAddressName(), dest.getSourceNode().getDeclareArgs()));
+                    dest.getAddressName(),dest.getAddressName(), dest.getNode().getDeclareArgs()));
         
         // create never --------------------------------------------
         addr1 = "ADDR:testQueue3; { create: never }";
@@ -161,7 +159,7 @@ public class AddressBasedDestinationTest
         }
             
         assertFalse("Queue should not be created",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, false));
         
         // create sender ------------------------------------------
         addr1 = "ADDR:testQueue3; { create: sender }";
@@ -177,14 +175,14 @@ public class AddressBasedDestinationTest
                     "doesn't resolve to an exchange or a queue"));
         }
         assertFalse("Queue should not be created",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, false));
         
         prod = jmsSession.createProducer(dest);
         assertTrue("Queue not created as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));              
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, true));
         assertTrue("Queue not bound as expected",(
                 (AMQSession_0_10)jmsSession).isQueueBound("", 
-                    dest.getAddressName(),dest.getAddressName(), dest.getSourceNode().getDeclareArgs()));
+                    dest.getAddressName(),dest.getAddressName(), dest.getNode().getDeclareArgs()));
         
     }
  
@@ -221,7 +219,7 @@ public class AddressBasedDestinationTest
         // Even if the consumer is closed the queue and the bindings should be intact.
         
         assertTrue("Queue not created as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));              
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, true));
         
         assertTrue("Queue not bound as expected",(
                 (AMQSession_0_10)jmsSession).isQueueBound("", 
@@ -326,7 +324,7 @@ public class AddressBasedDestinationTest
         }
         
         assertTrue("Exchange not created as expected",(
-                (AMQSession_0_10)jmsSession).isExchangeExist(dest, (ExchangeNode)dest.getTargetNode() , true));
+                (AMQSession_0_10)jmsSession).isExchangeExist(dest,true));
        
         // The existence of the queue is implicitly tested here
         assertTrue("Queue not bound as expected",(
@@ -367,7 +365,7 @@ public class AddressBasedDestinationTest
     public void checkQueueForBindings(Session jmsSession, AMQDestination dest,String headersBinding) throws Exception
     {
     	assertTrue("Queue not created as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));              
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, true));
         
         assertTrue("Queue not bound as expected",(
                 (AMQSession_0_10)jmsSession).isQueueBound("", 
@@ -506,14 +504,14 @@ public class AddressBasedDestinationTest
         MessageConsumer cons3 = jmsSession.createConsumer(dest3);
         
         assertTrue("Destination1 was not created as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest1,(QueueNode)dest1.getSourceNode(), true));              
+                (AMQSession_0_10)jmsSession).isQueueExist(dest1, true));
         
         assertTrue("Destination1 was not bound as expected",(
                 (AMQSession_0_10)jmsSession).isQueueBound("", 
                     dest1.getAddressName(),dest1.getAddressName(), null));
         
         assertTrue("Destination2 was not created as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest2,(QueueNode)dest2.getSourceNode(), true));              
+                (AMQSession_0_10)jmsSession).isQueueExist(dest2,true));
         
         assertTrue("Destination2 was not bound as expected",(
                 (AMQSession_0_10)jmsSession).isQueueBound("", 
@@ -602,14 +600,14 @@ public class AddressBasedDestinationTest
         cons.close();
         
         // Using the ADDR method to create a more complicated queue
-        String addr = "ADDR:amq.direct/x512; {create: receiver, " +
+        String addr = "ADDR:amq.direct/x512; {" +
         "link : {name : 'MY.RESP.QUEUE', " + 
         "x-declare : { auto-delete: true, exclusive: true, " +
                      "arguments : {'qpid.max_size': 1000, 'qpid.policy_type': ring} } } }";
         queue = ssn.createQueue(addr);
         
-        prod = ssn.createProducer(queue); 
         cons = ssn.createConsumer(queue);
+        prod = ssn.createProducer(queue);
         assertTrue("MY.RESP.QUEUE was not created as expected",(
                 (AMQSession_0_10)ssn).isQueueBound("amq.direct", 
                     "MY.RESP.QUEUE","x512", null));
@@ -677,8 +675,8 @@ public class AddressBasedDestinationTest
         
         // Using the ADDR method to create a more complicated topic
         topic = ssn.createTopic(addr);
-        prod = ssn.createProducer(topic); 
         cons = ssn.createConsumer(topic);
+        prod = ssn.createProducer(topic);
         
         assertTrue("The queue was not bound to vehicle exchange using bus as the binding key",(
                 (AMQSession_0_10)ssn).isQueueBound("vehicles", 
@@ -778,7 +776,7 @@ public class AddressBasedDestinationTest
     public void testSubscriptionForSameDestination() throws Exception
     {
         Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);        
-        Destination dest = ssn.createTopic("ADDR:amq.topic/foo; {link:{durable:true}}");
+        Destination dest = ssn.createTopic("ADDR:amq.topic/foo");
         MessageConsumer consumer1 = ssn.createConsumer(dest);
         MessageConsumer consumer2 = ssn.createConsumer(dest);
         MessageProducer prod = ssn.createProducer(dest);
@@ -840,7 +838,8 @@ public class AddressBasedDestinationTest
         		"}";
         
         // Using the ADDR method to create a more complicated topic
-        MessageConsumer  cons = ssn.createConsumer(new AMQAnyDestination(addr));
+        Topic topic = ssn.createTopic(addr);
+        MessageConsumer  cons = ssn.createConsumer(topic);
         
         assertTrue("The queue was not bound to MRKT exchange using NYSE.# as the binding key",(
                 (AMQSession_0_10)ssn).isQueueBound("MRKT", 
@@ -854,7 +853,7 @@ public class AddressBasedDestinationTest
                 (AMQSession_0_10)ssn).isQueueBound("MRKT", 
                     "my-topic","CNTL.#", null));
         
-        MessageProducer prod = ssn.createProducer(ssn.createTopic(addr));
+        MessageProducer prod = ssn.createProducer(topic);
         Message msg = ssn.createTextMessage("test");
         msg.setStringProperty("qpid.subject", "NASDAQ.ABCD");
         prod.send(msg);
@@ -909,32 +908,31 @@ public class AddressBasedDestinationTest
     {
         Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);        
         
+        String bindingStr = "x-bindings:[{key:'NYSE.#'},{key:'NASDAQ.#'},{key:'CNTL.#'}]}}";
+
         Properties props = new Properties();
         props.setProperty("java.naming.factory.initial", "org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
-        props.setProperty("destination.address1", "ADDR:amq.topic");
-        props.setProperty("destination.address2", "ADDR:amq.direct/test");                
-        String addrStr = "ADDR:amq.topic/test; {link:{name: my-topic," +
-                  "x-bindings:[{key:'NYSE.#'},{key:'NASDAQ.#'},{key:'CNTL.#'}]}}";
-        props.setProperty("destination.address3", addrStr);
-        props.setProperty("topic.address4", "hello.world");
-        addrStr = "ADDR:my_queue; {create:always,link: {x-subscribes:{exclusive: true, arguments: {a:b,x:y}}}}";
+        props.setProperty("destination.address1", "ADDR:amq.topic/test");
+        props.setProperty("destination.address2", "ADDR:amq.topic/test; {node:{" + bindingStr);
+        props.setProperty("destination.address3", "ADDR:amq.topic/test; {link:{" + bindingStr);
+        String addrStr = "ADDR:my_queue; {create:always,link: {x-subscribes:{exclusive: true, arguments: {a:b,x:y}}}}";
         props.setProperty("destination.address5", addrStr); 
         
         Context ctx = new InitialContext(props);       
 
-        for (int i=1; i < 5; i++)
+        for (int i=1; i < 4; i++)
         {
             Topic topic = (Topic) ctx.lookup("address"+i);
-            createDurableSubscriber(ctx,ssn,"address"+i,topic);
+            createDurableSubscriber(ctx,ssn,"address"+i,topic,"ADDR:amq.topic/test");
         }
         
         Topic topic = ssn.createTopic("ADDR:news.us");
-        createDurableSubscriber(ctx,ssn,"my-dest",topic);
+        createDurableSubscriber(ctx,ssn,"my-dest",topic,"ADDR:news.us");
         
         Topic namedQueue = (Topic) ctx.lookup("address5");
         try
         {
-            createDurableSubscriber(ctx,ssn,"my-queue",namedQueue);
+            createDurableSubscriber(ctx,ssn,"my-queue",namedQueue,"ADDR:amq.topic/test");
             fail("Exception should be thrown. Durable subscribers cannot be created for Queues");
         }
         catch(JMSException e)
@@ -943,16 +941,74 @@ public class AddressBasedDestinationTest
                     e.getMessage());
         }
     }
-    
-    private void createDurableSubscriber(Context ctx,Session ssn,String destName,Topic topic) throws Exception
+
+    public void testDurableSubscription() throws Exception
+    {
+        Session session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Topic topic = session.createTopic("ADDR:amq.topic/" + getTestQueueName());
+        MessageProducer publisher = session.createProducer(topic);
+        MessageConsumer subscriber = session.createDurableSubscriber(topic, getTestQueueName());
+
+        TextMessage messageToSend = session.createTextMessage("Test0");
+        publisher.send(messageToSend);
+        ((AMQSession<?,?>)session).sync();
+
+        Message receivedMessage = subscriber.receive(1000);
+        assertNotNull("Message has not been received", receivedMessage);
+        assertEquals("Unexpected message", messageToSend.getText(), ((TextMessage)receivedMessage).getText());
+
+        subscriber.close();
+
+        messageToSend = session.createTextMessage("Test1");
+        publisher.send(messageToSend);
+        ((AMQSession<?,?>)session).sync();
+
+        subscriber = session.createDurableSubscriber(topic, getTestQueueName());
+        receivedMessage = subscriber.receive(1000);
+        assertNotNull("Message has not been received", receivedMessage);
+        assertEquals("Unexpected message", messageToSend.getText(), ((TextMessage)receivedMessage).getText());
+    }
+
+    public void testDurableSubscriptionnWithSelector() throws Exception
+    {
+        Session session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Topic topic = session.createTopic("ADDR:amq.topic/" + getTestQueueName());
+        MessageProducer publisher = session.createProducer(topic);
+        MessageConsumer subscriber = session.createDurableSubscriber(topic, getTestQueueName(), "id=1", false);
+
+        TextMessage messageToSend = session.createTextMessage("Test0");
+        messageToSend.setIntProperty("id", 1);
+        publisher.send(messageToSend);
+        ((AMQSession<?,?>)session).sync();
+
+        Message receivedMessage = subscriber.receive(1000);
+        assertNotNull("Message has not been received", receivedMessage);
+        assertEquals("Unexpected message", messageToSend.getText(), ((TextMessage)receivedMessage).getText());
+        assertEquals("Unexpected id", 1, receivedMessage.getIntProperty("id"));
+
+        subscriber.close();
+
+        messageToSend = session.createTextMessage("Test1");
+        messageToSend.setIntProperty("id", 1);
+        publisher.send(messageToSend);
+        ((AMQSession<?,?>)session).sync();
+
+        subscriber = session.createDurableSubscriber(topic, getTestQueueName(), "id=1", false);
+        receivedMessage = subscriber.receive(1000);
+        assertNotNull("Message has not been received", receivedMessage);
+        assertEquals("Unexpected message", messageToSend.getText(), ((TextMessage)receivedMessage).getText());
+        assertEquals("Unexpected id", 1, receivedMessage.getIntProperty("id"));
+    }
+
+    private void createDurableSubscriber(Context ctx,Session ssn,String destName,Topic topic, String producerAddr) throws Exception
     {        
         MessageConsumer cons = ssn.createDurableSubscriber(topic, destName);
-        MessageProducer prod = ssn.createProducer(topic);
+        MessageProducer prod = ssn.createProducer(ssn.createTopic(producerAddr));
         
         Message m = ssn.createTextMessage(destName);
         prod.send(m);
         Message msg = cons.receive(1000);
-        assertNotNull(msg);
+        assertNotNull("Message not received as expected when using Topic : " + topic,msg);
         assertEquals(destName,((TextMessage)msg).getText());
         ssn.unsubscribe(destName);
     }
@@ -977,7 +1033,7 @@ public class AddressBasedDestinationTest
         }
         
         assertFalse("Queue not deleted as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));  
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, false));
         
         
         String addr2 = "ADDR:testQueue2;{create: always, delete: receiver}";
@@ -993,7 +1049,7 @@ public class AddressBasedDestinationTest
         }
         
         assertFalse("Queue not deleted as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));  
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, false));
 
         
         String addr3 = "ADDR:testQueue3;{create: always, delete: sender}";
@@ -1010,9 +1066,7 @@ public class AddressBasedDestinationTest
         }
         
         assertFalse("Queue not deleted as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));  
-
-        
+                (AMQSession_0_10)jmsSession).isQueueExist(dest, false));
     }
     
     /**
@@ -1094,7 +1148,7 @@ public class AddressBasedDestinationTest
         MessageConsumer cons = ssn.createConsumer(ssn.createTopic("ADDR:amq.topic/test"));
         MessageProducer prod = ssn.createProducer(null);
         
-        Queue queue = ssn.createQueue("ADDR:amq.topic/test");
+        Topic queue = ssn.createTopic("ADDR:amq.topic/test");
         prod.send(queue,ssn.createTextMessage("A"));
         
         Message msg = cons.receive(1000);
@@ -1307,4 +1361,62 @@ public class AddressBasedDestinationTest
         assertNotNull("message should be re-received by consumer after rollback", receivedMessage);
         jmsSession.commit();
     }
+
+    /**
+     * Test Goals :
+     *
+     * 1. Verify that link bindings are created and destroyed after creating and closing a subscriber.
+     * 2. Verify that link bindings are created and destroyed after creating and closing a subscriber.
+     */
+    public void testLinkBindingBehavior() throws Exception
+    {
+        Session jmsSession = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
+        String addr = "ADDR:my-queue; {create: always, " +
+              "link: " +
+              "{" +
+                   "x-bindings: [{exchange : 'amq.direct', key : test}]," +
+              "}" +
+        "}";
+
+        AMQDestination dest = (AMQDestination)jmsSession.createQueue(addr);
+        MessageConsumer cons = jmsSession.createConsumer(dest);
+        AMQSession_0_10 ssn = (AMQSession_0_10)jmsSession;
+
+        assertTrue("Queue not created as expected",ssn.isQueueExist(dest, true));
+        assertTrue("Queue not bound as expected",ssn.isQueueBound("amq.direct","my-queue","test", null));
+
+        cons.close(); // closing consumer, link binding should be removed now.
+        assertTrue("Queue should still be there",ssn.isQueueExist(dest, true));
+        assertFalse("Binding should not exist anymore",ssn.isQueueBound("amq.direct","my-queue","test", null));
+
+        MessageProducer prod = jmsSession.createProducer(dest);
+        assertTrue("Queue not bound as expected",ssn.isQueueBound("amq.direct","my-queue","test", null));
+        prod.close();
+        assertFalse("Binding should not exist anymore",ssn.isQueueBound("amq.direct","my-queue","test", null));
+    }
+
+    /**
+     * Test Goals : Verifies that the subscription queue created is as specified under link properties.
+     */
+    public void testCustomizingSubscriptionQueue() throws Exception
+    {
+        Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
+        String xDeclareArgs = "x-declare: { exclusive: false, auto-delete: false," +
+                                           "alternate-exchange: 'amq.fanout'," +
+                                           "arguments: {'qpid.max_size': 1000,'qpid.max_count': 100}" +
+                                          "}";
+
+        String addr = "ADDR:amq.topic/test; {link: {name:my-queue, durable:true," + xDeclareArgs + "}}";
+        Destination dest = ssn.createTopic(addr);
+        MessageConsumer cons = ssn.createConsumer(dest);
+
+        String verifyAddr = "ADDR:my-queue;{ node: {durable:true, " + xDeclareArgs + "}}";
+        AMQDestination verifyDest = (AMQDestination)ssn.createQueue(verifyAddr);
+        ((AMQSession_0_10)ssn).isQueueExist(verifyDest, true);
+
+        // Verify that the producer does not delete the subscription queue.
+        MessageProducer prod = ssn.createProducer(dest);
+        prod.close();
+        ((AMQSession_0_10)ssn).isQueueExist(verifyDest, true);
+    }
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java Thu Feb 28 16:14:30 2013
@@ -24,6 +24,7 @@ package org.apache.qpid.test.client.fail
 import org.apache.log4j.Logger;
 
 import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.jms.ConnectionListener;
 import org.apache.qpid.test.utils.FailoverBaseCase;
 
@@ -35,7 +36,6 @@ import javax.jms.MessageProducer;
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.TextMessage;
-import javax.naming.NamingException;
 import java.util.Random;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -75,7 +75,7 @@ public class FailoverTest extends Failov
         failoverComplete = new CountDownLatch(1);
     }
 
-    protected void init(boolean transacted, int mode) throws JMSException, NamingException
+    private void init(boolean transacted, int mode) throws Exception
     {
         consumerSession = connection.createSession(transacted, mode);
         queue = consumerSession.createQueue(getName()+System.currentTimeMillis());
@@ -125,7 +125,7 @@ public class FailoverTest extends Failov
         }
     }
 
-    private void sendMessages(int startIndex,int endIndex, boolean transacted) throws JMSException
+    private void sendMessages(int startIndex,int endIndex, boolean transacted) throws Exception
     {
         _logger.debug("**************** Send (Start: " + startIndex + ", End:" + endIndex + ")***********************");
         
@@ -144,6 +144,10 @@ public class FailoverTest extends Failov
         {
             producerSession.commit();
         }
+        else
+        {
+            ((AMQSession<?, ?>)producerSession).sync();
+        }
     }
 
     public void testP2PFailover() throws Exception
@@ -163,13 +167,13 @@ public class FailoverTest extends Failov
     {
         if (CLUSTERED)
         {    
-            testP2PFailover(numMessages, false,true, false);
+            testP2PFailover(numMessages, false, true, false);
         }
     }    
      
     public void testP2PFailoverTransacted() throws Exception
     {
-        testP2PFailover(numMessages, true,true, false);
+        testP2PFailover(numMessages, true,true, true);
     }
 
     public void testP2PFailoverTransactedWithMessagesLeftToConsumeAndProduce() throws Exception
@@ -177,17 +181,16 @@ public class FailoverTest extends Failov
         // Currently the cluster does not support transactions that span a failover
         if (CLUSTERED)
         {
-            testP2PFailover(numMessages, false,false, false);
+            testP2PFailover(numMessages, false, false, false);
         }
     }
-
-    private void testP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws JMSException, NamingException
+    private void testP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws Exception
     {        
         init(transacted, Session.AUTO_ACKNOWLEDGE);
         runP2PFailover(totalMessages,consumeAll, produceAll , transacted);
     } 
-    
-    protected void runP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws JMSException, NamingException
+
+    private void runP2PFailover(int totalMessages, boolean consumeAll, boolean produceAll , boolean transacted) throws Exception
     {
         int toProduce = totalMessages;
         
@@ -254,7 +257,7 @@ public class FailoverTest extends Failov
             //evil ignore IE.
         }
     }
-   
+
     public void testClientAckFailover() throws Exception
     {
         init(false, Session.CLIENT_ACKNOWLEDGE);

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/message/JMSDestinationTest.java Thu Feb 28 16:14:30 2013
@@ -63,8 +63,7 @@ public class JMSDestinationTest extends 
 
     public void setUp() throws Exception
     {
-        //Ensure JMX management is enabled for MovedToQueue test 
-        setConfigurationProperty("management.enabled", "true");
+        getBrokerConfiguration().addJmxManagementConfiguration();
 
         super.setUp();
 

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java Thu Feb 28 16:14:30 2013
@@ -54,11 +54,9 @@ public class SyncWaitDelayTest extends Q
     public void setUp() throws Exception
     {
 
-        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");
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.class", "org.apache.qpid.server.store.SlowMessageStore");
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.delays.commitTran.post", String.valueOf(POST_COMMIT_DELAY));
 
-        
         super.setUp();
 
         //Set the syncWrite timeout to be just larger than the delay on the commitTran.

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/basic/InvalidDestinationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/basic/InvalidDestinationTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/basic/InvalidDestinationTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/basic/InvalidDestinationTest.java Thu Feb 28 16:14:30 2013
@@ -21,16 +21,23 @@
 
 package org.apache.qpid.test.unit.basic;
 
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
+import java.util.Collections;
+import java.util.Map;
+import javax.jms.Connection;
 import javax.jms.InvalidDestinationException;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
 import javax.jms.Queue;
 import javax.jms.QueueSender;
 import javax.jms.QueueSession;
 import javax.jms.Session;
 import javax.jms.TextMessage;
+import javax.jms.Topic;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.configuration.ClientProperties;
+import org.apache.qpid.jms.ConnectionURL;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
 
 public class InvalidDestinationTest extends QpidBrokerTestCase
 {
@@ -48,21 +55,23 @@ public class InvalidDestinationTest exte
         super.tearDown();
     }
 
-
-
     public void testInvalidDestination() throws Exception
     {
-        Queue invalidDestination = new AMQQueue("amq.direct","unknownQ");
-        AMQQueue validDestination = new AMQQueue("amq.direct","knownQ");
         QueueSession queueSession = _connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
 
+        Queue invalidDestination = queueSession.createQueue("unknownQ");
+
+        Queue validDestination = queueSession.createQueue(getTestQueueName());
+
         // This is the only easy way to create and bind a queue from the API :-(
         queueSession.createConsumer(validDestination);
+        QueueSender sender;
+        TextMessage msg= queueSession.createTextMessage("Hello");
 
-        QueueSender sender = queueSession.createSender(invalidDestination);
-        TextMessage msg = queueSession.createTextMessage("Hello");
         try
         {
+            sender = queueSession.createSender(invalidDestination);
+
             sender.send(msg);
             fail("Expected InvalidDestinationException");
         }
@@ -70,10 +79,8 @@ public class InvalidDestinationTest exte
         {
             // pass
         }
-        sender.close();
 
         sender = queueSession.createSender(null);
-        invalidDestination = new AMQQueue("amq.direct","unknownQ");
 
         try
         {
@@ -86,19 +93,79 @@ public class InvalidDestinationTest exte
         }
         sender.send(validDestination,msg);
         sender.close();
-        validDestination = new AMQQueue("amq.direct","knownQ");
         sender = queueSession.createSender(validDestination);
         sender.send(msg);
+    }
 
+    /**
+     * Tests that specifying the {@value ClientProperties#VERIFY_QUEUE_ON_SEND} system property
+     * results in an exception when sending to an invalid queue destination.
+     */
+    public void testInvalidDestinationOnMessageProducer() throws Exception
+    {
+        setTestSystemProperty(ClientProperties.VERIFY_QUEUE_ON_SEND, "true");
+        final AMQConnection connection = (AMQConnection) getConnection();
+        doInvalidDestinationOnMessageProducer(connection);
+    }
 
+    /**
+     * Tests that specifying the {@value ConnectionURL.OPTIONS_VERIFY_QUEUE_ON_SEND}
+     * connection URL option property results in an exception when sending to an
+     * invalid queue destination.
+     */
+    public void testInvalidDestinationOnMessageProducerURL() throws Exception
+    {
+        Map<String, String> options = Collections.singletonMap(ConnectionURL.OPTIONS_VERIFY_QUEUE_ON_SEND, "true");
+        doInvalidDestinationOnMessageProducer(getConnectionWithOptions(options));
+    }
 
+    private void doInvalidDestinationOnMessageProducer(Connection connection) throws JMSException
+    {
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
-    }
+        String invalidQueueName = getTestQueueName() + "UnknownQ";
+        Queue invalidDestination = session.createQueue(invalidQueueName);
 
+        String validQueueName = getTestQueueName() + "KnownQ";
+        Queue validDestination = session.createQueue(validQueueName);
 
-    public static junit.framework.Test suite()
-    {
+        // This is the only easy way to create and bind a queue from the API :-(
+        session.createConsumer(validDestination);
+
+        MessageProducer sender;
+        TextMessage msg = session.createTextMessage("Hello");
+        try
+        {
+            sender = session.createProducer(invalidDestination);
+            sender.send(msg);
+            fail("Expected InvalidDestinationException");
+        }
+        catch (InvalidDestinationException ex)
+        {
+            // pass
+        }
 
-        return new junit.framework.TestSuite(InvalidDestinationTest.class);
+        sender = session.createProducer(null);
+        invalidDestination = new AMQQueue("amq.direct",invalidQueueName);
+
+        try
+        {
+            sender.send(invalidDestination,msg);
+            fail("Expected InvalidDestinationException");
+        }
+        catch (InvalidDestinationException ex)
+        {
+            // pass
+        }
+        sender.send(validDestination, msg);
+        sender.close();
+        sender = session.createProducer(validDestination);
+        sender.send(msg);
+
+        //Verify sending to an 'invalid' Topic doesn't throw an exception
+        String invalidTopic = getTestQueueName() + "UnknownT";
+        Topic topic = session.createTopic(invalidTopic);
+        sender = session.createProducer(topic);
+        sender.send(msg);
     }
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java Thu Feb 28 16:14:30 2013
@@ -20,26 +20,59 @@
  */
 package org.apache.qpid.test.unit.client;
 
+import java.io.IOException;
+
 import org.apache.qpid.AMQException;
+import org.apache.qpid.configuration.ClientProperties;
+import org.apache.qpid.management.common.mbeans.ManagedExchange;
 import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.test.utils.JMXTestUtils;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.url.BindingURL;
 
 import javax.jms.Connection;
 import javax.jms.JMSException;
 import javax.jms.Queue;
 import javax.jms.Session;
 
-/**
- * QPID-155
- *
- * Test to validate that setting the respective qpid.declare_queues,
- * qpid.declare_exchanges system properties functions as expected.
- */
 public class DynamicQueueExchangeCreateTest extends QpidBrokerTestCase
 {
-    public void testQueueDeclare() throws Exception
+    private JMXTestUtils _jmxUtils;
+
+    @Override
+    public void setUp() throws Exception
+    {
+        _jmxUtils = new JMXTestUtils(this);
+        _jmxUtils.setUp();
+
+        super.setUp();
+        _jmxUtils.open();
+    }
+
+    @Override
+    public void tearDown() throws Exception
+    {
+        try
+        {
+            if (_jmxUtils != null)
+            {
+                _jmxUtils.close();
+            }
+        }
+        finally
+        {
+            super.tearDown();
+        }
+    }
+
+    /*
+     * Tests to validate that setting the respective qpid.declare_queues,
+     * qpid.declare_exchanges system properties functions as expected.
+     */
+
+    public void testQueueNotDeclaredDuringConsumerCreation() throws Exception
     {
-        setSystemProperty("qpid.declare_queues", "false");
+        setSystemProperty(ClientProperties.QPID_DECLARE_QUEUES_PROP_NAME, "false");
 
         Connection connection = getConnection();
 
@@ -58,16 +91,16 @@ public class DynamicQueueExchangeCreateT
         }
     }
 
-    public void testExchangeDeclare() throws Exception
+    public void testExchangeNotDeclaredDuringConsumerCreation() throws Exception
     {
-        setSystemProperty("qpid.declare_exchanges", "false");
+        setSystemProperty(ClientProperties.QPID_DECLARE_EXCHANGES_PROP_NAME, "false");
 
         Connection connection = getConnection();
 
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
-        String EXCHANGE_TYPE = "test.direct";
-        Queue queue = session.createQueue("direct://" + EXCHANGE_TYPE + "/queue/queue");
+        String exchangeName = getTestQueueName();
+        Queue queue = session.createQueue("direct://" + exchangeName + "/queue/queue");
 
         try
         {
@@ -78,6 +111,50 @@ public class DynamicQueueExchangeCreateT
         {
             checkExceptionErrorCode(e, AMQConstant.NOT_FOUND);
         }
+
+        //verify the exchange was not declared
+        String exchangeObjectName = _jmxUtils.getExchangeObjectName("test", exchangeName);
+        assertFalse("exchange should not exist", _jmxUtils.doesManagedObjectExist(exchangeObjectName));
+    }
+
+    /**
+     * Checks that setting {@value ClientProperties#QPID_DECLARE_EXCHANGES_PROP_NAME} false results in
+     * disabling implicit ExchangeDeclares during producer creation when using a {@link BindingURL}
+     */
+    public void testExchangeNotDeclaredDuringProducerCreation() throws Exception
+    {
+        Connection connection = getConnection();
+        Session session1 = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        String exchangeName1 = getTestQueueName() + "1";
+
+
+        Queue queue = session1.createQueue("direct://" + exchangeName1 + "/queue/queue");
+        session1.createProducer(queue);
+
+        //close the session to ensure any previous commands were fully processed by
+        //the broker before observing their effect
+        session1.close();
+
+        //verify the exchange was declared
+        String exchangeObjectName = _jmxUtils.getExchangeObjectName("test", exchangeName1);
+        assertTrue("exchange should exist", _jmxUtils.doesManagedObjectExist(exchangeObjectName));
+
+        //Now disable the implicit exchange declares and try again
+        setSystemProperty(ClientProperties.QPID_DECLARE_EXCHANGES_PROP_NAME, "false");
+
+        Session session2 = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        String exchangeName2 = getTestQueueName() + "2";
+
+        Queue queue2 = session2.createQueue("direct://" + exchangeName2 + "/queue/queue");
+        session2.createProducer(queue2);
+
+        //close the session to ensure any previous commands were fully processed by
+        //the broker before observing their effect
+        session2.close();
+
+        //verify the exchange was not declared
+        String exchangeObjectName2 = _jmxUtils.getExchangeObjectName("test", exchangeName2);
+        assertFalse("exchange should not exist", _jmxUtils.doesManagedObjectExist(exchangeObjectName2));
     }
 
     private void checkExceptionErrorCode(JMSException original, AMQConstant code)
@@ -87,4 +164,71 @@ public class DynamicQueueExchangeCreateT
         assertTrue("Linked exception should be an AMQException", linked instanceof AMQException);
         assertEquals("Error code should be " + code.getCode(), code, ((AMQException) linked).getErrorCode());
     }
+
+    /*
+     * Tests to validate that the custom exchanges declared by the client during
+     * consumer and producer creation have the expected properties.
+     */
+
+    public void testPropertiesOfCustomExchangeDeclaredDuringProducerCreation() throws Exception
+    {
+        implTestPropertiesOfCustomExchange(true, false);
+    }
+
+    public void testPropertiesOfCustomExchangeDeclaredDuringConsumerCreation() throws Exception
+    {
+        implTestPropertiesOfCustomExchange(false, true);
+    }
+
+    private void implTestPropertiesOfCustomExchange(boolean createProducer, boolean createConsumer) throws Exception
+    {
+        Connection connection = getConnection();
+
+        Session session1 = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        String exchangeName1 = getTestQueueName() + "1";
+        String queueName1 = getTestQueueName() + "1";
+
+        Queue queue = session1.createQueue("direct://" + exchangeName1 + "/" + queueName1 + "/" + queueName1 + "?" + BindingURL.OPTION_EXCHANGE_AUTODELETE + "='true'");
+        if(createProducer)
+        {
+            session1.createProducer(queue);
+        }
+
+        if(createConsumer)
+        {
+            session1.createConsumer(queue);
+        }
+        session1.close();
+
+        //verify the exchange was declared to expectation
+        verifyDeclaredExchange(exchangeName1, true, false);
+
+        Session session2 = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        String exchangeName2 = getTestQueueName() + "2";
+        String queueName2 = getTestQueueName() + "2";
+
+        Queue queue2 = session2.createQueue("direct://" + exchangeName2 + "/" + queueName2 + "/" + queueName2 + "?" + BindingURL.OPTION_EXCHANGE_DURABLE + "='true'");
+        if(createProducer)
+        {
+            session2.createProducer(queue2);
+        }
+
+        if(createConsumer)
+        {
+            session2.createConsumer(queue2);
+        }
+        session2.close();
+
+        //verify the exchange was declared to expectation
+        verifyDeclaredExchange(exchangeName2, false, true);
+    }
+
+    private void verifyDeclaredExchange(String exchangeName, boolean isAutoDelete, boolean isDurable) throws IOException
+    {
+        String exchangeObjectName = _jmxUtils.getExchangeObjectName("test", exchangeName);
+        assertTrue("exchange should exist", _jmxUtils.doesManagedObjectExist(exchangeObjectName));
+        ManagedExchange exchange = _jmxUtils.getManagedExchange(exchangeName);
+        assertEquals(isAutoDelete, exchange.isAutoDelete());
+        assertEquals(isDurable,exchange.isDurable());
+    }
 }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/client/MaxDeliveryCountTest.java Thu Feb 28 16:14:30 2013
@@ -74,19 +74,20 @@ public class MaxDeliveryCountTest extend
     public void setUp() throws Exception
     {
         //enable DLQ/maximumDeliveryCount support for all queues at the vhost level
-        setConfigurationProperty("virtualhosts.virtualhost.test.queues.maximumDeliveryCount",
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.queues.maximumDeliveryCount",
                 String.valueOf(MAX_DELIVERY_COUNT));
-        setConfigurationProperty("virtualhosts.virtualhost.test.queues.deadLetterQueues",
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost.test.queues.deadLetterQueues",
                                 String.valueOf(true));
 
         //Ensure management is on
-        setConfigurationProperty("management.enabled", "true");
-        setConfigurationProperty("management.ssl.enabled", "false");
+        getBrokerConfiguration().addJmxManagementConfiguration();
 
         // Set client-side flag to allow the server to determine if messages
         // dead-lettered or requeued.
-        setTestClientSystemProperty(ClientProperties.REJECT_BEHAVIOUR_PROP_NAME, "server");
-
+        if (!isBroker010())
+        {
+            setTestClientSystemProperty(ClientProperties.REJECT_BEHAVIOUR_PROP_NAME, "server");
+        }
         super.setUp();
 
         boolean durableSub = isDurSubTest();

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/close/JavaServerCloseRaceConditionTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/close/JavaServerCloseRaceConditionTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/close/JavaServerCloseRaceConditionTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/close/JavaServerCloseRaceConditionTest.java Thu Feb 28 16:14:30 2013
@@ -21,7 +21,7 @@
 package org.apache.qpid.test.unit.close;
 
 import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.client.AMQSession_0_8;
 import org.apache.qpid.framing.AMQFrame;
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.framing.ExchangeDeclareBody;
@@ -81,7 +81,7 @@ public class JavaServerCloseRaceConditio
 
         AMQConnection connection = (AMQConnection) getConnection();
 
-        AMQSession session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        AMQSession_0_8 session = (AMQSession_0_8) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
         // Set no wait true so that we block the connection
         // Also set a different exchange class string so the attempt to declare

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java Thu Feb 28 16:14:30 2013
@@ -73,7 +73,7 @@ public class DurableSubscriptionTest ext
 
     public void setUp() throws Exception
     {
-        setConfigurationProperty("management.enabled", "true");     
+        getBrokerConfiguration().addJmxManagementConfiguration();
         _jmxConnected=false;
         super.setUp();
     }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java Thu Feb 28 16:14:30 2013
@@ -29,7 +29,7 @@ public class TransactionTimeoutDisabledT
     protected void configure() throws Exception
     {
         // Setup housekeeping every second
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
 
         // No transaction timeout configuration.
     }

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTest.java Thu Feb 28 16:14:30 2013
@@ -39,29 +39,29 @@ public class TransactionTimeoutTest exte
 
     protected void configure() throws Exception
     {
-        // Setup housekeeping every second
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
+        // Setup housekeeping every 100ms
+        setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod", "100");
 
         if (getName().contains("ProducerIdle"))
         {
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "0");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "0");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1500");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "0");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "0");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1500");
         }
         else if (getName().contains("ProducerOpen"))
         {
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "0");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "0");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "0");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "0");
         }
         else
         {
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500");
-            setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn", "1000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openClose", "2000");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleWarn", "500");
+            setVirtualHostConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.idleClose", "1000");
         }
     }
 

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java Thu Feb 28 16:14:30 2013
@@ -23,17 +23,13 @@ package org.apache.qpid.test.unit.transa
 import junit.framework.TestCase;
 
 import org.apache.qpid.AMQException;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQConnectionURL;
-import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.jms.ConnectionURL;
-import org.apache.qpid.jms.Session;
+import org.apache.qpid.configuration.ClientProperties;
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.util.LogMonitor;
 
+import javax.jms.Connection;
 import javax.jms.DeliveryMode;
 import javax.jms.ExceptionListener;
 import javax.jms.JMSException;
@@ -41,6 +37,7 @@ 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 java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -61,7 +58,7 @@ public abstract class TransactionTimeout
     public static final String OPEN = "Open";
     
     protected LogMonitor _monitor;
-    protected AMQConnection _con;
+    protected Connection _con;
     protected Session _psession, _csession;
     protected Queue _queue;
     protected MessageConsumer _consumer;
@@ -89,16 +86,14 @@ public abstract class TransactionTimeout
         super.setUp();
         
         // Connect to broker
-        String broker = ("tcp://localhost:" + DEFAULT_PORT);
-        ConnectionURL url = new AMQConnectionURL("amqp://guest:guest@clientid/test?brokerlist='" + broker + "'&maxprefetch='1'");
-        _con = (AMQConnection) getConnection(url);
+        setTestClientSystemProperty(ClientProperties.MAX_PREFETCH_PROP_NAME, String.valueOf(1));
+        _con = getConnection();
         _con.setExceptionListener(this);
         _con.start();
         
         // Create queue
         Session qsession = _con.createSession(true, Session.SESSION_TRANSACTED);
-        AMQShortString queueName = new AMQShortString("test");
-        _queue = new AMQQueue(qsession.getDefaultQueueExchangeName(), queueName, queueName, false, true);
+        _queue = qsession.createQueue(getTestQueueName());
         qsession.close();
         
         // Create producer and consumer

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/utils/InternalBrokerHolder.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/utils/InternalBrokerHolder.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/utils/InternalBrokerHolder.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/utils/InternalBrokerHolder.java Thu Feb 28 16:14:30 2013
@@ -20,9 +20,6 @@
  */
 package org.apache.qpid.test.utils;
 
-import java.lang.management.ManagementFactory;
-import java.lang.management.ThreadInfo;
-import java.lang.management.ThreadMXBean;
 import java.util.Set;
 
 import org.apache.log4j.Logger;
@@ -82,28 +79,7 @@ public class InternalBrokerHolder implem
     @Override
     public String dumpThreads()
     {
-        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
-        ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true);
-        StringBuilder dump = new StringBuilder();
-        dump.append(String.format("%n"));
-        for (ThreadInfo threadInfo : threadInfos)
-        {
-            dump.append(threadInfo);
-        }
-
-        long[] deadLocks = threadMXBean.findDeadlockedThreads();
-        if (deadLocks != null && deadLocks.length > 0)
-        {
-            ThreadInfo[] deadlockedThreads = threadMXBean.getThreadInfo(deadLocks);
-            dump.append(String.format("%n"));
-            dump.append("Deadlock is detected!");
-            dump.append(String.format("%n"));
-            for (ThreadInfo threadInfo : deadlockedThreads)
-            {
-                dump.append(threadInfo);
-            }
-        }
-        return dump.toString();
+        return TestUtils.dumpThreads();
     }
 
     @Override

Modified: qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java (original)
+++ qpid/branches/asyncstore/java/systests/src/main/java/org/apache/qpid/test/utils/JMXTestUtils.java Thu Feb 28 16:14:30 2013
@@ -24,7 +24,6 @@ import junit.framework.TestCase;
 import org.apache.commons.configuration.ConfigurationException;
 
 import org.apache.qpid.management.common.JMXConnnectionFactory;
-import org.apache.qpid.management.common.mbeans.ConfigurationManagement;
 import org.apache.qpid.management.common.mbeans.LoggingManagement;
 import org.apache.qpid.management.common.mbeans.ManagedBroker;
 import org.apache.qpid.management.common.mbeans.ManagedConnection;
@@ -32,6 +31,8 @@ import org.apache.qpid.management.common
 import org.apache.qpid.management.common.mbeans.ManagedQueue;
 import org.apache.qpid.management.common.mbeans.ServerInformation;
 import org.apache.qpid.management.common.mbeans.UserManagement;
+import org.apache.qpid.server.model.Plugin;
+import org.apache.qpid.server.plugin.PluginFactory;
 
 import javax.management.InstanceNotFoundException;
 import javax.management.JMException;
@@ -46,7 +47,9 @@ import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -78,7 +81,7 @@ public class JMXTestUtils
 
     public void setUp() throws IOException, ConfigurationException, Exception
     {
-        _test.setConfigurationProperty("management.enabled", "true");       
+        _test.getBrokerConfiguration().addJmxManagementConfiguration();
     }
 
     public void open() throws Exception
@@ -287,9 +290,7 @@ public class JMXTestUtils
     public ObjectName getQueueObjectName(String virtualHostName, String queue)
     {
         // Get the name of the test manager
-        String query = "org.apache.qpid:type=VirtualHost.Queue,VirtualHost="
-                       + ObjectName.quote(virtualHostName) + ",name="
-                       + ObjectName.quote(queue) + ",*";
+        String query = getQueueObjectNameString(virtualHostName, queue);
 
         Set<ObjectName> objectNames = queryObjects(query);
 
@@ -302,32 +303,20 @@ public class JMXTestUtils
         return objectName;
     }
 
+	public String getQueueObjectNameString(String virtualHostName, String queue) {
+	    return "org.apache.qpid:type=VirtualHost.Queue,VirtualHost="
+                       + ObjectName.quote(virtualHostName) + ",name="
+                       + ObjectName.quote(queue) + ",*";
+    }
+
     /**
-     * Retrive the ObjectName for the given Exchange on a VirtualHost.
-     *
-     * This is then used to create a proxy to the ManagedExchange MBean.
-     *
-     * @param virtualHostName the VirtualHost the Exchange is on
-     * @param exchange the Exchange to retireve e.g. 'direct'
-     * @return the ObjectName for the given Exchange on the VirtualHost
+     * Generate the ObjectName for the given Exchange on a VirtualHost.
      */
-    @SuppressWarnings("static-access")
-    public ObjectName getExchangeObjectName(String virtualHostName, String exchange)
+    public String getExchangeObjectName(String virtualHostName, String exchange)
     {
-        // Get the name of the test manager
-        String query = "org.apache.qpid:type=VirtualHost.Exchange,VirtualHost="
+        return "org.apache.qpid:type=VirtualHost.Exchange,VirtualHost="
                        + ObjectName.quote(virtualHostName) + ",name="
                        + ObjectName.quote(exchange) + ",*";
-
-        Set<ObjectName> objectNames = queryObjects(query);
-
-        _test.assertNotNull("Null ObjectName Set returned", objectNames);
-        _test.assertEquals("Incorrect number of exchange with name '" + exchange + "' returned", 1, objectNames.size());
-
-        // We have verified we have only one value in objectNames so return it
-        ObjectName objectName = objectNames.iterator().next();
-        _test.getLogger().info("Loading: " + objectName);
-        return objectName;
     }
 
     @SuppressWarnings("static-access")
@@ -343,7 +332,7 @@ public class JMXTestUtils
         return getManagedObject(managedClass, objectName);
     }
 
-    public boolean isManagedObjectExist(String query)
+    public boolean doesManagedObjectExist(String query)
     {
         return !queryObjects(query).isEmpty();
     }
@@ -373,9 +362,20 @@ public class JMXTestUtils
         return getManagedObject(ManagedBroker.class, getVirtualHostManagerObjectName(virtualHost));
     }
 
+    @SuppressWarnings("static-access")
     public ManagedExchange getManagedExchange(String exchangeName)
     {
-        ObjectName objectName = getExchangeObjectName("test", exchangeName);
+        String query = getExchangeObjectName("test", exchangeName);
+
+        Set<ObjectName> objectNames = queryObjects(query);
+
+        _test.assertNotNull("Null ObjectName Set returned", objectNames);
+        _test.assertEquals("Incorrect number of exchange with name '" + exchangeName + "' returned", 1, objectNames.size());
+
+        // We have verified we have only one value in objectNames so return an mbean proxy for it
+        ObjectName objectName = objectNames.iterator().next();
+        _test.getLogger().info("Loading: " + objectName);
+
         return MBeanServerInvocationHandler.newProxyInstance(_mbsc, objectName, ManagedExchange.class, false);
     }
 
@@ -391,12 +391,6 @@ public class JMXTestUtils
         return getManagedObject(LoggingManagement.class, objectName);
     }
 
-    public ConfigurationManagement getConfigurationManagement() throws MalformedObjectNameException
-    {
-        ObjectName objectName = new ObjectName("org.apache.qpid:type=ConfigurationManagement,name=ConfigurationManagement");
-        return getManagedObject(ConfigurationManagement.class, objectName);
-    }
-
     public UserManagement getUserManagement() throws MalformedObjectNameException
     {
         ObjectName objectName = new ObjectName("org.apache.qpid:type=UserManagement,name=UserManagement");



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org