Ejemplo n.º 1
0
            public override void Context()
            {
                base.Context();

                var successDetail = new DeploymentDetail(() => "success detail", () => new DeploymentResult()
                {
                    new DeploymentItem(DeploymentItemStatus.Good, "verify")
                }, () => new DeploymentResult()
                {
                    new DeploymentItem(DeploymentItemStatus.Good, "execute")
                }, () => new DeploymentResult());

                var failDetail = new DeploymentDetail(() => "fail detail", () => new DeploymentResult()
                {
                    new DeploymentItem(DeploymentItemStatus.Error, "fail verify")
                }, () => new DeploymentResult()
                {
                    new DeploymentItem(DeploymentItemStatus.Good, "execute")
                }, () => new DeploymentResult());


                var webRole = new DeploymentRole("Web");

                webRole.AddServer(new DeploymentServer("SrvWeb1"));
                webRole.AddServer(new DeploymentServer("SrvWeb2"));
                webRole.ForEachServerMapped(s => s.AddDetail(successDetail));
                var dbRole = new DeploymentRole("Db");

                dbRole.AddServer("SrvDb");
                dbRole.ForEachServerMapped(s => s.AddDetail(failDetail));
                Plan = new DeploymentPlan();
                Plan.AddRole(webRole);
                Plan.AddRole(dbRole);
            }
Ejemplo n.º 2
0
        public bool Look(ProtoTask protoTask)
        {
            //TODO: hackish
            _currentRole.ForEachServerMapped(server =>
            {
                protoTask.RegisterRealTasks(server);
            });

            return(true);
        }
        public void Execute()
        {
            bool verifyRan  = false;
            bool executeRan = false;
            bool traceRan   = false;

            var detail = new DeploymentDetail(() =>
            {
                traceRan = true;
                return("trace");
            }, () =>
            {
                verifyRan = true;
                var r     = new DeploymentResult();
                r.AddGood("test:v");
                return(r);
            }, () =>
            {
                executeRan = true;
                var r      = new DeploymentResult();
                r.AddGood("test:e");
                return(r);
            },
                                              () => new DeploymentResult());


            var web = new DeploymentRole("WEB");

            web.AddServer("BILL");
            web.ForEachServerMapped(s => s.AddDetail(detail));

            var plan = new DeploymentPlan();

            plan.AddRole(web);


            var args = new DeploymentArguments
            {
                Role    = "WEB",
                Command = DeploymentCommands.Execute
            };

            plan.Execute();

            Assert.IsTrue(traceRan, "trace");
            Assert.IsTrue(verifyRan, "verify");
            Assert.IsTrue(executeRan, "execute");
        }
        public void Trace()
        {
            bool verifyRan  = false;
            bool executeRan = false;
            bool traceRan   = false;

            var detail = new DeploymentDetail(() =>
            {
                traceRan = true;
                return("trace");
            }, () =>
            {
                verifyRan = true;
                return(new DeploymentResult());
            }, () =>
            {
                executeRan = true;
                return(new DeploymentResult());
            }, () => new DeploymentResult());


            var web = new DeploymentRole("WEB");

            web.AddServer(new DeploymentServer("bob"));
            web.ForEachServerMapped(s => s.AddDetail(detail));

            var plan = new DeploymentPlan();

            plan.AddRole(web);


            var args = new DeploymentArguments
            {
                Role    = "WEB",
                Command = DeploymentCommands.Trace
            };

            plan.Trace();

            Assert.IsTrue(traceRan);
            Assert.IsFalse(verifyRan);
            Assert.IsFalse(executeRan);
        }
Ejemplo n.º 5
0
        public void SetUp()
        {
            var detail = new DeploymentDetail(() => "test detail", () => new DeploymentResult()
            {
                new DeploymentItem(DeploymentItemStatus.Good, "verify")
            }, () => new DeploymentResult()
            {
                new DeploymentItem(DeploymentItemStatus.Good, "execute")
            }, () => new DeploymentResult());
            var webRole = new DeploymentRole("Web");

            webRole.AddServer(new DeploymentServer("SrvWeb1"));
            webRole.AddServer(new DeploymentServer("SrvWeb2"));
            webRole.ForEachServerMapped(s => s.AddDetail(detail));
            var dbRole = new DeploymentRole("Db");

            dbRole.AddServer("SrvDb");
            dbRole.ForEachServerMapped(s => s.AddDetail(detail));
            Plan = new DeploymentPlan();
            Plan.AddRole(webRole);
            Plan.AddRole(dbRole);

            BecauseOf();
        }