Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
            }
        }
Exemplo n.º 7
0
        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);
            }
        }
Exemplo n.º 8
0
        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"));
        }