Ejemplo n.º 1
0
        public void DeployHelloWorld()
        {
            IFileSystem       fileSystem = new FileSystem();
            var               settings   = new DeploymentSettings(@"C:\dev\test-profile\");
            IBottleRepository bottles    = new BottleRepository(fileSystem, new PackageExploder(new ZipFileService(fileSystem), new PackageExploderLogger(s => { }), fileSystem), settings);

            var initializer = new IisFubuInitializer(fileSystem, new DeploymentSettings());

            var deployer = new IisFubuDeployer(fileSystem, bottles);


            var directive = new FubuWebsite();

            directive.HostBottle          = "test";
            directive.WebsiteName         = "fubu";
            directive.WebsitePhysicalPath = @"C:\dev\test-web";
            directive.VDir             = "bob";
            directive.VDirPhysicalPath = @"C:\dev\test-app";
            directive.AppPool          = "fubizzle";

            directive.DirectoryBrowsing = Activation.Enable;


            initializer.Execute(directive, new HostManifest("something"), new PackageLog());

            var host = new HostManifest("a");

            deployer.Execute(directive, host, new PackageLog());
        }
        public void SetUp()
        {
            var writer = new DeploymentWriter("profile2");

            var host = writer.RecipeFor("r1").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"
                              });

            writer.Flush(FlushOptions.Wipeout);

            var env = new EnvironmentSettings();
            theHost = HostReader.ReadFrom("profile2/recipes/r1/h1.host");
        }
        public void DeployHelloWorld()
        {
            IFileSystem fileSystem = new FileSystem();
            var settings = new DeploymentSettings(@"C:\dev\test-profile\");
            IBottleRepository bottles = new BottleRepository(fileSystem, new PackageExploder(new ZipFileService(fileSystem), new PackageExploderLogger(s=>{ }), fileSystem ), settings);

            var initializer = new IisFubuInitializer(fileSystem, new DeploymentSettings());

            var deployer = new IisFubuDeployer(fileSystem, bottles);

            var directive = new FubuWebsite();
            directive.HostBottle = "test";
            directive.WebsiteName = "fubu";
            directive.WebsitePhysicalPath = @"C:\dev\test-web";
            directive.VDir = "bob";
            directive.VDirPhysicalPath = @"C:\dev\test-app";
            directive.AppPool = "fubizzle";

            directive.DirectoryBrowsing = Activation.Enable;

            initializer.Execute(directive, new HostManifest("something"), new PackageLog());

            var host = new HostManifest("a");

            deployer.Execute(directive, host, new PackageLog());
        }
Ejemplo n.º 4
0
        public void SetUp()
        {
            var writer = new DeploymentWriter("profile2");

            var host = writer.RecipeFor("r1").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"
            });

            writer.Flush(FlushOptions.Wipeout);

            theHost = HostReader.ReadFrom("profile2/recipes/r1/h1.host", new EnvironmentSettings());
        }
Ejemplo n.º 5
0
        public void Attach(HostManifest host, IDirective directive)
        {
            _host      = host;
            _directive = (T)directive;

            _diagnostics.LogDirective(host, directive);
        }
Ejemplo n.º 6
0
        public void Execute(ConfigurationDirectory directive, HostManifest host, IPackageLog log)
        {
            // copy the environment settings there
            // explode the bottles out to there
            // log each file to there

            var configDirectory = directive.ConfigDirectory.CombineToPath(_deploymentSettings.TargetDirectory);

            _fileSystem.Copy(_deploymentSettings.EnvironmentFile, configDirectory);

            var destinationDirectory = FileSystem.Combine(_deploymentSettings.TargetDirectory,
                                                          directive.ConfigDirectory);

            // TODO -- diagnostics?
            host.BottleReferences.Each(x =>
            {
                var request = new BottleExplosionRequest(new PackageLog())
                {
                    BottleDirectory      = BottleFiles.ConfigFolder,
                    BottleName           = x.Name,
                    DestinationDirectory = destinationDirectory
                };

                _repository.ExplodeFiles(request);
            });
        }
