Exemplo n.º 1
0
        public void DuplicateQueueNamesAreAllowedOnDifferentTransports_ShouldNotThrow()
        {
            var newInstance = new ServiceControlNewInstance
            {
                TransportPackage = "RabbitMQ",
                AuditLogQueue    = "auditlog",
                ErrorLogQueue    = "errorlog",
                AuditQueue       = "audit",
                ErrorQueue       = "error"
            };

            var p = new ServiceControlQueueNameValidator(newInstance)
            {
                Instances = instances
            };
            var ex = Assert.Throws <EngineValidationException>(() => p.CheckQueueNamesAreNotTakenByAnotherInstance());

            Assert.That(ex.Message, Is.StringContaining("Some queue names specified are already assigned to another ServiceControl instance - Correct the values for"));

            // null queues will default to default names
            p = new ServiceControlQueueNameValidator(new ServiceControlNewInstance())
            {
                Instances = instances
            };

            ex = Assert.Throws <EngineValidationException>(() => p.CheckQueueNamesAreNotTakenByAnotherInstance());
            Assert.That(ex.Message, Is.StringContaining("Some queue names specified are already assigned to another ServiceControl instance - Correct the values for"));
        }
Exemplo n.º 2
0
        public void EnsureDuplicateQueueNamesAreAllowedOnSameTransportWithDifferentConnectionString()
        {
            var newInstance = new ServiceControlNewInstance
            {
                TransportPackage = "RabbitMQ",
                AuditQueue       = "RMQaudit",
                AuditLogQueue    = "RMQauditlog",
                ErrorQueue       = "RMQerror",
                ErrorLogQueue    = "RMQerrorlog",
                ConnectionString = "afakeconnectionstring"
            };

            var p = new ServiceControlQueueNameValidator(newInstance)
            {
                Instances = instances
            };
            var ex = Assert.Throws <EngineValidationException>(() => p.CheckQueueNamesAreNotTakenByAnotherInstance());

            Assert.That(ex.Message, Is.StringContaining("Some queue names specified are already assigned to another ServiceControl instance - Correct the values for"));

            newInstance.ConnectionString = "differentconnectionstring";
            p = new ServiceControlQueueNameValidator(newInstance)
            {
                Instances = instances
            };
            Assert.DoesNotThrow(() => p.CheckQueueNamesAreNotTakenByAnotherInstance());
        }
        public void CheckQueueNamesAreNotTakenByAnotherInstance_ShouldThrow()
        {
            var newInstance = new ServiceControlNewInstance
            {
                TransportPackage = ServiceControlCoreTransports.All.First(t => t.Name == "MSMQ"),
                AuditLogQueue    = "auditlog",
                ErrorLogQueue    = "errorlog",
                AuditQueue       = "audit",
                ErrorQueue       = "error"
            };

            var p = new ServiceControlQueueNameValidator(newInstance)
            {
                Instances = instances
            };
            var ex = Assert.Throws <EngineValidationException>(() => p.CheckQueueNamesAreNotTakenByAnotherInstance());

            Assert.That(ex.Message, Does.Contain("Some queue names specified are already assigned to another ServiceControl instance - Correct the values for"));

            // null queues will default to default names
            p = new ServiceControlQueueNameValidator(new ServiceControlNewInstance())
            {
                Instances = instances
            };

            ex = Assert.Throws <EngineValidationException>(() => p.CheckQueueNamesAreNotTakenByAnotherInstance());
            Assert.That(ex.Message, Does.Contain("Some queue names specified are already assigned to another ServiceControl instance - Correct the values for"));
        }
Exemplo n.º 4
0
        public void CheckQueueNamesAreNotTakenByAnotherInstance_ShouldSucceed()
        {
            var newInstance = new ServiceControlNewInstance
            {
                TransportPackage = "MSMQ",
                AuditLogQueue    = "auditlog2",
                ErrorLogQueue    = "errorlog2",
                AuditQueue       = "audit2",
                ErrorQueue       = "error2"
            };

            var p = new ServiceControlQueueNameValidator(newInstance)
            {
                Instances = instances
            };

            Assert.DoesNotThrow(() => p.CheckQueueNamesAreNotTakenByAnotherInstance());
        }