public PowerGuideServiceImpl(PowerGuideAuthenticationService authentication, InstallationService installationService, MeasurementService measurementService) { this.authentication = authentication; installation = installationService; measurement = measurementService; }
public void Setup() { _container = new MocksAndStubsContainer(); _installerRepository = _container.InstallerRepository; _installationService = _container.InstallationService; }
protected override async Task OnParametersSetAsync() { var installation = await InstallationService.IsInstalled(); _installed = installation.Success; _initialized = true; }
public void InstallNextComponent_WithUnknownVersionComponent_FailsInstallation() { var unknownVersion = new Version(int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue); var currentVersion = new Version("0.0.0.1"); var latestVersion = new Version("0.0.0.2"); var component = new InstallationComponent("dshajdkh", OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); // Does nothing on installation or rollback var installationComponents = new Dictionary <int, InstallationComponent>(); installationComponents.Add(0, component); A.CallTo(() => discovery.Discover()) .Returns(new List <InstallationVersion> { new TestInstallationVersion(currentVersion, new Dictionary <int, InstallationComponent>()), new TestInstallationVersion(latestVersion, installationComponents), }); var dispatcher = A.Fake <IDataAccessDispatcher>(); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction <Solution> > ._)) .Returns(new Solution { Name = "TestSolution", DisplayName = "Test Solution", Version = currentVersion.ToString() }); var result = new InstallationService(discovery, dispatcher).InstallNextComponent(int.MaxValue, latestVersion); Assert.False(result.IsSuccess); Assert.False(result.MoreToInstall); Assert.NotNull(result.ErrorMessage); }
public void OnetimeSetup() { TestDbInit.SqlServer(BaseTest.MsSqlConnectionString); var installationService = new InstallationService(TestDbInit.DbSettings, DependencyResolver.Resolve <ILocalFileProvider>()); installationService.Install(); installationService.FillRequiredSeedData("*****@*****.**", "@#$%^&*", "localhost", "Test Store"); }
private async Task Install() { if (_serverName != "" && _databaseName != "" && _hostUsername != "" && _hostPassword.Length >= 6 && _hostPassword == _confirmPassword && _hostEmail != "") { _loadingDisplay = ""; StateHasChanged(); var connectionstring = ""; if (_databaseType == "LocalDB") { connectionstring = "Data Source=" + _serverName + ";AttachDbFilename=|DataDirectory|\\" + _databaseName + ".mdf;Initial Catalog=" + _databaseName + ";Integrated Security=SSPI;"; } else { connectionstring = "Data Source=" + _serverName + ";Initial Catalog=" + _databaseName + ";"; if (_integratedSecurityDisplay == "display: none;") { connectionstring += "Integrated Security=SSPI;"; } else { connectionstring += "User ID=" + _username + ";Password="******"://" + uri.Authority, true); } else { _message = "<div class=\"alert alert-danger\" role=\"alert\">" + installation.Message + "</div>"; _loadingDisplay = "display: none;"; } } else { _message = "<div class=\"alert alert-danger\" role=\"alert\">Please Enter All Fields And Ensure Passwords Match And Are Greater Than 5 Characters In Length</div>"; } }
public void InstallNextComponent_ForTwoNewVersionsWithTwoComponents_InstallationIsNotComplete_AndGivesDetailsOfNextComponentToInstall() { var currentVersion = new Version("0.0.0.1"); var firstNewVersion = new Version("0.0.0.2"); var secondNewVersion = new Version("0.0.0.3"); var firstComponentDescription = "dhjskldsa"; var secondComponentDescription = "DLAOIEHJK"; var firstComponent = new InstallationComponent(firstComponentDescription, OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); // Does nothing on installation or rollback var secondComponent = new InstallationComponent(secondComponentDescription, OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); var firstNewVersionComponents = new Dictionary <int, InstallationComponent>(); firstNewVersionComponents.Add(0, firstComponent); var secondNewVersionComponents = new Dictionary <int, InstallationComponent>(); secondNewVersionComponents.Add(0, secondComponent); A.CallTo(() => discovery.Discover()) .Returns(new List <InstallationVersion> { new TestInstallationVersion(currentVersion, new Dictionary <int, InstallationComponent>()), new TestInstallationVersion(firstNewVersion, firstNewVersionComponents), new TestInstallationVersion(secondNewVersion, secondNewVersionComponents), }); var dispatcher = A.Fake <IDataAccessDispatcher>(); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction <Solution> > ._)) .Returns(new Solution { Name = "TestSolution", DisplayName = "Test Solution", Version = currentVersion.ToString() }); var installation = new InstallationService(discovery, dispatcher); var startInstallationResult = installation.StartInstallation(); var result = installation.InstallNextComponent(startInstallationResult.NextComponentId.Value, startInstallationResult.Version); Assert.True(result.IsSuccess); Assert.True(result.MoreToInstall); Assert.Equal(secondComponentDescription, result.NextComponentDescription); Assert.True(result.NextComponentId.HasValue); Assert.Equal(0, result.NextComponentId.Value); Assert.NotNull(result.NextComponentVersion); Assert.Equal(0, secondNewVersion.CompareTo(result.NextComponentVersion)); }
public void OnetimeSetup() { TestDbInit.MySql(BaseTest.MySqlConnectionString); var installationService = new InstallationService(TestDbInit.DbSettings, DependencyResolver.Resolve <ILocalFileProvider>()); installationService.Install(); installationService.FillRequiredSeedData("*****@*****.**", "@#$%^&*", "localhost", "Test Store"); //set the current store to 1 ApplicationEngine.CurrentHttpContext.SetCurrentStore(new Store() { Id = 1 }); }
public InstallationsPanelViewModel(InstallationService installationService, Config config) { _installationService = installationService; _config = config; BuildNum = $"Hub Build Num: {Config.CurrentBuild}"; this.WhenAnyValue(p => p.AutoRemove) .Select(_ => Observable.FromAsync(OnAutoRemoveChangedAsync)) .Concat() .Subscribe(); RxApp.MainThreadScheduler.ScheduleAsync((scheduler, ct) => UpdateFromPreferencesAsync()); }
public async Task <IAppInstallation> Create() { try { var crmService = StartupHelper.CreateCrmService(); IInstallationRepository installationRepository = new InstallationRepository(); IInstallationService installationService = new InstallationService(crmService, installationRepository); IAppInstallation app = new AppInstallation(installationService); return(app); } catch (Exception ex) { throw ex; } }
/// <summary> /// Displays the second step in the installation wizard (connection strings and site url/name). /// </summary> public ActionResult Step2(string language) { // Persist the language change now that we know the web.config can be written to. if (!string.IsNullOrEmpty(language)) { Thread.CurrentThread.CurrentUICulture = new CultureInfo(language); _configReaderWriter.UpdateLanguage(language); } var settingsModel = new SettingsViewModel(); var installationService = new InstallationService(); IEnumerable <RepositoryInfo> supportedDatabases = installationService.GetSupportedDatabases(); settingsModel.SetSupportedDatabases(supportedDatabases); return(View(settingsModel)); }
public void Setup() { _container = new MocksAndStubsContainer(); _applicationSettings = _container.ApplicationSettings; _applicationSettings.Installed = false; _settingsService = _container.SettingsService; _userService = _container.UserService; _configReaderWriter = _container.ConfigReaderWriter; _repositoryFactory = _container.RepositoryFactory; _installationService = _container.InstallationService; _databaseTester = _container.DatabaseTester; _installerRepository = _container.InstallerRepository; _installController = new InstallController(_applicationSettings, _configReaderWriter, _installationService, _databaseTester); }
public void Setup() { _container = new MocksAndStubsContainer(); _applicationSettings = _container.ApplicationSettings; _context = _container.UserContext; _settingsService = _container.SettingsService; _userService = _container.UserService; _controller = new ControllerBaseStub(_applicationSettings, _userService, _context, _settingsService); _controller.SetFakeControllerContext("~/"); // InstallController _configReaderWriter = new ConfigReaderWriterStub(); _databaseTester = _container.DatabaseTester; _installationService = _container.InstallationService; }
private async Task Upgrade() { try { ShowProgressIndicator(); var interop = new Interop(JSRuntime); await interop.RedirectBrowser(NavigateUrl(), 10); await InstallationService.Upgrade(); } catch (Exception ex) { await logger.LogError(ex, "Error Executing Upgrade {Error}", ex.Message); AddModuleMessage("Error Executing Upgrade", MessageType.Error); } }
private async Task Download(string packageid, string version) { try { await PackageService.DownloadPackageAsync(packageid, version, "Framework"); ShowProgressIndicator(); var interop = new Interop(JSRuntime); await interop.RedirectBrowser(NavigateUrl(), 10); await InstallationService.Upgrade(); } catch (Exception ex) { await logger.LogError(ex, "Error Downloading Framework {Error}", ex.Message); AddModuleMessage("Error Downloading Framework", MessageType.Error); } }
public void GetStatus_ForDefaultSolution_ShouldSayNotInstalledAndUpdateNotRequired() { var version = Version.Parse(CrmConstants.InitialSolutionVersion); A.CallTo(() => discovery.Discover()) .Returns(new List <InstallationVersion> { new TestInstallationVersion(version, new Dictionary <int, InstallationComponent>()) }); var dispatcher = A.Fake <IDataAccessDispatcher>(); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction <Solution> > ._)) .Returns(new Solution { Name = "TestSolution", DisplayName = "Test Solution", Version = version.ToString() }); var result = new InstallationService(discovery, dispatcher).GetStatus(); Assert.False(result.IsInstalled); Assert.False(result.RequiresUpdate); }
public void StartInstallation_ForNewVersionWithOneComponent_InstallationIsNotComplete_AndReturnsDetailsOfFirstComponent() { var currentVersion = new Version("0.0.0.1"); var latestVersion = new Version("0.0.0.2"); var componentDescription = "dhjskldsa"; var componentInstall = new InstallationComponent(componentDescription, OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); var components = new Dictionary <int, InstallationComponent>(); components.Add(0, componentInstall); A.CallTo(() => discovery.Discover()) .Returns(new List <InstallationVersion> { new TestInstallationVersion(currentVersion, new Dictionary <int, InstallationComponent>()), new TestInstallationVersion(latestVersion, components), }); var dispatcher = A.Fake <IDataAccessDispatcher>(); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction <Solution> > ._)) .Returns(new Solution { Name = "TestSolution", DisplayName = "Test Solution", Version = currentVersion.ToString() }); var result = new InstallationService(discovery, dispatcher).StartInstallation(); Assert.True(result.IsSuccess); Assert.Equal(componentDescription, result.NextComponentDescription); Assert.Equal(0, result.NextComponentId); Assert.Equal("0.0.0.2", result.NextComponentVersion.ToString()); Assert.True(result.MoreToInstall); }
public void GetStatus_ForNotUpToDateSolution_ShouldSayIsInstalledAndUpdateIsRequired() { var currentVersion = new Version("0.0.0.1"); var latestVersion = new Version("0.0.0.2"); A.CallTo(() => discovery.Discover()) .Returns(new List <InstallationVersion> { new TestInstallationVersion(currentVersion, new Dictionary <int, InstallationComponent>()), new TestInstallationVersion(latestVersion, new Dictionary <int, InstallationComponent>()), }); var dispatcher = A.Fake <IDataAccessDispatcher>(); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction <Solution> > ._)) .Returns(new Solution { Name = "TestSolution", DisplayName = "Test Solution", Version = currentVersion.ToString() }); var result = new InstallationService(discovery, dispatcher).GetStatus(); Assert.True(result.IsInstalled); Assert.True(result.RequiresUpdate); }
/// <summary> /// Creates a new instance of MocksAndStubsContainer. /// </summary> /// <param name="useCacheMock">The 'Roadkill' MemoryCache is used by default, but as this is static it can have problems with /// the test runner unless you clear the Container.MemoryCache on setup each time, but then doing that doesn't give a realistic /// reflection of how the MemoryCache is used inside an ASP.NET environment.</param> public MocksAndStubsContainer(bool useCacheMock = false) { ApplicationSettings = new ApplicationSettings(); ApplicationSettings.Installed = true; ApplicationSettings.AttachmentsFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "attachments"); ConfigReaderWriter = new ConfigReaderWriterStub(); // Cache MemoryCache = useCacheMock ? new CacheMock() : CacheMock.RoadkillCache; ListCache = new ListCache(ApplicationSettings, MemoryCache); SiteCache = new SiteCache(MemoryCache); PageViewModelCache = new PageViewModelCache(ApplicationSettings, MemoryCache); // Repositories SettingsRepository = new SettingsRepositoryMock(); SettingsRepository.SiteSettings = new SiteSettings(); SettingsRepository.SiteSettings.MarkupType = "Creole"; UserRepository = new UserRepositoryMock(); PageRepository = new PageRepositoryMock(); InstallerRepository = new InstallerRepositoryMock(); RepositoryFactory = new RepositoryFactoryMock() { SettingsRepository = SettingsRepository, UserRepository = UserRepository, PageRepository = PageRepository, InstallerRepository = InstallerRepository }; DatabaseTester = new DatabaseTesterMock(); // Plugins PluginFactory = new PluginFactoryMock(); MarkupConverter = new MarkupConverter(ApplicationSettings, SettingsRepository, PageRepository, PluginFactory); // Services // Dependencies for PageService. Be careful to make sure the class using this Container isn't testing the mock. SettingsService = new SettingsService(RepositoryFactory, ApplicationSettings); UserService = new UserServiceMock(ApplicationSettings, UserRepository); UserContext = new UserContext(UserService); SearchService = new SearchServiceMock(ApplicationSettings, SettingsRepository, PageRepository, PluginFactory); SearchService.PageContents = PageRepository.PageContents; SearchService.Pages = PageRepository.Pages; HistoryService = new PageHistoryService(ApplicationSettings, SettingsRepository, PageRepository, UserContext, PageViewModelCache, PluginFactory); FileService = new FileServiceMock(); PageService = new PageService(ApplicationSettings, SettingsRepository, PageRepository, SearchService, HistoryService, UserContext, ListCache, PageViewModelCache, SiteCache, PluginFactory); StructureMapContainer = new Container(x => { x.AddRegistry(new TestsRegistry(this)); }); Locator = new StructureMapServiceLocator(StructureMapContainer, false); InstallationService = new InstallationService((databaseName, connectionString) => { InstallerRepository.DatabaseName = databaseName; InstallerRepository.ConnectionString = connectionString; return(InstallerRepository); }, Locator); // EmailTemplates EmailClient = new EmailClientMock(); }
public static void Execute(DatabaseManager dbMgr, string[] args) { //---- Hook up the assembly loading ---- AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); AppDomain.CurrentDomain.TypeResolve += new ResolveEventHandler(CurrentDomain_TypeResolve); assemblyLoader = new KernelAssemblyLoader(); assemblyLoader.DatabaseManager = dbMgr; kernelEnvironment.Register( new Instance(assemblyLoader, "AssemblyLoader")); kernelEnvironment.Register( new ConfiguredComponent( typeof(DocumentManagement), "DocumentManagement")); kernelEnvironment.Register( new ConfiguredComponent( typeof(KernelApplicationsDirectory), "ApplicationManagement")); kernelEnvironment.Register( new ConfiguredComponent( typeof(Installation.AuthoringInstallationService), "InstallationService")); kernelEnvironment.Register( new Instance(dbMgr, "DatabaseManagerDriver")); kernelEnvironment.Register( new AlwaysNewConfiguredComponent(typeof(DatabaseManager), "DatabaseManager")); kernelEnvironment.Register( new ConfiguredComponent(typeof(StandardConsole), "Console")); kernelEnvironment.Register( new ConfiguredComponent(typeof(ServiceManager), "Services")); kernelEnvironment.GetInstance<IServiceRegistry>(); kernelEnvironment.Register( new ConfiguredComponent(typeof(ThreadControl), "ThreadControl")); //---- INIT ---- InstallationService installService = kernelEnvironment.GetInstance<InstallationService>(); if (!installService.IsPackageInstalled(baseSystemId)) { IPackage pkg = installService.OpenPackageForInstallation("/Volumes/Host/Installation/BaseSystem.ipkg"); pkg.Selected = true; installService.Install(pkg); pkg = installService.OpenPackageForInstallation("/Volumes/Host/Installation/Graphics.ipkg"); pkg.Selected = true; installService.Install(pkg); pkg = installService.OpenPackageForInstallation("/Volumes/Host/Installation/Direct3D10Driver.ipkg"); pkg.Selected = true; installService.Install(pkg); /* pkg = installService.OpenPackageForInstallation("/Volumes/Host/Installation/Tools.ipkg"); pkg.Selected = true; installService.Install(pkg);*/ } IApplicationInstances appInstances = kernelEnvironment.GetInstance<IApplicationInstances>(); IApplicationInstance init = appInstances.Run("/System/Applications/Components/Init", string.Empty, args); while (init.IsRunning) Thread.Sleep(100); }
public MeasurementServiceImpl(PowerGuideClient client, InstallationService installationService, DateTimeZone reportTimeZone) { this.client = client; this.installationService = installationService; this.reportTimeZone = reportTimeZone; }
private async Task SaveSite() { if (_tenantid != "-" && _name != string.Empty && _urls != string.Empty && _themetype != "-" && (_layouts.Count == 0 || _layouttype != "-") && _containertype != "-" && _sitetemplatetype != "-") { var duplicates = new List <string>(); var aliases = await AliasService.GetAliasesAsync(); foreach (string name in _urls.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { if (aliases.Exists(item => item.Name == name)) { duplicates.Add(name); } } if (duplicates.Count == 0) { InstallConfig config = new InstallConfig(); if (_tenantid == "+") { if (!string.IsNullOrEmpty(_tenantname) && _tenants.FirstOrDefault(item => item.Name == _tenantname) == null) { // validate host credentials var user = new User(); user.SiteId = PageState.Site.SiteId; user.Username = Constants.HostUser; user.Password = _hostpassword; user = await UserService.LoginUserAsync(user, false, false); if (user.IsAuthenticated) { if (!string.IsNullOrEmpty(_server) && !string.IsNullOrEmpty(_database)) { var connectionString = string.Empty; if (_databasetype == "LocalDB") { connectionString = "Data Source=" + _server + ";AttachDbFilename=|DataDirectory|\\" + _database + ".mdf;Initial Catalog=" + _database + ";Integrated Security=SSPI;"; } else { connectionString = "Data Source=" + _server + ";Initial Catalog=" + _database + ";"; if (_integratedsecurity) { connectionString += "Integrated Security=SSPI;"; } else { connectionString += "User ID=" + _username + ";Password="******"You Must Specify A Server And Database", MessageType.Error); } } else { AddModuleMessage("Invalid Host Password", MessageType.Error); } } else { AddModuleMessage("Tenant Name Is Missing Or Already Exists", MessageType.Error); } } else { var tenant = _tenants.FirstOrDefault(item => item.TenantId == int.Parse(_tenantid)); if (tenant != null) { config.TenantName = tenant.Name; config.ConnectionString = tenant.DBConnectionString; config.IsNewTenant = false; } } if (!string.IsNullOrEmpty(config.TenantName)) { config.SiteName = _name; config.Aliases = _urls.Replace("\n", ","); config.DefaultTheme = _themetype; config.DefaultLayout = _layouttype; config.DefaultContainer = _containertype; config.SiteTemplate = _sitetemplatetype; ShowProgressIndicator(); var installation = await InstallationService.Install(config); if (installation.Success) { var aliasname = config.Aliases.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[0]; var uri = new Uri(NavigationManager.Uri); NavigationManager.NavigateTo(uri.Scheme + "://" + aliasname, true); } else { await logger.LogError("Error Creating Site {Error}", installation.Message); AddModuleMessage(installation.Message, MessageType.Error); } } } else { AddModuleMessage(string.Join(", ", duplicates.ToArray()) + " Already Used For Another Site", MessageType.Warning); } } else { AddModuleMessage("You Must Provide A Tenant, Site Name, Alias, Default Theme/Container, And Site Template", MessageType.Warning); } }