Exemple #1
0
        public void CopyAllInboundFromSftp()
        {
            //Arrange
            var channelSettings = new FromSettings()
            {
                Path       = "/home/ec2-user/From",
                Type       = ConfigChannelType.Sftp,
                PrivateKey = Path.Combine("Common", "key.private"),
                Host       = "127.0.0.1",
                Port       = 22,
                UserName   = "******",
            };

            _workingDirectory.DeleteWithContentIfExists().CreateIfNotExists();

            SftpChannel sftp = new SftpChannel(_workingDirectory, channelSettings);
            //Act
            var result = sftp.Copy();

            //Assert
            Assert.IsTrue(result.Any(d => d.Name == "EE_FEETRA_TPY_000451-0_18.xml"));
            Assert.IsTrue(result.Any(d => d.Name == "EE_FEETRA_TPY_000452-0_18.xml"));
            Assert.IsTrue(result.Any(d => d.Name == "EE_FEETRA_TPY_000454-0_18.XML"));
            Assert.IsTrue(result.Any(d => d.Name == "GG_TR_529900G3SW56SHYNPR95_01_20180316_0014_01.zip"));
        }
Exemple #2
0
        public void CopyWithExclusionFilemaskOnly()
        {
            //Arrange
            var channelSettings = new FromSettings()
            {
                Path                = "/home/ec2-user/From",
                Type                = ConfigChannelType.Sftp,
                PrivateKey          = Path.Combine("Common", "key.private"),
                Host                = "127.0.0.1",
                Port                = 22,
                UserName            = "******",
                ExclusionFileMasks  = new [] { "EE_*_*_*-0_18.xml" },
                IgnoreCaseSensitive = false
            };

            _workingDirectory.DeleteWithContentIfExists().CreateIfNotExists();

            SftpChannel sftp = new SftpChannel(_workingDirectory, channelSettings);
            //Act
            var result = sftp.Copy();

            //Assert
            Assert.IsTrue(result.Any(d => d.Name == "EE_FEETRA_TPY_000454-0_18.XML"));
            Assert.IsTrue(result.Any(d => d.Name == "GG_TR_529900G3SW56SHYNPR95_01_20180316_0014_01.zip"));

            //Assert.AreEqual(6, _from.Count());
            //Assert.IsTrue(sourceFiles.Any(d => d.Name == "EE_FEETRA_TPY_000451-0_18.xml"));
            //Assert.IsTrue(sourceFiles.Any(d => d.Name == "EE_FEETRA_TPY_000452-0_18.xml"));
            //Assert.IsTrue(sourceFiles.Any(d => d.Name == $"GG_TR_529900G3SW56SHYNPR95_01_20180316_0014_01.zip{Constants.FileExtensions.FileOps}"));
            //Assert.IsTrue(sourceFiles.Any(d => d.Name == $"EE_FEETRA_TPY_000454-0_18.XML{Constants.FileExtensions.FileOps}"));
            //Assert.IsTrue(sourceFiles.Any(d => d.Name == "EE_FEETRA_TPY_000454-0_18.XML"));
            //Assert.IsTrue(sourceFiles.Any(d => d.Name == "GG_TR_529900G3SW56SHYNPR95_01_20180316_0014_01.zip"));
        }
Exemple #3
0
        public void CopyByFilemaskUppercase()
        {
            //Arrange
            var channelSettings = new FromSettings()
            {
                Path                = "/home/ec2-user/From",
                Type                = ConfigChannelType.Sftp,
                PrivateKey          = Path.Combine("Common", "key.private"),
                Host                = "127.0.0.1",
                Port                = 22,
                UserName            = "******",
                FileMask            = "EE_*_*_*-0_18.xml",
                IgnoreCaseSensitive = true
            };

            _workingDirectory.DeleteWithContentIfExists().CreateIfNotExists();

            SftpChannel sftp = new SftpChannel(_workingDirectory, channelSettings);
            //Act
            var result = sftp.Copy();

            //Assert
            Assert.IsTrue(result.Any(d => d.Name == "EE_FEETRA_TPY_000451-0_18.xml"));
            Assert.IsTrue(result.Any(d => d.Name == "EE_FEETRA_TPY_000452-0_18.xml"));
            Assert.IsTrue(result.Any(d => d.Name == "EE_FEETRA_TPY_000454-0_18.XML"));
        }
Exemple #4
0
        public void CopyEmptyDirectoryFromSftp()
        {
            //Arrange
            var channelSettings = new FromSettings()
            {
                Path       = "/home/ec2-user/Empty",
                Type       = ConfigChannelType.Sftp,
                PrivateKey = Path.Combine("Common", "key.private"),
                Host       = "127.0.0.1",
                Port       = 22,
                UserName   = "******",
            };

            _workingDirectory.DeleteWithContentIfExists().CreateIfNotExists();

            SftpChannel sftp = new SftpChannel(_workingDirectory, channelSettings);
            //Act
            var result = sftp.Copy();

            //Assert
            Assert.IsTrue(!result.Any());
        }