/// <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();
        }
        /// <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();
        }
示例#3
0
        /// <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;
        }
示例#4
0
        /// <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) : base(queue)
        {
            if (ignoredFoldersFilter == null)
            {
                throw new ArgumentNullException("Given folder filter is null");
            }

            if (ignoredFileNameFilter == null)
            {
                throw new ArgumentNullException("Given file name filter is null");
            }

            if (ignoredFolderNameFilter == null)
            {
                throw new ArgumentNullException("Given folder name filter is null");
            }

            if (invalidFoderNameFilter == null)
            {
                throw new ArgumentNullException("Given invalid folder name filter is null");
            }

            this.ignoredFoldersFilter    = ignoredFoldersFilter;
            this.ignoredFileNameFilter   = ignoredFileNameFilter;
            this.ignoredFolderNameFilter = ignoredFolderNameFilter;
            this.invalidFolderNameFilter = invalidFoderNameFilter;
        }
示例#5
0
        /// <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)
        {
            if (fileNamesFilter == null)
            {
                throw new ArgumentNullException("Given file names filter is null");
            }

            if (folderNamesFilter == null)
            {
                throw new ArgumentNullException("Given folder names filter is null");
            }

            if (invalidFolderNamesFilter == null)
            {
                throw new ArgumentNullException("Given invalid folder names filter is null");
            }

            if (ignoredFolderFilter == null)
            {
                throw new ArgumentNullException("Given ignored folder filter is null");
            }

            this.FileNamesFilter          = fileNamesFilter;
            this.FolderNamesFilter        = folderNamesFilter;
            this.InvalidFolderNamesFilter = invalidFolderNamesFilter;
            this.IgnoredFolderFilter      = ignoredFolderFilter;
        }
 public void FilterLetsEventsPassIfNotMatchingWildcard() {
     var wildcards = new List<string>();
     wildcards.Add(".tmp");
     var filter = new IgnoredFolderNameFilter { Wildcards = wildcards };
     string reason;
     Assert.That(filter.CheckFolderName(".cache", out reason), Is.False);
     Assert.That(string.IsNullOrEmpty(reason), Is.True);
 }
 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>();
 }
示例#8
0
        /// <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;
        }
 private void SetUpTestMocks() {
     this.session = new Mock<ISession>();
     this.session.SetupTypeSystem();
     this.storage = new Mock<IMetaDataStorage>();
     this.filters = new Mock<IFilterAggregator>();
     this.fileNameFilter = new IgnoredFileNamesFilter();
     this.folderNameFilter = new IgnoredFolderNameFilter();
     this.filters.Setup(f => f.FileNamesFilter).Returns(this.fileNameFilter);
     this.filters.Setup(f => f.FolderNamesFilter).Returns(this.folderNameFilter);
     this.underTest = new RemoteObjectDeleted(this.session.Object, this.storage.Object, this.filters.Object);
 }
示例#10
0
        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 FilterFailsTakingNullWildcard() {
     var filter = new IgnoredFolderNameFilter();
     Assert.Throws<ArgumentNullException>(() => filter.Wildcards = null);
 }
 public void FilterTakesEmptyWildcardsWithoutFailure() {
     var filter = new IgnoredFolderNameFilter();
     filter.Wildcards = new List<string>();
 }
 public void FilterTakesWildcardsWithoutFailure() {
     var filter = new IgnoredFolderNameFilter();
     var wildcards = new List<string>();
     wildcards.Add("*.tmp");
     filter.Wildcards = wildcards;
 }
 public void FilterLetsFSEventsPassIfNoWildcardsAreSet() {
     var filter = new IgnoredFolderNameFilter();
     string reason;
     Assert.That(filter.CheckFolderName("foldername", out reason), Is.False);
     Assert.That(string.IsNullOrEmpty(reason), Is.True);
 }
 public void CreateFilter() {
     arg0 = new IgnoredFileNamesFilter();
     arg1 = new IgnoredFolderNameFilter();
     arg2 = new InvalidFolderNameFilter();
     arg3 = new IgnoredFoldersFilter();
 }