public void TestThatExecutionSequenceIsValid() { var config = new ConDepConfig { EnvironmentName = "bogusEnv" }; var server = new ServerConfig { Name = "jat-web03" }; config.Servers = new[] { server }; var infrastructureSequence = new InfrastructureSequence(); var preOpsSequence = new PreOpsSequence(new WebDeployHandlerMock()); var webDeploy = new WebDeployHandlerMock(); var infrastructureBuilder = new InfrastructureBuilder(infrastructureSequence, webDeploy); _infra.Configure(infrastructureBuilder, config); var local = new LocalOperationsBuilder(_sequenceManager.NewLocalSequence("Test"), infrastructureSequence, preOpsSequence, config.Servers, webDeploy); _app.Configure(local, config); var notification = new Notification(); Assert.That(_sequenceManager.IsValid(notification)); }
public PreRemoteOps(ServerConfig server, PreOpsSequence sequence, ConDepOptions options, IHandleWebDeploy webDeploy) { _server = server; _sequence = sequence; _options = options; _webDeploy = webDeploy; }
public void TestThatRoundRobinLoadBlancingWithOneServerAndManuelTestWorks() { var config = new ConDepConfig { EnvironmentName = "bogusEnv" }; var server1 = new ServerConfig { Name = "jat-web01" }; config.Servers = new[] { server1 }; var infrastructureSequence = new InfrastructureSequence(); var preOpsSequence = new PreOpsSequence(new WebDeployHandlerMock()); var loadBalancer = new MockLoadBalancer { Mode = LbMode.RoundRobin }; var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer); var status = new StatusReporter(); remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, true, false, null)); Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(1)); Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01")); Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline")); }
public LocalOperationsBuilder(LocalSequence localSequence, IManageInfrastructureSequence infrastructureSequence, PreOpsSequence preOpsSequence, IEnumerable <ServerConfig> servers, IHandleWebDeploy webDeploy) { _localSequence = localSequence; _infrastructureSequence = infrastructureSequence; _preOpsSequence = preOpsSequence; _servers = servers; _webDeploy = webDeploy; }
public void TestThatStickyWithContinueAfterManualTestExecutesOnCorrectServers() { var config = new ConDepConfig { EnvironmentName = "bogusEnv" }; var server1 = new ServerConfig { Name = "jat-web01" }; var server2 = new ServerConfig { Name = "jat-web02" }; var server3 = new ServerConfig { Name = "jat-web03" }; var server4 = new ServerConfig { Name = "jat-web04" }; var server5 = new ServerConfig { Name = "jat-web05" }; config.Servers = new[] { server1, server2, server3, server4, server5 }; var infrastructureSequence = new InfrastructureSequence(); var preOpsSequence = new PreOpsSequence(new WebDeployHandlerMock()); var loadBalancer = new MockLoadBalancer { Mode = LbMode.Sticky }; var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer); var status = new StatusReporter(); remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, false, true, null)); Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(((config.Servers.Count - 1) * 2) + 1)); Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01")); Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("online")); var serverNumber = 2; for (int i = 1; i < loadBalancer.OnlineOfflineSequence.Count; i += 2) { Assert.That(loadBalancer.OnlineOfflineSequence[i].Item1, Is.EqualTo("jat-web0" + serverNumber)); Assert.That(loadBalancer.OnlineOfflineSequence[i].Item2, Is.EqualTo("offline")); Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item1, Is.EqualTo("jat-web0" + serverNumber)); Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item2, Is.EqualTo("online")); serverNumber++; } }
public void TestThatRoundRobinWithContinueAfterManuelTestOnSpecificServerExecuteCorrectServers() { var config = new ConDepConfig { EnvironmentName = "bogusEnv" }; var server1 = new ServerConfig { Name = "jat-web01" }; var server2 = new ServerConfig { Name = "jat-web02" }; var server3 = new ServerConfig { Name = "jat-web03", StopServer = true }; var server4 = new ServerConfig { Name = "jat-web04" }; var server5 = new ServerConfig { Name = "jat-web05" }; config.Servers = new[] { server1, server2, server3, server4, server5 }; var infrastructureSequence = new InfrastructureSequence(); var preOpsSequence = new PreOpsSequence(new WebDeployHandlerMock()); var loadBalancer = new MockLoadBalancer { Mode = LbMode.RoundRobin }; var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer); var status = new StatusReporter(); remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, true, false, null)); Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(1)); Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web03")); Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline")); }
private void Execute(Assembly assembly, ConDepConfig envConfig, ConDepOptions options, IReportStatus status) { if (assembly == null) { throw new ArgumentException("assembly"); } if (envConfig == null) { throw new ArgumentException("envSettings"); } if (options == null) { throw new ArgumentException("options"); } if (status == null) { throw new ArgumentException("status"); } var applications = CreateApplicationArtifacts(options, assembly); if (!options.WebDeployExist) { var serverValidator = new RemoteServerValidator(envConfig.Servers); if (!serverValidator.IsValid()) { Logger.Error("Not all servers fulfill ConDep's requirements. Aborting execution."); return; } } var webDeploy = new WebDeployHandler(); var lbLookup = new LoadBalancerLookup(envConfig.LoadBalancer); var sequenceManager = new ExecutionSequenceManager(lbLookup.GetLoadBalancer()); var notification = new Notification(); var postOpSeq = new PostOpsSequence(); foreach (var application in applications) { var infrastructureSequence = new InfrastructureSequence(); var preOpsSequence = new PreOpsSequence(webDeploy); if (!options.DeployOnly) { var infrastructureBuilder = new InfrastructureBuilder(infrastructureSequence, webDeploy); Configure.InfrastructureOperations = infrastructureBuilder; if (HasInfrastructureDefined(application)) { var infrastructureInstance = GetInfrastructureArtifactForApplication(assembly, application); if (!infrastructureSequence.IsValid(notification)) { notification.Throw(); } infrastructureInstance.Configure(infrastructureBuilder, envConfig); } } var local = new LocalOperationsBuilder(sequenceManager.NewLocalSequence(application.GetType().Name), infrastructureSequence, preOpsSequence, envConfig.Servers, webDeploy); Configure.LocalOperations = local; application.Configure(local, envConfig); } if (!sequenceManager.IsValid(notification)) { notification.Throw(); } sequenceManager.Execute(status, envConfig, options); postOpSeq.Execute(status, options); }
public void TestThatRoundRobinLoadBalancingGoesOnlineOfflineInCorrectOrder() { var config = new ConDepConfig { EnvironmentName = "bogusEnv" }; var server1 = new ServerConfig { Name = "jat-web01" }; var server2 = new ServerConfig { Name = "jat-web02" }; var server3 = new ServerConfig { Name = "jat-web03" }; var server4 = new ServerConfig { Name = "jat-web04" }; var server5 = new ServerConfig { Name = "jat-web05" }; config.Servers = new[] { server1, server2, server3, server4, server5 }; var infrastructureSequence = new InfrastructureSequence(); var preOpsSequence = new PreOpsSequence(new WebDeployHandlerMock()); var loadBalancer = new MockLoadBalancer { Mode = LbMode.RoundRobin }; var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer); var status = new StatusReporter(); remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, false, false, null)); Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(config.Servers.Count * 2)); Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01")); Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline")); Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web02")); Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("offline")); Assert.That(loadBalancer.OnlineOfflineSequence[2].Item1, Is.EqualTo("jat-web03")); Assert.That(loadBalancer.OnlineOfflineSequence[2].Item2, Is.EqualTo("offline")); Assert.That(loadBalancer.OnlineOfflineSequence[3].Item1, Is.EqualTo("jat-web01")); Assert.That(loadBalancer.OnlineOfflineSequence[3].Item2, Is.EqualTo("online")); Assert.That(loadBalancer.OnlineOfflineSequence[4].Item1, Is.EqualTo("jat-web02")); Assert.That(loadBalancer.OnlineOfflineSequence[4].Item2, Is.EqualTo("online")); Assert.That(loadBalancer.OnlineOfflineSequence[5].Item1, Is.EqualTo("jat-web03")); Assert.That(loadBalancer.OnlineOfflineSequence[5].Item2, Is.EqualTo("online")); Assert.That(loadBalancer.OnlineOfflineSequence[6].Item1, Is.EqualTo("jat-web04")); Assert.That(loadBalancer.OnlineOfflineSequence[6].Item2, Is.EqualTo("offline")); Assert.That(loadBalancer.OnlineOfflineSequence[7].Item1, Is.EqualTo("jat-web05")); Assert.That(loadBalancer.OnlineOfflineSequence[7].Item2, Is.EqualTo("offline")); Assert.That(loadBalancer.OnlineOfflineSequence[8].Item1, Is.EqualTo("jat-web04")); Assert.That(loadBalancer.OnlineOfflineSequence[8].Item2, Is.EqualTo("online")); Assert.That(loadBalancer.OnlineOfflineSequence[9].Item1, Is.EqualTo("jat-web05")); Assert.That(loadBalancer.OnlineOfflineSequence[9].Item2, Is.EqualTo("online")); }