package de.fred4jupiter.plaincamel;

import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.commons.io.FileUtils;
import org.junit.Test;

import java.io.File;

public class ProcessFileTest extends CamelTestSupport {

	@Override
	protected RouteBuilder createRouteBuilder() throws Exception {
		return new MyRoute();
	}

	@Test
	public void moveFileAndCheckContent() throws Exception {
		template.sendBodyAndHeader("file://target/in", "Hello World", Exchange.FILE_NAME, "hello.txt");
		Thread.sleep(2000);
		File target = new File("target/out/hello.txt");
		assertTrue("File not moved", target.exists());

		String fileContent = FileUtils.readFileToString(target);
		assertEquals("Hello World, filename: hello.txt", fileContent);
	}
}

@@ -307,16 +307,142 @@
 port %7B%0A%0A
+%09public void setUp() throws Exception %7B%0A%09%09super.setUp();%0A%09%09deleteDirectory(%22target/in%22);%0A%09%09deleteDirectory(%22target/out%22);%0A%09%7D%0A%0A
 %09@Overri

update test