Ejemplo n.º 1
0
 public void GetSettingWithDefaultValueTest()
 {
     var config = new ConfigManager();
     var defValue = "DefaultReturn";
     var ret = config.GetSetting("NoKey", defValue);
     Assert.AreEqual(ret, defValue);
 }
        public void ReindexAllTest()
        {
            var config = new ConfigManager();
            using (var currentDB = new NAppProfiler.Server.Essent.Database(config))
            {
                currentDB.InitializeDatabase();
                using (var idxUpdate = new NAppIndexUpdater(config, currentDB))
                {
                    idxUpdate.Initialize();
                    DateTime start;
                    DateTime stop;
                    TimeSpan ts;
                    start = DateTime.UtcNow;
                    var count = idxUpdate.RebuildIndex();

                    //var totalCount = 0L;
                    //var curCount = 1L;
                    //while (curCount > 0)
                    //{
                    //    curCount = idxUpdate.UpdateIndex();
                    //    totalCount += curCount;
                    //}

                    stop = DateTime.UtcNow;
                    ts = stop - start;
                    Console.WriteLine("Index Rebuild " + count.ToString("#,##0") + " in " + ts.TotalMilliseconds.ToString("#,##0") + " ms");
                }
            }
        }
Ejemplo n.º 3
0
 public JobProcessor(ConfigManager config, Database currentDb, JobQueueManager manager, NAppIndexUpdater indexUpdater, NAppIndexReader indexReader)
 {
     this.currentDb = currentDb;
     this.manager = manager;
     this.indexReader = indexReader;
     this.indexUpdater = indexUpdater;
     if (!int.TryParse(config.GetSetting(SettingKeys.Manager_ProcessorQueueSize), out this.processorQueueSize))
     {
         this.processorQueueSize = 64;
     }
     InitializeLists();
 }
Ejemplo n.º 4
0
 public JobQueueManager(ConfigManager config)
 {
     this.config = config;
     if (!bool.TryParse(config.GetSetting(SettingKeys.Trace_Logging, bool.FalseString), out traceEnabled))
     {
         traceEnabled = false;
     }
     if (!bool.TryParse(config.GetSetting(SettingKeys.Manager_FixedNoOfTasks, bool.TrueString), out fixedNoOfTasks))
     {
         fixedNoOfTasks = true;
     }
 }
Ejemplo n.º 5
0
 public Listener(ConfigManager config, JobQueueManager manager)
 {
     listenerLock = new object();
     var defaultPort = 33700;
     var portStr = config.GetSetting(SettingKeys.Socket_PortNo, defaultPort.ToString());
     if (!int.TryParse(portStr, out this.port))
     {
         this.port = defaultPort;
     }
     else if (this.port <= 0)
     {
         this.port = defaultPort;
     }
     this.manager = manager;
 }
Ejemplo n.º 6
0
        public Job(ConfigManager config, JobQueueManager manager, bool IsDatabaseTask, bool traceEnabled)
        {
            this.config = config;
            this.manager = manager;
            if (IsDatabaseTask)
            {
                currentDb = new Database(config);
                currentDb.InitializeDatabase();
                indexUpdater = new NAppIndexUpdater(config, currentDb);
                indexUpdater.Initialize();
            }
            indexReader = new NAppIndexReader(config);

            this.traceEnabled = traceEnabled;
        }
Ejemplo n.º 7
0
 public Database(ConfigManager config, string directory = "")
 {
     this.config = config;
     databaseDirectory = Path.GetFullPath(GetDatabaseDirectory());
     if (string.IsNullOrWhiteSpace(directory))
     {
         databaseDirectory = Path.Combine(databaseDirectory, CurrentDatabase);
     }
     else
     {
         databaseDirectory = Path.Combine(databaseDirectory, directory);
     }
     databaseFullPath = Path.Combine(databaseDirectory, "NAppProfiler.edb");
     this.disposeLock = new object();
     this.tblSchema = new LogTableSchema();
     this.idxSchema = new IndexTableSchema();
 }
Ejemplo n.º 8
0
 public void GetSettingTest()
 {
     var config = new ConfigManager();
     var ret = config.GetSetting(SettingKeys.Database_CacheSizeMax);
     Assert.AreEqual(ret, "1024");
 }