Exemplo n.º 1
0
        public override void SetUp(ITestContext context)
        {
            _deploymentSettings = context.Retrieve<DeploymentSettings>();
            _deploymentOptions = context.Retrieve<DeploymentOptions>();

            var reader = new DeploymentGraphReader(_deploymentSettings);
            var graph = reader.Read(_deploymentOptions);
            _plan = new DeploymentPlan(_deploymentOptions, graph);
        }
        public void SetUp()
        {
            var writer = new DeploymentWriter("clonewars");

            var recipeDefinition = writer.RecipeFor("r1");
            var host = recipeDefinition.HostFor("h1");

            host.AddDirective(new SimpleSettings
            {
                One = "one",
                Two = "two"
            });

            host.AddDirective(new OneSettings()
            {
                Name = "Jeremy",
                Age = 37
            });

            host.AddReference(new BottleReference()
            {
                Name = "bottle1"
            });

            host.AddReference(new BottleReference()
            {
                Name = "bottle2"
            });

            recipeDefinition.HostFor("h2").AddProperty<ThreeSettings>(x => x.Direction, "North");
            recipeDefinition.HostFor("h3").AddProperty<TwoSettings>(x => x.City, "Austin");

            writer.RecipeFor("r2").HostFor("h3").AddProperty<SimpleSettings>(x => x.One, "one");
            writer.RecipeFor("r3").HostFor("h3").AddProperty<SimpleSettings>(x => x.Two, "two");
            writer.RecipeFor("r4").HostFor("h4").AddProperty<SimpleSettings>(x => x.Two, "ten");
            writer.RecipeFor("r4").HostFor("h5").AddProperty<SimpleSettings>(x => x.Two, "ten");
            writer.RecipeFor("r4").HostFor("h5").AddProperty<SimpleSettings>(x => x.One, "*{dbName}*");

            writer.AddEnvironmentSetting<SimpleSettings>(x => x.Two, "h4", "env-value");
            writer.AddEnvironmentSetting("dbName", "blue");

            writer.ProfileFor("default").AddRecipe("r1");
            writer.ProfileFor("default").AddRecipe("r2");
            writer.ProfileFor("default").AddRecipe("r3");
            writer.ProfileFor("default").AddRecipe("r4");

            writer.Flush(FlushOptions.Wipeout);

            var settings = new DeploymentSettings("clonewars");
            var reader = new DeploymentGraphReader(settings);
            var options = new DeploymentOptions("default");
            var graph = reader.Read(options);
            thePlan = new DeploymentPlan(options, graph);

            theHosts = thePlan.Hosts;
        }