/// <summary> /// Initializes a new instance of the FtpAdapterConnectionFactory class /// </summary> public FtpAdapterConnectionFactory(ConnectionUri connectionUri , ClientCredentials clientCredentials , FtpAdapter adapter) { this.clientCredentials = clientCredentials; this.adapter = adapter; this.ConnectionUri = connectionUri as FtpAdapterConnectionUri; }
/// <summary> /// Instantiate the adapter. /// </summary> /// <returns></returns> protected override BindingElement CreateBindingElement() { FtpAdapter adapter = new FtpAdapter(); this.ApplyConfiguration(adapter); return adapter; }
private FtpAdapterInboundHandler Internal_CreateHandler(string inputFolder, string filter, out IConnection connection) { var adapter = new FtpAdapter { PollingInterval = 15 }; var connectionUri = GetFtpAdapterConnectionUri(inputFolder, filter); var factory = new FtpAdapterConnectionFactory(connectionUri, GetCredentials(), adapter); connection = factory.CreateConnection(); connection.Open(TimeSpan.FromSeconds(30)); var inputHandler = connection.BuildHandler<FtpAdapterInboundHandler>(null); inputHandler.StartListener(new string[0], TimeSpan.MaxValue); return inputHandler; }
public void Internal_OutputTest(string sourcePath, string destinationFolder, string destinationFile, string expectedPath, string fileContent, OverwriteAction overwriteAction = default(OverwriteAction)) { var adapter = new FtpAdapter { OverwriteAction = overwriteAction }; var connectionUri = GetFtpAdapterConnectionUri(destinationFolder, destinationFile); var factory = new FtpAdapterConnectionFactory(connectionUri, GetCredentials(), adapter); var connection = factory.CreateConnection(); try { connection.Open(TimeSpan.FromSeconds(15)); var outputHandler = connection.BuildHandler<FtpAdapterOutboundHandler>(null); outputHandler.Execute(CreateMessage(sourcePath, GetTestStream(fileContent)), TimeSpan.MaxValue); Assert.IsTrue(System.IO.File.Exists(expectedPath)); Assert.AreEqual(fileContent, System.IO.File.ReadAllText(expectedPath)); } finally { connection.Close(TimeSpan.FromSeconds(15)); } }