Esempio n. 1
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)
                });
            }
        }
Esempio n. 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)
                });
            }
        }
Esempio n. 3
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)
                });
            }
        }
Esempio n. 4
0
 public static void Run(Action <EndpointDriver> action)
 {
     using (var server = EmbeddedFubuMvcServer.For <HarnessApplication>())
     {
         action(server.Endpoints);
     }
 }
        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)
                });
            }
        }
Esempio n. 6
0
 public void no_longer_puts_localhost_in_the_resolved_url()
 {
     using (var server = EmbeddedFubuMvcServer.For <HarnessApplication>())
     {
         server.Endpoints.Get <UrlEndpoints>(x => x.get_green())
         .ReadAsText().ShouldEqual("/green");
     }
 }
Esempio n. 7
0
        public static void Start()
        {
            FubuMvcPackageFacility.PhysicalRootPath = GetRootDirectory();

            int port = PortFinder.FindPort(5501);

            _server = EmbeddedFubuMvcServer.For <HarnessApplication>(GetRootDirectory(), port);
        }
Esempio n. 8
0
        public static void Start()
        {
            FubuMvcPackageFacility.PhysicalRootPath = GetRootDirectory();

            int port = PortFinder.FindPort(5501);

            _server = EmbeddedFubuMvcServer.For<HarnessApplication>(GetRootDirectory(), port);
        }
 public void hit_the_home_page()
 {
     using (var server = EmbeddedFubuMvcServer.For <MyApplication>())
     {
         server.Endpoints.Get <HomeEndpoint>(x => x.Index()).ReadAsText()
         .ShouldEqual("Hello, you've just built your first FubuMVC application");
     }
 }
Esempio n. 10
0
        public IApplicationUnderTest Start(ApplicationSettings settings, FubuRuntime runtime, IBrowserLifecycle lifecycle)
        {
            var port = PortFinder.FindPort(settings.Port);
            _server = new EmbeddedFubuMvcServer(runtime, settings.PhysicalPath, port);

            settings.RootUrl = _server.BaseAddress;
            return new ApplicationUnderTest(runtime, settings, lifecycle);
        }
Esempio n. 11
0
 public static void WithSpecialPath()
 {
     // SAMPLE: katana-with-explicit-path
     using (var server = EmbeddedFubuMvcServer.For <SimpleApplication>(physicalPath: "../../../SimpleApplication"))
     {
     }
     // ENDSAMPLE
 }
Esempio n. 12
0
 // The FubuMVC team recommends that you use an IApplicationSource
 // to contain your bootstrapping code
 public static void WithApplicationSource()
 {
     using (var server = EmbeddedFubuMvcServer.For <SimpleApplication>())
     {
         var greeting = server.Endpoints.Get <HelloEndpoint>(x => x.get_greeting());
         Console.WriteLine(greeting);
     }
 }
Esempio n. 13
0
 public static void WithSpecialPort()
 {
     // SAMPLE: katana-with-explicit-port
     using (var server = EmbeddedFubuMvcServer.For <SimpleApplication>(port: 6000))
     {
     }
     // ENDSAMPLE
 }
Esempio n. 14
0
        public IApplicationUnderTest Start(ApplicationSettings settings, FubuRuntime runtime, IBrowserLifecycle lifecycle)
        {
            var port = PortFinder.FindPort(settings.Port);

            _server = new EmbeddedFubuMvcServer(runtime, settings.PhysicalPath, port);

            settings.RootUrl = _server.BaseAddress;
            return(new ApplicationUnderTest(runtime, settings, lifecycle));
        }
        public static void Start()
        {
            FubuMvcPackageFacility.PhysicalRootPath = GetRootDirectory();

            _server =
                FubuApplication.For<HarnessRegistry>()
                               .StructureMap(new Container())
                               .RunEmbedded(GetRootDirectory(), PortFinder.FindPort(5500));
        }
Esempio n. 16
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Actions.IncludeType <FakeEndpoint>();

            server = FubuApplication.For(registry).StructureMap(new Container())
                     .RunEmbedded(".".ToFullPath());
        }
Esempio n. 17
0
        public static void Start()
        {
            FubuMvcPackageFacility.PhysicalRootPath = GetRootDirectory();

            _server =
                FubuApplication.For <HarnessRegistry>()
                .StructureMap(new Container())
                .RunEmbedded(GetRootDirectory(), PortFinder.FindPort(5500));
        }
