diff -urN unittest/pom.xml unittest-1/pom.xml
--- unittest/pom.xml 2011-12-03 14:42:35.795661379 +0000
+++ unittest-1/pom.xml 2011-12-03 14:15:05.000000000 +0000
@@ -61,6 +61,11 @@
camel-jms
2.9.0-RC1
+
+ org.apache.camel
+ camel-test
+ 2.9.0-RC1
+
@@ -86,7 +91,11 @@
log4j
1.2.16
-
+
+ junit
+ junit
+ 4.8.1
+
@@ -108,7 +117,6 @@
camel-maven-plugin
2.9.0-RC1
-
org.mortbay.jetty
jetty-maven-plugin
diff -urN unittest/src/data/message1.xml unittest-1/src/data/message1.xml
--- unittest/src/data/message1.xml 2011-12-03 14:42:35.819412755 +0000
+++ unittest-1/src/data/message1.xml 1970-01-01 01:00:00.000000000 +0100
@@ -1,22 +0,0 @@
-
-
-
- James
- Strachan
- London
-
\ No newline at end of file
diff -urN unittest/src/data/message2.xml unittest-1/src/data/message2.xml
--- unittest/src/data/message2.xml 2011-12-03 14:42:35.819412755 +0000
+++ unittest-1/src/data/message2.xml 1970-01-01 01:00:00.000000000 +0100
@@ -1,22 +0,0 @@
-
-
-
- Hiram
- Chirino
- Tampa
-
\ No newline at end of file
diff -urN unittest/src/data/message3.xml unittest-1/src/data/message3.xml
--- unittest/src/data/message3.xml 2011-12-03 14:42:35.819412755 +0000
+++ unittest-1/src/data/message3.xml 1970-01-01 01:00:00.000000000 +0100
@@ -1,22 +0,0 @@
-
-
-
- Jonathan
- Anstey
- St. John's
-
diff -urN unittest/src/test/java/wsinteg/unittest/FirstTest.java unittest-1/src/test/java/wsinteg/unittest/FirstTest.java
--- unittest/src/test/java/wsinteg/unittest/FirstTest.java 1970-01-01 01:00:00.000000000 +0100
+++ unittest-1/src/test/java/wsinteg/unittest/FirstTest.java 2011-12-03 14:38:46.880410882 +0000
@@ -0,0 +1,49 @@
+package wsinteg.unittest;
+
+import java.io.File;
+import org.apache.camel.Exchange;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Test;
+
+public class FirstTest extends CamelSpringTestSupport {
+
+ @EndpointInject(uri = "mock:result")
+ protected MockEndpoint resultEndpoint;
+
+ @Produce(uri = "file:src/data")
+ protected ProducerTemplate template;
+
+ public void sendMessage(String city, String folder) throws Exception {
+ String message1 = ""+city+"";
+ String filename = city+".xml";
+ template.sendBodyAndHeader(message1, Exchange.FILE_NAME, filename);
+ Thread.sleep(1000);
+ File target = new File("target/messages/"+folder+"/"+filename);
+ assertTrue("File not moved", target.exists());
+ String content = context.getTypeConverter()
+ .convertTo(String.class, target);
+ assertEquals(message1, content);
+ }
+
+ @Test
+ public void testSendOtherMessage() throws Exception {
+ sendMessage("Paris", "others");
+ }
+
+ @Test
+ public void testSendUKMessage() throws Exception {
+ sendMessage("London", "uk");
+ }
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("file:src/main/webapp/WEB-INF/applicationContext.xml");
+ }
+}