* recovering to verify the persistence, then removing it from the store, and ensuring
* that following the second reload process it is not recovered.
*/
public void testDurableBindingRemoval() throws Exception
{
QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();
//create durable queue and exchange, bind them
Exchange exch = createExchange(DirectExchange.TYPE, directExchangeName, true);
createQueue(durableQueueName, false, true, false, false);
bindQueueToExchange(exch, directRouting, queueRegistry.getQueue(durableQueueName), false, null);
assertEquals("Incorrect number of bindings registered before recovery",
1, queueRegistry.getQueue(durableQueueName).getBindings().size());
//verify binding is actually normally recovered
reloadVirtualHost();
queueRegistry = getVirtualHost().getQueueRegistry();
assertEquals("Incorrect number of bindings registered after first recovery",
1, queueRegistry.getQueue(durableQueueName).getBindings().size());
ExchangeRegistry exchangeRegistry = getVirtualHost().getExchangeRegistry();
exch = exchangeRegistry.getExchange(directExchangeName);
assertNotNull("Exchange was not recovered", exch);
//remove the binding and verify result after recovery
unbindQueueFromExchange(exch, directRouting, queueRegistry.getQueue(durableQueueName), false, null);
reloadVirtualHost();
queueRegistry = getVirtualHost().getQueueRegistry();
assertEquals("Incorrect number of bindings registered after second recovery",
0, queueRegistry.getQueue(durableQueueName).getBindings().size());
}