Esempio n. 18
0
        private void resetServer()
        {
            if (_server != null)
            {
                _server.SafeDispose();
            }

            _server = _application.BuildApplication().RunEmbedded(runningFolder(), _input.PortFlag);
        }
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<FakeEndpoint>();

            server = FubuApplication.For(registry).StructureMap(new Container())
                                        .RunEmbedded(".".ToFullPath());

        }
Esempio n. 20
0
        public void Shutdown()
        {
            if (_server != null)
            {
                _server.SafeDispose();
            }

            _server = null;
        }
Esempio n. 21
0
        public void the_scheduled_job_visualization_can_be_shown()
        {
            using (var server = EmbeddedFubuMvcServer.For <DiagnosticApplication>(appPath))
            {
                server.Endpoints.Get <ScheduledJobsFubuDiagnostics>(x => x.get_scheduled_jobs())
                .StatusCode.ShouldEqual(HttpStatusCode.OK);
            }

            InMemoryQueueManager.ClearAll();
        }
Esempio n. 22
0
 public void the_lightning_queues_summary_page_can_be_shown()
 {
     // If this test fails on you, try a quick "git clean -xfd" to get rid of the old fubu-content folders,
     // then rake compile to regenerate the bottle content
     using (var server = EmbeddedFubuMvcServer.For <LightningQueuesDiagnosticsApplication>())
     {
         server.Endpoints.Get <LightningQueuesFubuDiagnostics>(x => x.get_queue__managers())
         .StatusCode.ShouldEqual(HttpStatusCode.OK);
     }
 }
        public void SetUp()
        {
            _runner.RunBottles("init src/TestPackage1 pak1");
            _runner.RunBottles("link src/FubuMVC.Core.Assets.IntegrationTesting pak1");

            _server =
                FubuApplication.DefaultPolicies()
                .StructureMap(new Container())
                .RunEmbedded(port: PortFinder.FindPort(5505));
        }
        public static void Start()
        {
            var rootDirectory = GetRootDirectory();
            new FileSystem().DeleteDirectory(rootDirectory.AppendPath(FubuMvcPackageFacility.FubuContentFolder));

            var port = PortFinder.FindPort(5501);

            _server = FubuApplication.For<HarnessRegistry>()
                                     .StructureMap(new Container())
                                     .RunEmbedded(rootDirectory, port);
        }
Esempio n. 25
0
        public void AuthenticationSetup()
        {
            var registry = new FubuRegistry();
            configure(registry);

            theContainer = new Container();

            server = FubuApplication.For(registry).StructureMap(theContainer).RunEmbeddedWithAutoPort();

            beforeEach();
        }
Esempio n. 26
0
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<FakeEndpoint>();

            server = FubuApplication.For(registry).StructureMap(new Container())
                .Packages(x => {
                    x.Assembly(Assembly.GetExecutingAssembly());
                })
                                        .RunEmbedded(".".ToFullPath());
        }
Esempio n. 27
0
        public Harness(FubuRuntime runtime, int port)
        {
            _port   = PortFinder.FindPort(port);
            _server = new EmbeddedFubuMvcServer(runtime, GetApplicationDirectory(), _port);
            _port   = port;

            _remote = new Lazy <RemoteBehaviorGraph>(() =>
            {
                return(new RemoteBehaviorGraph(_server.BaseAddress));
            });
        }
        public void SetUp()
        {
            _runner.RunBottles("init src/TestPackage1 pak1");
            _runner.RunBottles("link src/FubuMVC.Core.Assets.IntegrationTesting pak1");

            _server =
                FubuApplication.DefaultPolicies()
                               .StructureMap(new Container())
                               .RunEmbedded(port: PortFinder.FindPort(5505));

        }
Esempio n. 29
0
 public void with_Katana_and_EndpointDriver()
 {
     using (var server = EmbeddedFubuMvcServer
                         .For <SampleApplication>(port: 5700))
     {
         server.Endpoints.Get("conneg/override/Foo?format=json", acceptType: "text/html")
         .ContentTypeShouldBe(MimeType.Json)
         .ReadAsJson <OverriddenResponse>()
         .Name.ShouldEqual("Foo");
     }
 }
