/// <summary>
        /// Stops the data package service.
        /// </summary>
        protected void StopDataPackageService()
        {
            if (_datapackageServiceStub != null)
            {
                _datapackageServiceStub.Dispose();
                _datapackageServiceStub = null;
            }

            if (_requestManager != null)
            {
                _requestManager.Dispose();
                _requestManager = null;
            }

            DataPackageService.Uninitialize();

            if (_baselineStatusUpdater != null)
            {
                _baselineStatusUpdater.Dispose();
                _baselineStatusUpdater = null;
            }

            if (_t2gManager != null)
            {
                _t2gManager.Dispose();
                _t2gManager = null;
            }

            T2GManagerContainer.T2GManager = null;
            _sessionManager = null;
            _requestFactory = null;
        }
        /// <summary>
        /// Initializes the data package service.
        /// </summary>
        /// <param name="isRestart">Parameter that indicates if it is a restart simulation of the services.</param>
        protected void InitializeDataPackageService(bool isRestart)
        {
            Assert.IsTrue(HistoryLoggerConfiguration.Used, "The test application is misconfigured. HistoryLoggerConfiguration.Used is not set to proper value");
            Assert.IsTrue(HistoryLoggerConfiguration.Valid, "The test application is misconfigured. HistoryLoggerConfiguration.Valid is not set to proper value");

            // Create a complete T2G Manager
            _t2gManager            = T2GManagerContainer.T2GManager;
            _sessionManager        = new SessionManager();
            _baselineStatusUpdater = new BaselineStatusUpdater();

            if (!isRestart)
            {
                Assert.IsEmpty(_sessionManager.RemoveAllSessions(), "Cannot empty the session database");
            }

            _requestFactory = new RequestContextFactory(_t2gManager, _remoteDataStoreFactoryMock.Object, _baselineStatusUpdater);
            _requestManager = new RequestManager();

            _datapackageServiceStub = new DataPackageServiceStub(_sessionManager,
                                                                 _notificationsSender,
                                                                 _t2gManager,
                                                                 _requestFactory,
                                                                 _remoteDataStoreFactoryMock.Object,
                                                                 _requestManager,
                                                                 _baselineStatusUpdater
                                                                 );
        }
Beispiel #3
0
 protected void TearDown()
 {
     if (_baselineStatusUpdater != null)
     {
         _baselineStatusUpdater.Dispose();
         _baselineStatusUpdater = null;
     }
 }
