public override void OnAfterRepositoryStart(RepositoryInstance repository) { var state = DistributedIndexingActivityQueue.GetCurrentState(); DistributedIndexingActivityQueue._setCurrentExecutionState(IndexingActivityStatus.Startup); base.OnAfterRepositoryStart(repository); }
protected virtual void Application_Start(object sender, EventArgs e, HttpApplication application) { using (var op = SnTrace.Repository.StartOperation("Application_Start. Process: {0}, AppDomain: {1}, ", System.Diagnostics.Process.GetCurrentProcess().Id, AppDomain.CurrentDomain.Id)) { var runOnceMarkerPath = application.Server.MapPath("/" + RunOnceGuid); var firstRun = File.Exists(runOnceMarkerPath); var startConfig = new RepositoryStartSettings { StartLuceneManager = !firstRun, IsWebContext = true }; RepositoryInstance.WaitForWriterLockFileIsReleased(RepositoryInstance.WaitForLockFileType.OnStart); Repository.Start(startConfig); RepositoryVersionInfo.CheckComponentVersions(); StorageContext.L2Cache = new L2CacheImpl(); RegisterRoutes(RouteTable.Routes, application); RepositoryPathProvider.Register(); op.Successful = true; } }
/* ============================================================================================================ static handlers */ protected static void ApplicationStartHandler(object sender, EventArgs e, HttpApplication application) { var runOnceMarkerPath = application.Server.MapPath("/" + RunOnceGuid); var firstRun = File.Exists(runOnceMarkerPath); var startConfig = new SenseNet.ContentRepository.RepositoryStartSettings { StartLuceneManager = !firstRun }; RepositoryInstance.WaitForWriterLockFileIsReleased(RepositoryInstance.WaitForLockFileType.OnStart); Repository.Start(startConfig); //-- <L2Cache> StorageContext.L2Cache = new L2CacheImpl(); //-- </L2Cache> RegisterRoutes(RouteTable.Routes); RepositoryPathProvider.Register(); //Database.SetInitializer(new InDocContextInitializer()); //using (var context = DependencyResolver.Current.GetService<InDocContext>()) //{ // context.Database.Initialize(false); //} //preload WarmUp.Preload(); }
protected virtual void Application_Start(object sender, EventArgs e, HttpApplication application) { var op = DetailedLogger.CreateOperation(); // category: general DetailedLogger.Log(op, "Application_Start"); // category: general var runOnceMarkerPath = application.Server.MapPath("/" + RunOnceGuid); var firstRun = File.Exists(runOnceMarkerPath); var startConfig = new ContentRepository.RepositoryStartSettings { StartLuceneManager = !firstRun }; RepositoryInstance.WaitForWriterLockFileIsReleased(RepositoryInstance.WaitForLockFileType.OnStart); Repository.Start(startConfig); //-- <L2Cache> StorageContext.L2Cache = new L2CacheImpl(); //-- </L2Cache> GlobalConfiguration.Configure(WebApiConfiguration.Register); RegisterRoutes(RouteTable.Routes, application); RepositoryPathProvider.Register(); //preload WarmUp.Preload(); op.Finish(); // category: general }
public static void InitializeRepositoryInstance(TestContext context) { Cache.Reset(); ContentTypeManager.Reset(); var portalContextAcc = new PrivateType(typeof(PortalContext)); portalContextAcc.SetStaticField("_sites", new Dictionary <string, Site>()); var builder = CreateRepositoryBuilderForTest(); Indexing.IsOuterSearchEngineEnabled = true; _repository = Repository.Start(builder); Cache.Reset(); ContentTypeManager.Reset(); using (new SystemAccount()) { SecurityHandler.CreateAclEditor() .Allow(Identifiers.PortalRootId, Identifiers.AdministratorsGroupId, false, PermissionType.BuiltInPermissionTypes) .Allow(Identifiers.PortalRootId, Identifiers.AdministratorUserId, false, PermissionType.BuiltInPermissionTypes) .Apply(); } }
public Controller(IXSocketClient client, string controller) { this.Subscriptions = new RepositoryInstance<string, ISubscription>(); this.Listeners = new RepositoryInstance<string, IListener>(); this.AddDefaultSubscriptions(); this.ClientInfo = new ClientInfo{PersistentId = client.PersistentId, Controller = controller}; this.XSocketClient = client; }
/// <summary> /// Sets the items database and feeds.db database files to non-deployed paths /// </summary> public void UnitTestMode() { var feedDatabaseConnection = string.Format("Data Source={0}/Feeds.db;Version=3;", "/Volumes/Public/Monotouch/ReallySimple/ReallySimple.UI"); var userDatabaseFilePath = string.Format("{0}/User.db", "/tmp"); string itemsDbFilePath = string.Format("{0}/{1}", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Settings.Current.ItemsDatabaseFilename); var userDatabaseConnection = string.Format("Data Source={0};Version=3;", itemsDbFilePath); RepositoryInstance.WipeUserDatabase(); }
public Controller(IXSocketClient client, string controller) { this.queuedFrames = new List <byte>(); this.Subscriptions = new RepositoryInstance <string, ISubscription>(); this.Listeners = new RepositoryInstance <string, IListener>(); this.AddDefaultSubscriptions(); this.ClientInfo = new ClientInfo { PersistentId = client.PersistentId, Controller = controller }; this.XSocketClient = client; }
private async Task IntegrationTestAsync(bool isolated, Func <Task> callback, Func <SystemFolder, Task> callbackWithSandbox) { var platformName = Platform.GetType().Name; var needToStartNew = isolated || _repositoryInstance == null || platformName != _lastPlatformName; if (needToStartNew) { Logger.Log(" (cleanup repository)"); _repositoryInstance?.Dispose(); _repositoryInstance = null; _lastPlatformName = null; var builder = Platform.CreateRepositoryBuilder(); Logger.Log(" start new repository"); _repositoryInstance = Repository.Start(builder); _lastPlatformName = platformName; //PrepareRepository(); } SystemFolder sandbox = null; try { using (new SystemAccount()) { if (callback != null) { await callback(); } else { await callbackWithSandbox(sandbox = CreateSandbox()); } } } finally { if (sandbox != null) { using (new SystemAccount()) sandbox.ForceDelete(); } if (isolated) { Logger.Log(" cleanup repository"); _repositoryInstance?.Dispose(); _repositoryInstance = null; _lastPlatformName = null; } } }
private void IntegrationTest <T>(bool isolated, Action callback, Action <T> callbackWithSandbox) where T : GenericContent { var platformName = Platform.GetType().Name; var needToStartNew = isolated || _repositoryInstance == null || platformName != _lastPlatformName; if (needToStartNew) { Logger.Log(" (cleanup repository)"); _repositoryInstance?.Dispose(); _repositoryInstance = null; _lastPlatformName = null; var builder = Platform.CreateRepositoryBuilder(); Logger.Log(" start new repository"); _repositoryInstance = Repository.Start(builder); _lastPlatformName = platformName; //PrepareRepository(); } T sandbox = null; try { using (new SystemAccount()) if (callback != null) { callback(); } else { callbackWithSandbox(sandbox = CreateSandbox <T>()); } } finally { if (sandbox != null) { using (new SystemAccount()) sandbox.ForceDelete(); } if (isolated) { Logger.Log(" cleanup repository"); _repositoryInstance?.Dispose(); _repositoryInstance = null; _lastPlatformName = null; } } }
public void InitializeTest() { // workaround for having a half-started repository if (RepositoryInstance.Started()) { RepositoryInstance.Shutdown(); } // the original collector default value is a class that is not available in this context Providers.PropertyCollectorClassName = typeof(EventPropertyCollector).FullName; SnTrace.Test.Enabled = true; SnTrace.Test.Write("START test: {0}", TestContext.TestName); }
public void ClearCache(bool deleteImages) { ImageDownloader.Current.TryStop(); RepositoryInstance.WipeUserDatabase(); ItemCache.Current.Clear(); LastUpdate = DateTime.Now.AddDays(-1); LastControllerId = ""; LastItemId = ""; if (deleteImages) { ClearImageCache(); } }
private async Task ODataTestAsync(IUser user, Action <RepositoryBuilder> initialize, Func <Task> callback, bool reused) { Cache.Reset(); if (!reused || _repository == null) { _repository?.Dispose(); _repository = null; var repoBuilder = CreateRepositoryBuilder(); if (initialize != null) { initialize(repoBuilder); } Indexing.IsOuterSearchEngineEnabled = true; _repository = Repository.Start(repoBuilder); } if (user == null) { using (new SystemAccount()) await callback().ConfigureAwait(false); } else { IUser backup = null; try { backup = User.Current; User.Current = user; await callback().ConfigureAwait(false); } finally { User.Current = backup; } } if (!reused) { _repository?.Dispose(); _repository = null; } }
public void InitializeTest() { // workaround for having a half-started repository if (RepositoryInstance.Started()) { RepositoryInstance.Shutdown(); } SnTrace.Test.Enabled = true; if (_testMethodOperation != null) { SnTrace.Test.Write("The operation was forced to close."); _testMethodOperation.Successful = false; _testMethodOperation.Dispose(); } _testMethodOperation = SnTrace.Test.StartOperation("TESTMETHOD: " + TestContext.TestName); }
public static void InitializeRepositoryInstance(TestContext context) { DistributedApplication.Cache.Reset(); ContentTypeManager.Reset(); var builder = CreateRepositoryBuilderForTest(); Indexing.IsOuterSearchEngineEnabled = true; _repository = Repository.Start(builder); using (new SystemAccount()) { SecurityHandler.CreateAclEditor() .Allow(Identifiers.PortalRootId, Identifiers.AdministratorsGroupId, false, PermissionType.BuiltInPermissionTypes) .Allow(Identifiers.PortalRootId, Identifiers.AdministratorUserId, false, PermissionType.BuiltInPermissionTypes) .Apply(); } }
protected virtual void Application_Start(object sender, EventArgs e, HttpApplication application) { var runOnceMarkerPath = application.Server.MapPath("/" + RunOnceGuid); var firstRun = File.Exists(runOnceMarkerPath); var startConfig = new SenseNet.ContentRepository.RepositoryStartSettings { StartLuceneManager = !firstRun }; RepositoryInstance.WaitForWriterLockFileIsReleased(RepositoryInstance.WaitForLockFileType.OnStart); Repository.Start(startConfig); //-- <L2Cache> StorageContext.L2Cache = new L2CacheImpl(); //-- </L2Cache> RegisterRoutes(RouteTable.Routes, application); RepositoryPathProvider.Register(); //preload WarmUp.Preload(); }
public static void CleanupClass() { Logger.Log(" ((cleanup repository))"); _repositoryInstance?.Dispose(); _repositoryInstance = null; }
public virtual void OnAfterRepositoryStart(RepositoryInstance repository) { }