Ejemplo n.º 7
0
        protected override void beforeEach()
        {
            theHost      = new HostManifest("something");
            theDirective = new OneDirective();

            ClassUnderTest.Attach(theHost, theDirective);
        }
Ejemplo n.º 8
0
        public void does_not_set_a_property_that_is_not_explicitly_configured()
        {
            var host = new HostManifest("h1");

            host.RegisterSettings(data4);

            // the default value for Name is "somebody"
            host.GetDirective <OneDirective>().Name.ShouldEqual("somebody");
        }
Ejemplo n.º 9
0
        public IEnumerable <IDirectiveRunner> BuildRunnersFor(HostManifest host)
        {
            foreach (var directive in host.BuildDirectives(_types))
            {
                var runner = Build(directive);
                runner.Attach(host, directive);

                yield return(runner);
            }
        }
Ejemplo n.º 10
0
        public void Execute(Website website, HostManifest host, IPackageLog log)
        {
            // TODO -- more logging!!!!

            new IisWebsiteCreator().Create(website);

            var destination = new FubuBottleDestination(website.VDirPhysicalPath);

            _bottleMover.Move(destination, host.BottleReferences);
        }
Ejemplo n.º 11
0
        public IEnumerable<IDirectiveRunner> BuildRunnersFor(HostManifest host)
        {
            foreach (var directive in host.BuildDirectives(_types))
            {
                var runner = Build(directive);
                runner.Attach(host, directive);

                yield return runner;
            }
        }
Ejemplo n.º 12
0
        public void can_pull_setting_class_out_of_request_data()
        {
            var host = new HostManifest("host1");

            host.RegisterSettings(data3);

            var directive = host.GetDirective <TwoDirective>();

            directive.City.ShouldEqual("Austin");
            directive.IsDomestic.ShouldBeTrue();
        }
Ejemplo n.º 13
0
        public IEnumerable<IDirectiveRunner> BuildRunnersFor(DeploymentPlan plan, HostManifest host)
        {
            BuildDirectives(plan, host, _types);
            foreach (var directive in host.Directives)
            {
                var runner = Build(directive);
                runner.Attach(host, directive);

                yield return runner;
            }
        }
Ejemplo n.º 14
0
        public void can_pull_setting_class_out_of_multiple_data_settings_with_no_conflict()
        {
            var host = new HostManifest("host1");

            host.RegisterSettings(data1);
            host.RegisterSettings(data4);

            var directive = host.GetDirective <OneDirective>();

            directive.Name.ShouldEqual("Max");
            directive.Age.ShouldEqual(7);
        }
Ejemplo n.º 15
0
        public void append_host_respects_setting_order()
        {
            var host1 = new HostManifest("h1");
            host1.RegisterSettings(data4);

            var host2 = new HostManifest("h2");
            host2.RegisterSettings(data5);

            host1.Append(host2);

            host1.CreateDiagnosticReport().First(x => x.Key == "OneDirective.Age").Value.ShouldEqual("7");
        }
Ejemplo n.º 16
0
        public void append_host_imports_bottle_references_but_does_not_duplicate()
        {
            var host1 = new HostManifest("h1");
            host1.RegisterBottle(new BottleReference("b1"));

            var host2 = new HostManifest("h2");
            host2.RegisterBottle(new BottleReference("b1"));

            host1.Append(host2);

            host1.BottleReferences.ShouldHaveTheSameElementsAs(new BottleReference("b1"));
        }
Ejemplo n.º 17
0
        public void append_host_respects_setting_order()
        {
            var host1 = new HostManifest("h1");
            host1.RegisterSettings(data4);

            var host2 = new HostManifest("h2");
            host2.RegisterSettings(data5);

            host1.Append(host2);

            host1.GetDirective<OneDirective>().Age.ShouldEqual(7);
        }
Ejemplo n.º 18
0
        public void Execute(ScheduledTask directive, HostManifest host, IPackageLog log)
        {
            var psi = new ProcessStartInfo("schtasks");

            var args = @"/create /tn {0} /sc {1} /mo {2} /ru {3} /tr {4};".ToFormat(directive.Name, directive.ScheduleType, directive.Modifier, directive.UserAccount, directive.TaskToRun);

            psi.Arguments = args;

            log.Trace(args);

            _runner.Run(psi, new TimeSpan(0, 0, 1, 0));
        }
