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>(); }
/// <summary> /// Change the default RavenDb datastore to the configured settings /// </summary> /// <param name="container"></param> /// <param name="settings"></param> public static void ReplaceDatastore(this IContainer container, RavenDbSettings settings) { container.Model.For <IDocumentStore>().Default.EjectObject(); container.Model.For <RavenDbSettings>().EjectAndRemoveAll(); container.Inject(settings); }
public void load_a_store_with_explicit_port_see_the_hosted_url() { var settings = new RavenDbSettings { RunInMemory = true, Port = 8082, UseEmbeddedHttpServer = true }; using (var store = settings.Create()) { store.Initialize(); using (var session = store.OpenSession()) { session.Store(new House { Whose = "Mine", Id = Guid.NewGuid() }); session.SaveChanges(); } Process.Start("http://localhost:8082"); Thread.Sleep(30000); } }
public void in_memory_is_wait_for_it_in_memory() { var settings = RavenDbSettings.InMemory(); var store = settings.Create(); store.ShouldBeOfType <EmbeddableDocumentStore>().RunInMemory.ShouldBeTrue(); }
public void build_empty_does_not_throw_but_connects_to_the_parallel_data_folder() { using (var store = new RavenDbSettings().Create()) { store.ShouldBeOfType <EmbeddableDocumentStore>() .DataDirectory.ShouldEndWith("data"); } }
public void InvalidSectionName(string invalidSectionName) { var configuration = CreateConfiguration(); Action act = () => RavenDbSettings.FromConfiguration(configuration, invalidSectionName); act.Should().Throw <ArgumentException>() .Which.ShouldBeWrittenTo(Output); }
public void NonExistingSection(string nonExistingSection) { var configuration = CreateConfiguration(); Action act = () => RavenDbSettings.FromConfiguration(configuration, nonExistingSection); act.Should().Throw <InvalidConfigurationException>() .Which.ShouldBeWrittenTo(Output); }
public void build_in_memory() { var settings = new RavenDbSettings { RunInMemory = true }; settings.Create().ShouldBeOfType <EmbeddableDocumentStore>() .RunInMemory.ShouldBeTrue(); }
private T createStore <T>(Action <RavenDbSettings> setup) where T : IDocumentStore { var settings = new RavenDbSettings(); if (setup != null) { setup(settings); } return(settings.Create().ShouldBeOfType <T>()); }
private void ConfigureDIContainer() { var store = RavenDbSettings.FromConfiguration(Configuration) .InitializeConnection(_logger); _container.RegisterStoreAndSessionWithContainer(store) .RegisterMigrationEngine(store) .RunMigrations(_logger); _container.RegisterLogging(); }
public void uses_the_port_number_if_it_is_non_zero() { var settings = new RavenDbSettings { RunInMemory = true, Port = 8081 }; using (var store = settings.Create()) { store.ShouldBeOfType <EmbeddableDocumentStore>() .Configuration.Port.ShouldBe(8081); } }
public void Configure(FubuRegistry registry) { registry.Policies.Add <TransactionalBehaviorPolicy>(); var defaultDataDirectory = FubuMvcPackageFacility.GetApplicationPath().ParentDirectory().AppendPath("data"); var defaultSettings = new RavenDbSettings { DataDirectory = defaultDataDirectory }; registry.Services(x => x.SetServiceIfNone(defaultSettings)); }
public static void LoadDefaultConfiguration(string sectionName, string serverUrl, string databaseName) { var configuration = CreateConfiguration(sectionName, serverUrl, databaseName); var ravenDbSettings = RavenDbSettings.FromConfiguration(configuration, sectionName); var expectedSettings = new RavenDbSettings { ServerUrls = new List <string> { serverUrl }, DatabaseName = databaseName }; ravenDbSettings.Should().BeEquivalentTo(expectedSettings); }
public void uses_default_port_number_if_none() { var settings = new RavenDbSettings { RunInMemory = true }; using (var store = settings.Create()) { // 8080 is RavenDb's default port number store.ShouldBeOfType <EmbeddableDocumentStore>() .Configuration.Port.ShouldBe(8080); } }
public HarnessRegistry() { var dbSettings = new RavenDbSettings { RunInMemory = true, UseEmbeddedHttpServer = true }; Services(x => { x.AddService(dbSettings); x.AddService <IDocumentStoreConfigurationAction, SimpleEmbeddedRavenDbPortConfigurationAction>(); }); }
public static void LoadCustomSettings(string sectionName, string serverUrl, string databaseName, int otherValue) { var configuration = CreateConfiguration(sectionName, serverUrl, databaseName, new KeyValuePair <string, string>($"{sectionName}:otherValue", otherValue.ToString())); var customSettings = RavenDbSettings.FromConfiguration <CustomRavenDbSettings>(configuration, sectionName); var expectedSettings = new CustomRavenDbSettings { ServerUrls = new List <string> { serverUrl }, DatabaseName = databaseName, OtherValue = otherValue }; customSettings.Should().BeEquivalentTo(expectedSettings); }
public void simple_construction() { var settings = new RavenDbSettings { RunInMemory = true }; var actions = new IDocumentStoreConfigurationAction[] { new CustomizeRavenJsonSerializer(new JsonConverter[0]), }; var builder = new DocumentStoreBuilder(settings, actions); var store = builder.Build().ShouldBeOfType <EmbeddableDocumentStore>(); store.RunInMemory.ShouldBeTrue(); store.Conventions.CustomizeJsonSerializer.ShouldNotBeNull(); }
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 }); }); }
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(); } }
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 }); }); }
public RavenModule(RavenDbSettings setting) { _setting = setting; }
/// <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()); }
/// <summary> /// Change the default RavenDb datastore to the configured settings /// </summary> /// <param name="factory"></param> /// <param name="settings"></param> public static void ReplaceDatastore(this IServiceFactory factory, RavenDbSettings settings) { factory.Get <IContainer>().ReplaceDatastore(settings); }