public void SetUp()
        {
            FubuMode.SetUpForDevelopmentMode();
            runtime = FubuApplication.DefaultPolicies().StructureMap().Bootstrap();

            runtime.Factory.Get<FubuDiagnosticsEndpoint>().get__fubu();
        }
        public void StartUp()
        {
            try
            {
                _server = _registry.ToRuntime();

                EventAggregator.SendMessage(new ApplicationStarted
                {
                    ApplicationName = _registry.GetType().Name,
                    HomeAddress = _server.BaseAddress,
                    Timestamp = DateTime.Now,
                    Watcher = _server.Get<AssetSettings>().CreateFileWatcherManifest(_server.Files)
                });
            }
            catch (HostingFailedException 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(_registry.GetType().Name)
                });
            }
        }
示例#3
0
 protected void Application_Start(object sender, EventArgs e)
 {
     _runtime = FubuApplication
         .DefaultPolicies()  // Use the default FubuMVC conventions
         .StructureMap()     // Use a new StructureMap container
         .Bootstrap();
 }
        public void Start()
        {
            _controller = _input.BuildRemoteController();
            var context = new StorytellerContext(_controller, _input);

            if (_controller.BinPath.IsEmpty())
            {
                throw new Exception("Could not determine any BinPath for the testing AppDomain. Has the Storyteller specification project been compiled, \nor is Storyteller using the wrong compilation target maybe?\n\ntype 'st.exe ? open' or st.exe ? run' to see the command usages\n\n");
            }

            context.Start();

            var registry = new FubuRegistry();


            registry.AlterSettings<DiagnosticsSettings>(_ => _.TraceLevel = TraceLevel.Verbose);
            registry.Mode = "development";
            registry.HostWith<NOWIN>();
            registry.Services.For<IRemoteController>().Use(_controller);
            registry.Services.For<StorytellerContext>().Use(context);
            
            registry.Services.IncludeRegistry<WebApplicationRegistry>();


            _server = registry.ToRuntime();
        }
        public void SetUp()
        {
            FubuTransport.Reset();

            // Need to do something about this.  Little ridiculous
            var settings = new BusSettings
            {
                Downstream = "lq.tcp://localhost:2020/downstream".ToUri()
            };

            var container = new Container();
            container.Inject(settings);

            _runtime = FubuTransport.For<DelayedRegistry>().StructureMap(container)
                                       .Bootstrap();

            theServiceBus = _runtime.Factory.Get<IServiceBus>();
            _runtime.Factory.Get<IPersistentQueues>().ClearAll();

            theClock = _runtime.Factory.Get<ISystemTime>().As<SettableClock>();

            message1 = new OneMessage();
            message2 = new OneMessage();
            message3 = new OneMessage();
            message4 = new OneMessage();

            theServiceBus.DelaySend(message1, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message2, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message3, theClock.UtcNow().AddHours(2));
            theServiceBus.DelaySend(message4, theClock.UtcNow().AddHours(2));
        }
示例#6
0
        public MonitoredNodeGroup()
        {
            _port = PortFinder.FindPort(5500);

            AlterSettings<KatanaSettings>(_ =>
            {
                _.AutoHostingEnabled = true;
                _.Port = _port;
            });

            Services(_ =>
            {
                _.ReplaceService<ISchedulePersistence, RavenDbSchedulePersistence>();
                _.ReplaceService<ISubscriptionPersistence, RavenDbSubscriptionPersistence>();
            });

            ReplaceSettings(RavenDbSettings.InMemory());

            Import<MonitoredTransportRegistry>();

            container = new Container(_ => { _.ForSingletonOf<MonitoredNodeGroup>().Use(this); });

            _runtime = FubuApplication.For(this).StructureMap(container).Bootstrap();

            _runtime.Factory.Get<ChannelGraph>().Name = "Monitoring";
            _subscriptions = _runtime.Factory.Get<ISubscriptionPersistence>();
            _schedules = _runtime.Factory.Get<ISchedulePersistence>();
            _store = _runtime.Factory.Get<IDocumentStore>();
        }
        public void SetUp()
        {
            // Need to do something about this.  Little ridiculous
            FubuTransport.SetupForInMemoryTesting();
            TestMessageRecorder.Clear();
            MessageHistory.ClearAll();
            InMemoryQueueManager.ClearAll();

            runtime = FubuTransport.For<DelayedRegistry>().StructureMap(new Container())
                                       .Bootstrap();

            theServiceBus = runtime.Factory.Get<IServiceBus>();

            theClock = runtime.Factory.Get<ISystemTime>().As<SettableClock>();

            message1 = new OneMessage();
            message2 = new OneMessage();
            message3 = new OneMessage();
            message4 = new OneMessage();

            theServiceBus.DelaySend(message1, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message2, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message3, theClock.UtcNow().AddHours(2));
            theServiceBus.DelaySend(message4, theClock.UtcNow().AddHours(2));
        }
