Updated Branches:
  refs/heads/camel-2.11.x ae23e200b -> bae0c7e1f
  refs/heads/camel-2.12.x 19c96be7b -> e166ab638
  refs/heads/master b92d62375 -> 6a71168ce


Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6a71168c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6a71168c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6a71168c

Branch: refs/heads/master
Commit: 6a71168cea008e3fad3f9271255d32ade0ab08a2
Parents: b92d623
Author: Claus Ibsen <davscl...@apache.org>
Authored: Tue Sep 10 12:08:50 2013 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Tue Sep 10 12:08:50 2013 +0200

----------------------------------------------------------------------
 .../dataformat/zipfile/ZipFileDataFormatTest.java     | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6a71168c/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java
 
b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java
index b16daeb..889e480 100644
--- 
a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java
+++ 
b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormatTest.java
@@ -21,10 +21,12 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
@@ -102,6 +104,8 @@ public class ZipFileDataFormatTest extends CamelTestSupport 
{
 
     @Test
     public void testZipToFileWithoutFileName() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
+
         String[] files = TEST_DIR.list();
         assertTrue(files == null || files.length == 0);
 
@@ -112,6 +116,9 @@ public class ZipFileDataFormatTest extends CamelTestSupport 
{
 
         assertMockEndpointsSatisfied();
 
+        // use builder to ensure the exchange is fully done before we check 
for file exists
+        assertTrue(notify.matches(5, TimeUnit.SECONDS));
+
         Exchange exchange = mock.getReceivedExchanges().get(0);
         File file = new File(TEST_DIR, exchange.getIn().getMessageId() + 
".zip");
         assertTrue(file.exists());
@@ -120,6 +127,8 @@ public class ZipFileDataFormatTest extends CamelTestSupport 
{
 
     @Test
     public void testZipToFileWithFileName() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
+
         MockEndpoint mock = getMockEndpoint("mock:zipToFile");
         mock.expectedMessageCount(1);
         
@@ -130,7 +139,10 @@ public class ZipFileDataFormatTest extends 
CamelTestSupport {
 
         // just make sure the file is created
         mock.assertIsSatisfied();
-        
+
+        // use builder to ensure the exchange is fully done before we check 
for file exists
+        assertTrue(notify.matches(5, TimeUnit.SECONDS));
+
         assertTrue(file.exists());
         assertTrue(ObjectHelper.equalByteArray(getZippedText("poem.txt"), 
getBytes(file)));
     }

Reply via email to