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 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")); }
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")); }
public void ValidateChanges() { try { new PathsValidator(this).RunValidation(false); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } try { ServiceControlQueueNameValidator.Validate(this); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } var oldSettings = InstanceFinder.FindServiceControlInstance(Name); var passwordSet = !string.IsNullOrWhiteSpace(ServiceAccountPwd); var accountChanged = !string.Equals(oldSettings.ServiceAccount, ServiceAccount, StringComparison.OrdinalIgnoreCase); if (passwordSet || accountChanged) { try { ServiceAccountValidation.Validate(this); } catch (IdentityNotMappedException) { ReportCard.Errors.Add("The service account specified does not exist"); return; } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); return; } } try { ConnectionStringValidator.Validate(this); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } }
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()); }
public void CheckQueueNamesAreUniqueShouldSucceed() { var newInstance = new ServiceControlNewInstance { TransportPackage = "MSMQ", AuditLogQueue = "auditlog", ErrorLogQueue = "errorlog", AuditQueue = "audit", ErrorQueue = "error" }; var p = new ServiceControlQueueNameValidator(newInstance) { Instances = new List <IServiceControlTransportConfig>() }; Assert.DoesNotThrow(() => p.CheckQueueNamesAreUniqueWithinInstance()); }
public void CheckQueueNamesAreUniqueShouldThrow() { var newInstance = new ServiceControlNewInstance { TransportPackage = "MSMQ", AuditLogQueue = "audit", ErrorLogQueue = "error", AuditQueue = "audit", ErrorQueue = "error" }; var p = new ServiceControlQueueNameValidator(newInstance) { Instances = new List <IServiceControlTransportConfig>() }; var ex = Assert.Throws <EngineValidationException>(() => p.CheckQueueNamesAreUniqueWithinInstance()); Assert.That(ex.Message, Is.StringContaining("Each of the queue names specified for a instance should be unique")); }
public void Validate(Func <PathInfo, bool> promptToProceed) { if (TransportPackage.Equals("MSMQ", StringComparison.OrdinalIgnoreCase)) { try { MsmqConfigValidator.Validate(); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } } try { PortValidator.Validate(this); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } try { DatabaseMaintenancePortValidator.Validate(this); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } try { ReportCard.CancelRequested = new PathsValidator(this).RunValidation(true, promptToProceed); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } try { ServiceControlQueueNameValidator.Validate(this); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } try { CheckForConflictingUrlAclReservations(); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } try { ServiceAccountValidation.Validate(this); ConnectionStringValidator.Validate(this); } catch (IdentityNotMappedException) { ReportCard.Errors.Add("The service account specified does not exist"); } catch (EngineValidationException ex) { ReportCard.Errors.Add(ex.Message); } }