public void Should_be_able_to_delete_an_exchange()
        {
            var exchange = managementClient.GetExchanges().SingleOrDefault(x => x.Name == testExchange);

            if (exchange == null)
            {
                throw new ApplicationException(
                          string.Format("Test exchange '{0}' hasn't been created", testExchange));
            }

            managementClient.DeleteExchange(exchange);
        }
Пример #2
0
        public void AfterAllTests()
        {
            var notAsyncQueue = GetQueue(QueueNameSync);

            if (notAsyncQueue != null)
            {
                _managementClient.DeleteQueue(notAsyncQueue);
            }

            var asyncQueue = GetQueue(QueueNameAsync);

            if (asyncQueue != null)
            {
                _managementClient.DeleteQueue(asyncQueue);
            }

            var exchange = GetExchange(ExchangeName);

            if (exchange != null)
            {
                _managementClient.DeleteExchange(exchange);
            }

            // Needed or tests were hanging.
            var bus = _container.GetInstance <IBus>();

            bus.Advanced.Dispose();
        }
        protected internal override void Apply(IManagementClient managementClient)
        {
            _log.Info($"Deleting exchange '{Name}' from '{VirtualHost}'");

            var virtualHost = managementClient.GetVhost(VirtualHost);
            var exchange    = managementClient.GetExchange(Name, virtualHost);

            managementClient.DeleteExchange(exchange);

            _log.Info($"Finished deleting exchange '{Name}' from '{VirtualHost}'");
        }
Пример #4
0
 public void CleanUp(IManagementClient client)
 {
     foreach (var queue in client.GetQueues())
     {
         Console.Out.WriteLine("Deleting Queue: {0}", queue.Name);
         client.DeleteQueue(queue);
     }
     foreach (var exchange in client.GetExchanges())
     {
         if (!exchange.Name.StartsWith("amp."))
         {
             Console.Out.WriteLine("Deleting Exchange: {0}", exchange.Name);
             client.DeleteExchange(exchange);
         }
     }
 }