* Tests queue creation/deletion also verifying the automatic binding to the default exchange.
*/
public void testCreateQueueAndDeletion() throws Exception
{
final String queueName = getTestQueueName();
final ManagedExchange defaultExchange = _jmxUtils.getManagedExchange(ExchangeDefaults.DEFAULT_EXCHANGE_NAME.asString());
// Check that bind does not exist before queue creation
assertFalse("Binding to " + queueName + " should not exist in default exchange before queue creation",
defaultExchange.bindings().containsKey(new String[] {queueName}));
_managedBroker.createNewQueue(queueName, "testowner", true);
// Ensure the queue exists
assertNotNull("Queue object name expected to exist", _jmxUtils.getQueueObjectName("test", queueName));
assertNotNull("Manager queue expected to be available", _jmxUtils.getManagedQueue(queueName));
// Now verify that the default exchange has been bound.
assertTrue("Binding to " + queueName + " should exist in default exchange after queue creation",
defaultExchange.bindings().containsKey(new String[] {queueName}));
// Now delete the queue
_managedBroker.deleteQueue(queueName);
// Finally ensure that the binding has been removed.
assertFalse("Binding to " + queueName + " should not exist in default exchange after queue deletion",
defaultExchange.bindings().containsKey(new String[] {queueName}));
}