コード例 #1
0
ファイル: Expiration.cs プロジェクト: carlosagsmendes/ravendb
		public Expiration()
		{
			path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning.Versioning)).CodeBase);
			path = Path.Combine(path, "TestDb").Substring(6);
			Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
			var ravenConfiguration = new Raven.Database.Config.RavenConfiguration
			{
				Port = 8079,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
				DataDirectory = path,
				Settings =
					{
						{"Raven/Expiration/DeleteFrequencySeconds", "1"},
						{"Raven/ActiveBundles", "DocumentExpiration"}
					}
			};
			ravenConfiguration.PostInit();
			ravenDbServer = new RavenDbServer(
				ravenConfiguration);
			SystemTime.UtcDateTime = () => DateTime.UtcNow;
			documentStore = new DocumentStore
			{
				Url = "http://localhost:8079"
			};
			documentStore.Initialize();
		}
コード例 #2
0
ファイル: ReplicationBase.cs プロジェクト: arelee/ravendb
        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);
        }
コード例 #3
0
        protected TestWithInMemoryDatabase(Action <Raven.Database.Config.RavenConfiguration> configModifier)
        {
            var ravenConfiguration = new Raven.Database.Config.RavenConfiguration
            {
                Port = 8079,
                RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
            };

            configModifier(ravenConfiguration);

            path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(TestWithInMemoryDatabase)).CodeBase);
            path = Path.Combine(path, "TestDb").Substring(6);

            ravenConfiguration.DataDirectory = path;

            Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);

            ravenDbServer = new RavenDbServer(ravenConfiguration);

            documentStore = new DocumentStore
            {
                Url = "http://localhost:8079"
            };
            documentStore.Initialize();
        }
コード例 #4
0
		public CompressionAndEncryption()
		{
			path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning.Versioning)).CodeBase);
			path = Path.Combine(path, "TestDb").Substring(6);
			Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
			settings = new Raven.Database.Config.RavenConfiguration
			{
				Port = 8079,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
				DataDirectory = path,
				Settings =
					{
						{"Raven/Encryption/Key", "3w17MIVIBLSWZpzH0YarqRlR2+yHiv1Zq3TCWXLEMI8="},
						{"Raven/ActiveBundles", "Compression;Encryption"}
					}
			};
			ConfigureServer(settings);
			settings.PostInit();
			ravenDbServer = new RavenDbServer(settings);
			documentStore = new DocumentStore
			{
				Url = "http://localhost:8079"
			};
			documentStore.Initialize();
		}
コード例 #5
0
ファイル: RavenDB_560.cs プロジェクト: webmonger/ravendb
        private RavenDbServer CreateServer(int port, string dataDirectory, bool removeDataDirectory = true)
        {
            Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port);

            var serverConfiguration = new Raven.Database.Config.RavenConfiguration
            {
                Settings = { { "Raven/ActiveBundles", "replication" } },
                AnonymousUserAccessMode = Raven.Database.Server.AnonymousUserAccessMode.All,
                DataDirectory           = dataDirectory,
                RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
                RunInMemory            = false,
                Port                   = port,
                DefaultStorageTypeName = "esent"
            };

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

            var server = new RavenDbServer(serverConfiguration);

            serverConfiguration.PostInit();

            return(server);
        }
コード例 #6
0
 public CompressionAndEncryption()
 {
     path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning.Versioning)).CodeBase);
     path = Path.Combine(path, "TestDb").Substring(6);
     Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
     settings = new Raven.Database.Config.RavenConfiguration
     {
         Port = 8079,
         RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
         DataDirectory = path,
         Settings      =
         {
             { "Raven/Encryption/Key", "3w17MIVIBLSWZpzH0YarqRlR2+yHiv1Zq3TCWXLEMI8=" },
             { "Raven/ActiveBundles",  "Compression;Encryption"                       }
         }
     };
     ConfigureServer(settings);
     settings.PostInit();
     ravenDbServer = new RavenDbServer(settings);
     documentStore = new DocumentStore
     {
         Url = "http://localhost:8079"
     };
     documentStore.Initialize();
 }
コード例 #7
0
		protected TestWithInMemoryDatabase(Action<Raven.Database.Config.RavenConfiguration> configModifier)
		{
			var ravenConfiguration = new Raven.Database.Config.RavenConfiguration
			{
				Port = 8079,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
			};

			configModifier(ravenConfiguration);

			path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(TestWithInMemoryDatabase)).CodeBase);
			path = Path.Combine(path, "TestDb").Substring(6);

			ravenConfiguration.DataDirectory = path;

			Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);

			ravenDbServer = new RavenDbServer(ravenConfiguration);

			documentStore = new DocumentStore
			{
				Url = "http://localhost:8079"
			};
			documentStore.Initialize();
		}