Ejemplo n.º 19
0
        public void do_not_bind_complex_child_if_no_data_exists()
        {
            var host = new HostManifest("host1");

            var data = new SettingsData()
                       .With("ComplexDirective.One.Name", "Thurgood")
                       .With("ComplexDirective.One.Age", "57");

            host.RegisterSettings(data);

            var complex = host.GetDirective <ComplexDirective>();

            complex.One.ShouldNotBeNull();
            complex.Two.ShouldBeNull();
        }
Ejemplo n.º 20
0
        public static HostManifest ReadFrom(string fileName, EnvironmentSettings environment)
        {
            var parser = new SettingsParser(fileName, environment.Overrides.ToDictionary());
            new FileSystem().ReadTextFile(fileName, parser.ParseText);

            var hostName = Path.GetFileNameWithoutExtension(fileName);
            var host = new HostManifest(hostName);

            var settings = parser.Settings;

            host.RegisterSettings(settings);
            host.RegisterBottles(parser.References);

            return host;
        }
Ejemplo n.º 21
0
        public void append_host_imports_bottle_references_but_does_not_duplicate()
        {
            var host1 = new HostManifest("h1");

            host1.RegisterBottle(new BottleReference("b1"));


            var host2 = new HostManifest("h2");

            host2.RegisterBottle(new BottleReference("b1"));


            host1.Append(host2);

            host1.BottleReferences.ShouldHaveTheSameElementsAs(new BottleReference("b1"));
        }
Ejemplo n.º 22
0
        public void respects_ordering_of_setting_data()
        {
            var host1 = new HostManifest("h1");

            host1.RegisterSettings(data4);
            host1.RegisterSettings(data5);

            host1.GetDirective <OneDirective>().Age.ShouldEqual(7);

            var host2 = new HostManifest("h2");

            host2.RegisterSettings(data5);
            host2.RegisterSettings(data4);

            host2.GetDirective <OneDirective>().Age.ShouldEqual(8);
        }
Ejemplo n.º 23
0
        public void append_host_respects_setting_order()
        {
            var host1 = new HostManifest("h1");

            host1.RegisterSettings(data4);


            var host2 = new HostManifest("h2");

            host2.RegisterSettings(data5);


            host1.Append(host2);

            host1.GetDirective <OneDirective>().Age.ShouldEqual(7);
        }
Ejemplo n.º 24
0
        public static HostManifest ReadFrom(string fileName, EnvironmentSettings environment)
        {
            var parser = new SettingsParser(fileName, environment.Overrides.ToDictionary());

            new FileSystem().ReadTextFile(fileName, parser.ParseText);

            var hostName = Path.GetFileNameWithoutExtension(fileName);
            var host     = new HostManifest(hostName);


            var settings = parser.Settings;

            host.RegisterSettings(settings);
            host.RegisterBottles(parser.References);

            return(host);
        }
Ejemplo n.º 25
0
        public void Execute(FubuWebsite directive, HostManifest host, IPackageLog log)
        {
            if (_settings.UserForced)
            {
                log.Trace("UserForced: deleting directories");
                _fileSystem.DeleteDirectory(directive.WebsitePhysicalPath);
                _fileSystem.DeleteDirectory(directive.VDirPhysicalPath);
            }

            _fileSystem.CreateDirectory(directive.WebsitePhysicalPath);
            _fileSystem.CreateDirectory(directive.VDirPhysicalPath);

            var appOfflineFile = FileSystem.Combine(directive.VDirPhysicalPath, "app_offline.htm");

            log.Trace("Applying the application offline file");
            _fileSystem.WriteStringToFile(appOfflineFile, "&lt;html&gt;&lt;body&gt;Application is being rebuilt&lt;/body&gt;&lt;/html&gt;");
        }
