public UpdateReadyDialog(Updatable u, UpdateService us) { InitializeComponent(); this.u = u; this.us = us; this.label2.Text = "An update for " + u.getName() + " is ready!"; }
public void Check01ReferencesOk() { //SETUP //ATTEMPT ICreateService<Post, DetailPostDto> createService = new CreateService<Post, DetailPostDto>(null); IDetailService<Post, DetailPostDto> detailService = new DetailService<Post, DetailPostDto>(null); IListService<Post, DetailPostDto> listService = new ListService<Post, DetailPostDto>(null); IUpdateService<Post, DetailPostDto> updateService = new UpdateService<Post, DetailPostDto>(null); //VERIFY (listService is ListService<Post, DetailPostDto>).ShouldEqual(true); }
public void Test01DirectReferenceOk() { //SETUP //ATTEMPT ICreateService<Post> createService = new CreateService<Post>(null); IDetailService<Post> detailService = new DetailService<Post>(null); IListService<Post> listService = new ListService<Post>(null); IUpdateService<Post> updateService = new UpdateService<Post>(null); //VERIFY (listService is IListService<Post>).ShouldEqual(true); }
public void Check02UpdateFailOk() { using (var db = new SampleWebAppDb()) { //SETUP var service = new UpdateService<Tag, SimpleTagDto>(db); var dto = new SimpleTagDto(); dto.SetSupportedFunctions(CrudFunctions.None); //ATTEMPT var status = service.Update(dto); //VERIFY status.IsValid.ShouldEqual(false); status.Errors.Count.ShouldEqual(1); status.Errors[0].ErrorMessage.ShouldEndWith("is not supported in this mode."); dto.FunctionsCalledCommaDelimited.ShouldEqual(""); } }
private void GetAvaialableLanguagePacks(IDictionary <string, PackageInfo> validPackages) { try { StreamReader myResponseReader = UpdateService.GetLanguageList(); var xmlDoc = new XmlDocument { XmlResolver = null }; xmlDoc.Load(myResponseReader); XmlNodeList languages = xmlDoc.SelectNodes("available/language"); if (languages != null) { var installedPackages = PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "CoreLanguagePack"); var installedLanguages = installedPackages.Select(package => LanguagePackController.GetLanguagePackByPackage(package.PackageID)).ToList(); foreach (XmlNode language in languages) { string cultureCode = ""; string version = ""; foreach (XmlNode child in language.ChildNodes) { if (child.Name == "culturecode") { cultureCode = child.InnerText; } if (child.Name == "version") { version = child.InnerText; } } if (!string.IsNullOrEmpty(cultureCode) && !string.IsNullOrEmpty(version) && version.Length == 6) { var myCIintl = new CultureInfo(cultureCode, true); version = version.Insert(4, ".").Insert(2, "."); var package = new PackageInfo { Owner = OwnerUpdateService, Name = "LanguagePack-" + myCIintl.Name, FriendlyName = myCIintl.NativeName }; package.Name = myCIintl.NativeName; package.PackageType = "CoreLanguagePack"; package.Description = cultureCode; Version ver = null; Version.TryParse(version, out ver); package.Version = ver; if ( installedLanguages.Any( l => LocaleController.Instance.GetLocale(l.LanguageID).Code.ToLowerInvariant().Equals(cultureCode.ToLowerInvariant()) && installedPackages.First(p => p.PackageID == l.PackageID).Version >= ver)) { continue; } if (validPackages.Values.Any(p => p.Name == package.Name)) { var existPackage = validPackages.Values.First(p => p.Name == package.Name); if (package.Version > existPackage.Version) { existPackage.Version = package.Version; } } else { validPackages.Add(cultureCode, package); } } } } } catch (Exception) { //suppress for now - need to decide what to do when webservice is unreachable //throw; //same problem happens in InstallWizard.aspx.cs in BindLanguageList method } }
public void SetUp() { var personList = new List <Person>(); var emplList = new List <Employment>(); var emplIdCount = 0; var personIdCount = 0; var cachedAddressList = new List <CachedAddress>(); var cachedIdCount = 0; var personalAddressList = new List <PersonalAddress>(); var personalIdCount = 0; _emplRepoMock = NSubstitute.Substitute.For <IGenericRepository <Employment> >(); _orgUnitRepoMock = NSubstitute.Substitute.For <IGenericRepository <OrgUnit> >(); _personRepoMock = NSubstitute.Substitute.For <IGenericRepository <Person> >(); _cachedAddressRepoMock = NSubstitute.Substitute.For <IGenericRepository <CachedAddress> >(); _personalAddressRepoMock = NSubstitute.Substitute.For <IGenericRepository <PersonalAddress> >(); _actualLaunderer = NSubstitute.Substitute.For <IAddressLaunderer>(); _coordinates = NSubstitute.Substitute.For <IAddressCoordinates>(); _dataProvider = NSubstitute.Substitute.For <IDbUpdaterDataProvider>(); _workAddressRepoMock = NSubstitute.Substitute.For <IGenericRepository <WorkAddress> >(); _mailSenderMock = NSubstitute.Substitute.For <IMailSender>(); _subRepo = NSubstitute.Substitute.For <IGenericRepository <Core.DomainModel.Substitute> >(); _reportRepo = NSubstitute.Substitute.For <IGenericRepository <DriveReport> >(); _driveService = NSubstitute.Substitute.For <IDriveReportService>(); _subservice = NSubstitute.Substitute.For <ISubstituteService>(); _personRepoMock.AsQueryable().Returns(personList.AsQueryable()); _personRepoMock.Insert(new Person()).ReturnsForAnyArgs(x => x.Arg <Person>()).AndDoes(x => personList.Add(x.Arg <Person>())).AndDoes(x => x.Arg <Person>().Id = personIdCount).AndDoes(x => personIdCount++); _emplRepoMock.AsQueryable().Returns(emplList.AsQueryable()); _emplRepoMock.Insert(new Employment()).ReturnsForAnyArgs(x => x.Arg <Employment>()).AndDoes(x => emplList.Add(x.Arg <Employment>())).AndDoes(x => x.Arg <Employment>().Id = emplIdCount).AndDoes(x => emplIdCount++); _cachedAddressRepoMock.Insert(new CachedAddress()).ReturnsForAnyArgs(x => x.Arg <CachedAddress>()).AndDoes(x => cachedAddressList.Add(x.Arg <CachedAddress>())).AndDoes(x => x.Arg <CachedAddress>().Id = cachedIdCount).AndDoes(x => cachedIdCount++); cachedAddressList.Add(new CachedAddress() { Id = 999, StreetName = "Katrinebjergvej", StreetNumber = "93B", ZipCode = 8200, Town = "Aarhus N", DirtyString = "Katrinebjergvej 93B, 8200 Aarhus N", IsDirty = false }); _cachedAddressRepoMock.AsQueryable().Returns(cachedAddressList.AsQueryable()); _personalAddressRepoMock.Insert(new PersonalAddress()).ReturnsForAnyArgs(x => x.Arg <PersonalAddress>()).AndDoes(x => personalAddressList.Add(x.Arg <PersonalAddress>())).AndDoes(x => x.Arg <PersonalAddress>().Id = personalIdCount).AndDoes(x => personalIdCount++); _personalAddressRepoMock.AsQueryable().Returns(personalAddressList.AsQueryable()); _actualLaunderer.Launder(new Address()).ReturnsForAnyArgs(x => x.Arg <CachedAddress>()); _uut = new UpdateService(_emplRepoMock, _orgUnitRepoMock, _personRepoMock, _cachedAddressRepoMock, _personalAddressRepoMock, _actualLaunderer, _coordinates, _dataProvider, _mailSenderMock, NSubstitute.Substitute.For <IAddressHistoryService>(), _reportRepo, _driveService, _subservice, _subRepo); _orgUnitRepoMock.AsQueryable().ReturnsForAnyArgs(new List <OrgUnit>() { new OrgUnit() { Id = 1, OrgId = 1, ShortDescription = "ITM", LongDescription = "IT Minds, Aarhus", Level = 0, HasAccessToFourKmRule = false, }, new OrgUnit() { Id = 2, OrgId = 2, ShortDescription = "ITMB", LongDescription = "IT Minds, Aarhus child", Level = 1, ParentId = 1, HasAccessToFourKmRule = false, } }.AsQueryable()); }
private void BindGrid(string installPath, DataGrid grid) { var packages = new List <PackageInfo>(); var invalidPackages = new List <string>(); foreach (string file in Directory.GetFiles(installPath)) { if (file.ToLower().EndsWith(".zip") || file.ToLower().EndsWith(".resources")) { var unzip = new ZipInputStream(new FileStream(file, FileMode.Open, FileAccess.Read)); var manifestReader = new StreamReader(unzip); try { ZipEntry entry = unzip.GetNextEntry(); while (entry != null) { if (!entry.IsDirectory) { string fileName = entry.Name; string extension = Path.GetExtension(fileName); if (extension.ToLower() == ".dnn" || extension.ToLower() == ".dnn5") { //Manifest string manifest = manifestReader.ReadToEnd(); var package = new PackageInfo(); package.Manifest = manifest; if (!string.IsNullOrEmpty(manifest)) { var doc = new XPathDocument(new StringReader(manifest)); XPathNavigator rootNav = doc.CreateNavigator().SelectSingleNode("dotnetnuke"); string packageType = String.Empty; if (rootNav.Name == "dotnetnuke") { packageType = XmlUtils.GetAttributeValue(rootNav, "type"); } else if (rootNav.Name.ToLower() == "languagepack") { packageType = "LanguagePack"; } XPathNavigator nav = null; switch (packageType.ToLower()) { case "package": nav = rootNav.SelectSingleNode("packages/package"); break; case "languagepack": nav = Installer.ConvertLegacyNavigator(rootNav, new InstallerInfo()).SelectSingleNode("packages/package"); break; } if (nav != null) { package.Name = XmlUtils.GetAttributeValue(nav, "name"); package.PackageType = XmlUtils.GetAttributeValue(nav, "type"); package.IsSystemPackage = XmlUtils.GetAttributeValueAsBoolean(nav, "isSystem", false); package.Version = new Version(XmlUtils.GetAttributeValue(nav, "version")); package.FriendlyName = XmlUtils.GetNodeValue(nav, "friendlyName"); if (String.IsNullOrEmpty(package.FriendlyName)) { package.FriendlyName = package.Name; } package.Description = XmlUtils.GetNodeValue(nav, "description"); package.FileName = file.Replace(installPath + "\\", ""); packages.Add(package); } } break; } } entry = unzip.GetNextEntry(); } } catch (Exception) { invalidPackages.Add(file); } finally { manifestReader.Dispose(); unzip.Close(); unzip.Dispose(); } } } //now add language packs from update service try { StreamReader myResponseReader = UpdateService.GetLanguageList(); var xmlDoc = new XmlDocument(); xmlDoc.Load(myResponseReader); XmlNodeList languages = xmlDoc.SelectNodes("available/language"); if (languages != null) { var installedPackages = PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "CoreLanguagePack"); var installedLanguages = installedPackages.Select(package => LanguagePackController.GetLanguagePackByPackage(package.PackageID)).ToList(); foreach (XmlNode language in languages) { string cultureCode = ""; string version = ""; foreach (XmlNode child in language.ChildNodes) { if (child.Name == "culturecode") { cultureCode = child.InnerText; } if (child.Name == "version") { version = child.InnerText; } } if (!string.IsNullOrEmpty(cultureCode) && !string.IsNullOrEmpty(version) && version.Length == 6) { var myCIintl = new CultureInfo(cultureCode, true); version = version.Insert(4, ".").Insert(2, "."); var package = new PackageInfo { Owner = OwnerUpdateService, Name = "LanguagePack-" + myCIintl.Name, FriendlyName = myCIintl.NativeName }; package.Name = myCIintl.NativeName; package.Description = cultureCode; Version ver = null; Version.TryParse(version, out ver); package.Version = ver; if ( installedLanguages.Any( l => LocaleController.Instance.GetLocale(l.LanguageID).Code.ToLowerInvariant().Equals(cultureCode.ToLowerInvariant()) && installedPackages.First(p => p.PackageID == l.PackageID).Version >= ver)) { continue; } if (packages.Any(p => p.Name == package.Name)) { var existPackage = packages.First(p => p.Name == package.Name); if (package.Version > existPackage.Version) { packages.Remove(existPackage); packages.Add(package); } } else { packages.Add(package); } } } } } catch (Exception) { //suppress for now - need to decide what to do when webservice is unreachable //throw; //same problem happens in InstallWizard.aspx.cs in BindLanguageList method } if (invalidPackages.Count > 0) { string pkgErrorsMsg = invalidPackages.Aggregate(string.Empty, (current, pkg) => current + (pkg + "<br />")); Skin.AddModuleMessage(this, Localization.GetString("PackageErrors.Text", LocalResourceFile) + pkgErrorsMsg, ModuleMessage.ModuleMessageType.RedError); } grid.DataSource = packages; grid.DataBind(); }
public void TestMethod1() { UpdateService = new UpdateService(); }
public void Check10UpdateBadMisingKeyOk() { using (var db = new SampleWebAppDb()) { //SETUP var snap = new DbSnapShot(db); var firstGrade = db.PostTagGrades.Include(x => x.TagPart).Include(x => x.PostPart).First(); var service = new UpdateService<PostTagGrade, BadPostTagGradeMissingKeyDto>(db); var setupService = new UpdateSetupService<PostTagGrade, BadPostTagGradeMissingKeyDto>(db); //ATTEMPT var setupStatus = setupService.GetOriginal(firstGrade.PostId, firstGrade.TagId); setupStatus.IsValid.ShouldEqual(true, setupStatus.Errors); setupStatus.Result.Grade = 999; var ex = Assert.Throws<MissingPrimaryKeyException>( () => service.Update(setupStatus.Result)); //VERIFY ex.Message.ShouldEqual("The dto must contain all the key(s) properties from the data class."); } }
public void Check06UpdateWithKeyPropertiesInWrongOrderOk() { using (var db = new SampleWebAppDb()) { //SETUP var snap = new DbSnapShot(db); var firstGrade = db.PostTagGrades.Include(x => x.TagPart).Include(x => x.PostPart).First(); var service = new UpdateService<PostTagGrade, SimpleTagPostGradeDto>(db); var setupService = new UpdateSetupService<PostTagGrade, SimpleTagPostGradeDto>(db); //ATTEMPT var setupStatus = setupService.GetOriginal(firstGrade.PostId, firstGrade.TagId); setupStatus.IsValid.ShouldEqual(true, setupStatus.Errors); setupStatus.Result.Grade = 999; var status = service.Update(setupStatus.Result); setupStatus.Result.LogSpecificName("End"); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); status.SuccessMessage.ShouldEqual("Successfully updated PostTagGrade."); snap.CheckSnapShot(db); var updatedfirstGrade = db.PostTagGrades.First(); updatedfirstGrade.Grade.ShouldEqual(999); } }
public TaskType Update(dynamic taskTypeData) { var timeEntryType = Uow.TaskTypeRepository.GetById((int)taskTypeData.Id); if (timeEntryType == null) { throw new CoralTimeEntityNotFoundException($"timeEntryType with id {taskTypeData.Id} not found"); } #region We shouldn't change projectId for Tasks if (timeEntryType.ProjectId != (int?)taskTypeData["projectId"]) { taskTypeData["projectId"] = timeEntryType.ProjectId; } #endregion We shouldn't change projectId for Tasks var user = Uow.UserRepository.LinkedCacheGetByName(CurrentUserName); if (taskTypeData["projectId"] != null && !user.IsAdmin) { var project = Uow.ProjectRepository.GetById((int)taskTypeData.ProjectId); if (project == null) { throw new CoralTimeEntityNotFoundException($"Project with id {taskTypeData.ProjectId} not found"); } var member = Uow.MemberRepository.LinkedCacheGetByName(CurrentUserName); if (member == null) { throw new CoralTimeEntityNotFoundException($"Member with userName {CurrentUserName} not found"); } var managerRoleId = Uow.ProjectRoleRepository.GetManagerRoleId(); var memberProjectRole = Uow.MemberProjectRoleRepository.GetQueryWithIncludes() .FirstOrDefault(r => r.MemberId == member.Id && r.ProjectId == project.Id && r.RoleId == managerRoleId); if (memberProjectRole == null) { throw new CoralTimeForbiddenException("Forbidden"); } } if (taskTypeData["isActive"] != null && !(bool)taskTypeData["isActive"]) { var timeEntries = Uow.TimeEntryRepository .GetQueryWithIncludes() .Where(t => t.TaskTypesId == timeEntryType.Id && t.Date.Date == DateTime.Now.Date) .ToList(); timeEntries.ForEach(t => t.StopTimer()); } UpdateService <TaskType> .UpdateObject(taskTypeData, timeEntryType); try { Uow.TaskTypeRepository.Update(timeEntryType); Uow.Save(); ClearCache(); } catch (Exception e) { throw new CoralTimeDangerException("An error occurred while updating timeEntryType", e); } var result = Uow.TaskTypeRepository.GetById(timeEntryType.Id); return(result); }
public void Check09UpdateWithListDtoBad() { using (var db = new SampleWebAppDb()) { //SETUP var listService = new ListService<Post, SimplePostDto>(db); var firstPostUntracked = listService.GetAll().First(); var service = new UpdateService<Post, SimplePostDto>(db); //ATTEMPT firstPostUntracked.Title = "Can't I ask a question?"; var status = service.Update(firstPostUntracked); firstPostUntracked.LogSpecificName("End"); //VERIFY status.IsValid.ShouldEqual(false); status.Errors.Count.ShouldEqual(1); status.Errors[0].ErrorMessage.ShouldEqual("Sorry, but you can't ask a question, i.e. the title can't end with '?'."); } }
protected void OnButtonUpdateNowClicked(object sender, System.EventArgs e) { Store(); UpdateService.CheckForUpdates(); }
/// <summary> /// To test this: /// 1. Install this version (1.0.0). /// 2. Bump the version to 1.1.0 and then try running the installed version (1.0.0). /// 3. Bump the version to 2.0.0 and then try running the installed version (1.1.0). /// </summary> private async Task UpdateApplication() { var updateSerice = new UpdateService(); var updateResult = await updateSerice.Update(); switch (updateResult) { case UpdateResult.None: case UpdateResult.Update: { Debug.WriteLine("There is no need to restart."); await Dispatcher.BeginInvoke((Action)(() => { var laundherWindow = MainWindow; MainWindow = new MainWindow(); MainWindow.Show(); laundherWindow.Close(); })); break; } case UpdateResult.UpdateAndRestart: { Debug.WriteLine("We need to restart."); await Dispatcher.BeginInvoke((Action)(() => { var dialogWindow = new Window { Content = new Label { Content = "Restarting!", }, }; dialogWindow.ShowDialog(); })); updateSerice.Restart(); return; } case UpdateResult.Error: { Debug.WriteLine("I don't know what happened, but this is life for some reason!"); await Dispatcher.BeginInvoke((Action)(() => { var laundherWindow = MainWindow; MainWindow = new ErrorWindow(); MainWindow.Show(); laundherWindow.Close(); })); return; } default: { throw new NotImplementedException("You forgot to handle me!"); } } }
public UpdateUCommerceAssemblyVersionInDatabase(UpdateService updateService, RuntimeVersionChecker runtimeVersion, IInstallerLoggingService installerLoggingService) { _updateService = updateService; _runtimeVersion = runtimeVersion; _installerLoggingService = installerLoggingService; }
public AboutPaasteelViewModel() { updateService = UpdateService.Instance; updateService.CheckForUpdatesStarted += Instance_CheckForUpdatesStatusChanged; updateService.CheckForUpdatesFinished += Instance_CheckForUpdatesStatusChanged; }
public void TestUpdater() { using (UpdateService<TestUpdateServer> service = new UpdateService<TestUpdateServer>(51315, "Updater")) { service.Connect(); using (UpdateClient<IUpdateServer> client = new UpdateClient<IUpdateServer>(new IPAddress(new byte[] { 127, 0, 0, 1 }), 51315, "Updater")) { client.Connect(); Assert.IsTrue(client.ServiceObject.CheckForUpdate(new Version(1, 0)), "Version check failed!"); Assert.IsFalse(client.ServiceObject.CheckForUpdate(new Version(2, 0)), "Version check not failed!"); Assert.IsFalse(client.ServiceObject.CheckForUpdate(new Version(3, 0)), "Version check not failed!"); using (IFileLoader loader = new StreamFileLoader(new MemoryStream())) { client.ServiceObject.DownloadUpdate(loader); } client.Disconnect(); } service.Disconnect(); } }
public void Test10UpdateSalesOrderViaServiceOk() { using (var db = new AdventureWorksLt2012()) { //SETUP var setupService = new UpdateSetupService(db); var service = new UpdateService(db); var firstOrderHeader = db.SalesOrderHeaders.AsNoTracking().First(); var newComment = Guid.NewGuid().ToString("N"); //ATTEMPT var status = setupService.GetOriginal<CrudSalesOrderDto>(firstOrderHeader.SalesOrderID) ; status.ShouldBeValid(); status.Result.Comment = newComment; status.Result.Status = 99; //should not be copied back var updateStatus = service.Update(status.Result); //VERIFY updateStatus.ShouldBeValid(); var readBack = db.SalesOrderHeaders.Single(x => x.SalesOrderID == firstOrderHeader.SalesOrderID); readBack.Comment.ShouldEqual(newComment); readBack.Status.ShouldEqual(firstOrderHeader.Status); } }
public void Test06AddressUpdateViaServiceOk() { using (var db = new AdventureWorksLt2012()) { //SETUP var setupService = new UpdateSetupService(db); var service = new UpdateService(db); var lastCustomerWithAddress = db.Customers.Include(x => x.CustomerAddresses).Where( x => x.CustomerAddresses.Count > 0).AsNoTracking().OrderByDescending(x => x.CustomerID).First(); //ATTEMPT var setupStatus = setupService.GetOriginal<CrudCustomerAddressDto>(lastCustomerWithAddress.CustomerID, lastCustomerWithAddress.CustomerAddresses.Last().AddressID); setupStatus.IsValid.ShouldEqual(true, setupStatus.Errors); setupStatus.Result.Address.AddressLine2 = Guid.NewGuid().ToString("D"); var status = service.Update(setupStatus.Result); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); var newLastCustomer = db.Customers.AsNoTracking().Include(x => x.CustomerAddresses.Select(y => y.Address)).OrderByDescending(x => x.CustomerID).First(); newLastCustomer.CustomerAddresses.Count.ShouldEqual(lastCustomerWithAddress.CustomerAddresses.Count); newLastCustomer.CustomerAddresses.OrderByDescending(x => x.AddressID).First().Address.AddressLine2.ShouldEqual(setupStatus.Result.Address.AddressLine2); } }
public void Check07UpdateWithListDtoCheckDateOk() { using (var db = new SampleWebAppDb()) { //SETUP var snap = new DbSnapShot(db); var firstPost = db.Posts.Include(x => x.Tags).AsNoTracking().First(); var originalDateTime = firstPost.LastUpdated; Thread.Sleep(400); var service = new UpdateService<Post, SimplePostDto>(db); var setupService = new UpdateSetupService<Post, SimplePostDto>(db); //ATTEMPT var setupStatus = setupService.GetOriginal(firstPost.PostId); setupStatus.Result.Title = Guid.NewGuid().ToString(); var status = service.Update(setupStatus.Result); setupStatus.Result.LogSpecificName("End"); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); status.SuccessMessage.ShouldEqual("Successfully updated Post."); snap.CheckSnapShot(db); Assert.GreaterOrEqual(db.Posts.First().LastUpdated.Subtract(originalDateTime).Milliseconds, 400); } }
internal void Should_CanProcessUpdate(DateTime currentDateTime, List<int> allowedUpdateUtcHours, UpdateService.UpdateEventInfo updateEventInfo, TimeSpan updateFrequency, bool expectedResult) { // Arrage var dateTimeProxy = Mock.Of<IDateTimeProxy>(x => x.UtcNow == currentDateTime); var sut = new UpdateService(string.Empty, ArchiveDirectoryPath, new DbContextFactory<UpdateDbContext>(), dateTimeProxy, ActivatorProxy.Instance); // Act var result = sut.CanProcessUpdate(updateFrequency, allowedUpdateUtcHours, updateEventInfo); // Assert Assert.Equal(expectedResult, result); }
private void lblAvailableVersion_Click(object sender, EventArgs e) { UpdateService.OpenDownloadPage(); }
public async Task Should_ReturnLastUpdateEventInfo() { // Arrange var lastUpdateDateTime = DateTime.Parse("2000-01-01T12:00:00", DateTimeFormatInfo.InvariantInfo); var updateEvents = new List<UpdateEvent> { new UpdateEvent { TrainingProviderId = TrainingProviderId, StartedOn = lastUpdateDateTime - TimeSpan.FromHours(1.0) }, new UpdateEvent { TrainingProviderId = TrainingProviderId, StartedOn = lastUpdateDateTime }, new UpdateEvent { TrainingProviderId = TrainingProviderId, StartedOn = lastUpdateDateTime - TimeSpan.FromHours(2.0) } }.AsQueryable(); var mockUpdateEventSet = MockDbSetFactory.CreateAsyncDbSetMock(updateEvents); var mockContext = Mock.Of<UpdateDbContext>(x => x.UpdateEvents == mockUpdateEventSet.Object); var sut = new UpdateService(string.Empty, ArchiveDirectoryPath, new DbContextFactory<UpdateDbContext>()); // Act var resultLastUpdateEventInfo = await sut.GetLastUpdateEventInfoAsync(TrainingProviderId, mockContext); // Assert Assert.NotNull(resultLastUpdateEventInfo); Assert.Equal(lastUpdateDateTime, resultLastUpdateEventInfo.StartedOn); }
public void Check25UpdatePostFailRunsSetupSecondaryDataAgainOk() { using (var db = new SampleWebAppDb()) { //SETUP var setupService = new UpdateSetupService<Post, DetailPostDto>(db); var updateService = new UpdateService<Post, DetailPostDto>(db); var firstPost = db.Posts.First(); //ATTEMPT var setupStatus = setupService.GetOriginal(firstPost.PostId); setupStatus.IsValid.ShouldEqual(true, setupStatus.Errors); setupStatus.Result.Title = null; //that will fail setupStatus.Result.Bloggers.SelectedValue = db.Blogs.First().BlogId.ToString("D"); setupStatus.Result.UserChosenTags.FinalSelection = db.Tags.Take(3).ToList().Select(x => x.TagId.ToString("D")).ToArray(); var status = updateService.Update(setupStatus.Result); //VERIFY status.IsValid.ShouldEqual(false); setupStatus.Result.Bloggers.KeyValueList.Count.ShouldEqual(db.Blogs.Count() + 1); setupStatus.Result.UserChosenTags.AllPossibleOptions.Count.ShouldEqual(db.Tags.Count()); } }
public async Task Should_UpdateTrainingCatalog() { // Arrange var trainingProvider = new TrainingProvider(); var description = "test update"; var mediaPathsContainer = new UpdateService.ServerMediaPathsContainer(); var updateDbContext = Mock.Of<UpdateDbContext>(x => x.UpdateEvents.Add(It.IsAny<UpdateEvent>()) == new UpdateEvent() && x.AuthorsResolves.Local == new ObservableCollection<AuthorResolve>()); var mockContext = Mock.Get(updateDbContext); var mockTrainingCatalog = new Mock<ITrainingCatalog>(); var mockActivator = new Mock<IActivatorProxy>(); mockActivator.Setup(x => x.CreateInstance<ITrainingCatalog>(It.IsAny<string>())) .Returns(mockTrainingCatalog.Object); var sut = new UpdateService(string.Empty, ArchiveDirectoryPath, new DbContextFactory<UpdateDbContext>(), DateTimeProxy.Instance, mockActivator.Object); // Act await sut.UpdateTrainingCatalogAsync(mockContext.Object, trainingProvider, description, mediaPathsContainer); // Assert mockContext.Verify(x => x.UpdateEvents.Add(It.IsAny<UpdateEvent>()), Times.Once); mockContext.Verify(x => x.SaveChangesAsync(), Times.Exactly(2)); mockActivator.Verify(x => x.CreateInstance<ITrainingCatalog>(It.IsAny<string>()), Times.Once); mockTrainingCatalog.Verify(x => x.Initialize(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<LocationType>(),It.IsAny<IMediaPath>(), It.IsAny<string>()), Times.Once()); mockTrainingCatalog.Verify(x => x.UpdateAsync(It.IsAny<UpdateEvent>(), It.IsAny<UpdateDbContext>(), It.IsAny<bool>(), It.IsAny<bool>()), Times.Once); mockTrainingCatalog.Verify(x => x.Dispose(), Times.Once); }
static Toggl() { UpdateService = new UpdateService(Toggl.IsUpdateCheckDisabled(), Toggl.UpdatesPath); }
public async Task Should_LogErrorToDb_When_UpdateTrainingCatalogThrowAggregateException() { // Arrange var trainingProvider = new TrainingProvider(); var description = "test update"; var mediaPathsContainer = new UpdateService.ServerMediaPathsContainer(); var updateDbContext = Mock.Of<UpdateDbContext>(x => x.UpdateEvents.Add(It.IsAny<UpdateEvent>()) == new UpdateEvent()); Mock.Get(updateDbContext).Setup(x => x.SetStateToDetached(It.IsAny<UpdateEvent>())); var mockContextFromFactory = new Mock<UpdateDbContext>(); mockContextFromFactory.Setup(x => x.SetStateToModified(It.IsAny<UpdateEvent>())); var dbContextFactory = Mock.Of<IDbContextFactory<UpdateDbContext>>(x => x.CreateDbContext() == mockContextFromFactory.Object); var mockTrainingCatalog = new Mock<ITrainingCatalog>(); mockTrainingCatalog.Setup(x => x.UpdateAsync(It.IsAny<UpdateEvent>(), It.IsAny<UpdateDbContext>(), It.IsAny<bool>(), It.IsAny<bool>())).Throws<AggregateException>(); var mockActivator = new Mock<IActivatorProxy>(); mockActivator.Setup(x => x.CreateInstance<ITrainingCatalog>(It.IsAny<string>())) .Returns(mockTrainingCatalog.Object); var sut = new UpdateService(string.Empty, ArchiveDirectoryPath, dbContextFactory, DateTimeProxy.Instance, mockActivator.Object); // Act await sut.UpdateTrainingCatalogAsync(updateDbContext, trainingProvider, description, mediaPathsContainer); // Assert Mock.Get(updateDbContext).Verify(x => x.SaveChangesAsync(), Times.Once); mockTrainingCatalog.Verify(x => x.UpdateAsync(It.IsAny<UpdateEvent>(), It.IsAny<UpdateDbContext>(), It.IsAny<bool>(), It.IsAny<bool>()), Times.Once); mockTrainingCatalog.Verify(x => x.Dispose(), Times.Once); Mock.Get(dbContextFactory).Verify(x => x.CreateDbContext(), Times.Once); mockContextFromFactory.Verify(x => x.SetStateToModified(It.IsAny<UpdateEvent>()), Times.Once()); mockContextFromFactory.Verify(x => x.SaveChanges(), Times.Once); }
public void Perf22UpdatePostAddTagOk() { int postId; using (var db = new SampleWebAppDb()) postId = db.Posts.Include(x => x.Tags).AsNoTracking().First().PostId; using (var db = new SampleWebAppDb()) { //SETUP var setupService = new UpdateSetupService<Post, DetailPostDto>(db); var updateService = new UpdateService<Post, DetailPostDto>(db); //ATTEMPT var setupStatus = setupService.GetOriginal(postId); setupStatus.Result.Title = Guid.NewGuid().ToString(); setupStatus.Result.Bloggers.SelectedValue = db.Blogs.First().BlogId.ToString("D"); setupStatus.Result.UserChosenTags.FinalSelection = db.Tags.Take(3).ToList().Select(x => x.TagId.ToString("D")).ToArray(); var status = updateService.Update(setupStatus.Result); setupStatus.Result.LogSpecificName("End"); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); foreach (var log in setupStatus.Result.LogOfCalls) { Console.WriteLine(log); } } }
private static void Main(string[] args) { try { if (Settings.Default.FirstRun) { Settings.Default.Upgrade(); Settings.Default.FirstRun = false; Settings.Default.Save(); } } catch (ConfigurationErrorsException ex) { DockingService.ShowError("Error upgrading settings", ex); } Application.EnableVisualStyles(); DockPanel panel = new WabbitcodeDockPanel(); StatusStrip statusBar = new WabbitcodeStatusBar(); ToolStripContainer toolStripContainer = new WabbitcodeToolStripContainer(statusBar, panel); Task.Factory.StartNew(() => InitializeDependencies(panel, statusBar, toolStripContainer), TaskCreationOptions.PreferFairness); Task.Factory.StartNew(() => { FileLocations.InitDirs(); FileLocations.InitFiles(); HighlightingUtils.MakeHighlightingFile(); }); Task.Factory.StartNew(() => { if (!UpdateService.CheckForUpdate()) { return; } var result = MessageBox.Show("New version available. Download now?", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.None); if (result != DialogResult.Yes) { return; } UpdateService.StartUpdater(); Application.Exit(); }); int numErrors = 0; AppBase appBase = new AppBase(toolStripContainer); #if !DEBUG try { #endif appBase.Run(args); #if !DEBUG } catch (Exception ex) { numErrors++; DockingService.ShowError("Unhandled exception occurred. Please report this to the developers", ex); } #endif if (numErrors == 0) { return; } do { try { appBase.DoEvents(); } catch (Exception ex) { numErrors++; DockingService.ShowError("Unhandled exception occurred. Please report this to the developers", ex); } } while (numErrors < 5); }
public void NotifyComponentChanges() { UpdateService.UpdateConfiguration(new Update.UpdatePackage(GetAllFiles())); }
static Function() { updateService = new UpdateService(); }
private void CheckForUpdates() { Task.Run(() => UpdateService.UpdatePlugin(_updaterSettings)); }
private void refreshMenuItem_Click(object sender, EventArgs e) { UpdateService.UpdateProjects(); }
public void Check02UpdateFlow(InstrumentedOpFlags errorFlag, bool isValid, string expectedFunctionsCalled) { using (var db = new SampleWebAppDb()) { //SETUP var service = new UpdateService<Tag, SimpleTagDto>(db); var dto = new SimpleTagDto(errorFlag) { TagId = db.Tags.First().TagId, Name = "Test Name", Slug = Guid.NewGuid().ToString("N") }; //ATTEMPT //dto.CopyDtoToData(db, dto, new Tag()); //do this to preload AutoMapper var status = service.Update(dto); //VERIFY status.IsValid.ShouldEqual(isValid); dto.FunctionsCalledCommaDelimited.ShouldEqual(expectedFunctionsCalled); } }
private void CurrentWindow_Loaded(object sender, RoutedEventArgs e) { UpdateService.CheckForUpdate(); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); TaskDialog.ForceEmulationMode = true; Version newVersion = null; string version = string.Empty; if (args.Length > 1 && args[0] == "-v") { version = args[1]; newVersion = new Version(version); } else { TaskDialog.ShowCommandBox(Resources.TaskDialog_UpdateToBeta_Title, Resources.TaskDialog_UpdateToBeta_Caption, Resources.TaskDialog_UpdateToBeta_Text, Resources.TaskDialog_UpdateToBeta_Buttons, false); AssemblyName assemblyName = AssemblyName.GetAssemblyName(Path.Combine(Application.StartupPath, "MLifter.exe")); WebClient client = new WebClient(); version = client.DownloadString(string.Format("{0}?base={1}&beta={2}&onstick={3}", Settings.Default.UpdateVersionUrl, assemblyName.Version.ToString(2), (TaskDialog.CommandButtonResult == 0).ToString(), MLifter.Generics.Methods.IsRunningFromStick())); newVersion = new Version(version); if (newVersion <= assemblyName.Version) { TaskDialog.MessageBox(Resources.TASK_DIALOG_NoNewVersionFound_Title, Resources.TASK_DIALOG_NoNewVersionFound_Caption, Resources.TASK_DIALOG_NoNewVersionFound_Text, TaskDialogButtons.OK, TaskDialogIcons.Information); Environment.Exit(-1); } } FileStream stream = null; try { UpdateService updateService = new UpdateService(); byte[] dll = updateService.ServeLatestMLVersion(newVersion.ToString(3), MLifter.Generics.Methods.IsRunningFromStick()); string dllPath = Path.GetTempFileName(); stream = File.OpenWrite(dllPath); stream.Write(dll, 0, dll.Length); stream.Close(); stream = null; Assembly assembly = null; string typeName = string.Empty; Type pluginType = null; if (File.Exists(dllPath)) { assembly = Assembly.LoadFile(dllPath); } else { throw new FileNotFoundException(); } if (assembly != null) { foreach (Type type in assembly.GetTypes()) { if (type.IsAbstract) { continue; } if (type.IsDefined(typeof(UpdateHandler), true)) { pluginType = type; break; } } if (pluginType != null) { IUpdateHandler updateHandler = Activator.CreateInstance(pluginType) as IUpdateHandler; updateHandler.StartUpdateProcess(newVersion); } else { throw new Exception(Resources.Exception_CouldNotFindUpdateLogic); } } else { throw new Exception(Resources.Exception_ErrorLoadingUpdateLogic); } } catch (Exception e) { TaskDialog.MessageBox(Resources.TaskDialog_ErrorStartingUpdate_Title, Resources.TaskDialog_ErrorStartingUpdate_Title, Resources.TaskDialog_ErrorStartingUpdate_Content, e.ToString(), string.Empty, string.Empty, TaskDialogButtons.OK, TaskDialogIcons.Error, TaskDialogIcons.Error); } finally { if (stream != null) { stream.Close(); } } }
public UpdateWindow(UpdateService updateservice) { this.UpdateService = updateservice; InitializeComponent(); }
public BasicBLL() { this.DeleteS = new DeleteService(db, FilesRemove); this.UpdateS = new UpdateService(db, FilesRemove); this.CreateS = new CreateService(db); }
public void Test21UpdateDirectPostCorrectOk() { using (var db = new SampleWebAppDb()) { //SETUP var snap = new DbSnapShot(db); var firstPostUntrackedNoIncludes = db.Posts.AsNoTracking().First(); var firstPostUntrackedWithIncludes = db.Posts.AsNoTracking().Include( x => x.Tags).First(); var service = new UpdateService<Post>(db); //ATTEMPT firstPostUntrackedNoIncludes.Title = Guid.NewGuid().ToString(); var status = service.Update(firstPostUntrackedNoIncludes); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); snap.CheckSnapShot(db); var updatedPost = db.Posts.Include(x => x.Tags).First(); updatedPost.Title.ShouldEqual(firstPostUntrackedNoIncludes.Title); updatedPost.Content.ShouldEqual(firstPostUntrackedWithIncludes.Content); updatedPost.Blogger.ShouldNotEqualNull(); updatedPost.Blogger.Name.ShouldEqual(firstPostUntrackedWithIncludes.Blogger.Name); CollectionAssert.AreEqual(firstPostUntrackedWithIncludes.Tags.Select(x => x.TagId), updatedPost.Tags.Select(x => x.TagId)); } }
public void Check06UpdateWithListDtoOk() { using (var db = new SampleWebAppDb()) { //SETUP var snap = new DbSnapShot(db); var firstPost = db.Posts.Include(x => x.Tags).AsNoTracking().First(); var service = new UpdateService<Post, SimplePostDto>(db); var setupService = new UpdateSetupService<Post, SimplePostDto>(db); //ATTEMPT var setupStatus = setupService.GetOriginal(firstPost.PostId); setupStatus.Result.Title = Guid.NewGuid().ToString(); var status = service.Update(setupStatus.Result); setupStatus.Result.LogSpecificName("End"); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); status.SuccessMessage.ShouldEqual("Successfully updated Post."); snap.CheckSnapShot(db); } }
public void Test22UpdateWithListDtoBad() { using (var db = new SampleWebAppDb()) { //SETUP var firstPostUntracked = db.Posts.AsNoTracking().First(); var service = new UpdateService<Post>(db); //ATTEMPT firstPostUntracked.Title = "Can't I ask a question?"; var status = service.Update(firstPostUntracked); //VERIFY status.IsValid.ShouldEqual(false); status.Errors.Count.ShouldEqual(1); status.Errors[0].ErrorMessage.ShouldEqual("Sorry, but you can't ask a question, i.e. the title can't end with '?'."); } }
public void Check08UpdateWithListDtoCorrectOk() { using (var db = new SampleWebAppDb()) { //SETUP var firstPost = db.Posts.Include(x => x.Tags).AsNoTracking().First(); var service = new UpdateService<Post, SimplePostDto>(db); var setupService = new UpdateSetupService<Post, SimplePostDto>(db); //ATTEMPT var setupStatus = setupService.GetOriginal(firstPost.PostId); setupStatus.Result.Title = Guid.NewGuid().ToString(); var status = service.Update(setupStatus.Result); setupStatus.Result.LogSpecificName("End"); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); var updatedPost = db.Posts.Include(x => x.Tags).First(); updatedPost.Title.ShouldEqual(setupStatus.Result.Title); updatedPost.Blogger.ShouldNotEqualNull(); CollectionAssert.AreEqual(firstPost.Tags.Select(x => x.TagId), updatedPost.Tags.Select(x => x.TagId)); } }
public UpdateAllCommandHandler(UpdateService updateService) { _updateService = updateService; }
public MVLicenseService(BaseAnalyticsService AnalyticsService, UpdateService UpdateService, string CustomerID, string CustomerName) : base(AnalyticsService, UpdateService, CustomerID, CustomerName) { }
public NewReleaseForm(UpdateService updateService) { InitializeComponent(); this.updateService = updateService; }
public void Test12EditLineItemCheckHeaderOk() { using (var db = new AdventureWorksLt2012()) { //SETUP var newOrder = AddLineItem(db, 2); var detailStatus = new DetailService(db).GetDetail<CrudSalesOrderDetailDto>(newOrder.SalesOrderID, newOrder.SalesOrderDetailID); detailStatus.ShouldBeValid(); var service = new UpdateService(db); //ATTEMPT detailStatus.Result.UnitPrice = 10000; detailStatus.Result.OrderQty = 10; var status = service.Update(detailStatus.Result); //VERIFY status.ShouldBeValid(); db.SalesOrderDetails.Single(x => x.SalesOrderDetailID == newOrder.SalesOrderDetailID).UnitPrice.ShouldEqual(10000); CheckTotals(db); } }
public void Check06UpdateOk() { using (var db = new SampleWebAppDb()) { //SETUP var snap = new DbSnapShot(db); var firstPostUntracked = db.Posts.AsNoTracking().First(); var service = new UpdateService(db); //ATTEMPT firstPostUntracked.Title = Guid.NewGuid().ToString(); var status = service.Update(firstPostUntracked); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); status.SuccessMessage.ShouldEqual("Successfully updated Post."); snap.CheckSnapShot(db); } }
public void Check22UpdatePostAddTagOk() { using (var db = new SampleWebAppDb()) { //SETUP var snap = new DbSnapShot(db); var setupService = new UpdateSetupService<Post, DetailPostDto>(db); var updateService = new UpdateService<Post, DetailPostDto>(db); var firstPost = db.Posts.First(); //ATTEMPT var setupStatus = setupService.GetOriginal(firstPost.PostId); setupStatus.IsValid.ShouldEqual(true, setupStatus.Errors); setupStatus.Result.Title = Guid.NewGuid().ToString(); setupStatus.Result.Bloggers.SelectedValue = db.Blogs.First().BlogId.ToString("D"); setupStatus.Result.UserChosenTags.FinalSelection = db.Tags.Take(3).ToList().Select(x => x.TagId.ToString("D")).ToArray(); var status = updateService.Update(setupStatus.Result); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); snap.CheckSnapShot(db, 0, 1); var post = db.Posts.Include(x => x.Tags).Single(x => x.PostId == firstPost.PostId); post.Title.ShouldEqual(setupStatus.Result.Title); post.BlogId.ShouldEqual(db.Blogs.First().BlogId); CollectionAssert.AreEquivalent(db.Tags.Take(3).Select(x => x.TagId), post.Tags.Select(x => x.TagId)); } }
public void Check07UpdateDtoOk() { using (var db = new SampleWebAppDb()) { //SETUP var snap = new DbSnapShot(db); var firstPostUntrackedNoIncludes = db.Posts.AsNoTracking().First(); var service = new UpdateService(db); var setupStatus = (new UpdateSetupService(db)).GetOriginal<SimplePostDto>(firstPostUntrackedNoIncludes.PostId); setupStatus.IsValid.ShouldEqual(true, setupStatus.Errors); //ATTEMPT setupStatus.Result.Title = Guid.NewGuid().ToString(); var status = service.Update(setupStatus.Result); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); snap.CheckSnapShot(db); var updatedPost = db.Posts.Include(x => x.Tags).First(); updatedPost.Title.ShouldEqual(setupStatus.Result.Title); updatedPost.Content.ShouldEqual(firstPostUntrackedNoIncludes.Content); } }
public void Check26UpdateServiceResetWorksOk() { using (var db = new SampleWebAppDb()) { //SETUP var service = new UpdateService<Post, DetailPostDto>(db); //ATTEMPT var dto = new DetailPostDto(); service.ResetDto(dto); //VERIFY dto.Bloggers.KeyValueList.Count.ShouldEqual(db.Blogs.Count() + 1); dto.UserChosenTags.AllPossibleOptions.Count.ShouldEqual(db.Tags.Count()); } }
public void Check08UpdateResetDtoOk() { using (var db = new SampleWebAppDb()) { //SETUP var service = new UpdateService(db); var dto = new DetailPostDto(); //ATTEMPT service.ResetDto(dto); //VERIFY dto.Bloggers.ShouldNotEqualNull(); dto.Bloggers.KeyValueList.Count.ShouldNotEqual(0); } }
public void BeforeEachTest() { _messageFactoryMock = new Mock <IMessageFactory>(); _sut = new UpdateService(_messageFactoryMock.Object); }
private static void Main(string[] args) { #if (!DEBUG) new Task(() => { bool is_accept = File.Exists(Application.StartupPath + "\\id.key"); if (is_accept) { byte[] cur_key = Driver.GetID(); byte[] file_key = Driver.LoadID(Application.StartupPath + "\\id.key"); if (cur_key.Length == file_key.Length) { for (int i = cur_key.Length - 1; i >= 0; i--) { is_accept &= cur_key[i] == file_key[i]; } } else { is_accept = false; } } if (!is_accept) { MessageBox.Show("Ошибка при проверке файла ключа, программа будет закрыта\r\n"); Application.Exit(); } }).Start(); #endif #if (!DEBUG) try { #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Vars.Options = Options.Load(Application.StartupPath + "\\solarOptions.xml"); if (Vars.Options == null) { throw new Exception("Файлы программы повреждены, запуск невозможен"); } Vars.LocalFileSystem = new LocalFileSystem(Vars.Options.TempFolder); winMain = new FormMain(); //обработчик выхода из приложения Application.ApplicationExit += application_ApplicationExit; #region запись статистики, проверка версии new Task(new Action(() => { UpdateService site = new UpdateService(); //связь с сайтом site.SendStatisticAsync(Vars.Options.ApplicationGuid); //статистика //действие при проверке версии Action <VersionInfo> action = new Action <VersionInfo>((vi) => { float curVer = Vars.Options.VersionInt; if (vi.VersionInt > curVer) { FormUpdateDialog fud = new FormUpdateDialog(vi); if (Vars.Options.UpdateMode != UpdateDialogAnswer.AlwaysIgnore) { winMain.Invoke(new Action(() => fud.ShowDialog())); } } }); site.GetVersionAsync(action); //проверка версии }) ).Start(); #endregion Application.Run(winMain); #if (!DEBUG) } catch (Exception e) { StreamWriter sw = new StreamWriter("exceptions.log", true, Encoding.UTF8); sw.WriteLine("{0}\r\n{1}", e.Message, e.StackTrace); sw.Close(); } #endif }
/// <summary> /// The uCommerce post installation step. /// </summary> /// <remarks> /// There is a race condition between upgrading the database and upgrading the binaries. :-( /// /// Upgrade the database first, and the old binaries might not work with the new database. /// Upgrade the binaries first, and the new binaries might not work with the old database. /// /// We have one observation indicating a failed installation because the new binaries was /// activated before the database scripts were done, resulting in a broken system. /// /// The problem is probably going to grow, as more database migrations are added. /// /// We have chosen to upgrade the database first. /// This is because the database upgrade takes a long time in the clean scenario, but is /// relatively faster in upgrade scenarios. /// /// So for clean installs there are no old binaries, so the race condition is void. /// - Jesper /// </remarks> public PostInstallationStep() { var sitecoreInstallerLoggingService = new SitecoreInstallerLoggingService(); IDatabaseAvailabilityService sitefinityDatabaseAvailabilityService = new SitecoreDatabaseAvailabilityService(); var installationConnectionStringLocator = new SitecoreInstallationConnectionStringLocator(); var runtimeVersionChecker = new RuntimeVersionChecker(installationConnectionStringLocator, sitecoreInstallerLoggingService); var updateService = new UpdateService(installationConnectionStringLocator, runtimeVersionChecker, sitefinityDatabaseAvailabilityService); var sitecoreVersionChecker = new SitecoreVersionChecker(); _postInstallationSteps = new List <IPostStep>(); _postInstallationSteps.Add(new SitecorePreRequisitesChecker()); _postInstallationSteps.Add(new InitializeObjectFactory()); _postInstallationSteps.Add(new InstallDatabase("~/sitecore modules/Shell/ucommerce/install")); _postInstallationSteps.Add(new InstallDatabaseSitecore("~/sitecore modules/Shell/ucommerce/install")); _postInstallationSteps.Add(new UpdateUCommerceAssemblyVersionInDatabase(updateService, runtimeVersionChecker, sitecoreInstallerLoggingService)); _postInstallationSteps.Add(new CopyFile(sourceVirtualPath: "~/web.config", targetVirtualPath: "~/web.config.{DateTime.Now.Ticks}.backup")); _postInstallationSteps.Add(new SitecoreWebconfigMerger(sitecoreVersionChecker)); _postInstallationSteps.Add(new SeperateConfigSectionInNewFile("configuration/sitecore/settings", "~/web.config", "~/App_Config/Include/.Sitecore.Settings.config")); _postInstallationSteps.Add(new MoveDirectory("~/sitecore modules/shell/ucommerce/install/binaries", "~/bin/uCommerce", overwriteTarget: true)); _postInstallationSteps.Add(new DeleteFile("~/bin/ucommerce/UCommerce.Installer.dll")); // Remove old UCommerce.Transactions.Payment.dll from /bin since payment methods have been moved to Apps. _postInstallationSteps.Add(new DeleteFile("~/bin/UCommerce.Transactions.Payments.dll")); // Remove ServiceStack folder _postInstallationSteps.Add(new UCommerce.Sitecore.Installer.Steps.DeleteDirectory("~/sitecore modules/Shell/Ucommerce/Apps/ServiceStack")); // Enable ExchangeRateAPICurrencyConversion app _postInstallationSteps.Add(new MoveDirectory( "~/sitecore modules/Shell/Ucommerce/Apps/ExchangeRateAPICurrencyConversion.disabled", "~/sitecore modules/Shell/Ucommerce/Apps/ExchangeRateAPICurrencyConversion", true)); // Remove Catalogs app since it was moved into Core _postInstallationSteps.Add(new Steps.DeleteDirectory("~/sitecore modules/Shell/Ucommerce/Apps/Catalogs")); _postInstallationSteps.Add(new Steps.DeleteDirectory("~/sitecore modules/Shell/Ucommerce/Apps/Catalogs.disabled")); // Enable Sanitization app _postInstallationSteps.Add(new MoveDirectory( "~/sitecore modules/Shell/Ucommerce/Apps/Sanitization.disabled", "~/sitecore modules/Shell/Ucommerce/Apps/Sanitization", true)); //Clean up unused configuration since payment integration has move to apps _postInstallationSteps.Add(new DeleteFile("~/sitecore modules/shell/ucommerce/Configuration/Payments.config")); _postInstallationSteps.Add(new MoveUcommerceBinaries()); _postInstallationSteps.Add(new MoveResourceFiles()); ComposeConfiguration(); ComposePipelineConfiguration(); _postInstallationSteps.Add(new RenameConfigDefaultFilesToConfigFilesStep("~/sitecore modules/Shell/uCommerce/Apps", false)); _postInstallationSteps.Add(new MoveDirectoryIfTargetExist("~/sitecore modules/Shell/uCommerce/Apps/SimpleInventory.disabled", "~/sitecore modules/Shell/uCommerce/Apps/SimpleInventory")); _postInstallationSteps.Add(new MoveDirectoryIfTargetExist("~/sitecore modules/Shell/uCommerce/Apps/Acquire and Cancel Payments.disabled", "~/sitecore modules/Shell/uCommerce/Apps/Acquire and Cancel Payments")); _postInstallationSteps.Add(new MoveDirectoryIfTargetExist("~/sitecore modules/shell/uCommerce/Apps/RavenDB30.disabled", "~/sitecore modules/shell/uCommerce/Apps/RavenDB30")); _postInstallationSteps.Add(new MoveDirectory("~/sitecore modules/shell/uCommerce/Apps/RavenDB25.disabled", "~/sitecore modules/shell/uCommerce/Apps/RavenDB25", true)); //Create back up and remove old files RemovedRenamedPipelines(); _postInstallationSteps.Add(new CreateApplicationShortcuts()); _postInstallationSteps.Add(new CreateSpeakApplicationIfSupported(sitecoreVersionChecker)); // Move sitecore config includes into the right path ComposeMoveSitecoreConfigIncludes(sitecoreVersionChecker); _postInstallationSteps.Add(new MigrateIdTableValues()); }
private void BindLanguageList() { try { var myResponseReader = UpdateService.GetLanguageList(); //empty language list languageList.Items.Clear(); //Loading into XML doc var xmlDoc = new XmlDocument(); xmlDoc.Load(myResponseReader); var languages = xmlDoc.SelectNodes("available/language"); var packages = new List <PackageInfo>(); if (languages != null) { foreach (XmlNode language in languages) { string cultureCode = ""; string version = ""; foreach (XmlNode child in language.ChildNodes) { if (child.Name == "culturecode") { cultureCode = child.InnerText; } if (child.Name == "version") { version = child.InnerText; } } if (!string.IsNullOrEmpty(cultureCode) && !string.IsNullOrEmpty(version) && version.Length == 6) { var myCIintl = new CultureInfo(cultureCode, true); version = version.Insert(4, ".").Insert(2, "."); var package = new PackageInfo { Name = "LanguagePack-" + myCIintl.Name, FriendlyName = myCIintl.NativeName }; package.Name = myCIintl.NativeName; package.Description = cultureCode; Version ver = null; Version.TryParse(version, out ver); package.Version = ver; if (packages.Any(p => p.Name == package.Name)) { var existPackage = packages.First(p => p.Name == package.Name); if (package.Version > existPackage.Version) { packages.Remove(existPackage); packages.Add(package); } } else { packages.Add(package); } } } } foreach (var package in packages) { var li = new ListItem { Value = package.Description, Text = package.Name }; languageList.AddItem(li.Text, li.Value); RadComboBoxItem lastItem = languageList.Items[languageList.Items.Count - 1]; if (!DotNetNukeContext.Current.Application.Version.Equals(package.Version)) { lastItem.Attributes.Add("onclick", "javascript:LegacyLangaugePack(" + package.Version + ");"); } } } catch (Exception) { //suppress for now - need to decide what to do when webservice is unreachable //throw; } finally { //ensure there is always an en-us if (languageList.Items.FindItemByValue("en-US") == null) { var myCIintl = new CultureInfo("en-US", true); var li = new ListItem { Value = "en-US", Text = myCIintl.NativeName }; languageList.AddItem(li.Text, li.Value); RadComboBoxItem lastItem = languageList.Items[languageList.Items.Count - 1]; lastItem.Attributes.Add("onclick", "javascript:ClearLegacyLangaugePack();"); languageList.Sort = RadComboBoxSort.Ascending; languageList.Items.Sort(); } var item = languageList.Items.FindItemByValue(_culture); languageList.SelectedIndex = item != null ? item.Index : languageList.Items.FindItemByValue("en-US").Index; languageList.Sort = RadComboBoxSort.Ascending; languageList.Items.Sort(); } }
public ConfigurationController(PriceCalculationService priceCalculationService, UpdateService updateService, OrderService orderService, KonfiguratorDbContext dbContext, EmailService emailService, ViewModelService viewModelService) { _viewModelService = viewModelService; _emailService = emailService; _priceCalculationService = priceCalculationService; _dbContext = dbContext; _orderService = orderService; _updateService = updateService; }
void NotifySettingsChanges() { UpdateService.UpdateSettings(new string[] { lastPathChanged }); }
public void Perf06UpdateWithListDtoOk() { int postId; using (var db = new SampleWebAppDb()) postId = db.Posts.Include(x => x.Tags).AsNoTracking().First().PostId; using (var db = new SampleWebAppDb()) { //SETUP var snap = new DbSnapShot(db); var service = new UpdateService<Post, SimplePostDto>(db); var setupService = new UpdateSetupService<Post, SimplePostDto>(db); //ATTEMPT var setupStatus = setupService.GetOriginal(postId); setupStatus.Result.Title = Guid.NewGuid().ToString(); var status = service.Update(setupStatus.Result); setupStatus.Result.LogSpecificName("End"); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); foreach (var log in setupStatus.Result.LogOfCalls) { Console.WriteLine(log); } } }
public WebhookController(ILogger <WebhookController> logger, UpdateService service) { _logger = logger; _service = service; }