Пример #1
0
        public void StartUp()
        {
            try
            {
                var application = _applicationSource.BuildApplication();
                var runtime     = application.Bootstrap();
                _server = new EmbeddedFubuMvcServer(runtime, _physicalPath, _port);

                EventAggregator.SendMessage(new ApplicationStarted
                {
                    ApplicationName = _applicationSource.GetType().Name,
                    HomeAddress     = _server.BaseAddress,
                    Timestamp       = DateTime.Now,
                    Watcher         = runtime.Factory.Get <AssetSettings>().CreateFileWatcherManifest()
                });
            }
            catch (KatanaRightsException e)
            {
                EventAggregator.SendMessage(new InvalidApplication
                {
                    ExceptionText = e.Message,
                    Message       = "Access denied."
                });
            }
            catch (Exception e)
            {
                EventAggregator.SendMessage(new InvalidApplication
                {
                    ExceptionText = e.ToString(),
                    Message       = "Bootstrapping {0} Failed!".ToFormat(_applicationSource.GetType().Name)
                });
            }
        }
Пример #2
0
        public void StartUp()
        {
            try
            {
                var application = _applicationSource.BuildApplication();
                var runtime     = application.Bootstrap();
                _server = new EmbeddedFubuMvcServer(runtime, _physicalPath, _port);

                var list = new List <string>();
                PackageRegistry.Packages.Each(pak => pak.ForFolder(BottleFiles.WebContentFolder, list.Add));

                EventAggregator.SendMessage(new ApplicationStarted
                {
                    ApplicationName      = _applicationSource.GetType().Name,
                    HomeAddress          = _server.BaseAddress,
                    Timestamp            = DateTime.Now,
                    BottleContentFolders = list.ToArray()
                });
            }
            catch (Exception e)
            {
                EventAggregator.SendMessage(new InvalidApplication
                {
                    ExceptionText = e.ToString(),
                    Message       = "Bootstrapping {0} Failed!".ToFormat(_applicationSource.GetType().Name)
                });
            }
        }
Пример #3
0
        public void AddApplication(IApplicationSource source)
        {
            var settings    = ApplicationSettings.ReadByName(source.GetType().Name);
            var application = new ApplicationUnderTest(source, settings, _browserBuilder);

            _applications.AddApplication(application);
        }
Пример #4
0
 public ApplicationUnderTest(IApplicationSource source, ApplicationSettings settings, IBrowserLifecycle browser)
     : this(source.GetType().Name, settings.RootUrl, browser, () =>
 {
     var app = source.BuildApplication();
     return(app.Bootstrap().Factory);
 })
 {
 }
Пример #5
0
 public ApplicationUnderTest(IApplicationSource source, ApplicationSettings settings, IBrowserLifecycle browser)
     : this(source.GetType().Name, settings.RootUrl, browser, () =>
     {
         var app = source.BuildApplication();
         return app.Bootstrap().Factory;
     })
 {
 }
Пример #6
0
        public ApplicationUnderTest(IApplicationSource source, ApplicationSettings settings, Func <IWebDriver> createWebDriver)
            : this(source.GetType().Name, settings.RootUrl, createWebDriver, () =>
        {
            var app = source.BuildApplication();

            app.ModifyRegistry(r => r.Services(x =>
            {
                x.ReplaceService <ICurrentHttpRequest>(new StubCurrentHttpRequest
                {
                    ApplicationRoot = settings.RootUrl
                });
            }));

            app.Bootstrap();


            return(app.Facility);
        })
        {
        }