Ejemplo n.º 26
0
        public void can_pull_complex_settings()
        {
            var host = new HostManifest("host1");

            var data = new SettingsData()
                       .With("ComplexDirective.One.Name", "Thurgood")
                       .With("ComplexDirective.One.Age", "57")
                       .With("ComplexDirective.Two.City", "Joplin");

            host.RegisterSettings(data);

            var complex = host.GetDirective <ComplexDirective>();

            complex.One.Name.ShouldEqual("Thurgood");
            complex.One.Age.ShouldEqual(57);
            complex.Two.City.ShouldEqual("Joplin");
        }
        public void Execute(Roundhouse directive, HostManifest host, IPackageLog log)
        {
            var destinationDirectory = directive.GetDirectory();

            new FileSystem().CleanDirectory(destinationDirectory);

            host.BottleReferences.Each(b =>
            {
                _bottleRepository.ExplodeFiles(new BottleExplosionRequest()
                {
                    BottleDirectory      = BottleFiles.DataFolder,
                    CopyBehavior         = CopyBehavior.overwrite,
                    BottleName           = b.Name,
                    DestinationDirectory = destinationDirectory
                });
            });

            rh(directive, destinationDirectory);
        }
Ejemplo n.º 28
0
        public void Execute(TopshelfService directive, HostManifest host, IPackageLog log)
        {
            //copy out TS host
            _bottles.ExplodeTo("bottlehost", directive.InstallLocation);

            //copy out service bottle exploded
            var location = FileSystem.Combine(directive.InstallLocation, "svc");

            _bottles.ExplodeTo(directive.HostBottle, location);

            var args = buildInstallArgs(directive);
            var psi  = new ProcessStartInfo("Bottles.Host.exe")
            {
                Arguments        = args,
                WorkingDirectory = directive.InstallLocation
            };

            _runner.Run(psi);
        }
Ejemplo n.º 29
0
        public void get_all_unique_directive_names()
        {
            var host = new HostManifest("h1");

            host.RegisterSettings(data1);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective");

            host.RegisterSettings(data2);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective", "ThreeDirective");

            host.RegisterSettings(data3);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective", "ThreeDirective", "TwoDirective");

            host.RegisterSettings(data4);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective", "ThreeDirective", "TwoDirective");

            host.RegisterSettings(data5);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective", "ThreeDirective", "TwoDirective");
        }
Ejemplo n.º 30
0
        protected override void beforeEach()
        {
            theHost      = new HostManifest("something");
            theDirective = new OneDirective();



            theDeployers = Services.CreateMockArrayFor <IDeployer <OneDirective> >(5);

            theLogs = new PackageLog[5];
            for (int i = 0; i < theLogs.Length; i++)
            {
                theLogs[i] = new PackageLog();
                MockFor <IDeploymentDiagnostics>().Expect(x => x.LogAction(theHost, theDirective, theDeployers[i]))
                .Return(theLogs[i]);
            }

            ClassUnderTest.Attach(theHost, theDirective);
            ClassUnderTest.Deploy();
        }
        public void HostManifest_can_create_all_directives_for_itself()
        {
            var host = new HostManifest("h1");
            host.RegisterValue<BottleDeployers1.OneDirective>(x => x.Age, 11);
            host.RegisterValue<BottleDeployers1.OneDirective>(x => x.Name, "Robert");

            host.RegisterValue<BottleDeployers2.SixDirective>(x => x.Direction, "North");
            host.RegisterValue<BottleDeployers2.SixDirective>(x => x.Threshold, 5);

            var registry = theContainer.GetInstance<DirectiveTypeRegistry>();
            var directives = host.BuildDirectives(registry);

            directives.Count().ShouldEqual(2);
            var directiveOne = directives.OfType<BottleDeployers1.OneDirective>().Single();
            directiveOne.Age.ShouldEqual(11);
            directiveOne.Name.ShouldEqual("Robert");

            var directiveSix = directives.OfType<SixDirective>().Single();
            directiveSix.Direction.ShouldEqual("North");
            directiveSix.Threshold.ShouldEqual(5);
        }
Ejemplo n.º 32
0
        public static HostManifest ReadFrom(string fileName)
        {
            var parser = new SettingsParser(fileName);
            try
            {
                new FileSystem().ReadTextFile(fileName, parser.ParseText);
            }
            catch (Exception ex)
            {
                var message = "Failed trying to read " + fileName;
                throw new ApplicationException(message, ex);
            }

            var hostName = Path.GetFileNameWithoutExtension(fileName);
            var host = new HostManifest(hostName);

            var settings = parser.Settings;

            host.RegisterSettings(settings);
            host.RegisterBottles(parser.References);

            return host;
        }