Esempio n. 30
0
        public static void Recycle()
        {
            if (_server != null)
            {
                _server.Dispose();
            }

            var port    = PortFinder.FindPort(5500);
            var runtime = bootstrapRuntime();

            _server = new EmbeddedFubuMvcServer(runtime, GetRootDirectory(), port);
        }
Esempio n. 31
0
        public void SetUp()
        {
            var registry = new FubuRegistry(x =>
            {
                x.Actions.IncludeType <AsyncAction>();
                x.Policies.Add <EarlyReturnConvention>();
            });

            _server = FubuApplication.For(registry)
                      .StructureMap(new Container())
                      .RunEmbedded(port: PortFinder.FindPort(5500));
        }
        public void SetUp()
        {
            var registry = new FubuRegistry(x =>
            {
                x.Actions.IncludeType<AsyncAction>();
                x.Policies.Add<EarlyReturnConvention>();
            });

            _server = FubuApplication .For(registry)
                .StructureMap(new Container())
                .RunEmbedded(port: PortFinder.FindPort(5500));
        }
Esempio n. 33
0
        public void SetUp()
        {
            var registry = new FubuRegistry();

            registry.Actions.IncludeType <FakeEndpoint>();

            server = FubuApplication.For(registry).StructureMap(new Container())
                     .Packages(x => {
                x.Assembly(Assembly.GetExecutingAssembly());
            })
                     .RunEmbedded(".".ToFullPath());
        }
Esempio n. 34
0
        public static void Start()
        {
            var rootDirectory = GetRootDirectory();

            new FileSystem().DeleteDirectory(rootDirectory.AppendPath(FubuMvcPackageFacility.FubuContentFolder));

            var port = PortFinder.FindPort(5501);

            _server = FubuApplication.For <HarnessRegistry>()
                      .StructureMap(new Container())
                      .RunEmbedded(rootDirectory, port);
        }
        public void end_to_end_test()
        {
            using (var server = new EmbeddedFubuMvcServer(theRuntime))
            {
                var response = server.Endpoints.PostJson(new Message1Input());

                theServiceBus.AssertWasCalled(x => x.Send(new Message1()), x => x.IgnoreArguments());


                response.StatusCode.ShouldEqual(HttpStatusCode.OK);
                response.ReadAsText().ShouldContain("\"success\":true");
            }
        }
Esempio n. 36
0
        public void the_subscriptions_visualization_can_be_shown()
        {
            using (var server = EmbeddedFubuMvcServer.For <DiagnosticApplication>(appPath))
            {
                var httpResponse = server.Endpoints.Get <SubscriptionsFubuDiagnostics>(x => x.get_subscriptions());
                if (httpResponse.StatusCode != HttpStatusCode.OK)
                {
                    Assert.Fail(httpResponse.ReadAsText());
                }
            }

            InMemoryQueueManager.ClearAll();
        }
        public void end_to_end_test()
        {
            using (var server = new EmbeddedFubuMvcServer(theRuntime))
            {
                var response = server.Endpoints.PostJson(new Message1Input());

                theServiceBus.AssertWasCalled(x => x.Send(new Message1()), x => x.IgnoreArguments());

                response.StatusCode.ShouldEqual(HttpStatusCode.OK);
                response.ReadAsText().ShouldContain("\"success\":true");

            }
        }
Esempio n. 38
0
        public void Start()
        {
            _controller = _input.BuildRemoteController();
            var context = new StorytellerContext(_controller, _input);

            var container = new Container(new WebApplicationRegistry(_controller, context));

            context.Start();

            var registry = new FubuRegistry();
            registry.AlterSettings<DiagnosticsSettings>(_ => _.TraceLevel = TraceLevel.Verbose);

            _server = FubuApplication.For(registry).StructureMap(container).RunEmbeddedWithAutoPort();
        }
Esempio n. 39
0
        private static List <ContentUrl> findInitialContentUrlList(EmbeddedFubuMvcServer server)
        {
            var url = server.Services.GetInstance <IUrlRegistry>().UrlFor <UrlQueryEndpoint>(x => x.get_urls());

            if (url.EndsWith("index.html"))
            {
                url = url.ParentUrl();
            }

            var urls = server.Endpoints.Get(url).ReadAsJson <UrlList>();

            var contentUrls = urls.Urls.Select(x => new ContentUrl(x)).ToList();

            contentUrls.Sort();
            return(contentUrls);
        }
