use of org.apache.camel.Producer in project camel by apache.
the class FromFtpDoNotDeleteFileIfProcessFailsTest 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 this file will NOT be deleted");
exchange.getIn().setHeader(Exchange.FILE_NAME, "hello.txt");
Producer producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
producer.stop();
// assert file is created
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
assertTrue("The file should exists", file.exists());
}
use of org.apache.camel.Producer in project camel by apache.
the class FromFileToFtpDefaultRootRenameStrategyTest method prepareFtpServer.
private void prepareFtpServer() throws Exception {
// create a binary file .. uploaded to the default root location
Endpoint endpoint = context.getEndpoint(getFtpUrl());
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();
}
use of org.apache.camel.Producer in project camel by apache.
the class FromFtpPollFileOnlyTest 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("ftp://admin@localhost:" + getPort() + "/fileonly/?password=admin&binary=false");
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 FromFtpPreMoveFileExpressionTest 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 this file will be moved");
exchange.getIn().setHeader(Exchange.FILE_NAME, "hello.txt");
Producer producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
producer.stop();
// assert file is created
File file = new File(FTP_ROOT_DIR + "/movefile/hello.txt");
assertTrue("The file should exists", file.exists());
}
use of org.apache.camel.Producer in project camel by apache.
the class FromFtpPreMoveFilePostfixTest 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 this file will be moved");
exchange.getIn().setHeader(Exchange.FILE_NAME, "hello.txt");
Producer producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
producer.stop();
// assert file is created
File file = new File(FTP_ROOT_DIR + "/movefile/hello.txt");
assertTrue("The file should exists", file.exists());
}
Aggregations