private static void RemoveChildIntegrationFoldersFromCache(Item item) { IntegrationCache.RemoveIntegrationConfigData(item.ID); foreach (Item child in item.Children.Where(SharepointProvider.IsIntegrationFolder)) { RemoveChildIntegrationFoldersFromCache(child); } }
public void ShouldStartSyncForFolderParent() { // Arrange Item item = Substitute.For <Database>().CreateConfigurationFolder(); IntegrationCache.RemoveIntegrationConfigData(item.ParentID); var args = this.CreateItemArgs(item); // Act this.processor.Process(args); // Assert item.ParentID.WasSyncStarted().Should().BeTrue(); }
public void ShouldNotStartSyncIfIntegrationDisabled() { // Arrange Item item = Substitute.For <Database>().CreateConfigurationFolder(); IntegrationCache.RemoveIntegrationConfigData(item.ID); var args = this.CreateItemArgs(item); // Act using (new IntegrationDisabler()) { this.processor.Process(args); } // Assert item.ParentID.WasSyncStarted().Should().BeFalse(); }
public void ShouldNotStartSyncIfIntegrationDisabled() { // Arrange Item item = new ItemMock(); IntegrationCache.RemoveIntegrationConfigData(item.ID); var args = new GetChildrenArgs(this.itemProvider, item, SecurityCheck.Disable, ChildListOptions.None); // Act using (new IntegrationDisabler()) { this.processor.Process(args); } // Assert item.ID.WasSyncStarted().Should().BeFalse(); }
public void ShouldStartSyncForFolder() { Item item = Substitute.For <Database>().CreateConfigurationFolder(); using (new ItemIsContentItem(item)) { // Arrange IntegrationCache.RemoveIntegrationConfigData(item.ID); var args = new GetChildrenArgs(this.itemProvider, item, SecurityCheck.Disable, ChildListOptions.None); // Act this.processor.Process(args); // Assert item.ID.WasSyncStarted().Should().BeTrue(); } }
protected bool UpdateIntegrationConfigData(Item item) { IntegrationConfigData integrationData = null; try { integrationData = IntegrationConfigDataProvider.GetFromItem(item); if (integrationData == null) { return(true); } var context = SpContextProviderBase.Instance.CreateDataContext(integrationData); string listId; listId = BaseList.GetList(integrationData.Web, integrationData.List, context).ID; Assert.IsNotNullOrEmpty(listId, "listId"); if (integrationData.List == listId) { return(true); } integrationData.List = listId; IntegrationConfigDataProvider.SaveToItem(integrationData, item); IntegrationCache.RemoveIntegrationConfigData(item.ID); return(true); } catch (Exception exception) { var errorMessage = new StringBuilder("Updating integration config data has been failed."); errorMessage.AppendLine(string.Format("Integration config item: {0}", item.ID)); if (integrationData != null) { errorMessage.AppendLine(string.Format("SharePoint list: {0}{1}{2}", integrationData.Server.Trim('/'), StringUtil.EnsurePrefix('/', StringUtil.EnsurePostfix('/', integrationData.Web)), integrationData.List.Trim('/'))); } Log.Error(errorMessage.ToString(), exception, this); return(false); } }
public void should_process_tree_for_queued_events() { // Arrange Item item = new ItemMock().AsConfigurationItem(); IntegrationCache.RemoveIntegrationConfigData(item.ID); string jobName = string.Format("SharePoint_Integration_{0}", item.ID); SharepointProvider.Instance.Should().NotBeNull(); this.factory.GetDatabase(item.Database.Name).Returns(item.Database); // Act EventManager.RaiseEvent(new ProcessTreeRemoteEvent(item.ID, item.Database.Name)); // Assert JobManager.GetJobs().Any(x => x.Name == jobName).Should().BeTrue(); }