Пример #1
0
        private RavenDbServer CreateServer(int port, string dataDirectory, bool removeDataDirectory = true)
        {
            Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port);

            var serverConfiguration = new Database.Config.RavenConfiguration
            {
                AnonymousUserAccessMode = Database.Server.AnonymousUserAccessMode.Admin,
                DataDirectory = dataDirectory,
                RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
                RunInMemory = false,
                Port = port,
                DefaultStorageTypeName = "esent"
            };

            if (removeDataDirectory)
                IOExtensions.DeleteDirectory(serverConfiguration.DataDirectory);

            var server = new RavenDbServer(serverConfiguration)
            {
                UseEmbeddedHttpServer = true
            };
            server.Initialize();
            serverConfiguration.PostInit();

            return server;
        }
Пример #2
0
		protected RavenDbServer CreateRavenDbServer(int port)
		{
			var path = Path.Combine(testAssemblyPath, "TestDb" + (++dbCount)).Substring(6);
			Database.Extensions.IOExtensions.DeleteDirectory(path);
			dbDirectories.Add(path);

			var cfg = new Database.Config.RavenConfiguration
			{
				Port = port,
				DataDirectory = path,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
				Settings =
					{
						{"Raven/ActiveBundles", "Versioning"}
					}
			};
			cfg.PostInit();
			return new RavenDbServer(cfg);
		}