Esempio n. 40
0
        public void show_downgrades_to_none_if_the_security_ixnays_it()
        {
            var container = new Container();

            using (
                EmbeddedFubuMvcServer server = FubuApplication.For <TestRegistry>().StructureMap(container).RunEmbeddedWithAutoPort()
                )
            {
                container.Inject <IFieldAccessRule>(new ShowEditFakePolicy {
                    Logic = r => AccessRight.None
                });

                server.Endpoints.GetByInput(new ShowModel {
                    Name = "Jeremy"
                }).ReadAsText().ShouldBeEmpty();
            }
        }
Esempio n. 41
0
        public void edit_shows_nothing_with_no_access_rights()
        {
            var container = new Container();

            using (
                EmbeddedFubuMvcServer server = FubuApplication.For <TestRegistry>().StructureMap(container).RunEmbeddedWithAutoPort()
                )
            {
                container.Inject <IFieldAccessRule>(new ShowEditFakePolicy {
                    Logic = r => AccessRight.None
                });

                server.Endpoints.GetByInput(new EditModel {
                    Name = "Jeremy"
                }).ReadAsText().ShouldBeEmpty();
            }
        }
Esempio n. 42
0
        public void simplest_example_of_show()
        {
            var container = new Container();

            using (
                EmbeddedFubuMvcServer server = FubuApplication.For <TestRegistry>().StructureMap(container).RunEmbeddedWithAutoPort()
                )
            {
                container.Inject <IFieldAccessRule>(new ShowEditFakePolicy {
                    Logic = r => AccessRight.All
                });

                server.Endpoints.GetByInput(new ShowModel {
                    Name = "Jeremy"
                })
                .ToString()
                .ShouldEqual("<dt><label for=\"Name\">Name</label></dt>\n<dd><span id=\"Name\">Jeremy</span></dd>");
            }
        }
Esempio n. 43
0
        public void edit_downgrades_to_show_when_the_access_rights_make_it_so()
        {
            var container = new Container();

            using (
                EmbeddedFubuMvcServer server = FubuApplication.For <TestRegistry>().StructureMap(container).RunEmbeddedWithAutoPort()
                )
            {
                container.Inject <IFieldAccessRule>(new ShowEditFakePolicy {
                    Logic = r => AccessRight.ReadOnly
                });

                server.Endpoints.GetByInput(new EditModel {
                    Name = "Jeremy"
                })
                .ToString()
                .ShouldEqual("<dt><label for=\"Name\">Name</label></dt>\n<dd><span id=\"Name\">Jeremy</span></dd>");
            }
        }
Esempio n. 44
0
        public Harness(FubuRuntime runtime, int port)
        {
            _port = PortFinder.FindPort(port);
            _server = new EmbeddedFubuMvcServer(runtime, GetApplicationDirectory(), _port);
            _port = port;

            _remote = new Lazy<RemoteBehaviorGraph>(() =>
            {
                return new RemoteBehaviorGraph(_server.BaseAddress);
            });
        }
Esempio n. 45
0
        private void resetServer()
        {
            if (_server != null)
            {
                _server.SafeDispose();
            }

            _server = _application.BuildApplication().RunEmbedded(runningFolder(), _input.PortFlag);
        }
        public void StartServer()
        {
            var port = PortFinder.FindPort(5500);

            _server = FubuApplication.DefaultPolicies().StructureMap(new Container()).RunEmbedded(port:port);
        }
Esempio n. 47
0
        public static void Recycle()
        {
            if (_server != null)
            {
                _server.Dispose();
            }

            FubuMvcPackageFacility.PhysicalRootPath = GetRootDirectory();

            var port = PortFinder.FindPort(5500);
            var runtime = bootstrapRuntime();

            _server = new EmbeddedFubuMvcServer(runtime, GetRootDirectory(), port);
        }
        public void SetUp()
        {
            FubuMode.Mode(FubuMode.Development);

            server = FubuApplication.DefaultPolicies().StructureMap().RunEmbedded(port: PortFinder.FindPort(5500));
        }
Esempio n. 49
0
        public void Shutdown()
        {
            if (_server != null) _server.SafeDispose();

            _server = null;
        }
 public void Setup()
 {
     _application = FubuApplication.For<HarnessRegistry>().StructureMap(new Container()).RunEmbedded();
 }