示例#8
0
        public IApplicationUnderTest Start(ApplicationSettings settings, FubuRuntime runtime, IBrowserLifecycle lifecycle)
        {
            var application = new ApplicationUnderTest(runtime, settings, lifecycle);
            application.Ping();

            return application;
        }
        public void SetUp()
        {
            _runtime = FubuRuntime.For<ApplicationRegistry>();
            behaviors = _runtime.Get<BehaviorGraph>();

            appChain = behaviors.ChainFor<ApplicationActions>(x => x.get_app_action());
            pakChain = behaviors.ChainFor<PackageActions>(x => x.get_pak_action());
        }
示例#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);
        }
示例#11
0
 public HomeEndpoint(IServiceBus serviceBus, INumberCache cache, FubuHtmlDocument document, FubuRuntime runtime, MessagePumper pumper)
 {
     _serviceBus = serviceBus;
     _cache = cache;
     _document = document;
     _runtime = runtime;
     _pumper = pumper;
 }
示例#12
0
 public static Action<IAppBuilder> ToStartup(FubuRuntime runtime)
 {
     return builder =>
     {
         var host = new FubuOwinHost(runtime.Routes);
         builder.Run(host);
     };
 }
 public void SetUp()
 {
     server = FubuRuntime.Basic(_ =>
     {
         _.Mode = "development";
         _.HostWith<Katana>();
     });
 }
示例#14
0
 protected void Application_Start(object sender, EventArgs e)
 {
     runtime = FubuApplication.BootstrapApplication<FuduApplication>();
     //ObjectFactory.Configure(config =>
     //{
     //    config.For<ITaskService>().Use<TaskService>();
     //});
 }
        public SelfHostHttpMessageHandler(FubuRuntime runtime)
        {
            _runtime = runtime;

            _routes = new RouteCollection();
            _routes.AddRange(runtime.Routes);

            RouteTable.Routes.Clear();
        }
示例#16
0
        protected void Application_Start(object sender, EventArgs e)
        {
            // Simplest possible way to bootstrap w/ StructureMap

            // You can do this if you want:
            //  FubuApplication.DefaultPolicies().StructureMap(new Container()).Bootstrap();

            _runtime = FubuApplication.BootstrapApplication<MyApplication>();
        }
        public void ReplaceRuntime(FubuRuntime runtime)
        {
            _runtime = runtime;

            _routes.Clear();
            _routes.AddRange(runtime.Routes);

            RouteTable.Routes.Clear();
        }
        public void FixtureSetup()
        {
            FubuTransport.AllQueuesInMemory = true;

            theRuntime = FubuTransport.For(x => { }).StructureMap(new Container()).Bootstrap();
            graph = theRuntime.Factory.Get<ChannelGraph>();

            var uri = graph.ReplyChannelFor(InMemoryChannel.Protocol);
            theReplyNode = graph.Single(x => x.Channel.Address == uri);
        }
示例#19
0
        public void Start(FubuRuntime runtime, Action action)
        {
            Console.WriteLine("Starting to listen for requests at http://localhost:" + _listeningEndpoint.Port);

            Console.WriteLine("Listening on Thread " + Thread.CurrentThread.Name);

            _kayakListenerDisposer = _server.Listen(_listeningEndpoint);
            _scheduler.Post(() => ThreadPool.QueueUserWorkItem(o => action()));
            _scheduler.Start();
        }
