Beispiel #1
0
        /// <summary>
        /// Create File Distribution request
        /// </summary>
        /// <param name="prequestID">Request id</param>
        /// <param name="pstrFolderName">The folder’s name to be uploaded/downloaded</param>
        /// <param name="pdtExpiration">The date and time when the distribution task will expire and the file will be deleted from the T2G product. </param>
        /// <param name="plstFilePathList">A list of relative file paths </param>
        /// <param name="pbCompression">If true, the files will be compressed before being transferred from train to the ground or vice-versa. false, otherwise</param>
        /// <param name="plstRecipient">The lists of targeted T2G systems and the list of T2G applications to be notified once the files are uploaded.</param>
        /// <param name="pstartDate">The date and time when the distribution of the specified files should start</param>
        /// <param name="pstrDescription">A description of the file transfer task.</param>
        /// <param name="ptransferMode">File transfer mode</param>
        /// <param name="ipriority">The priority of the transfer: a number between 0 and 32 (0 being the highest priority).</param>
        /// <param name="pOnFileDistributeNotification">Event handler for notification on file distribute</param>
        /// <param name="pOnTaskCreatedNotification">Event handler to be notified when transfer task is created.</param>
        public FileDistributionRequest(Guid prequestID, string pstrFolderName, DateTime pdtExpiration, List <string> plstFilePathList, bool pbCompression, List <RecipientId> plstRecipient, DateTime pstartDate, string pstrDescription, FileTransferMode ptransferMode, sbyte ipriority, EventHandler <FileDistributionStatusArgs> pOnFileDistributeNotification, EventHandler <FileDistributionTaskCreatedArgs> pOnTaskCreatedNotification)
        {
            this.requestID      = prequestID;
            this.expirationDate = pdtExpiration;
            this.compression    = pbCompression;
            this.lstRecipient   = plstRecipient;
            this.startDate      = pstartDate;
            this.strDescription = pstrDescription;
            this.transferMode   = ptransferMode;
            this.priority       = ipriority;
            this.OnFileDistributeNotification = pOnFileDistributeNotification;
            this._onTaskCreatedNotification   = pOnTaskCreatedNotification;

            //create RemoteFolderClass
            this.folder = new RemoteFolderClass(pstrFolderName);

            //Fill the folder with files. This will automatically generate CRC for each file and CRCGuid for the folder
            foreach (string lFilePath in plstFilePathList)
            {
                //CRC Calculation is long. Developer can initialize file when required.
                this.folder.AddFileToFolder(new RemoteFileClass(lFilePath, false));
            }

            this.folder.ExpirationDate = pdtExpiration;
        }
        public void TestFolderValidity()
        {
            IRemoteFolderClass lRemoteFolder2 = new RemoteFolderClass("CopyTest", 1);

            foreach (Mock <IRemoteFileClass> remoteFileMock in _remoteFileMockList)
            {
                lRemoteFolder2.AddFileToFolder(remoteFileMock.Object);
            }

            lRemoteFolder2.CalculateCRCGuid();

            Assert.AreEqual(4, lRemoteFolder2.TotalFilesSize);

            foreach (Mock <IRemoteFileClass> remoteFileMock in _remoteFileMockList)
            {
                Assert.Contains(remoteFileMock.Object.FileName, lRemoteFolder2.FilenameList);
                Assert.Contains(remoteFileMock.Object, lRemoteFolder2.FolderFilesList);
            }

            Assert.AreEqual(4, lRemoteFolder2.TotalFilesSize);

            lRemoteFolder = new RemoteFolderClass((RemoteFolderClass)lRemoteFolder2);

            lRemoteFolder.CalculateCRCGuid();

            Assert.AreEqual(4, lRemoteFolder.TotalFilesSize);
            //Assert.AreEqual(lRemoteFolder2.CRCGuid, lRemoteFolder.CRCGuid);

            foreach (Mock <IRemoteFileClass> remoteFileMock in _remoteFileMockList)
            {
                Assert.Contains(remoteFileMock.Object.FileName, lRemoteFolder.FilenameList);
                Assert.Contains(remoteFileMock.Object, lRemoteFolder.FolderFilesList);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public FileDistributionRequest()
        {
            this.lstRecipient   = new List <RecipientId>();
            this.expirationDate = DateTime.Now;
            this.startDate      = DateTime.Now;

            //create RemoteFolderClass
            this.folder = new RemoteFolderClass();
        }
Beispiel #4
0
        /// <summary>
        /// Create Download Folder Request
        /// </summary>
        /// <param name="prequestID">Request id</param>
        /// <param name="pstrFolderName">The folder’s name to be uploaded/downloaded</param>
        /// <param name="pdtExpiration">The date and time when the distribution task will expire and the file will be deleted from the T2G product. </param>
        /// <param name="pDownloadFolderPath">Download folder path</param>
        /// <param name="plstRecipient">The lists of targeted T2G systems and the list of T2G applications to be notified once the files are uploaded.</param>
        /// <param name="pstartDate">The date and time when the distribution of the specified files should start</param>
        /// <param name="pstrDescription">A description of the file transfer task.</param>
        /// <param name="ptransferMode">File transfer mode</param>
        /// <param name="ipriority">The priority of the transfer: a number between 0 and 32 (0 being the highest priority).</param>
        /// <param name="pOnFileDistributeNotification">File Transfer notification event handler</param>
        /// <param name="pfolderId">folder id to be downloaded</param>
        /// <param name="pOnFileDistributeNotification">Event handler for notification on file distribute</param>
        /// <param name="pOnTaskCreatedNotification">Event handler to be notified when transfer task is created.</param>
        public FileDistributionRequest(Guid prequestID, DateTime pdtExpiration, List <RecipientId> plstRecipient, DateTime pstartDate, string pstrDescription, FileTransferMode ptransferMode, sbyte ipriority, EventHandler <FileDistributionStatusArgs> pOnFileDistributeNotification, int pfolderId, EventHandler <FileDistributionTaskCreatedArgs> pOnTaskCreatedNotification)
        {
            this.requestID      = prequestID;
            this.expirationDate = pdtExpiration;
            //this.compression = pbCompression;
            this.lstRecipient   = plstRecipient;
            this.startDate      = pstartDate;
            this.strDescription = pstrDescription;
            this.priority       = ipriority;
            this.onFileDistributeNotification = pOnFileDistributeNotification;
            this._onTaskCreatedNotification   = pOnTaskCreatedNotification;
            this.transferMode = ptransferMode;

            //create RemoteFolderClass
            this.folder                = new RemoteFolderClass();
            this.folder.FolderId       = pfolderId;
            this.folder.ExpirationDate = pdtExpiration;
        }
        public void Setup()
        {
            _remoteDataStorePath = Path.Combine(Path.GetTempPath(), "RemoteDataStorePathUnitTest");

            if (!Directory.Exists(_remoteDataStorePath))
            {
                Directory.CreateDirectory(_remoteDataStorePath);
            }

            ConfigurationSettings.AppSettings["RemoteDataStoreUrl"] = _remoteDataStorePath;

            lRemoteFolder = new RemoteFolderClass("FolderName", 0);

            //Create Mocks
            for (int i = 0; i < _nbFiles; i++)
            {
                _remoteFileMockList.Add(new Mock <IRemoteFileClass>());
                _remoteFileMockList[i].Setup(x => x.FileName).Returns("Filename" + i.ToString());
                _remoteFileMockList[i].Setup(x => x.CRC).Returns(i.ToString());
                _remoteFileMockList[i].Setup(x => x.Size).Returns(1);
                _remoteFileMockList[i].Setup <int>(x => x.CompareTo(It.IsAny <IRemoteFileClass>())).Returns(0);
            }
        }
 /// <summary>
 /// Create File Distribution request
 /// </summary>
 /// <param name="prequestID">Request id</param>
 /// <param name="pstrFolderName">The folder to be uploaded</param>
 /// <param name="pdtExpiration">The date and time when the distribution task will expire and the file will be deleted from the T2G product. </param>
 /// <param name="pbCompression">If true, the files will be compressed before being transferred from train to the ground or vice-versa. false, otherwise</param>
 /// <param name="plstRecipient">The lists of targeted T2G systems and the list of T2G applications to be notified once the files are uploaded.</param>
 /// <param name="pstartDate">The date and time when the distribution of the specified files should start</param>
 /// <param name="pstrDescription">A description of the file transfer task.</param>
 /// <param name="ptransferMode">File transfer mode</param>
 /// <param name="ipriority">The priority of the transfer: a number between 0 and 32 (0 being the highest priority).</param>
 /// <param name="pOnFileDistributeNotification">Event handler to be notified on file distribution progress.</param>
 /// <param name="pOnTaskCreatedNotification">Event handler to be notified when transfer task is created.</param>
 public UploadFileDistributionRequest(Guid prequestID, IRemoteFolderClass pFolder, DateTime pdtExpiration, bool pbCompression, List <RecipientId> plstRecipient, DateTime pstartDate, string pstrDescription, FileTransferMode ptransferMode, sbyte ipriority, EventHandler <FileDistributionStatusArgs> pOnFileDistributeNotification, EventHandler <FileDistributionTaskCreatedArgs> pOnTaskCreatedNotification)
     : base(prequestID, pFolder, pdtExpiration, pbCompression, plstRecipient, pstartDate, pstrDescription, ptransferMode, ipriority, pOnFileDistributeNotification, pOnTaskCreatedNotification)
 {
     this.associatedRequestId = new List <Guid>();
 }