Пример #1
0
        /// <summary>Initializes a new instance of the T2GManager class. This constructor is used for unit tests.</summary>
        /// <param name="sessionData">Information describing the session.</param>
        /// <param name="localDataStorage">The local data storage.</param>
        /// <param name="fileDistributionManager">Manager for file distribution.</param>
        /// <param name="notifier">The notifier.</param>
        /// <param name="connectionManager">Manager for connection.</param>
        internal T2GManager(T2GSessionData sessionData, T2GLocalDataStorage localDataStorage, T2GFileDistributionManager fileDistributionManager, IT2GNotificationProcessor notifier, IT2GConnectionManager connectionManager)
        {
            _systemChangedEventHandlers               = new Dictionary <string, EventHandler <SystemChangedNotificationArgs> >();
            _systemDeletedEventHandlers               = new Dictionary <string, EventHandler <SystemDeletedNotificationArgs> >();
            _T2GOnlineOfflineEventHandlers            = new Dictionary <string, EventHandler <T2GOnlineStatusNotificationArgs> >();
            _elementEventHandlers                     = new Dictionary <string, EventHandler <ElementEventArgs> >();
            _filePublicationNotificationEventHandlers = new Dictionary <string, EventHandler <FilePublicationNotificationArgs> >();
            _filePublishedNotificationEventHandlers   = new Dictionary <string, EventHandler <FilePublishedNotificationArgs> >();
            _fileReceivedNotificationEventHandlers    = new Dictionary <string, EventHandler <FileReceivedArgs> >();
            _fileDistributionEventHandlers            = new Dictionary <string, EventHandler <FileDistributionStatusArgs> >();

            _sessionData             = sessionData;
            _localDataStorage        = localDataStorage;
            _fileDistributionManager = fileDistributionManager;
            _notifier          = notifier;
            _connectionManager = connectionManager;
        }
Пример #2
0
        public void TearDown()
        {
            if (_t2gManager != null)
            {
                _t2gManager.Dispose();
            }

            _t2gManager = null;

            _sessionData      = null;
            _localDataStorage = null;
            //_notifierTarget = null;
            //_connectionListener = null;
            _fileDistributionManager = null;
            _notifier          = null;
            _connectionManager = null;
        }
Пример #3
0
        public void Setup()
        {
            ServiceConfiguration.Initialize();
            //_sessionData = new Mock<T2GSessionData>();
            _sessionData = new T2GSessionData();
            //_localDataStorage = new Mock<T2GLocalDataStorage>(_sessionData);
            _localDataStorage = new T2GLocalDataStorage(_sessionData, false);
            //_notifierTarget = new Mock<IT2GNotifierTarget>();
            //_connectionListener = new Mock<IT2GConnectionListener>();
            //_fileDistributionManager = new Mock<T2GFileDistributionManager>(_sessionData, _notifierTarget.Object);
            _fileDistributionManager = new T2GFileDistributionManager(_sessionData, this);
            //_notifier = new Mock<T2GNotificationProcessor>(_notifierTarget.Object, _localDataStorage, _fileDistributionManager.Object);
            _notifier = new T2GNotificationProcessor(this, _localDataStorage, _fileDistributionManager);
            //_connectionManager = new Mock<T2GConnectionManager>(_sessionData, _connectionListener.Object);
            //_connectionManager = new MockT2GConnectionManager();
            _connectionManager = new Mock <IT2GConnectionManager>();

            //_t2gManager = new T2GManager(_sessionData, _localDataStorage, _fileDistributionManager, _notifier, _connectionManager);
            _t2gManager = new T2GManager(_sessionData, _localDataStorage, _fileDistributionManager, _notifier, _connectionManager.Object);
        }
        /// <summary>Initializes a new instance of the T2GNotificationProcessor class.</summary>
        /// <exception cref="ArgumentNullException">Thrown when one or more required arguments are null.</exception>
        /// <param name="notifierTarget">The notifier target.</param>
        /// <param name="localDataStorage">The local data storage.</param>
        /// <param name="fileDistributionManager">Manager for file distribution(optional).</param>
        internal T2GNotificationProcessor(
            IT2GNotifierTarget notifierTarget,
            T2GLocalDataStorage localDataStorage,
            T2GFileDistributionManager fileDistributionManager)
        {
            if (notifierTarget == null)
            {
                throw new ArgumentNullException("notifierTarget");
            }

            if (localDataStorage == null)
            {
                throw new ArgumentNullException("localDataStorage");
            }

            _notifierTarget          = notifierTarget;
            _localDataStorage        = localDataStorage;
            _fileDistributionManager = fileDistributionManager;

            _lock = new object();
        }
