Skip to content

Instantly share code, notes, and snippets.

@peysal
Created February 18, 2013 09:04
Show Gist options
  • Save peysal/4976062 to your computer and use it in GitHub Desktop.
Save peysal/4976062 to your computer and use it in GitHub Desktop.
Camel test using xml file
import java.io.File;
import org.apache.camel.Exchange;
import org.apache.camel.test.junit4.CamelSpringTestSupport;
import org.junit.Test;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class SpringFirstTest extends CamelSpringTestSupport {
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("CONTEXT-INF/firststep.xml");
}
@Test
public void testMoveFile() throws Exception {
template.sendBodyAndHeader("file://target/inbox", "Hello World",
Exchange.FILE_NAME, "hello.txt");
Thread.sleep(1000);
File target = new File("target/outbox/hello.txt");
assertTrue("File not moved", target.exists());
String content = context.getTypeConverter().convertTo(String.class,
target);
assertEquals("Hello World", content);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment