/// <summary> /// Initializes a new instance of the <see cref="ReportingFilter"/> class. /// </summary> /// <param name="queue">Sync Event Queue to put work on.</param> /// <param name="ignoredFoldersFilter">Ignored folders filter.</param> /// <param name="ignoredFileNameFilter">Ignored file name filter.</param> /// <param name="ignoredFolderNameFilter">Ignored folder name filter.</param> /// <param name="invalidFoderNameFilter">Invalid folder name filter</param> public ReportingFilter( ISyncEventQueue queue, IgnoredFoldersFilter ignoredFoldersFilter, IgnoredFileNamesFilter ignoredFileNameFilter, IgnoredFolderNameFilter ignoredFolderNameFilter, InvalidFolderNameFilter invalidFoderNameFilter, SymlinkFilter symlinkFilter) : base(queue) { if (ignoredFoldersFilter == null) { throw new ArgumentNullException("ignoredFoldersFilter"); } if (ignoredFileNameFilter == null) { throw new ArgumentNullException("ignoredFileNameFilter"); } if (ignoredFolderNameFilter == null) { throw new ArgumentNullException("ignoredFolderNameFilter"); } if (invalidFoderNameFilter == null) { throw new ArgumentNullException("invalidFoderNameFilter"); } if (symlinkFilter == null) { throw new ArgumentNullException("symlinkFilter"); } this.ignoredFoldersFilter = ignoredFoldersFilter; this.ignoredFileNameFilter = ignoredFileNameFilter; this.ignoredFolderNameFilter = ignoredFolderNameFilter; this.invalidFolderNameFilter = invalidFoderNameFilter; this.symlinkFilter = symlinkFilter; }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Filter.FilterAggregator"/> class. /// </summary> /// <param name="fileNamesFilter">File names filter.</param> /// <param name="folderNamesFilter">Folder names filter.</param> /// <param name="invalidFolderNamesFilter">Invalid folder names filter.</param> /// <param name="ignoredFolderFilter">Ignored folder filter.</param> public FilterAggregator( IgnoredFileNamesFilter fileNamesFilter, IgnoredFolderNameFilter folderNamesFilter, InvalidFolderNameFilter invalidFolderNamesFilter, IgnoredFoldersFilter ignoredFolderFilter, SymlinkFilter symlinkFilter = null) { if (fileNamesFilter == null) { throw new ArgumentNullException("fileNamesFilter"); } if (folderNamesFilter == null) { throw new ArgumentNullException("folderNamesFilter"); } if (invalidFolderNamesFilter == null) { throw new ArgumentNullException("invalidFolderNamesFilter"); } if (ignoredFolderFilter == null) { throw new ArgumentNullException("ignoredFolderFilter"); } this.FileNamesFilter = fileNamesFilter; this.FolderNamesFilter = folderNamesFilter; this.InvalidFolderNamesFilter = invalidFolderNamesFilter; this.IgnoredFolderFilter = ignoredFolderFilter; this.SymlinkFilter = symlinkFilter ?? new SymlinkFilter(); }
public void SetUpFilter() { this.ignoreFoldersFilter = Mock.Of<IgnoredFoldersFilter>(); this.ignoreFileNamesFilter = Mock.Of<IgnoredFileNamesFilter>(); this.ignoreFolderNamesFilter = Mock.Of<IgnoredFolderNameFilter>(); this.invalidFolderNameFilter = Mock.Of<InvalidFolderNameFilter>(); this.symlinkFilter = Mock.Of<SymlinkFilter>(); this.queue = new Mock<ISyncEventQueue>(); }
public void ValidFolderNames() { InvalidFolderNameFilter filter = new InvalidFolderNameFilter(); string reason; Assert.That(filter.CheckFolderName("test", out reason), Is.False); Assert.That(string.IsNullOrEmpty(reason), Is.True, reason); Assert.That(filter.CheckFolderName("test_test", out reason), Is.False); Assert.That(string.IsNullOrEmpty(reason), Is.True, reason); }
private SingleStepEventQueue CreateQueue(Mock<ISession> session, IMetaDataStorage storage, ObservableHandler observer, IFileSystemInfoFactory fsFactory = null) { var manager = new SyncEventManager(); SingleStepEventQueue queue = new SingleStepEventQueue(manager); manager.AddEventHandler(observer); var connectionScheduler = new ConnectionScheduler(new RepoInfo(), queue, Mock.Of<ISessionFactory>(), Mock.Of<IAuthenticationProvider>()); manager.AddEventHandler(connectionScheduler); var changes = new ContentChanges(session.Object, storage, queue, this.maxNumberOfContentChanges, this.isPropertyChangesSupported); manager.AddEventHandler(changes); var transformer = new ContentChangeEventTransformer(queue, storage, fsFactory); manager.AddEventHandler(transformer); var ccaccumulator = new ContentChangeEventAccumulator(session.Object, queue); manager.AddEventHandler(ccaccumulator); var remoteFetcher = new RemoteObjectFetcher(session.Object, storage); manager.AddEventHandler(remoteFetcher); var localFetcher = new LocalObjectFetcher(storage.Matcher, fsFactory); manager.AddEventHandler(localFetcher); var watcher = new Strategy.WatcherConsumer(queue); manager.AddEventHandler(watcher); var localDetection = new LocalSituationDetection(); var remoteDetection = new RemoteSituationDetection(); var transmissionManager = new TransmissionManager(); var activityAggregator = new ActivityListenerAggregator(Mock.Of<IActivityListener>(), transmissionManager); var ignoreFolderFilter = new IgnoredFoldersFilter(); var ignoreFolderNameFilter = new IgnoredFolderNameFilter(); var ignoreFileNamesFilter = new IgnoredFileNamesFilter(); var invalidFolderNameFilter = new InvalidFolderNameFilter(); var filterAggregator = new FilterAggregator(ignoreFileNamesFilter, ignoreFolderNameFilter, invalidFolderNameFilter, ignoreFolderFilter); var syncMechanism = new SyncMechanism(localDetection, remoteDetection, queue, session.Object, storage, Mock.Of<IFileTransmissionStorage>(), activityAggregator, filterAggregator); manager.AddEventHandler(syncMechanism); var remoteFolder = MockSessionUtil.CreateCmisFolder(); remoteFolder.Setup(r => r.Path).Returns(this.remoteRoot); var localFolder = new Mock<IDirectoryInfo>(); localFolder.Setup(f => f.FullName).Returns(this.localRoot); var generator = new CrawlEventGenerator(storage, fsFactory); var ignoreStorage = new IgnoredEntitiesStorage(new IgnoredEntitiesCollection(), storage); var treeBuilder = new DescendantsTreeBuilder(storage, remoteFolder.Object, localFolder.Object, filterAggregator, ignoreStorage); var notifier = new CrawlEventNotifier(queue); var crawler = new DescendantsCrawler(queue, treeBuilder, generator, notifier, Mock.Of<IActivityListener>()); manager.AddEventHandler(crawler); var permissionDenied = new GenericHandleDublicatedEventsFilter<PermissionDeniedEvent, ConfigChangedEvent>(); manager.AddEventHandler(permissionDenied); var alreadyAddedFilter = new IgnoreAlreadyHandledFsEventsFilter(storage, fsFactory); manager.AddEventHandler(alreadyAddedFilter); var ignoreContentChangesFilter = new IgnoreAlreadyHandledContentChangeEventsFilter(storage, session.Object); manager.AddEventHandler(ignoreContentChangesFilter); var delayRetryAndNextSyncEventHandler = new DelayRetryAndNextSyncEventHandler(queue); manager.AddEventHandler(delayRetryAndNextSyncEventHandler); /* This is not implemented yet var failedOperationsFilder = new FailedOperationsFilter(queue); manager.AddEventHandler(failedOperationsFilder); */ var reportingFilter = new ReportingFilter(queue, ignoreFolderFilter, ignoreFileNamesFilter, ignoreFolderNameFilter, invalidFolderNameFilter, new SymlinkFilter()); manager.AddEventHandler(reportingFilter); var debugHandler = new DebugLoggingHandler(); manager.AddEventHandler(debugHandler); var movedOrRenamed = new RemoteObjectMovedOrRenamedAccumulator(queue, storage, fsFactory); manager.AddEventHandler(movedOrRenamed); return queue; }
public void CreateFilter() { arg0 = new IgnoredFileNamesFilter(); arg1 = new IgnoredFolderNameFilter(); arg2 = new InvalidFolderNameFilter(); arg3 = new IgnoredFoldersFilter(); }