コード例 #8
0
ファイル: Expiration.cs プロジェクト: thoemmi/ravendb
        public Expiration()
        {
            path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning.Versioning)).CodeBase);
            path = Path.Combine(path, "TestDb").Substring(6);
            Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
            var ravenConfiguration = new Raven.Database.Config.RavenConfiguration
            {
                Port = 8079,
                RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
                DataDirectory = path,
                Settings      =
                {
                    { "Raven/Expiration/DeleteFrequencySeconds", "1"                  },
                    { "Raven/ActiveBundles",                     "DocumentExpiration" }
                }
            };

            ravenConfiguration.PostInit();
            ravenDbServer = new RavenDbServer(
                ravenConfiguration);
            Raven.Bundles.Expiration.ExpirationReadTrigger.GetCurrentUtcDate = () => DateTime.UtcNow;
            documentStore = new DocumentStore
            {
                Url = "http://localhost:8079"
            };
            documentStore.Initialize();
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        public VersioningTest()
        {
            path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning)).CodeBase);
            path = Path.Combine(path, "TestDb").Substring(6);
            Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
            var cfg = new Raven.Database.Config.RavenConfiguration
            {
                Port          = 8079,
                DataDirectory = path,
                RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
                Settings =
                {
                    { "Raven/ActiveBundles", "Versioning" }
                }
            };

            cfg.PostInit();
            ravenDbServer = new RavenDbServer(cfg);
            documentStore = new DocumentStore
            {
                Url = "http://localhost:8079"
            };
            documentStore.Initialize();
            using (var s = documentStore.OpenSession())
            {
                s.Store(new Raven.Bundles.Versioning.Data.VersioningConfiguration
                {
                    Exclude = true,
                    Id      = "Raven/Versioning/Users",
                });
                s.Store(new Raven.Bundles.Versioning.Data.VersioningConfiguration
                {
                    Exclude = true,
                    Id      = "Raven/Versioning/Comments",
                });
                s.Store(new Raven.Bundles.Versioning.Data.VersioningConfiguration
                {
                    Exclude      = false,
                    Id           = "Raven/Versioning/DefaultConfiguration",
                    MaxRevisions = 5
                });
                s.SaveChanges();
            }
        }
コード例 #11
0
ファイル: VersioningTest.cs プロジェクト: arelee/ravendb
		public VersioningTest()
		{
			path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning)).CodeBase);
			path = Path.Combine(path, "TestDb").Substring(6);
			Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
			var cfg = new Raven.Database.Config.RavenConfiguration
			          	{
			          		Port = 8079,
			          		DataDirectory = path,
			          		RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
			          		Settings =
			          			{
			          				{"Raven/ActiveBundles", "Versioning"}
			          			}
			          	};
			cfg.PostInit();
			ravenDbServer = new RavenDbServer(cfg);
			documentStore = new DocumentStore
			{
				Url = "http://localhost:8079"
			};
			documentStore.Initialize();
			using(var s = documentStore.OpenSession())
			{
				s.Store(new Raven.Bundles.Versioning.Data.VersioningConfiguration
				{
					Exclude = true,
					Id = "Raven/Versioning/Users",
				});
				s.Store(new Raven.Bundles.Versioning.Data.VersioningConfiguration
				{
					Exclude = true,
					Id = "Raven/Versioning/Comments",
				});
				s.Store(new Raven.Bundles.Versioning.Data.VersioningConfiguration
				{
					Exclude = false,
					Id = "Raven/Versioning/DefaultConfiguration",
					MaxRevisions = 5
				});
				s.SaveChanges();
			}
		}
コード例 #12
0
ファイル: Compression.cs プロジェクト: 925coder/ravendb
		public Compression()
		{
			path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning.Versioning)).CodeBase);
			path = Path.Combine(path, "TestDb").Substring(6);
			Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
			var config = new Raven.Database.Config.RavenConfiguration
			             	{
			             		Port = 8079,
			             		RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
			             		DataDirectory = path,
								Settings = {{"Raven/ActiveBundles", "Compression"}}
			             	};
			config.PostInit();
			ravenDbServer = new RavenDbServer(config);
			documentStore = new DocumentStore
			{
				Url = "http://localhost:8079"
			};
			documentStore.Initialize();
		}
コード例 #13
0
ファイル: Compression.cs プロジェクト: arelee/ravendb
        public Compression()
        {
            path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning.Versioning)).CodeBase);
            path = Path.Combine(path, "TestDb").Substring(6);
            Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
            var config = new Raven.Database.Config.RavenConfiguration
            {
                Port = 8079,
                RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
                DataDirectory = path,
                Settings      = { { "Raven/ActiveBundles", "Compression" } }
            };

            config.PostInit();
            ravenDbServer = new RavenDbServer(config);
            documentStore = new DocumentStore
            {
                Url = "http://localhost:8079"
            };
            documentStore.Initialize();
        }
コード例 #14
0
        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;
        }
コード例 #15
0
 protected virtual void ConfigureServer(Raven.Database.Config.RavenConfiguration ravenConfiguration)
 {
 }
コード例 #16
0
ファイル: RavenDB_993.cs プロジェクト: 925coder/ravendb
		private RavenDbServer CreateServer(int port, string dataDirectory, bool removeDataDirectory = true)
		{
			Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port);

			var serverConfiguration = new Raven.Database.Config.RavenConfiguration
			{
				Settings = { { "Raven/ActiveBundles", "replication" } },
                AnonymousUserAccessMode = Raven.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);
			serverConfiguration.PostInit();

			return server;
		}
コード例 #17
0
ファイル: WithoutEncryption.cs プロジェクト: ybdev/ravendb
 protected override void ConfigureServer(Raven.Database.Config.RavenConfiguration ravenConfiguration)
 {
     ravenConfiguration.Settings["Raven/ActiveBundles"] = "none";
 }