use of org.apache.camel.Producer in project camel by apache.
the class FtpLoginTest method uploadFile.
private void uploadFile(String username, String password) throws Exception {
Endpoint endpoint = context.getEndpoint("ftp://" + username + "@localhost:" + getPort() + "/login?password=" + password);
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody("Hello World from FTPServer");
exchange.getIn().setHeader(Exchange.FILE_NAME, "report.txt");
Producer producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
producer.stop();
}
use of org.apache.camel.Producer in project camel by apache.
the class FromFtpStartingDirAndFileNameClashTest method prepareFtpServer.
private void prepareFtpServer() throws Exception {
// prepares the FTP Server by creating a file on the server that we want to unit
// test that we can pool and store as a local file
Endpoint endpoint = context.getEndpoint(getFtpUrl());
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody("Hello World");
exchange.getIn().setHeader(Exchange.FILE_NAME, "hello-world.txt");
Producer producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
producer.stop();
}
use of org.apache.camel.Producer in project camel by apache.
the class FtpConsumerBodyAsStringTest method prepareFtpServer.
private void prepareFtpServer() throws Exception {
// prepares the FTP Server by creating a file on the server that we want to unit
// test that we can pool
Endpoint endpoint = context.getEndpoint(getFtpUrl());
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody("Hello World");
exchange.getIn().setHeader(Exchange.FILE_NAME, "hello.txt");
Producer producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
producer.stop();
}
use of org.apache.camel.Producer in project camel by apache.
the class FromFtpToBinaryFilesTest method prepareFtpServer.
private void prepareFtpServer() throws Exception {
// prepares the FTP Server by creating a file on the server that we want to unit
// test that we can pool and store as a local file
String ftpUrl = "ftp://admin@localhost:" + getPort() + "/incoming?password=admin&binary=true" + "&consumer.delay=2000&recursive=false";
Endpoint endpoint = context.getEndpoint(ftpUrl);
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody(IOConverter.toFile("src/test/data/ftpbinarytest/logo.jpeg"));
exchange.getIn().setHeader(Exchange.FILE_NAME, "logo.jpeg");
Producer producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
producer.stop();
ftpUrl = "ftp://admin@localhost:" + getPort() + "/incoming/a?password=admin&binary=true" + "&consumer.delay=2000&recursive=false";
endpoint = context.getEndpoint(ftpUrl);
exchange = endpoint.createExchange();
exchange.getIn().setBody(IOConverter.toFile("src/test/data/ftpbinarytest/logo1.jpeg"));
exchange.getIn().setHeader(Exchange.FILE_NAME, "logo1.jpeg");
producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
producer.stop();
}
use of org.apache.camel.Producer in project camel by apache.
the class FromFtpToFileNoFileNameHeaderTest method prepareFtpServer.
private void prepareFtpServer() throws Exception {
// prepares the FTP Server by creating a file on the server that we want to unit
// test that we can pool and store as a local file
Endpoint endpoint = context.getEndpoint(getFtpUrl());
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody("Hello World from FTPServer");
exchange.getIn().setHeader(Exchange.FILE_NAME, "hello.txt");
Producer producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
producer.stop();
}
Aggregations