Пример #5
0
        public void Setup()
        {
            _fileTransferPortMock = new Mock <PIS.Ground.Core.T2G.WebServices.FileTransfer.FileTransferPortType>();
            _notifierTargetMock   = new Mock <PIS.Ground.Core.T2G.IT2GNotifierTarget>();
            _t2gFileDistMgr       = new T2GFileDistributionManager(new T2GSessionData(), _notifierTargetMock.Object, _fileTransferPortMock.Object);
            _transferTaskList     = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskList();
            _transferTask1        = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskStruct();
            _transferTask1.taskId = 67;
            _transferTask2        = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskStruct();
            _transferTask2.taskId = 72;
            _transferTask3        = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskStruct();
            _transferTask3.taskId = 98;
            _transferTask4        = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskStruct();
            _transferTask4.taskId = 118;
            _transferTask5        = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskStruct();
            _transferTask5.taskId = 128;
            _transferTask6        = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskStruct();
            _transferTask6.taskId = 138;
            _transferTask7        = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskStruct();
            _transferTask7.taskId = 148;
            _transferTask8        = new PIS.Ground.Core.T2G.WebServices.FileTransfer.transferTaskStruct();
            _transferTask8.taskId = 158;
            _transferReply        = new PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutput();
            _transferReply.Body   = new PIS.Ground.Core.T2G.WebServices.FileTransfer.enumTransferTaskOutputBody();
            _transferReply.Body.transferTaskList = null;
            _transferReply.Body.endOfEnum        = true;

            //Build Mock folder for a request
            _remoteFolderMock = new Mock <IRemoteFolderClass>();

            //build Mock answer for enumFolders
            _testFolder = new folderInfoStruct();

            //Build fake answer to enumFolders function
            _enumFoldersOutput                 = new enumFoldersOutput();
            _enumFoldersOutput.Body            = new enumFoldersOutputBody();
            _enumFoldersOutput.Body.endOfEnum  = true;
            _enumFoldersOutput.Body.folderList = new folderList();
            _enumFoldersOutput.Body.folderList.Add(_testFolder);
        }
Пример #6
0
        /// <summary>Initializes a new instance of the T2GManager class.</summary>
        internal T2GManager()
        {
            _systemChangedEventHandlers               = new Dictionary <string, EventHandler <SystemChangedNotificationArgs> >();
            _systemDeletedEventHandlers               = new Dictionary <string, EventHandler <SystemDeletedNotificationArgs> >();
            _T2GOnlineOfflineEventHandlers            = new Dictionary <string, EventHandler <T2GOnlineStatusNotificationArgs> >();
            _elementEventHandlers                     = new Dictionary <string, EventHandler <ElementEventArgs> >();
            _filePublicationNotificationEventHandlers = new Dictionary <string, EventHandler <FilePublicationNotificationArgs> >();
            _filePublishedNotificationEventHandlers   = new Dictionary <string, EventHandler <FilePublishedNotificationArgs> >();
            _fileReceivedNotificationEventHandlers    = new Dictionary <string, EventHandler <FileReceivedArgs> >();
            _fileDistributionEventHandlers            = new Dictionary <string, EventHandler <FileDistributionStatusArgs> >();

            _sessionData      = new T2GSessionData();
            _localDataStorage = new T2GLocalDataStorage(_sessionData, null);

            if (!string.IsNullOrEmpty(ServiceConfiguration.T2GServiceNotificationUrl))
            {
                _fileDistributionManager = new T2GFileDistributionManager(_sessionData, this);
            }

            _notifier          = new T2GNotificationProcessor(this, _localDataStorage, _fileDistributionManager);
            _connectionManager = new T2GConnectionManager(_sessionData, this);
        }