Ejemplo n.º 33
0
        public void Execute(FubuWebsite directive, HostManifest host, IPackageLog log)
        {
            //currenly only IIS 7
            using (var iisManager = new ServerManager())
            {
                var pool = iisManager.CreateAppPool(directive.AppPool);
                pool.ManagedRuntimeVersion = "v4.0";
                pool.ManagedPipelineMode   = ManagedPipelineMode.Integrated;
                pool.Enable32BitAppOnWin64 = false;

                if (directive.HasCredentials())
                {
                    pool.ProcessModel.UserName = directive.Username;
                    pool.ProcessModel.Password = directive.Password;
                }

                var site = iisManager.CreateSite(directive.WebsiteName, directive.WebsitePhysicalPath, directive.Port);


                var app = site.CreateApplication(directive.VDir, directive.VDirPhysicalPath);
                app.ApplicationPoolName = directive.AppPool;

                //flush the changes so that we can now tweak them.
                iisManager.CommitChanges();

                app.DirectoryBrowsing(directive.DirectoryBrowsing);

                //app.AnonAuthentication(direc.AnonAuth);
                //app.BasicAuthentication(direc.BasicAuth);
                //app.WindowsAuthentication(direc.WindowsAuth);

                app.MapAspNetToEverything();
                iisManager.CommitChanges();
            }

            // TODO -- deal with bottle references
        }
Ejemplo n.º 34
0
        public void HostManifest_can_create_all_directives_for_itself()
        {
            var host = new HostManifest("h1");

            host.RegisterValue <BottleDeployers1.OneDirective>(x => x.Age, 11);
            host.RegisterValue <BottleDeployers1.OneDirective>(x => x.Name, "Robert");

            host.RegisterValue <BottleDeployers2.SixDirective>(x => x.Direction, "North");
            host.RegisterValue <BottleDeployers2.SixDirective>(x => x.Threshold, 5);

            var registry   = theContainer.GetInstance <DirectiveTypeRegistry>();
            var directives = host.BuildDirectives(registry);

            directives.Count().ShouldEqual(2);
            var directiveOne = directives.OfType <BottleDeployers1.OneDirective>().Single();

            directiveOne.Age.ShouldEqual(11);
            directiveOne.Name.ShouldEqual("Robert");

            var directiveSix = directives.OfType <SixDirective>().Single();

            directiveSix.Direction.ShouldEqual("North");
            directiveSix.Threshold.ShouldEqual(5);
        }
        public void HostManifest_can_create_all_directives_for_itself()
        {
            var host = new HostManifest("h1");
            host.RegisterValue<BottleDeployers1.OneDirective>(x => x.Age, 11);
            host.RegisterValue<BottleDeployers1.OneDirective>(x => x.Name, "Robert");

            host.RegisterValue<BottleDeployers2.SixDirective>(x => x.Direction, "North");
            host.RegisterValue<BottleDeployers2.SixDirective>(x => x.Threshold, 5);

            var registry = theContainer.GetInstance<DirectiveTypeRegistry>();

            var factory = theContainer.GetInstance<DirectiveRunnerFactory>();

            var profile = new Profile("profile1");
            profile.AddRecipe("something");

            var plan = new DeploymentPlan(new DeploymentOptions(), new DeploymentGraph(){
                Environment = new EnvironmentSettings(),
                Profile = profile,
                Recipes = new Recipe[]{new Recipe("something"), },
                Settings = new DeploymentSettings()

            });

            factory.BuildDirectives(plan, host, registry);
            var directives = host.Directives;

            directives.Count().ShouldEqual(2);
            var directiveOne = directives.OfType<BottleDeployers1.OneDirective>().Single();
            directiveOne.Age.ShouldEqual(11);
            directiveOne.Name.ShouldEqual("Robert");

            var directiveSix = directives.OfType<SixDirective>().Single();
            directiveSix.Direction.ShouldEqual("North");
            directiveSix.Threshold.ShouldEqual(5);
        }
