示例#1
0
        public static void WaitForUserToContinueTheTest(EmbeddableDocumentStore documentStore, bool debug = true)
        {
            if (debug && Debugger.IsAttached == false)
            {
                return;
            }

            documentStore.SetStudioConfigToAllowSingleDb();

            documentStore.DatabaseCommands.Put("Pls Delete Me", null,

                                               RavenJObject.FromObject(new { StackTrace = new StackTrace(true) }),
                                               new RavenJObject());

            documentStore.Configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.All;
            using (var server = new HttpServer(documentStore.Configuration, documentStore.DocumentDatabase))
            {
                server.StartListening();
                Process.Start(documentStore.Configuration.ServerUrl);                 // start the server

                do
                {
                    Thread.Sleep(100);
                } while (documentStore.DatabaseCommands.Get("Pls Delete Me") != null && (debug == false || Debugger.IsAttached));
            }
        }
示例#2
0
        public static void WaitForUserToContinueTheTest(EmbeddableDocumentStore documentStore, bool debug = true)
        {
            if (debug && Debugger.IsAttached == false)
            {
                return;
            }

            documentStore.SetStudioConfigToAllowSingleDb();

            documentStore.DatabaseCommands.Put("Pls Delete Me", null,

                                               RavenJObject.FromObject(new { StackTrace = new StackTrace(true) }),
                                               new RavenJObject());

            documentStore.Configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.Admin;
            using (var server = new HttpServer(documentStore.Configuration, documentStore.DocumentDatabase))
            {
                server.StartListening();

                try
                {
                    Process.Start(documentStore.Configuration.ServerUrl);                     // start the server
                }
                catch (Win32Exception e)
                {
                    Console.WriteLine("Failed to open the browser. Please open it manually at {0}. {1}", documentStore.Configuration.ServerUrl, e);
                }

                do
                {
                    Thread.Sleep(100);
                } while (documentStore.DatabaseCommands.Get("Pls Delete Me") != null && (debug == false || Debugger.IsAttached));
            }
        }
示例#3
0
        private static void Main()
        {
            // Initialize the database and create indexes
            var documentStore = new EmbeddableDocumentStore {
                UseEmbeddedHttpServer = true,
#if DEBUG
                RunInMemory = true
#endif
            };

            _documentStore = documentStore;
            documentStore.SetStudioConfigToAllowSingleDb();
            documentStore.Configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.All;
            documentStore.Configuration.Settings.Add("Raven/ActiveBundles", "Expiration");
            documentStore.Configuration.Settings.Add("Raven/Expiration/DeleteFrequencySeconds", "10");
            documentStore.Initialize();
            IndexCreation.CreateIndexes(typeof(Program).Assembly, documentStore);

            // Set up some pressure gauge simulators at different starting points and speeds
            AddPressureGauge("Pressure Gague 1", 30, 10);
            AddPressureGauge("Pressure Gague 2", 50, 20);
            AddPressureGauge("Pressure Gague 3", 70, 30);

            // Set up the polling timer to read the gauges periodically
            PollingTimer.Interval = TakeReadingsEvery.TotalMilliseconds;
            PollingTimer.Elapsed += PollingTimerElapsed;
            PollingTimer.Start();

            while (DoMenu())
            {
            }

            PollingTimer.Stop();
            PollingTimer.Dispose();
            foreach (var sensor in Sensors.Values)
            {
                sensor.Dispose();
            }

            documentStore.DocumentDatabase.StopBackgroundWorkers();
            documentStore.Dispose();
        }