private EmbeddableDocumentStore CreateEmbeddableStoreAtPort(int port, bool enableCompressionBundle = false, bool removeDataDirectory = true, Action <DocumentStore> configureStore = null, AnonymousUserAccessMode anonymousUserAccessMode = AnonymousUserAccessMode.All) { Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port); var embeddedStore = new EmbeddableDocumentStore { UseEmbeddedHttpServer = true, Configuration = { Settings = { { "Raven/ActiveBundles", "replication" + (enableCompressionBundle ? ";compression" : string.Empty) } }, AnonymousUserAccessMode = anonymousUserAccessMode, DataDirectory = "Data #" + stores.Count, RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true, RunInMemory = true, Port = port, DefaultStorageTypeName = RavenTest.GetDefaultStorageType() }, }; if (removeDataDirectory) { IOExtensions.DeleteDirectory(embeddedStore.Configuration.DataDirectory); } ConfigureStore(embeddedStore); if (configureStore != null) { configureStore(embeddedStore); } embeddedStore.Initialize(); stores.Add(embeddedStore); return(embeddedStore); }
private IDocumentStore CreateStoreAtPort(int port, Action <DocumentStore> configureStore = null) { Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port); var serverConfiguration = new Raven.Database.Config.RavenConfiguration { Settings = { { "Raven/ActiveBundles", "replication" } }, AnonymousUserAccessMode = Raven.Database.Server.AnonymousUserAccessMode.All, DataDirectory = "Data #" + servers.Count, RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true, RunInMemory = true, Port = port, DefaultStorageTypeName = RavenTest.GetDefaultStorageType() }; ConfigureServer(serverConfiguration); IOExtensions.DeleteDirectory(serverConfiguration.DataDirectory); serverConfiguration.PostInit(); var ravenDbServer = new RavenDbServer(serverConfiguration); servers.Add(ravenDbServer); var documentStore = new DocumentStore { Url = ravenDbServer.Database.Configuration.ServerUrl }; ConfigureStore(documentStore); if (configureStore != null) { configureStore(documentStore); } documentStore.Initialize(); stores.Add(documentStore); return(documentStore); }
private IDocumentStore CreateStoreAtPort(int port, bool enableCompressionBundle = false, bool removeDataDirectory = true, Action <DocumentStore> configureStore = null, AnonymousUserAccessMode anonymousUserAccessMode = AnonymousUserAccessMode.Admin, bool enableAuthorization = false) { Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port); var serverConfiguration = new Raven.Database.Config.RavenConfiguration { Settings = { { "Raven/ActiveBundles", "replication" + (enableCompressionBundle ? ";compression" : string.Empty) } }, AnonymousUserAccessMode = anonymousUserAccessMode, DataDirectory = "Data #" + stores.Count, RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true, RunInMemory = true, Port = port, DefaultStorageTypeName = RavenTest.GetDefaultStorageType() }; ConfigureServer(serverConfiguration); if (removeDataDirectory) { IOExtensions.DeleteDirectory(serverConfiguration.DataDirectory); } serverConfiguration.PostInit(); var ravenDbServer = new RavenDbServer(serverConfiguration); servers.Add(ravenDbServer); if (enableAuthorization) { RavenTestBase.EnableAuthentication(ravenDbServer.Database); ConfigureServer(serverConfiguration); } var documentStore = new DocumentStore { Url = ravenDbServer.Database.Configuration.ServerUrl }; ConfigureStore(documentStore); if (configureStore != null) { configureStore(documentStore); } documentStore.Initialize(); stores.Add(documentStore); ConfigureDatbase(ravenDbServer.Database); return(documentStore); }
public void StartDatabase(int index) { var previousServer = servers[index]; Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(previousServer.Database.Configuration.Port); var serverConfiguration = new Raven.Database.Config.RavenConfiguration { Settings = { { "Raven/ActiveBundles", "replication" } }, AnonymousUserAccessMode = Raven.Database.Server.AnonymousUserAccessMode.All, DataDirectory = previousServer.Database.Configuration.DataDirectory, RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true, RunInMemory = previousServer.Database.Configuration.RunInMemory, Port = previousServer.Database.Configuration.Port, DefaultStorageTypeName = RavenTest.GetDefaultStorageType() }; ConfigureServer(serverConfiguration); serverConfiguration.PostInit(); var ravenDbServer = new RavenDbServer(serverConfiguration); servers[index] = ravenDbServer; }