Ejemplo n.º 36
0
        private IEnumerable<HtmlTag> writeHostSettings(string provRoot, HostManifest host)
        {
            yield return new HtmlTag("h4").Text(host.Name);

            var settingDataSources = host.CreateDiagnosticReport();

            yield return writeSettings(provRoot, settingDataSources);
        }
Ejemplo n.º 37
0
 public void Execute(T directive, HostManifest host, IPackageLog log)
 {
     DeploymentRecorder.Directives.Add(directive);
 }
Ejemplo n.º 38
0
 //public void LogInitialization(IInitializer initializer, IDirective directive)
 //{
 //    LogObject(initializer, "Running initializer for directive '{0}'".ToFormat(directive));
 //    LogFor(directive).AddChild(initializer);
 //}
 //public void LogFinalization(IFinalizer finalizer, IDirective directive)
 //{
 //    LogObject(finalizer, "Running finalizer for directive '{0}'".ToFormat(directive));
 //    LogFor(directive).AddChild(finalizer);
 //}
 //public void LogDeployment(IDeployer deployer, IDirective directive)
 //{
 //    LogObject(deployer, "Running with directive '{0}'".ToFormat(directive));
 //    LogFor(directive).AddChild(deployer);
 //}
 public void LogHost(HostManifest hostManifest)
 {
     LogObject(hostManifest, "Deploying host from deployment ???");
     LogFor("deploymentname").AddChild(hostManifest);
 }
Ejemplo n.º 39
0
        public void can_pull_setting_class_out_of_multiple_data_settings_with_no_conflict()
        {
            var host = new HostManifest("host1");
            host.RegisterSettings(data1);
            host.RegisterSettings(data4);

            var directive = host.GetDirective<OneDirective>();
            directive.Name.ShouldEqual("Max");
            directive.Age.ShouldEqual(7);
        }
Ejemplo n.º 40
0
        // overridden in testing classes
        public virtual void BuildDirectives(DeploymentPlan plan, HostManifest host, IDirectiveTypeRegistry typeRegistry)
        {
            var provider = SettingsProvider.For(host.AllSettingsData().Union(plan.Substitutions()).ToArray());

            host.BuildDirectives(provider, typeRegistry);
        }
Ejemplo n.º 41
0
        //public void LogInitialization(IInitializer initializer, IDirective directive)
        //{
        //    LogObject(initializer, "Running initializer for directive '{0}'".ToFormat(directive));
        //    LogFor(directive).AddChild(initializer);
        //}

        //public void LogFinalization(IFinalizer finalizer, IDirective directive)
        //{
        //    LogObject(finalizer, "Running finalizer for directive '{0}'".ToFormat(directive));
        //    LogFor(directive).AddChild(finalizer);
        //}

        //public void LogDeployment(IDeployer deployer, IDirective directive)
        //{
        //    LogObject(deployer, "Running with directive '{0}'".ToFormat(directive));
        //    LogFor(directive).AddChild(deployer);
        //}

        public void LogHost(HostManifest hostManifest)
        {
            LogObject(hostManifest, "Deploying host from deployment ???");
            LogFor("deploymentname").AddChild(hostManifest);
        }
Ejemplo n.º 42
0
 public void LogHost(HostManifest hostManifest, Action<HostManifest> action)
 {
     action(hostManifest);
 }
Ejemplo n.º 43
0
 public void Execute(T directive, HostManifest host, IPackageLog log)
 {
     PassedInDirective = directive;
     DeployWasCalled   = true;
 }
Ejemplo n.º 44
0
 public void LogDirective(HostManifest host, IDirective directive)
 {
 }
Ejemplo n.º 45
0
        public void respects_ordering_of_setting_data()
        {
            var host1 = new HostManifest("h1");
            host1.RegisterSettings(data4);
            host1.RegisterSettings(data5);

            host1.GetDirective<OneDirective>().Age.ShouldEqual(7);

            var host2 = new HostManifest("h2");
            host2.RegisterSettings(data5);
            host2.RegisterSettings(data4);

            host2.GetDirective<OneDirective>().Age.ShouldEqual(8);
        }
