use of java.io.File in project camel by apache.
the class FromFtpPreMoveDeleteTest method createRouteBuilder.
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
from(getFtpUrl()).process(new Processor() {
public void process(Exchange exchange) throws Exception {
// assert the file is pre moved
File file = new File(FTP_ROOT_DIR + "/movefile/work/hello.txt");
assertTrue("The file should have been moved", file.exists());
}
}).to("mock:result");
}
};
}
use of java.io.File 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 java.io.File 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());
}
use of java.io.File in project camel by apache.
the class FromFtpSedaDeleteFileTest method testPollFileAndShouldBeDeleted.
@Test
public void testPollFileAndShouldBeDeleted() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
mock.expectedBodiesReceived("Hello World this file will be deleted");
mock.assertIsSatisfied();
Thread.sleep(500);
// assert the file is deleted
File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
assertFalse("The file should have been deleted", file.exists());
}
use of java.io.File in project camel by apache.
the class FromFtpSedaDeleteFileTest 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 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());
}
Aggregations