public async Task DeleteQueuesForEndpointWithPrefix() { var endpointName = "mydeleteprefixendpoint"; var errorQueueName = "mydeleteprefixerror"; var auditQueueName = "mydeleteprefixaudit"; await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, queueNamePrefix : "DEV") .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(errorQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(auditQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, queueNamePrefix : "DEV") .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(errorQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(auditQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await AssertQueuesDeleted(endpointName, errorQueueName, auditQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); }
public async Task DeleteQueuesForEndpointWithRetries() { var endpointName = "mydeleteretriesendpoint"; var errorQueueName = "mydeleteretrieserror"; var auditQueueName = "mydeleteretriesaudit"; await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, includeRetries : true) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(errorQueueName) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(auditQueueName) .ConfigureAwait(false); await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(errorQueueName) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(auditQueueName) .ConfigureAwait(false); await AssertQueuesDeleted(endpointName, errorQueueName, auditQueueName, includeRetries : true) .ConfigureAwait(false); }
public async Task DeleteQueuesForEndpointWithRetries(string delayedDeliveryMethod) { var randomName = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()); var endpointName = $"mydeleteretriesendpoint-{randomName}"; var errorQueueName = $"mydeleteretrieserror-{randomName}"; var auditQueueName = $"mydeleteretriesaudit-{randomName}"; await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, includeRetries : true, delayedDeliveryMethod : delayedDeliveryMethod) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(errorQueueName) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(auditQueueName) .ConfigureAwait(false); await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, includeRetries : true, delayedDeliveryMethod : delayedDeliveryMethod) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(errorQueueName) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(auditQueueName) .ConfigureAwait(false); await AssertQueuesDeleted(endpointName, errorQueueName, auditQueueName, includeRetries : true, delayedDeliveryMethod : delayedDeliveryMethod) .ConfigureAwait(false); }
public async Task DeleteQueuesForEndpoint() { var endpointName = "mydeleteendpoint"; var errorQueueName = "mydeleteerror"; var auditQueueName = "mydeleteaudit"; await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(errorQueueName) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(auditQueueName) .ConfigureAwait(false); await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(errorQueueName) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(auditQueueName) .ConfigureAwait(false); await AssertQueuesDeleted(endpointName, errorQueueName, auditQueueName) .ConfigureAwait(false); }
public async Task DeleteQueuesForEndpointWithPrefix(string delayedDeliveryMethod) { var randomName = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()); var endpointName = $"mydeleteprefixendpoint-{randomName}"; var errorQueueName = $"mydeleteprefixerror-{randomName}"; var auditQueueName = $"mydeleteprefixaudit-{randomName}"; await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, queueNamePrefix : "DEV", delayedDeliveryMethod : delayedDeliveryMethod) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(errorQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(auditQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, queueNamePrefix : "DEV", delayedDeliveryMethod : delayedDeliveryMethod) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(errorQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(auditQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await AssertQueuesDeleted(endpointName, errorQueueName, auditQueueName, queueNamePrefix : "DEV", delayedDeliveryMethod : delayedDeliveryMethod) .ConfigureAwait(false); }
public async Task DeleteQueueForEndpointWithPrefix_Powershell(string delayedDeliveryMethod) { var randomName = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()); var endpointName = $"mydeleteprefixendpoint-{randomName}-powershell"; var errorQueueName = $"mydeleteprefixerror-{randomName}-powershell"; var auditQueueName = $"mydeleteprefixaudit-{randomName}-powershell"; await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName, queueNamePrefix : "DEV", delayedDeliveryMethod : delayedDeliveryMethod) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(errorQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(auditQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); try { var scriptPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "QueueDeletion/QueueDeletion.ps1"); using (var powerShell = PowerShell.Create()) { powerShell.AddScript(File.ReadAllText(scriptPath)); powerShell.Invoke(); var command = powerShell.AddCommand("DeleteQueuesForEndpoint"); command.AddParameter("EndpointName", endpointName); command.AddParameter("QueueNamePrefix", "DEV"); command.AddParameter("DelayedDeliveryMethod", delayedDeliveryMethod); command.Invoke(); command = powerShell.AddCommand("DeleteQueue"); command.AddParameter("QueueName", errorQueueName); command.AddParameter("QueueNamePrefix", "DEV"); command.Invoke(); command = powerShell.AddCommand("DeleteQueue"); command.AddParameter("QueueName", auditQueueName); command.AddParameter("QueueNamePrefix", "DEV"); command.Invoke(); } await AssertQueuesDeleted(endpointName, errorQueueName, auditQueueName, queueNamePrefix : "DEV", delayedDeliveryMethod : delayedDeliveryMethod) .ConfigureAwait(false); } finally { await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName, queueNamePrefix : "DEV", delayedDeliveryMethod : delayedDeliveryMethod) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(errorQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(auditQueueName, queueNamePrefix : "DEV") .ConfigureAwait(false); } }
public static void CreateQueuesForEndpoint(string endpointName, string account) { // main queue QueueCreationUtils.CreateQueue(endpointName, account); // timeout queue QueueCreationUtils.CreateQueue($"{endpointName}.timeouts", account); // timeout dispatcher queue QueueCreationUtils.CreateQueue($"{endpointName}.timeoutsdispatcher", account); }
public async Task DeleteQueueForEndpoint_Powershell() { var endpointName = "mydeleteendpoint-powershell"; var errorQueueName = "mydeleteerror-powershell"; var auditQueueName = "mydeleteaudit-powershell"; await CreateEndpointQueues.CreateQueuesForEndpoint(endpointName) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(errorQueueName) .ConfigureAwait(false); await QueueCreationUtils.CreateQueue(auditQueueName) .ConfigureAwait(false); try { var scriptPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "QueueDeletion/QueueDeletion.ps1"); using (var powerShell = PowerShell.Create()) { powerShell.AddScript(File.ReadAllText(scriptPath)); powerShell.Invoke(); var command = powerShell.AddCommand("DeleteQueuesForEndpoint"); command.AddParameter("EndpointName", endpointName); command.Invoke(); command = powerShell.AddCommand("DeleteQueue"); command.AddParameter("QueueName", errorQueueName); command.Invoke(); command = powerShell.AddCommand("DeleteQueue"); command.AddParameter("QueueName", auditQueueName); command.Invoke(); } await AssertQueuesDeleted(endpointName, errorQueueName, auditQueueName) .ConfigureAwait(false); } finally { await DeleteEndpointQueues.DeleteQueuesForEndpoint(endpointName) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(errorQueueName) .ConfigureAwait(false); await QueueDeletionUtils.DeleteQueue(auditQueueName) .ConfigureAwait(false); } }
QueueCreationUtilsUsage() { #region rabbit-create-queues-shared-usage QueueCreationUtils.CreateQueue( uri: "amqp://*****:*****@localhost:5672", queueName: "error", durableMessages: true, createExchange: true); QueueCreationUtils.CreateQueue( uri: "amqp://*****:*****@localhost:5672", queueName: "audit", durableMessages: true, createExchange: true); #endregion }
public void DeleteQueuesForEndpoint() { CreateEndpointQueues.CreateQueuesForEndpoint( endpointName: "myendpoint", account: Environment.UserName); DeleteEndpointQueues.DeleteQueuesForEndpoint("myendpoint"); Assert.IsFalse(MessageQueue.Exists(@".\private$\myendpoint")); QueueCreationUtils.CreateQueue( queueName: "myerror", account: Environment.UserName); QueueDeletionUtils.DeleteQueue(queueName: "myerror"); Assert.IsFalse(MessageQueue.Exists(@".\private$\myerror")); QueueCreationUtils.CreateQueue( queueName: "myaudit", account: Environment.UserName); QueueDeletionUtils.DeleteQueue(queueName: "myaudit"); Assert.IsFalse(MessageQueue.Exists(@".\private$\myaudit")); }