public void Init() { // Configure Log4Net XmlConfigurator.Configure(new FileInfo(Constants.LOG_CONFIG_PATH)); // Set CWD so that native libs are found. Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); // Load INI stuff var configSource = new ArgvConfigSource(new string[] { }); // Configure nIni aliases and locale Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", true); configSource.Alias.AddAlias("On", true); configSource.Alias.AddAlias("Off", false); configSource.Alias.AddAlias("True", true); configSource.Alias.AddAlias("False", false); configSource.Alias.AddAlias("Yes", true); configSource.Alias.AddAlias("No", false); // Read in the ini file configSource.Merge(new IniConfigSource(Constants.INI_PATH)); // Prep cache folder try { Directory.Delete(Constants.TEST_CACHE_PATH, true); } catch (DirectoryNotFoundException) { // Skip. } Directory.CreateDirectory(Constants.TEST_CACHE_PATH); // Start booting server var pidFileManager = new PIDFileManager(Constants.PID_FILE_PATH); var chattelConfigRead = new ChattelConfiguration(Constants.TEST_CACHE_PATH); LocalStorage = new AssetStorageSimpleFolderTree(chattelConfigRead); var chattelReader = new ChattelReader(chattelConfigRead, LocalStorage); _service = new F_Stop( Constants.SERVICE_URI, Constants.SERVICE_ADMIN_TOKEN, TimeSpan.FromSeconds(Constants.SERVICE_NC_LIFETIME_SECONDS), chattelReader, new List <sbyte> { 0, 12, /*18, 19,*/ 49 } ); _service.Start(); }
public void Init() { // Configure Log4Net XmlConfigurator.Configure(new FileInfo(Constants.LOG_CONFIG_PATH)); // Set CWD so that native libs are found. Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory); // Load INI stuff var configSource = new ArgvConfigSource(new string[] { }); // Configure nIni aliases and locale Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", true); configSource.Alias.AddAlias("On", true); configSource.Alias.AddAlias("Off", false); configSource.Alias.AddAlias("True", true); configSource.Alias.AddAlias("False", false); configSource.Alias.AddAlias("Yes", true); configSource.Alias.AddAlias("No", false); // Read in the ini file configSource.Merge(new IniConfigSource(Constants.INI_PATH)); #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body try { Directory.Delete(DATABASE_FOLDER_PATH, true); } catch (Exception) { } try { File.Delete(WRITE_CACHE_FILE_PATH); } catch (Exception) { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body Directory.CreateDirectory(DATABASE_FOLDER_PATH); // Start booting server var pidFileManager = new LibWhipLru.Util.PIDFileManager(Constants.PID_FILE_PATH); var chattelConfigRead = new ChattelConfiguration(DATABASE_FOLDER_PATH); var chattelConfigWrite = new ChattelConfiguration(DATABASE_FOLDER_PATH); var readerLocalStorage = new LibWhipLru.Cache.AssetLocalStorageLmdbPartitionedLRU( chattelConfigRead, DATABASE_MAX_SIZE_BYTES, TimeSpan.FromSeconds(1) ); var chattelReader = new ChattelReader(chattelConfigRead, readerLocalStorage); var chattelWriter = new ChattelWriter(chattelConfigWrite, readerLocalStorage); var storageManager = new LibWhipLru.Cache.StorageManager( readerLocalStorage, TimeSpan.FromMinutes(2), chattelReader, chattelWriter ); _service = new WhipLru( Constants.SERVICE_ADDRESS, Constants.SERVICE_PORT, Constants.PASSWORD, pidFileManager, storageManager ); _service.Start(); }