Beispiel #4
0
        protected void SetUp()
        {
            _train2groundManagerMock    = new Mock <PIS.Ground.Core.T2G.IT2GManager>();
            _remoteDataStoreMock        = new Mock <PIS.Ground.RemoteDataStore.IRemoteDataStore>();
            _remoteDataStoreFactoryMock = new Mock <PIS.Ground.DataPackage.RemoteDataStoreFactory.IRemoteDataStoreFactory>();
            _baselineStatusUpdater      = new BaselineStatusUpdater();

            _testedInstance = new PIS.Ground.DataPackage.RequestMgt.BaselineDistributingRequestContextProcessor(_remoteDataStoreFactoryMock.Object, _train2groundManagerMock.Object, _baselineStatusUpdater);
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataPackageServiceStub"/> class.
 /// </summary>
 /// <param name="sessionManager">The session manager.</param>
 /// <param name="notificationSender">The notification sender.</param>
 /// <param name="t2gManager">The T2G manager.</param>
 /// <param name="requestsFactory">The requests factory.</param>
 /// <param name="remoteDataStoreFactory">The remote data store factory.</param>
 /// <param name="requestManager">The request manager.</param>
 /// <param name="baselineStatusUpdater">The baseline status updater.</param>
 public DataPackageServiceStub(ISessionManager sessionManager,
                               INotificationSender notificationSender,
                               IT2GManager t2gManager,
                               IRequestContextFactory requestsFactory,
                               IRemoteDataStoreFactory remoteDataStoreFactory,
                               IRequestManager requestManager,
                               BaselineStatusUpdater baselineStatusUpdater) :
     base(sessionManager, notificationSender, t2gManager, requestsFactory, remoteDataStoreFactory, requestManager, baselineStatusUpdater)
 {
     // No logic body.
 }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the BaselineDistributingRequestContextProcessor class.
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown when one or more required arguments are null.</exception>
        /// <param name="remoteDataStoreFactory">The remote data store factory.</param>
        /// <param name="trainToGroundManager">Manager for train to ground.</param>
        public BaselineDistributingRequestContextProcessor(IRemoteDataStoreFactory remoteDataStoreFactory, IT2GManager trainToGroundManager, BaselineStatusUpdater baselineStatusUpdater)
        {
            if (null == remoteDataStoreFactory)
            {
                throw new ArgumentNullException("remoteDataStoreFactory");
            }
            else if (null == trainToGroundManager)
            {
                throw new ArgumentNullException("trainToGroundManager");
            }
            else if (null == baselineStatusUpdater)
            {
                throw new ArgumentNullException("baselineStatusUpdater");
            }

            _remoteDataStoreFactory = remoteDataStoreFactory;
            _trainToGroundManager   = trainToGroundManager;
            _baselineStatusUpdater  = baselineStatusUpdater;
        }
Beispiel #7
0
        /// <summary>Initializes a new instance of the RequestContextFactory class.</summary>
        public RequestContextFactory(IT2GManager t2gManager, IRemoteDataStoreFactory remoteDataStoreFactory, BaselineStatusUpdater baselineStatusUpdater)
        {
            if (t2gManager == null)
            {
                throw new ArgumentNullException("t2gManager");
            }
            else if (remoteDataStoreFactory == null)
            {
                throw new ArgumentNullException("remoteDataStoreFactory");
            }
            else if (baselineStatusUpdater == null)
            {
                throw new ArgumentNullException("baselineStatusUpdater");
            }

            _t2gManager             = t2gManager;
            _remoteDataStoreFactory = remoteDataStoreFactory;
            _baselineStatusUpdater  = baselineStatusUpdater;
        }
        protected void SetUp()
        {
            _train2groundManagerMock = new Mock <PIS.Ground.Core.T2G.IT2GManager>();
            _notificationSenderMock  = new Mock <PIS.Ground.Core.Common.INotificationSender>();
            _testedInstance          = new RequestManagerMonitor();
            _testedInstance.Initialize(_train2groundManagerMock.Object, _notificationSenderMock.Object);

            _sessionMgrMock             = new Mock <PIS.Ground.Core.SessionMgmt.ISessionManager>();
            _requestFactoryMock         = new Mock <PIS.Ground.DataPackage.RequestMgt.IRequestContextFactory>();
            _remoteDataStoreMock        = new Mock <PIS.Ground.RemoteDataStore.IRemoteDataStore>();
            _remoteDataStoreFactoryMock = new Mock <PIS.Ground.DataPackage.RemoteDataStoreFactory.IRemoteDataStoreFactory>();
            _baselineStatusUpdater      = new BaselineStatusUpdater();
            PIS.Ground.DataPackage.DataPackageService.Initialize(
                _sessionMgrMock.Object,
                _notificationSenderMock.Object,
                _train2groundManagerMock.Object,
                _requestFactoryMock.Object,
                _remoteDataStoreFactoryMock.Object,
                _testedInstance,
                _baselineStatusUpdater,
                false);
        }
        public void TearDown()
        {
            if (_datapackageServiceStub != null)
            {
                _datapackageServiceStub.Dispose();
                _datapackageServiceStub = null;
            }

            if (_requestManager != null)
            {
                _requestManager.Dispose();
                _requestManager = null;
            }

            foreach (ServiceHost service in new ServiceHost[] { _hostVehicleInfoService, _hostFileTransferService, _hostIdentificationService, _hostNotificationService, _hostTrainDataPackageService })
            {
                if (service == null)
                {
                    continue;
                }

                if (service.State == CommunicationState.Faulted)
                {
                    service.Abort();
                }

                service.Close();
            }

            if (_vehicleInfoServiceStub != null)
            {
                _vehicleInfoServiceStub.Dispose();
            }

            if (_baselineStatusUpdater != null)
            {
                _baselineStatusUpdater.Dispose();
            }

            _hostIdentificationService   = null;
            _hostFileTransferService     = null;
            _hostVehicleInfoService      = null;
            _hostNotificationService     = null;
            _hostTrainDataPackageService = null;
            _fileTransferServiceStub     = null;
            _identificationServiceStub   = null;
            _vehicleInfoServiceStub      = null;
            _notificationServiceStub     = null;
            _trainDataPackageServiceStub = null;
            _baselineStatusUpdater       = null;
            DataPackageService.Uninitialize();
            T2GManagerContainer.T2GManager = null;
            _t2gManager     = null;
            _sessionManager = null;
            _requestFactory = null;

            if (_dataStoreServiceStub != null)
            {
                _dataStoreServiceStub.Dispose();
                _dataStoreServiceStub = null;
            }

            _remoteDataStoreFactoryMock = null;

            TestContext currentContext = TestContext.CurrentContext;

            Console.Out.WriteLine("===================================");
            Console.Out.WriteLine("END TEST {0}", currentContext.Test.Name);
            Console.Out.WriteLine("===================================");
        }