Beispiel #1
0
 public PreRemoteOps(ServerConfig server, PreOpsSequence sequence, ConDepOptions options, IHandleWebDeploy webDeploy)
 {
     _server = server;
     _sequence = sequence;
     _options = options;
     _webDeploy = webDeploy;
 }
Beispiel #2
0
 public RemoteSequence(IManageInfrastructureSequence infrastructureSequence, PreOpsSequence preOpsSequence, IEnumerable <ServerConfig> servers, ILoadBalance loadBalancer)
 {
     _infrastructureSequence = infrastructureSequence;
     _preOpsSequence         = preOpsSequence;
     _servers      = servers;
     _loadBalancer = loadBalancer;
 }
Beispiel #3
0
 public RemoteSequence(IManageInfrastructureSequence infrastructureSequence, PreOpsSequence preOpsSequence, IEnumerable<ServerConfig> servers, ILoadBalance loadBalancer)
 {
     _infrastructureSequence = infrastructureSequence;
     _preOpsSequence = preOpsSequence;
     _servers = servers;
     _loadBalancer = loadBalancer;
 }
Beispiel #4
0
 public LocalOperationsBuilder(LocalSequence localSequence, IManageInfrastructureSequence infrastructureSequence, PreOpsSequence preOpsSequence, IEnumerable<ServerConfig> servers, IHandleWebDeploy webDeploy)
 {
     _localSequence = localSequence;
     _infrastructureSequence = infrastructureSequence;
     _preOpsSequence = preOpsSequence;
     _servers = servers;
     _webDeploy = webDeploy;
 }
Beispiel #5
0
        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"));
        }
Beispiel #6
0
        public void TestThatRoundRobinLoadBlancingWithOneServerAndContinueWorks()
        {
            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, false, true, 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("online"));
        }
        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);
        }
Beispiel #8
0
        public void TestThatStickyWithContinueAfterManualTestOnSpecificServerExecutesOnCorrectServers()
        {
            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.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-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item2, Is.EqualTo("offline"));

            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-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item2, Is.EqualTo("online"));

            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-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item2, Is.EqualTo("online"));
        }
Beispiel #9
0
        public void TestThatStickyLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            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, false, null));

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(config.Servers.Count * 2));

            var serverNumber = 1;
            for (int i = 0; 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++;
            }
        }
Beispiel #10
0
        public RemoteSequence NewRemoteSequence(IManageInfrastructureSequence infrastructureSequence, PreOpsSequence preOpsSequence, IEnumerable <ServerConfig> servers)
        {
            var sequence = new RemoteSequence(infrastructureSequence, preOpsSequence, servers, _loadBalancer);

            _sequence.Add(sequence);
            return(sequence);
        }