Exemple #1
0
        public void Init() {
            if (Directory.Exists(_basePath)) {
                Directory.Delete(_basePath, true);
            }

            Directory.CreateDirectory(_basePath);
            _appDataFolder = AppDataFolderTests.CreateAppDataFolder(_basePath);
            _webDownloader = new Mock<IWebDownloader>();
            _orchardServices = new StubOrchardServices();
            ((StubWorkContextAccessor.WorkContextImpl.StubSite) _orchardServices.WorkContext.CurrentSite).BaseUrl = "http://orchardproject.net";

            _settings = new WarmupSettingsPart { Record = new WarmupSettingsPartRecord() };
            _orchardServices.WorkContext.CurrentSite.ContentItem.Weld(_settings);
 
            var builder = new ContainerBuilder();
            builder.RegisterInstance(_appDataFolder).As<IAppDataFolder>();
            builder.RegisterInstance(_orchardServices).As<IOrchardServices>();
            builder.RegisterType<DefaultLockFileManager>().As<ILockFileManager>();
            builder.RegisterType<WarmupUpdater>().As<IWarmupUpdater>();
            builder.RegisterType<StubClock>().As<IClock>();
            builder.RegisterType<WarmupReportManager>().As<IWarmupReportManager>();
            builder.RegisterInstance(new ShellSettings { Name = "Default" }).As<ShellSettings>();
            builder.RegisterInstance(_clock = new StubClock()).As<IClock>();
            builder.RegisterInstance(_webDownloader.Object).As<IWebDownloader>();
            _container = builder.Build();

            _lockFileManager = _container.Resolve<ILockFileManager>();
            _warmupUpdater = _container.Resolve<IWarmupUpdater>();
            _reportManager = _container.Resolve<IWarmupReportManager>();

            _warmupFilename = _appDataFolder.Combine(TenantFolder, "warmup.txt");
            _lockFilename = _appDataFolder.Combine(TenantFolder, "warmup.txt.lock");
        }
        public AdminController(
            IOrchardServices services,
            IWarmupUpdater warmupUpdater,
            IWarmupReportManager reportManager)
        {
            _warmupUpdater = warmupUpdater;
            _reportManager = reportManager;
            Services       = services;

            T = NullLocalizer.Instance;
        }
Exemple #3
0
        public AdminController(
            IOrchardServices services,
            ISiteService siteService,
            IWarmupReportManager reportManager,
            IWarmupScheduler warmupScheduler)
        {
            _siteService     = siteService;
            _reportManager   = reportManager;
            Services         = services;
            _warmupScheduler = warmupScheduler;

            T = NullLocalizer.Instance;
        }
Exemple #4
0
        public WarmupUpdater(
            IOrchardServices orchardServices, 
            ILockFileManager lockFileManager,
            IClock clock,
            IAppDataFolder appDataFolder,
            IWebDownloader webDownloader,
            IWarmupReportManager reportManager,
            ShellSettings shellSettings) {
            _orchardServices = orchardServices;
            _lockFileManager = lockFileManager;
            _clock = clock;
            _appDataFolder = appDataFolder;
            _webDownloader = webDownloader;
            _reportManager = reportManager;

            _lockFilename = _appDataFolder.Combine("Sites", _appDataFolder.Combine(shellSettings.Name, WarmupFilename + ".lock"));
            _warmupPath = _appDataFolder.Combine("Sites", _appDataFolder.Combine(shellSettings.Name, WarmupFilename));

            Logger = NullLogger.Instance;
        }
        public WarmupUpdater(
            IOrchardServices orchardServices,
            ILockFileManager lockFileManager,
            IClock clock,
            IAppDataFolder appDataFolder,
            IWebDownloader webDownloader,
            IWarmupReportManager reportManager,
            ShellSettings shellSettings)
        {
            _orchardServices = orchardServices;
            _lockFileManager = lockFileManager;
            _clock           = clock;
            _appDataFolder   = appDataFolder;
            _webDownloader   = webDownloader;
            _reportManager   = reportManager;

            _lockFilename = _appDataFolder.Combine("Sites", _appDataFolder.Combine(shellSettings.Name, WarmupFilename + ".lock"));
            _warmupPath   = _appDataFolder.Combine("Sites", _appDataFolder.Combine(shellSettings.Name, WarmupFilename));

            Logger = NullLogger.Instance;
        }
Exemple #6
0
        public void Init()
        {
            if (Directory.Exists(_basePath))
            {
                Directory.Delete(_basePath, true);
            }

            Directory.CreateDirectory(_basePath);
            _appDataFolder   = AppDataFolderTests.CreateAppDataFolder(_basePath);
            _webDownloader   = new Mock <IWebDownloader>();
            _orchardServices = new StubOrchardServices();
            ((StubWorkContextAccessor.WorkContextImpl.StubSite)_orchardServices.WorkContext.CurrentSite).BaseUrl = "http://orchardproject.net";

            _settings = new WarmupSettingsPart();

            _orchardServices.WorkContext.CurrentSite.ContentItem.Weld(_settings);
            _orchardServices.WorkContext.CurrentSite.ContentItem.Weld(new InfosetPart());

            var builder = new ContainerBuilder();

            builder.RegisterInstance(_appDataFolder).As <IAppDataFolder>();
            builder.RegisterInstance(_orchardServices).As <IOrchardServices>();
            builder.RegisterType <DefaultLockFileManager>().As <ILockFileManager>();
            builder.RegisterType <WarmupUpdater>().As <IWarmupUpdater>();
            builder.RegisterType <StubClock>().As <IClock>();
            builder.RegisterType <WarmupReportManager>().As <IWarmupReportManager>();
            builder.RegisterInstance(new ShellSettings {
                Name = "Default"
            }).As <ShellSettings>();
            builder.RegisterInstance(_clock = new StubClock()).As <IClock>();
            builder.RegisterInstance(_webDownloader.Object).As <IWebDownloader>();
            _container = builder.Build();

            _lockFileManager = _container.Resolve <ILockFileManager>();
            _warmupUpdater   = _container.Resolve <IWarmupUpdater>();
            _reportManager   = _container.Resolve <IWarmupReportManager>();

            _warmupFilename = _appDataFolder.Combine(TenantFolder, "warmup.txt");
            _lockFilename   = _appDataFolder.Combine(TenantFolder, "warmup.txt.lock");
        }