Exemplo n.º 1
0
        public void TestThatStickyLoadBlancingWithOneServerAndManuelTestWorks()
        {
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };

            _settingsStopAfterMarkedServer.Config.Servers = new[] { server1 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.Sticky
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsStopAfterMarkedServer.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            sequnceManager.Execute(status, _settingsStopAfterMarkedServer, _token);

            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"));
        }
Exemplo n.º 2
0
        public void TestThatRoundRobinLoadBlancingWithOneServerWorks()
        {
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };

            _settingsDefault.Config.Servers = new[] { server1 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.RoundRobin
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsDefault.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsDefault, _token);
            sequnceManager.Execute(status, _settingsDefault, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(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-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("online"));
        }
Exemplo n.º 3
0
        public void TestThatStickyWithContinueAfterManualTestExecutesOnCorrectServers()
        {
            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"
            };

            _settingsContinueAfterMarkedServer.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.Sticky
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsContinueAfterMarkedServer.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsContinueAfterMarkedServer, _token);
            sequnceManager.Execute(status, _settingsContinueAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(((_settingsContinueAfterMarkedServer.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++;
            }
        }
Exemplo n.º 4
0
 private void ConfigureAtrifact(IProvideArtifact artifact, ExecutionSequenceManager sequenceManager, ConDepSettings settings)
 {
     if (artifact is Artifact.Local)
     {
         var localSequence = sequenceManager.NewLocalSequence(artifact.GetType().Name);
         var localBuilder  = new LocalOperationsBuilder(localSequence);
         ((Artifact.Local)artifact).Configure(localBuilder, settings);
     }
     else if (artifact is Artifact.Remote)
     {
         var remoteSequence = sequenceManager.NewRemoteSequence(artifact.GetType().Name);
         var remoteBuilder  = new RemoteOperationsBuilder(remoteSequence);
         ((Artifact.Remote)artifact).Configure(remoteBuilder, settings);
     }
 }
Exemplo n.º 5
0
        public void TestThatStickyLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            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"
            };

            _settingsDefault.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.Sticky
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsDefault.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsDefault, _token);
            sequnceManager.Execute(status, _settingsDefault, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(_settingsDefault.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++;
            }
        }
Exemplo n.º 6
0
        public void TestThatRoundRobinWithContinueAfterManuelTestOnSpecificServerExecuteCorrectServers()
        {
            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"
            };

            _settingsStopAfterMarkedServer.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.RoundRobin
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsStopAfterMarkedServer.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            sequnceManager.Execute(status, _settingsStopAfterMarkedServer, _token);

            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"));
        }
Exemplo n.º 7
0
        public void TestThatStickyWithContinueAfterManualTestOnSpecificServerExecutesOnCorrectServers()
        {
            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"
            };

            _settingsContinueAfterMarkedServer.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.Sticky
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsContinueAfterMarkedServer.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsContinueAfterMarkedServer, _token);
            sequnceManager.Execute(status, _settingsContinueAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(((_settingsContinueAfterMarkedServer.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"));
        }
Exemplo n.º 8
0
        public void TestThatRoundRobinLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            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"
            };

            _settingsDefault.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.RoundRobin
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsDefault.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsDefault, _token);
            sequnceManager.Execute(status, _settingsDefault, _token);


            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(_settingsDefault.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"));
        }