コード例 #1
0
	    public RavenDbServer Initialize(Action<RavenDBOptions> configure = null)
	    {
            owinHttpServer = new OwinHttpServer(configuration, useHttpServer: UseEmbeddedHttpServer, configure: configure);
            options = owinHttpServer.Options;
            serverThingsForTests = new ServerThingsForTests(options);
	        documentStore.HttpMessageHandler = new OwinClientHandler(owinHttpServer.Invoke);
	        documentStore.Url = string.IsNullOrWhiteSpace(Url) ? "http://localhost" : Url;
	        documentStore.Initialize();
	        return this;
	    }
コード例 #2
0
ファイル: RavenDbServer.cs プロジェクト: jesuslpm/ravendb
	    public RavenDbServer Initialize(Action<RavenDBOptions> configure = null)
	    {
            owinHttpServer = new OwinHttpServer(configuration, useHttpServer: UseEmbeddedHttpServer, configure: configure);
            options = owinHttpServer.Options;
            serverThingsForTests = new ServerThingsForTests(options);
	        documentStore.HttpMessageHandler = new OwinClientHandler(owinHttpServer.Invoke);
	        documentStore.Url = string.IsNullOrWhiteSpace(Url) ? "http://localhost" : Url;
	        documentStore.Initialize();

			foreach (var task in configuration.Container.GetExportedValues<IServerStartupTask>())
			{
				task.Execute(this);
			}

	        return this;
	    }
コード例 #3
0
ファイル: RavenDbServer.cs プロジェクト: knives-out/ravendb
        public RavenDbServer Initialize(Action<RavenDBOptions> configure = null)
        {
            if (configuration.IgnoreSslCertificateErrors == IgnoreSslCertificateErrorsMode.All)
            {
                // we ignore either all or none at the moment
                ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
            }
            BooleanQuery.MaxClauseCount = configuration.MaxClauseCount;

            owinHttpServer = new OwinHttpServer(configuration, useHttpServer: UseEmbeddedHttpServer, configure: configure);
            options = owinHttpServer.Options;
            serverThingsForTests = new ServerThingsForTests(options);
            Func<HttpMessageHandler> httpMessageHandlerFactory = ()=>new OwinClientHandler(owinHttpServer.Invoke, options.SystemDatabase.Configuration.EnableResponseLoggingForEmbeddedDatabases);
            documentStore.HttpMessageHandlerFactory = httpMessageHandlerFactory;
            documentStore.Url = string.IsNullOrWhiteSpace(Url) ? "http://localhost" : Url;
            documentStore.Initialize();

            filesStore.HttpMessageHandlerFactory = httpMessageHandlerFactory;
            filesStore.Url = string.IsNullOrWhiteSpace(Url) ? "http://localhost" : Url;
            filesStore.Initialize();

            return this;
        }
コード例 #4
0
ファイル: RavenTestBase.cs プロジェクト: hero106wen/ravendb
        protected static void WaitForUserToContinueTheTest(IDocumentStore documentStore, bool debug = true, int port = 8079)
        {
            if (debug && Debugger.IsAttached == false)
                return;

            var databaseName = Constants.SystemDatabase;

            var embeddableDocumentStore = documentStore as EmbeddableDocumentStore;
            OwinHttpServer server = null;
            string url = documentStore.Url;
            if (embeddableDocumentStore != null)
            {
                databaseName = embeddableDocumentStore.DefaultDatabase;
                embeddableDocumentStore.Configuration.Port = port;
                SetStudioConfigToAllowSingleDb(embeddableDocumentStore);
                embeddableDocumentStore.Configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.Admin;
                NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port);
                server = new OwinHttpServer(embeddableDocumentStore.Configuration, embeddableDocumentStore.DocumentDatabase);
                url = embeddableDocumentStore.Configuration.ServerUrl;
            }

            var remoteDocumentStore = documentStore as DocumentStore;
            if (remoteDocumentStore != null)
            {
                databaseName = remoteDocumentStore.DefaultDatabase;
            }

            using (server)
            {
                try
                {
                    var databaseNameEncoded = Uri.EscapeDataString(databaseName ?? Constants.SystemDatabase);
                    var documentsPage = url + "studio/index.html#databases/documents?&database=" + databaseNameEncoded + "&withStop=true";
                    Process.Start(documentsPage); // start the server
                }
                catch (Win32Exception e)
                {
                    Console.WriteLine("Failed to open the browser. Please open it manually at {0}. {1}", url, e);
                }

                do
                {
                    Thread.Sleep(100);
                } while (documentStore.DatabaseCommands.Head("Debug/Done") == null && (debug == false || Debugger.IsAttached));
            }
        }
コード例 #5
0
		public static void WaitForUserToContinueTheTest(IDocumentStore documentStore, bool debug = true, int port = 8079)
		{
			if (debug && Debugger.IsAttached == false)
				return;

		    var embeddableDocumentStore = documentStore as EmbeddableDocumentStore;
			OwinHttpServer server = null;
            string url = documentStore.Url;
		    if (embeddableDocumentStore != null)
		    {
		        embeddableDocumentStore.Configuration.Port = port;
                SetStudioConfigToAllowSingleDb(embeddableDocumentStore);
                embeddableDocumentStore.Configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.Admin;
		        NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(port);
                server = new OwinHttpServer(embeddableDocumentStore.Configuration, embeddableDocumentStore.DocumentDatabase);
                url = embeddableDocumentStore.Configuration.ServerUrl;
		    }

			using (server)
			{
				Process.Start(url); // start the server

				do
				{
					Thread.Sleep(100);
				} while (documentStore.DatabaseCommands.Head("Debug/Done") == null && (debug == false || Debugger.IsAttached));
			}
		}
コード例 #6
0
		public RavenDbServer Initialize(Action<RavenDBOptions> configure = null)
		{
			if (configuration.IgnoreSslCertificateErros == IgnoreSslCertificateErrorsMode.All)
			{
				// we ignore either all or none at the moment
				ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
			}

			owinHttpServer = new OwinHttpServer(configuration, useHttpServer: UseEmbeddedHttpServer, configure: configure);
			options = owinHttpServer.Options;
			serverThingsForTests = new ServerThingsForTests(options);
			documentStore.HttpMessageHandler = new OwinClientHandler(owinHttpServer.Invoke);
			documentStore.Url = string.IsNullOrWhiteSpace(Url) ? "http://localhost" : Url;
			documentStore.Initialize();

			filesStore.HttpMessageHandler = new OwinClientHandler(owinHttpServer.Invoke);
			filesStore.Url = string.IsNullOrWhiteSpace(Url) ? "http://localhost" : Url;
			filesStore.Initialize();

			serverStartupTasks = configuration.Container.GetExportedValues<IServerStartupTask>();

			foreach (var task in serverStartupTasks)
			{
				toDispose.Add(task);
				task.Execute(this);
			}

	        return this;
	    }