How to use SftpClientBuilder class of com.consol.citrus.ftp.client package

Best Citrus code snippet using com.consol.citrus.ftp.client.SftpClientBuilder

Source:CitrusEndpoints.java Github

copy

Full Screen

...114 /**115 * Creates new SftpClient or SftpServer builder.116 * @return117 */118 public static ClientServerEndpointBuilder<SftpClientBuilder, SftpServerBuilder> sftp() {119 return new ClientServerEndpointBuilder<>(new SftpClientBuilder(), new SftpServerBuilder());120 }121 /**122 * Creates new ScpClient or SftpServer builder.123 * @return124 */125 public static ClientServerEndpointBuilder<ScpClientBuilder, SftpServerBuilder> scp() {126 return new ClientServerEndpointBuilder<>(new ScpClientBuilder(), new SftpServerBuilder());127 }128 /**129 * Creates new SshClient or SshServer builder.130 * @return131 */132 public static ClientServerEndpointBuilder<SshClientBuilder, SshServerBuilder> ssh() {133 return new ClientServerEndpointBuilder<>(new SshClientBuilder(), new SshServerBuilder());...

Full Screen

Full Screen

Source:SftpClientBuilder.java Github

copy

Full Screen

...21/**22 * @author Christoph Deppisch23 * @since 2.7.524 */25public class SftpClientBuilder extends AbstractEndpointBuilder<SftpClient> {26 /** Endpoint target */27 private SftpClient endpoint = new SftpClient();28 @Override29 protected SftpClient getEndpoint() {30 return endpoint;31 }32 /**33 * Sets the host property.34 * @param host35 * @return36 */37 public SftpClientBuilder host(String host) {38 endpoint.getEndpointConfiguration().setHost(host);39 return this;40 }41 /**42 * Sets the port property.43 * @param port44 * @return45 */46 public SftpClientBuilder port(int port) {47 endpoint.getEndpointConfiguration().setPort(port);48 return this;49 }50 /**51 * Sets the auto read files property.52 * @param autoReadFiles53 * @return54 */55 public SftpClientBuilder autoReadFiles(boolean autoReadFiles) {56 endpoint.getEndpointConfiguration().setAutoReadFiles(autoReadFiles);57 return this;58 }59 /**60 * Sets the local passive mode property.61 * @param localPassiveMode62 * @return63 */64 public SftpClientBuilder localPassiveMode(boolean localPassiveMode) {65 endpoint.getEndpointConfiguration().setLocalPassiveMode(localPassiveMode);66 return this;67 }68 /**69 * Sets the client username.70 * @param username71 * @return72 */73 public SftpClientBuilder username(String username) {74 endpoint.getEndpointConfiguration().setUser(username);75 return this;76 }77 /**78 * Sets the client password.79 * @param password80 * @return81 */82 public SftpClientBuilder password(String password) {83 endpoint.getEndpointConfiguration().setPassword(password);84 return this;85 }86 /**87 * Sets the privateKeyPath property.88 * @param privateKeyPath89 * @return90 */91 public SftpClientBuilder privateKeyPath(String privateKeyPath) {92 endpoint.getEndpointConfiguration().setPrivateKeyPath(privateKeyPath);93 return this;94 }95 /**96 * Sets the privateKeyPassword property.97 * @param privateKeyPassword98 * @return99 */100 public SftpClientBuilder privateKeyPassword(String privateKeyPassword) {101 endpoint.getEndpointConfiguration().setPrivateKeyPassword(privateKeyPassword);102 return this;103 }104 /**105 * Sets the strictHostChecking property.106 * @param strictHostChecking107 * @return108 */109 public SftpClientBuilder strictHostChecking(boolean strictHostChecking) {110 endpoint.getEndpointConfiguration().setStrictHostChecking(strictHostChecking);111 return this;112 }113 /**114 * Sets the knownHosts property.115 * @param knownHosts116 * @return117 */118 public SftpClientBuilder knownHosts(String knownHosts) {119 endpoint.getEndpointConfiguration().setKnownHosts(knownHosts);120 return this;121 }122 /**123 * Sets the preferred authentications property.124 * @param preferredAuthentications125 * @return126 */127 public SftpClientBuilder preferredAuthentications(String preferredAuthentications) {128 endpoint.getEndpointConfiguration().setPreferredAuthentications(preferredAuthentications);129 return this;130 }131 /**132 * Sets the sessionConfigs property.133 * @param sessionConfigs134 * @return135 */136 public SftpClientBuilder sessionConfigs(Map<String, String> sessionConfigs) {137 endpoint.getEndpointConfiguration().setSessionConfigs(sessionConfigs);138 return this;139 }140 /**141 * Sets the message correlator.142 * @param correlator143 * @return144 */145 public SftpClientBuilder correlator(MessageCorrelator correlator) {146 endpoint.getEndpointConfiguration().setCorrelator(correlator);147 return this;148 }149 /**150 * Sets the error handling strategy.151 * @param errorStrategy152 * @return153 */154 public SftpClientBuilder errorHandlingStrategy(ErrorHandlingStrategy errorStrategy) {155 endpoint.getEndpointConfiguration().setErrorHandlingStrategy(errorStrategy);156 return this;157 }158 /**159 * Sets the polling interval.160 * @param pollingInterval161 * @return162 */163 public SftpClientBuilder pollingInterval(int pollingInterval) {164 endpoint.getEndpointConfiguration().setPollingInterval(pollingInterval);165 return this;166 }167 /**168 * Sets the default timeout.169 * @param timeout170 * @return171 */172 public SftpClientBuilder timeout(long timeout) {173 endpoint.getEndpointConfiguration().setTimeout(timeout);174 return this;175 }176}...

Full Screen

Full Screen

Source:SftpClientConfigParser.java Github

copy

Full Screen

...17import com.consol.citrus.TestActor;18import com.consol.citrus.config.annotation.AbstractAnnotationConfigParser;19import com.consol.citrus.context.ReferenceResolver;20import com.consol.citrus.ftp.client.SftpClient;21import com.consol.citrus.ftp.client.SftpClientBuilder;22import com.consol.citrus.message.MessageCorrelator;23import org.springframework.util.StringUtils;24import java.util.Map;25/**26 * @author Christoph Deppisch27 * @since 2.7.528 */29public class SftpClientConfigParser extends AbstractAnnotationConfigParser<SftpClientConfig, SftpClient> {30 /**31 * Constructor matching super.32 * @param referenceResolver33 */34 public SftpClientConfigParser(ReferenceResolver referenceResolver) {35 super(referenceResolver);36 }37 @Override38 public SftpClient parse(SftpClientConfig annotation) {39 SftpClientBuilder builder = new SftpClientBuilder();40 if (StringUtils.hasText(annotation.host())) {41 builder.host(annotation.host());42 }43 builder.port(annotation.port());44 builder.autoReadFiles(annotation.autoReadFiles());45 builder.localPassiveMode(annotation.localPassiveMode());46 if (StringUtils.hasText(annotation.username())) {47 builder.username(annotation.username());48 }49 if (StringUtils.hasText(annotation.password())) {50 builder.password(annotation.password());51 }52 if (StringUtils.hasText(annotation.privateKeyPath())) {53 builder.privateKeyPath(annotation.privateKeyPath());...

Full Screen

Full Screen

SftpClientBuilder

Using AI Code Generation

copy

Full Screen

1import com.consol.citrus.ftp.client.SftpClientBuilder;2import com.consol.citrus.ftp.message.FtpMessage;3import com.consol.citrus.ftp.server.SftpServerBuilder;4import com.consol.citrus.message.MessageType;5import com.consol.citrus.testng.CitrusParameters;6import com.consol.citrus.testng.CitrusXmlTestNG;7import org.testng.annotations.Test;8import static com.consol.citrus.actions.CreateVariablesAction.Builder.createVariable;9import static com.consol.citrus.container.Sequence.Builder.sequential;10import static com.consol.citrus.container.Parallel.Builder.parallel;11import static com.consol.citrus.container.FinallySequence.Builder.doFinally;12import static com.consol.citrus.container.Assert.Builder.assertException;13import static com.consol.citrus.container.Assert.Builder.assertSoapFault;14import static com.consol.citrus.container.Assert.Builder.assertSoapEnvelope;15import static com.consol.citrus.container.Assert.Builder.assertXPath;16import static com.consol.citrus.container.Assert.Builder.assertJsonPath;17import static com.consol.citrus.container.Assert.Builder.assertJson;18import static com.consol.citrus.container.Assert.Builder.assertJavaScript;19import static com.consol.citrus.container.Assert.Builder.assertGroovyScript;20import static com.consol.citrus.container.Assert.Builder.assertXml;21import static com.consol.citrus.container.Assert.Builder.assertXmlString;22import static com.consol.citrus.container.Assert.Builder.assertVariable;23import static com.consol.citrus.container.Assert.Builder.assertHttpStatus;24import static com.consol.citrus.container.Assert.Builder.assertExceptionMessage;25import static com.consol.citrus.container.Assert.Builder.assertExceptionCode;26import static com.consol.citrus.container.Assert.Builder.assertExceptionCause;27import static com.consol.citrus.container.Assert.Builder.assertExceptionStackTrace;28import static com.consol.citrus.container.Assert.Builder.assertExceptionRootCause;29import static com.consol.citrus.container.Assert.Builder.assertExceptionRootCauseMessage;30import static com.consol.citrus.container.Assert.Builder.assertExceptionRootCauseStackTrace;31import static com.consol.citrus.container.Assert.Builder.assertExceptionRootCauseCode;32import static com.consol.citrus.container.Assert.Builder.assertExceptionRootCauseType;33import static com.consol.citrus.container.Assert.Builder.assertExceptionType;34import static com.consol.citrus.container.Assert.Builder.assertExceptionMessageStart

Full Screen

Full Screen

SftpClientBuilder

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.ftp.client;2import com.consol.citrus.dsl.runner.TestRunner;3import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;4import org.testng.annotations.Test;5public class SftpClientBuilderTest extends TestNGCitrusTestDesigner {6 public void ftpClientBuilder() {7 TestRunner runner = createTestRunner();8 runner.sftp()9 .client()10 .host("localhost")11 .port(2222)12 .username("admin")13 .password("admin")14 .autoLogin(true)15 .autoCreateLocalDirectory(true)16 .autoCreateRemoteDirectory(true)17 .autoDeleteLocalDirectory(true)18 .autoDeleteRemoteDirectory(true)19 .autoCreateRemoteDirectory(true)20 .autoCreateLocalDirectory(true)21 .autoDeleteRemoteDirectory(true)22 .autoDeleteLocalDirectory(true)23 .autoCreateLocalDirectory(true)24 .autoCreateRemoteDirectory(true)25 .autoDeleteLocalDirectory(true)26 .autoDeleteRemoteDirectory(true)27 .autoCreateRemoteDirectory(true)28 .autoCreateLocalDirectory(true)29 .autoDeleteRemoteDirectory(true)30 .autoDeleteLocalDirectory(true)31 .autoCreateLocalDirectory(true)32 .autoCreateRemoteDirectory(true)33 .autoDeleteLocalDirectory(true)34 .autoDeleteRemoteDirectory(true)35 .autoCreateRemoteDirectory(true)36 .autoCreateLocalDirectory(true)37 .autoDeleteRemoteDirectory(true)38 .autoDeleteLocalDirectory(true)39 .autoCreateLocalDirectory(true)40 .autoCreateRemoteDirectory(true)41 .autoDeleteLocalDirectory(true)42 .autoDeleteRemoteDirectory(true)43 .autoCreateRemoteDirectory(true)44 .autoCreateLocalDirectory(true)45 .autoDeleteRemoteDirectory(true)46 .autoDeleteLocalDirectory(true)47 .autoCreateLocalDirectory(true)48 .autoCreateRemoteDirectory(true)49 .autoDeleteLocalDirectory(true)50 .autoDeleteRemoteDirectory(true)51 .autoCreateRemoteDirectory(true)52 .autoCreateLocalDirectory(true)53 .autoDeleteRemoteDirectory(true)54 .autoDeleteLocalDirectory(true)55 .autoCreateLocalDirectory(true)56 .autoCreateRemoteDirectory(true)57 .autoDeleteLocalDirectory(true)58 .autoDeleteRemoteDirectory(true)59 .autoCreateRemoteDirectory(true)60 .autoCreateLocalDirectory(true)61 .autoDeleteRemoteDirectory(true)

Full Screen

Full Screen

SftpClientBuilder

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.ftp.client;2import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;3import com.consol.citrus.ftp.message.FtpMessage;4import org.springframework.beans.factory.annotation.Autowired;5import org.springframework.core.io.ClassPathResource;6import org.springframework.core.io.Resource;7import org.springframework.ftp.core.FtpClient;8import org.springframework.ftp.core.FtpClientTemplate;9import org.springframework.ftp.core.FtpTemplate;10import org.springframework.ftp.core.support.FtpClientInterceptor;11import org.springframework.ftp.core.support.FtpClientInterceptorChain;12import org.springframework.ftp.core.support.FtpClientInterceptorFactory;13import org.springframework.ftp.core.support.FtpClientInterceptorFactoryChain;14import org.springframework.ftp.support.FtpSession;15import org.springframework.ftp.support.FtpSessionPool;16import org.springframework.integration.ftp.session.DefaultFtpSessionFactory;17import org.springframework.integration.ftp.session.FtpSessionPoolFactory;18import org.testng.annotations.Test;19import java.io.File;20import java.io.InputStream;21import java.util.ArrayList;22import java.util.List;23import java.util.function.Consumer;24public class SftpClientBuilderTest extends TestNGCitrusTestDesigner {25 private FtpSessionPoolFactory ftpSessionPoolFactory;26 private FtpClientInterceptorFactoryChain ftpClientInterceptorFactoryChain;27 private FtpClientInterceptorChain ftpClientInterceptorChain;28 private DefaultFtpSessionFactory defaultFtpSessionFactory;29 private FtpTemplate ftpTemplate;30 private FtpClientTemplate ftpClientTemplate;31 private FtpClient ftpClient;32 public void test() {33 .sftp()34 .username("user")35 .password("password")36 .sessionPoolFactory(ftpSessionPoolFactory)37 .sessionPool("ftpSessionPool")38 .sessionFactory(defaultFtpSessionFactory)39 .ftpClientInterceptorFactoryChain(ftpClientInterceptorFactoryChain)40 .ftpClientInterceptorChain(ftpClientInterceptorChain)41 .ftpTemplate(ftpTemplate)42 .ftpClientTemplate(ftpClientTemplate)43 .ftpClient(ftpClient)44 .autoCreateLocalDirectory(true)45 .autoCreateRemoteDirectory(true)

Full Screen

Full Screen

SftpClientBuilder

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.ftp.client;2import com.consol.citrus.dsl.endpoint.CitrusEndpoints;3import com.consol.citrus.dsl.runner.TestRunner;4import com.consol.citrus.ftp.server.SftpServer;5import com.consol.citrus.ftp.server.SftpServerBuilder;6import com.consol.citrus.testng.AbstractTestNGUnitTest;7import org.testng.annotations.Test;8import java.io.File;9public class SftpClientBuilderTest extends AbstractTestNGUnitTest {10 public void testSftpClientBuilder() {11 SftpServer sftpServer = CitrusEndpoints.sftp()12 .autoStart(true)13 .port(2222)14 .build();15 SftpClient sftpClient = CitrusEndpoints.sftp()16 .autoStart(true)17 .port(2222)18 .build();19 TestRunner runner = createTestRunner();20 File file = new File("src/test/resources/test.txt");21 runner.sftp(sftpClient)22 .upload(file);23 runner.sftp(sftpClient)24 .download(file);25 runner.sftp(sftpClient)26 .delete(file);27 sftpServer.stop();28 }29}30package com.consol.citrus.ftp.client;31import com.consol.citrus.dsl.endpoint.CitrusEndpoints;32import com.consol.citrus.dsl.runner.TestRunner;33import com.consol.citrus.ftp.server.SftpServer;34import com.consol.citrus.ftp.server.SftpServerBuilder;35import com.consol.citrus.testng.AbstractTestNGUnitTest;36import org.testng.annotations.Test;37import java.io.File;

Full Screen

Full Screen

SftpClientBuilder

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.ftp.client;2import com.consol.citrus.dsl.endpoint.FtpEndpointConfigurator;3import com.consol.citrus.dsl.endpoint.FtpServerConfigurator;4import com.consol.citrus.dsl.runner.TestRunner;5import com.consol.citrus.ftp.message.FtpMessage;6import com.consol.citrus.ftp.server.SftpServer;7import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;8import org.apache.sshd.server.SshServer;9import org.apache.sshd.server.auth.password.PasswordAuthenticator;10import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;11import org.apache.sshd.server.session.ServerSession;12import java.io.File;13import java.util.ArrayList;14import java.util.List;15public class SftpClientBuilder implements FtpEndpointConfigurator<SftpClientBuilder>, FtpServerConfigurator<SftpClientBuilder> {16 private final TestRunner runner;17 private final SftpServer sftpServer;18 public SftpClientBuilder(TestRunner runner) {19 this.runner = runner;20 this.sftpServer = new SftpServer();21 }22 public SftpClientBuilder autoLogin(boolean autoLogin) {23 sftpServer.setAutoLogin(autoLogin);24 return this;25 }26 public SftpClientBuilder autoReadFiles(boolean autoReadFiles) {27 sftpServer.setAutoReadFiles(autoReadFiles);28 return this;29 }30 public SftpClientBuilder autoReadTimeout(long autoReadTimeout) {31 sftpServer.setAutoReadTimeout(autoReadTimeout);32 return this;33 }34 public SftpClientBuilder autoRemove(boolean autoRemove) {35 sftpServer.setAutoRemove(autoRemove);36 return this;37 }38 public SftpClientBuilder autoRemoveTimeout(long autoRemoveTimeout) {39 sftpServer.setAutoRemoveTimeout(autoRemoveTimeout);40 return this;41 }42 public SftpClientBuilder autoStart(boolean autoStart) {43 sftpServer.setAutoStart(autoStart);44 return this;45 }46 public SftpClientBuilder autoStop(boolean autoStop) {47 sftpServer.setAutoStop(autoStop);48 return this;49 }50 public SftpClientBuilder autoUpload(boolean autoUpload) {51 sftpServer.setAutoUpload(autoUpload);

Full Screen

Full Screen

SftpClientBuilder

Using AI Code Generation

copy

Full Screen

1import com.consol.citrus.ftp.client.SftpClient;2import com.consol.citrus.ftp.client.SftpClientBuilder;3import com.consol.citrus.ftp.client.SftpEndpointConfiguration;4import com.consol.citrus.ftp.client.SftpEndpointConfigurationBuilder;5public class SftpClientTest {6 public static void main(String[] args) {7 SftpEndpointConfiguration endpointConfiguration = new SftpEndpointConfigurationBuilder()8 .host("localhost")9 .port(22)10 .username("user")11 .password("password")12 .build();13 SftpClient client = new SftpClientBuilder()14 .endpointConfiguration(endpointConfiguration)15 .build();16 client.connect();17 client.downloadFile("path/to/local/file", "path/to/remote/file");18 client.disconnect();19 }20}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Citrus automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful