Updated Branches:
  refs/heads/camel-2.11.x 96c1ca4ea -> d2fbde7a9
  refs/heads/camel-2.12.x 12fc496fb -> f884a26b0
  refs/heads/master 2414eb613 -> 7c35dd872


CAMEL-6679: Added unit test


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

Branch: refs/heads/master
Commit: 43704eb715ff72b4341527d455738ca1da991e22
Parents: 2414eb6
Author: Claus Ibsen <[email protected]>
Authored: Tue Nov 12 11:26:47 2013 +0100
Committer: Claus Ibsen <[email protected]>
Committed: Tue Nov 12 11:26:58 2013 +0100

----------------------------------------------------------------------
 .../zipfile/ZipSplitterRouteIssueTest.java      |  56 +++++++++++++++++++
 .../zipfile/ZipSplitterRouteTest.java           |  11 ++--
 .../camel-zipfile/src/test/resources/data.zip   | Bin 0 -> 540 bytes
 .../src/test/resources/log4j.properties         |  40 ++++++-------
 4 files changed, 83 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/43704eb7/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
new file mode 100644
index 0000000..8e69e57
--- /dev/null
+++ 
b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteIssueTest.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.zipfile;
+
+import java.io.File;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class ZipSplitterRouteIssueTest extends CamelTestSupport {
+
+    @Override
+    public void setUp() throws Exception {
+        deleteDirectory("target/zip");
+        super.setUp();
+    }
+
+    @Test
+    public void testSplitter() throws Exception {
+        getMockEndpoint("mock:entry").expectedMessageCount(2);
+
+        template.sendBody("seda:decompressFiles", new 
File("src/test/resources/data.zip"));
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("seda:decompressFiles")
+                    .split(new ZipSplitter()).streaming().shareUnitOfWork()
+                        .log("we are splitting")
+                        .to("mock:entry")
+                        
.to("file:target/zip/?fileName=decompressed.txt&fileExist=Append");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/43704eb7/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteTest.java
 
b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteTest.java
index 27de3ba..d94e0c7 100644
--- 
a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteTest.java
+++ 
b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipSplitterRouteTest.java
@@ -16,14 +16,12 @@
  */
 package org.apache.camel.dataformat.zipfile;
 
-
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 public class ZipSplitterRouteTest extends CamelTestSupport {
-    
 
     @Test
     public void testSplitter() throws InterruptedException {
@@ -39,9 +37,12 @@ public class ZipSplitterRouteTest extends CamelTestSupport {
             public void configure() throws Exception {
                 // Unzip file and Split it according to FileEntry
                 
from("file:src/test/resources/org/apache/camel/dataformat/zipfile?consumer.delay=1000&noop=true")
-                        .log("Start processing big file: 
${header.CamelFileName}").split(new ZipSplitter())
-                        
.streaming().convertBodyTo(String.class).to("mock:processZipEntry")
-                        .end().log("Done processing big file: 
${header.CamelFileName}");
+                    .log("Start processing big file: ${header.CamelFileName}")
+                    .split(new ZipSplitter()).streaming()
+                        .to("log:entry")
+                        .convertBodyTo(String.class).to("mock:processZipEntry")
+                    .end()
+                    .log("Done processing big file: ${header.CamelFileName}");
             }
         };
 

http://git-wip-us.apache.org/repos/asf/camel/blob/43704eb7/components/camel-zipfile/src/test/resources/data.zip
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/test/resources/data.zip 
b/components/camel-zipfile/src/test/resources/data.zip
new file mode 100644
index 0000000..fa6e598
Binary files /dev/null and 
b/components/camel-zipfile/src/test/resources/data.zip differ

http://git-wip-us.apache.org/repos/asf/camel/blob/43704eb7/components/camel-zipfile/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/test/resources/log4j.properties 
b/components/camel-zipfile/src/test/resources/log4j.properties
index 0a720b7..13093d4 100644
--- a/components/camel-zipfile/src/test/resources/log4j.properties
+++ b/components/camel-zipfile/src/test/resources/log4j.properties
@@ -1,32 +1,34 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
+## ------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ------------------------------------------------------------------------
 
 #
-# The logging properties used
+# The logging properties used for testing.
 #
 log4j.rootLogger=INFO, file
 
+#
+# uncomment the following line to enable debugging of Camel
 #log4j.logger.org.apache.camel=DEBUG
-#log4j.logger.org.apache.camel.dataformat.zipfile=DEBUG
 
 # CONSOLE appender not used by default
 log4j.appender.out=org.apache.log4j.ConsoleAppender
 log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=[%t] %c{1} %-5p %m%n
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
 
 # File appender
 log4j.appender.file=org.apache.log4j.FileAppender

Reply via email to