You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/05/05 04:40:53 UTC

[1/2] git commit: Remove the Sytem.out line of AggregationStrategyWithPreservationTest

Repository: camel
Updated Branches:
  refs/heads/master 8b78f5ca9 -> 2b1da7b86


Remove the Sytem.out line of AggregationStrategyWithPreservationTest


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

Branch: refs/heads/master
Commit: 2b1da7b865add71750d5cbcaee3c3f9255c942bd
Parents: 37fdb57
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon May 5 10:38:10 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon May 5 10:40:14 2014 +0800

----------------------------------------------------------------------
 .../aggregate/zipfile/AggregationStrategyWithPreservationTest.java  | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2b1da7b8/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/AggregationStrategyWithPreservationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/AggregationStrategyWithPreservationTest.java b/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/AggregationStrategyWithPreservationTest.java
index 647faa5..9c40cad 100644
--- a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/AggregationStrategyWithPreservationTest.java
+++ b/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/AggregationStrategyWithPreservationTest.java
@@ -60,7 +60,6 @@ public class AggregationStrategyWithPreservationTest extends CamelTestSupport {
         try {
             int fileCount = 0;
             for (ZipEntry ze = zin.getNextEntry(); ze != null; ze = zin.getNextEntry()) {
-                System.out.println(ze.toString());
                 expectedZipFiles.remove(ze.toString());
                 fileCount++;
             }


[2/2] git commit: CAMEL-7409 Camel ZipIterator should not eat up the IOException

Posted by ni...@apache.org.
CAMEL-7409 Camel ZipIterator should not eat up the IOException


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

Branch: refs/heads/master
Commit: 37fdb57c85748b125158500f29342cd89fc612d9
Parents: 8b78f5c
Author: Willem Jiang <wi...@gmail.com>
Authored: Mon May 5 10:36:48 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon May 5 10:40:14 2014 +0800

----------------------------------------------------------------------
 .../camel/dataformat/zipfile/ZipIterator.java      | 11 +++++++----
 .../zipfile/ZipSplitterRouteIssueTest.java         | 17 +++++++++++++++--
 2 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/37fdb57c/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
index dc8b714..d54029e 100644
--- a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
+++ b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
@@ -25,6 +25,7 @@ import java.util.zip.ZipInputStream;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.DefaultMessage;
 import org.apache.camel.util.IOHelper;
 import org.slf4j.Logger;
@@ -70,9 +71,9 @@ class ZipIterator implements Iterator<Message> {
                 }                
             }
             return availableDataInCurrentEntry;            
-        } catch (IOException e) {
-            LOGGER.warn("Fail hasNext()", e);
-            return false;            
+        } catch (IOException exception) {
+            //Just wrap the IOException as CamelRuntimeException
+            throw new RuntimeCamelException(exception);      
         }
     }
 
@@ -106,7 +107,9 @@ class ZipIterator implements Iterator<Message> {
                 } else {
                     LOGGER.trace("close zipInputStream");
                 }
-            } catch (IOException ignore) {
+            } catch (IOException exception) {
+                //Just wrap the IOException as CamelRuntimeException
+                throw new RuntimeCamelException(exception);
             }
         }        
         

http://git-wip-us.apache.org/repos/asf/camel/blob/37fdb57c/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteIssueTest.java b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteIssueTest.java
index 8e69e57..6f5dacb 100644
--- a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteIssueTest.java
+++ b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteIssueTest.java
@@ -38,17 +38,30 @@ public class ZipSplitterRouteIssueTest extends CamelTestSupport {
 
         assertMockEndpointsSatisfied();
     }
+    
+    @Test
+    public void testSplitterWithWrongFile() throws Exception {
+        getMockEndpoint("mock:entry").expectedMessageCount(0);
+        getMockEndpoint("mock:errors").expectedMessageCount(1);
+        //Send a file which is not exit
+        template.sendBody("seda:decompressFiles", new File("src/test/resources/data"));
+        
+        assertMockEndpointsSatisfied();
+        
+    }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                errorHandler(deadLetterChannel("mock:errors"));
+                
                 from("seda:decompressFiles")
                     .split(new ZipSplitter()).streaming().shareUnitOfWork()
                         .log("we are splitting")
-                        .to("mock:entry")
-                        .to("file:target/zip/?fileName=decompressed.txt&fileExist=Append");
+                        .to("mock:entry");
+                        //.to("file:target/zip/?fileName=decompressed.txt&fileExist=Append");
             }
         };
     }