Beispiel #1
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>();
        }
Beispiel #2
0
        public void in_memory_is_wait_for_it_in_memory()
        {
            var settings = RavenDbSettings.InMemory();

            var store = settings.Create();

            store.ShouldBeOfType <EmbeddableDocumentStore>().RunInMemory.ShouldBeTrue();
        }
Beispiel #3
0
        public void SetUp()
        {
            theContainer = new Container(x =>
            {
                x.ConnectToRavenDb <FourthDbSettings>(store =>
                {
                    store.Conventions.DefaultQueryingConsistency = ConsistencyOptions.None;
                }).Using <IFourthDatabase, FourthDatabase>();


                x.IncludeRegistry <RavenDbRegistry>();
                x.For <RavenDbSettings>().Use(() => RavenDbSettings.InMemory());
                x.For <FourthDbSettings>().Use(new FourthDbSettings {
                    RunInMemory = true
                });
            });
        }
Beispiel #4
0
        public void can_run_silverlight_from_embedded()
        {
            NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080);

            var container = new Container();
            var settings  = RavenDbSettings.InMemory();

            //settings.Url = "http://localhost:8080";
            settings.UseEmbeddedHttpServer = true;
            container.Inject(settings);

            var store = settings.Create();

            store.Initialize();

            Debug.WriteLine(store.Url);

            //Process.Start("http://localhost:8080");

            var store2 = new DocumentStore
            {
                Url             = "http://localhost:8080",
                DefaultDatabase = "Portal"
            };

            store2.Initialize();

            var entity1 = new FakeEntity {
                Id = Guid.NewGuid()
            };

            using (var session = store2.OpenSession())
            {
                session.Store(entity1);
                session.SaveChanges();
            }

            using (var session2 = store2.OpenSession())
            {
                session2.Query <FakeEntity>()
                .Customize(x => x.WaitForNonStaleResultsAsOfNow())
                .Any().ShouldBeTrue();
            }
        }
Beispiel #5
0
        public void registers_and_uses_a_lambda_configuration_action()
        {
            var registry = new Registry();

            registry.RavenDbConfiguration(store => {
                store.Conventions.DefaultQueryingConsistency = ConsistencyOptions.AlwaysWaitForNonStaleResultsAsOfLastWrite;
            });

            var container = new Container(x => {
                x.IncludeRegistry <RavenDbRegistry>();
                x.IncludeRegistry(registry);
                x.For <RavenDbSettings>().Use(() => RavenDbSettings.InMemory());
            });

            container.GetInstance <IDocumentStore>().Conventions
            .DefaultQueryingConsistency.ShouldBe(ConsistencyOptions.AlwaysWaitForNonStaleResultsAsOfLastWrite);

            container.Dispose();
        }
        public void SetUp()
        {
            theContainer = new Container(x => {
                x.ConnectToRavenDb <SecondDbSettings>(store => {
                    store.Conventions.DefaultQueryingConsistency = ConsistencyOptions.None;
                });
                x.ConnectToRavenDb <ThirdDbSettings>(store => {
                    store.Conventions.DefaultQueryingConsistency = ConsistencyOptions.AlwaysWaitForNonStaleResultsAsOfLastWrite;
                });

                x.IncludeRegistry <RavenDbRegistry>();
                x.For <RavenDbSettings>().Use(() => RavenDbSettings.InMemory());
                x.For <SecondDbSettings>().Use(new SecondDbSettings {
                    RunInMemory = true
                });
                x.For <ThirdDbSettings>().Use(new ThirdDbSettings {
                    RunInMemory = true
                });
            });
        }
 /// <summary>
 /// Replace the current datastore with a new in memory datastore
 /// </summary>
 /// <param name="container"></param>
 public static void UseInMemoryDatastore(this IContainer container)
 {
     container.ReplaceDatastore(RavenDbSettings.InMemory());
 }