コード例 #1
0
        protected override void ConfigureServer(database::Raven.Database.Config.RavenConfiguration serverConfiguration)
        {
            serverConfiguration.AuthenticationMode      = "oauth";
            serverConfiguration.AnonymousUserAccessMode = database::Raven.Database.Server.AnonymousUserAccessMode.None;

            serverConfiguration.Catalog.Catalogs.Add(new AssemblyCatalog(typeof(AuthenticationUser).Assembly));
        }
コード例 #2
0
ファイル: WithCascade.cs プロジェクト: arelee/ravendb
		public WithCascade()
		{
			path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning.Versioning)).CodeBase);
			path = Path.Combine(path, "TestDb").Substring(6);
			database::Raven.Database.Extensions.IOExtensions.DeleteDirectory("Data");
			var ravenConfiguration = new database::Raven.Database.Config.RavenConfiguration
			{
				Port = 8079,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
				DataDirectory = path,
				Catalog =
					{
						Catalogs =
							{
								new AssemblyCatalog(typeof(CascadeDeleteTrigger).Assembly)
							}
					},
				Settings =
					{
						{"Raven/Expiration/DeleteFrequencySeconds", "1"},
						{"Raven/ActiveBundles", "Expiration"}
			}
			};
			ravenConfiguration.PostInit();
			ravenDbServer = new RavenDbServer(ravenConfiguration);
			database::Raven.Bundles.Expiration.ExpirationReadTrigger.GetCurrentUtcDate = () => DateTime.UtcNow;
			documentStore = new DocumentStore
			{
				Url = "http://localhost:8079"
			};
			documentStore.Initialize();
		}
コード例 #3
0
        public WithCascade()
        {
            path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(WithCascade)).CodeBase);
            path = Path.Combine(path, "TestDb").Substring(6);
            database::Raven.Database.Extensions.IOExtensions.DeleteDirectory("Data");
            var ravenConfiguration = new database::Raven.Database.Config.RavenConfiguration
            {
                Port = 8079,
                RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
                DataDirectory = path,
                Catalog       =
                {
                    Catalogs =
                    {
                        new AssemblyCatalog(typeof(CascadeDeleteTrigger).Assembly)
                    }
                },
                Settings =
                {
                    { "Raven/Expiration/DeleteFrequencySeconds", "1"                  },
                    { "Raven/ActiveBundles",                     "documentExpiration" }
                }
            };

            ravenConfiguration.PostInit();
            ravenDbServer = new RavenDbServer(ravenConfiguration);
            documentStore = new DocumentStore
            {
                Url = "http://localhost:8079"
            };
            documentStore.Initialize();
        }
コード例 #4
0
        private IDocumentStore CreateStoreAtPort(int port)
        {
            database::Raven.Database.Server.NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port);
            var assemblyCatalog     = new AssemblyCatalog(typeof(replication::Raven.Bundles.Replication.Triggers.AncestryPutTrigger).Assembly);
            var serverConfiguration = new database::Raven.Database.Config.RavenConfiguration
            {
                AnonymousUserAccessMode = database::Raven.Database.Server.AnonymousUserAccessMode.All,
                Catalog       = { Catalogs = { assemblyCatalog } },
                DataDirectory = "Data #" + servers.Count,
                RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
                RunInMemory = true,
                Port        = port
            };

            ConfigureServer(serverConfiguration);
            serverConfiguration.PostInit();
            var ravenDbServer = new RavenDbServer(serverConfiguration);

            ravenDbServer.Server.SetupTenantDatabaseConfiguration += configuration => configuration.Catalog.Catalogs.Add(assemblyCatalog);
            servers.Add(ravenDbServer);
            var documentStore = new DocumentStore {
                Url = ravenDbServer.Database.Configuration.ServerUrl
            };

            ConfigureStore(documentStore);
            documentStore.Initialize();
            documentStore.JsonRequestFactory.EnableBasicAuthenticationOverUnsecureHttpEvenThoughPasswordsWouldBeSentOverTheWireInClearTextToBeStolenByHackers = true;
            stores.Add(documentStore);
            return(documentStore);
        }
コード例 #5
0
		protected TestWithInMemoryDatabase(Action<database::Raven.Database.Config.RavenConfiguration> configModifier)
		{
			var ravenConfiguration = new database::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;

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

			ravenDbServer = new RavenDbServer(ravenConfiguration);

			documentStore = new DocumentStore
			{
				Url = "http://localhost:8079"
			};
			documentStore.Initialize();
		}
コード例 #6
0
        protected TestWithInMemoryDatabase(Action <database::Raven.Database.Config.RavenConfiguration> configModifier)
        {
            var ravenConfiguration = new database::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;

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

            ravenDbServer = new RavenDbServer(ravenConfiguration);

            documentStore = new DocumentStore
            {
                Url = "http://localhost:8079"
            };
            documentStore.Initialize();
        }
コード例 #7
0
 protected override void ModifyConfiguration(database::Raven.Database.Config.RavenConfiguration configuration)
 {
     configuration.Catalog.Catalogs.Add(new AssemblyCatalog(typeof(Bundles.UniqueConstraints.UniqueConstraintsPutTrigger).Assembly));
 }
コード例 #8
0
 protected virtual void ConfigureServer(database::Raven.Database.Config.RavenConfiguration serverConfiguration)
 {
 }
コード例 #9
0
 protected override void ConfigureServer(database::Raven.Database.Config.RavenConfiguration serverConfiguration)
 {
     serverConfiguration.AnonymousUserAccessMode = database::Raven.Database.Server.AnonymousUserAccessMode.None;
     database::Raven.Database.Server.Security.Authentication.EnableOnce();
 }
コード例 #10
0
 protected override void ConfigureServer(database::Raven.Database.Config.RavenConfiguration serverConfiguration)
 {
     serverConfiguration.AnonymousUserAccessMode = database::Raven.Database.Server.AnonymousUserAccessMode.None;
 }
コード例 #11
0
 protected override void ConfigureServer(database::Raven.Database.Config.RavenConfiguration serverConfiguration)
 {
     serverConfiguration.RunInMemory            = false;
     serverConfiguration.DefaultStorageTypeName = "esent";
 }