Ejemplo n.º 46
0
        public void respects_ordering_for_diagnostics_report()
        {
            var host1 = new HostManifest("h1");
            host1.RegisterSettings(data4); //age 7
            host1.RegisterSettings(data5); //age 8

            var dia = host1.CreateDiagnosticReport();
            dia.Single().Value.ShouldEqual("7");

            var host2 = new HostManifest("h1");
            host2.RegisterSettings(data5); //age 8
            host2.RegisterSettings(data4); //age 7

            var dia2 = host2.CreateDiagnosticReport();
            dia2.Single().Value.ShouldEqual("8");
        }
Ejemplo n.º 47
0
        public void can_pull_complex_settings()
        {
            var host = new HostManifest("host1");

            var data = new SettingsData()
                .With("ComplexDirective.One.Name", "Thurgood")
                .With("ComplexDirective.One.Age", "57")
                .With("ComplexDirective.Two.City", "Joplin");

            host.RegisterSettings(data);

            var complex = host.GetDirective<ComplexDirective>();

            complex.One.Name.ShouldEqual("Thurgood");
            complex.One.Age.ShouldEqual(57);
            complex.Two.City.ShouldEqual("Joplin");
        }
Ejemplo n.º 48
0
 public PackageLog LogAction(HostManifest host, IDirective directive, object action)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 49
0
 public void LogDirective(HostManifest host, IDirective directive)
 {
     LogObject(directive, "Found in '{0}'".ToFormat(host));
     LogFor(host).AddChild(directive);
 }
Ejemplo n.º 50
0
 public void LogDirective(HostManifest host, IDirective directive)
 {
     LogObject(directive, "Found in '{0}'".ToFormat(host));
     LogFor(host).AddChild(directive);
 }
Ejemplo n.º 51
0
 public void Execute(T directive, HostManifest host, IPackageLog log)
 {
     directive.As <FakeDirective>().HitIt();
 }
Ejemplo n.º 52
0
        public void get_all_unique_directive_names()
        {
            var host = new HostManifest("h1");

            host.RegisterSettings(data1);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective");

            host.RegisterSettings(data2);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective", "ThreeDirective");

            host.RegisterSettings(data3);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective", "ThreeDirective", "TwoDirective");

            host.RegisterSettings(data4);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective", "ThreeDirective", "TwoDirective");

            host.RegisterSettings(data5);
            host.UniqueDirectiveNames().ShouldHaveTheSameElementsAs("OneDirective", "ThreeDirective", "TwoDirective");
        }
Ejemplo n.º 53
0
 public void RegisterHost(HostManifest host)
 {
     _hosts[host.Name] = host;
 }
Ejemplo n.º 54
0
 public IPackageLog LogAction(HostManifest host, IDirective directive, object action, string description)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 55
0
        public void do_not_bind_complex_child_if_no_data_exists()
        {
            var host = new HostManifest("host1");

            var data = new SettingsData()
                .With("ComplexDirective.One.Name", "Thurgood")
                .With("ComplexDirective.One.Age", "57");

            host.RegisterSettings(data);

            var complex = host.GetDirective<ComplexDirective>();
            complex.One.ShouldNotBeNull();
            complex.Two.ShouldBeNull();
        }
Ejemplo n.º 56
0
 public void LogHost(DeploymentPlan plan, HostManifest hostManifest)
 {
 }
Ejemplo n.º 57
0
        public void does_not_set_a_property_that_is_not_explicitly_configured()
        {
            var host = new HostManifest("h1");
            host.RegisterSettings(data4);

            // the default value for Name is "somebody"
            host.GetDirective<OneDirective>().Name.ShouldEqual("somebody");
        }
Ejemplo n.º 58
0
        public void can_pull_setting_class_out_of_request_data()
        {
            var host = new HostManifest("host1");
            host.RegisterSettings(data3);

            var directive = host.GetDirective<TwoDirective>();
            directive.City.ShouldEqual("Austin");
            directive.IsDomestic.ShouldBeTrue();
        }
Ejemplo n.º 59
0
 public void LogHost(HostManifest hostManifest)
 {
 }