示例#20
0
        public void Start(FubuRuntime runtime, string rootDirectory)
        {
            _port = PortFinder.FindPort(_port);

            int i = 0;
            while (!tryStartAtPort(rootDirectory, runtime) && i > 3)
            {
                i++;
            }
        }
        public void SetUp()
        {
            registry = new FubuRegistry();
            container = new Lazy<IContainer>(() => {
                var c = new Container(x => x.For<ISettingsSource>().Add<FakeSettingsData>());

                runtime = FubuApplication.For(registry).StructureMap(c).Bootstrap();

                return c;
            });
        }
        public void SetUp()
        {
            OneJob.Executed = TwoJob.Executed = ThreeJob.Executed = 0;

            container = new Container();

            theRuntime = FubuTransport.For<PollingRegistry>().StructureMap(container)
                                       .Bootstrap();

            Wait.Until(() => ThreeJob.Executed > 10, timeoutInMilliseconds:60000);
        }
        public void SetUp()
        {
            var registry = new FubuRegistry(x =>
            {
                x.Actions.IncludeType<AsyncAction>();
                x.Policies.Local.Add<EarlyReturnConvention>();
                x.HostWith<Katana>();
            });

            _server = registry.ToRuntime();
        }
        public void AuthenticationSetup()
        {
            var registry = new FubuRegistry();
            configure(registry);

            registry.Features.Authentication.Enable(true);

            server = registry.ToRuntime();
            theContainer = server.Get<IContainer>();

            beforeEach();
        }
        public void SetUp()
        {
            runtime = FubuRuntime.BasicBus();
            runtime.Get<IContainer>().UseInMemoryDatastore();

            thePersistence = runtime.Get<RavenDbSchedulePersistence>();

            foo1 = new JobStatusDTO {JobKey = "1", NodeName = "foo"};
            foo2 = new JobStatusDTO {JobKey = "2", NodeName = "foo"};
            foo3 = new JobStatusDTO {JobKey = "3", NodeName = "foo"};
            bar1 = new JobStatusDTO {JobKey = "1", NodeName = "bar"};
            bar2 = new JobStatusDTO {JobKey = "2", NodeName = "bar"};

            thePersistence.Persist(new[] {foo1, foo2, foo3, bar1, bar2});
        }
示例#26
0
 protected void Application_Start(object sender, EventArgs e)
 {
     _runtime = FubuApplication.For<Bootstrapper>()
         .StructureMapObjectFactory(
             ix =>
                 {
                     ix.AddRegistry<AppSettingProviderRegistry>();
                     ix.Scan(s =>
                                 {
                                     s.AssemblyContainingType<Global>();
                                     s.LookForRegistries();
                                 });
                 })
         .Bootstrap();
 }
        public void SetUp()
        {
            runtime = FubuTransport.DefaultPolicies().StructureMap().Bootstrap();
            runtime.Factory.Get<IContainer>().UseInMemoryDatastore();

            thePersistence = runtime.Factory.Get<RavenDbSchedulePersistence>();

            foo1 = new JobStatusDTO { JobKey = "1", NodeName = "foo" };
            foo2 = new JobStatusDTO { JobKey = "2", NodeName = "foo" };
            foo3 = new JobStatusDTO { JobKey = "3", NodeName = "foo" };
            bar1 = new JobStatusDTO { JobKey = "1", NodeName = "bar" };
            bar2 = new JobStatusDTO { JobKey = "2", NodeName = "bar" };

            thePersistence.Persist(new[] { foo1, foo2, foo3, bar1, bar2 });
        }
示例#28
0
        private void startAtPort(string rootDirectory, FubuRuntime runtime)
        {
            _baseAddress = "http://localhost:" + _port;
            _configuration = new HttpSelfHostConfiguration(_baseAddress);

            FubuMvcPackageFacility.PhysicalRootPath = rootDirectory;

            _server = new HttpSelfHostServer(_configuration, new SelfHostHttpMessageHandler(runtime){
                Verbose = Verbose
            });

            runtime.Facility.Register(typeof(HttpSelfHostConfiguration), ObjectDef.ForValue(_configuration));

            Console.WriteLine("Starting to listen for requests at " + _configuration.BaseAddress);

            _server.OpenAsync().Wait();
        }
示例#29
0
        public ManualResetEvent StartOnNewThread(FubuRuntime runtime, Action action)
        {
            var reset = new ManualResetEvent(false);

            _listeningThread = new Thread(o =>
            {
                Start(runtime, () =>
                {
                    action();
                    reset.Set();
                });
            });

            _listeningThread.Name = "Serenity:Kayak:Thread";
            _listeningThread.Start();

            return reset;
        }
        public void FixtureSetUp()
        {
            fileSystem.DeleteDirectory(Folder);
            fileSystem.CreateDirectory(Folder);

            fileSystem.CreateDirectory(Folder.AppendPath(Application));

            _streams.Each(x => x.DumpContents());

            var registry = determineRegistry();
            registry.Mode = Mode;

            registry.RootPath = _applicationDirectory;

            var runtime = registry.ToRuntime();

            _host = runtime;

            _allAssets = new Lazy<AssetGraph>(() => { return runtime.Get<IAssetFinder>().FindAll(); });
        }
示例#31
0
        /// <summary>
        /// Sets the RootPath to the root directory of a named folder parallel
        /// to the currently executing project
        /// </summary>
        /// <param name="directory"></param>
        public void UseParallelDirectory(string directory)
        {
            var path = FubuRuntime.DefaultApplicationPath();

            RootPath = path.ParentDirectory().AppendPath(directory);
        }