Created
February 18, 2013 09:04
-
-
Save peysal/4976062 to your computer and use it in GitHub Desktop.
Camel test using xml file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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