This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 4c7d2c256fa [CAMEL-17983]add tests in camel-zipfile-starter (#532)
4c7d2c256fa is described below

commit 4c7d2c256fa32536b7ebd6f55c9b1f8a0fa982e3
Author: Freeman(Yue) Fang <[email protected]>
AuthorDate: Wed Apr 20 03:49:40 2022 -0400

    [CAMEL-17983]add tests in camel-zipfile-starter (#532)
---
 .../AggregationStrategyWithFilenameHeaderTest.java | 136 +++++++
 .../AggregationStrategyWithPreservationTest.java   | 143 +++++++
 .../ZipAggregationStrategyEmptyFileTest.java       | 138 +++++++
 .../springboot/ZipAggregationStrategyTest.java     | 131 +++++++
 .../zipfile/springboot/ZipFileDataFormatTest.java  | 434 +++++++++++++++++++++
 .../springboot/ZipFileIteratorDataFormatTest.java  | 118 ++++++
 .../ZipFileMultipleFilesSplitterTest.java          | 132 +++++++
 .../springboot/ZipFileSplitAndDeleteTest.java      | 153 ++++++++
 .../ZipFileSplitIteratorCorruptTest.java           | 106 +++++
 .../springboot/ZipFileSplitOneFileTest.java        | 142 +++++++
 .../springboot/ZipSplitterRouteIssueTest.java      | 125 ++++++
 .../zipfile/springboot/ZipSplitterRouteTest.java   | 100 +++++
 .../src/test/resources/corrupt.zip                 |   1 +
 .../src/test/resources/data.zip                    | Bin 0 -> 540 bytes
 .../src/test/resources/hello.odt                   | Bin 0 -> 8039 bytes
 .../src/test/resources/log4j2.properties           |  28 ++
 .../camel/aggregate/zipfile/data/another/hello.txt |   1 +
 .../apache/camel/aggregate/zipfile/data/chiau.txt  |   1 +
 .../org/apache/camel/aggregate/zipfile/data/hi.txt |   1 +
 .../apache/camel/aggregate/zipfile/data/hola.txt   |   1 +
 .../aggregate/zipfile/data/other/greetings.txt     |   1 +
 .../zipfile/SpringZipSplitterRouteTest.xml         |  45 +++
 .../camel/dataformat/zipfile/data/resources.zip    | Bin 0 -> 1051 bytes
 23 files changed, 1937 insertions(+)

diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/AggregationStrategyWithFilenameHeaderTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/AggregationStrategyWithFilenameHeaderTest.java
new file mode 100644
index 00000000000..793c5e14e52
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/AggregationStrategyWithFilenameHeaderTest.java
@@ -0,0 +1,136 @@
+/*
+ * 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.springboot;
+
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.aggregate.zipfile.ZipAggregationStrategy;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.junit5.TestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.util.IOHelper;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        AggregationStrategyWithFilenameHeaderTest.class,
+        AggregationStrategyWithFilenameHeaderTest.TestConfiguration.class
+    }
+)
+public class AggregationStrategyWithFilenameHeaderTest {
+
+    private static final List<String> FILE_NAMES = Arrays.asList("foo", "bar");
+    private static final String TEST_DIR = 
"target/out_AggregationStrategyWithFilenameHeaderTest";
+
+    @Autowired
+    ProducerTemplate template;
+    
+    @EndpointInject("mock:aggregateToZipEntry")
+    MockEndpoint mock;
+    
+    @BeforeEach
+    public void setUp() throws Exception {
+        TestSupport.deleteDirectory(TEST_DIR);
+    }
+
+    @Test
+    public void testSplitter() throws Exception {
+        
+        mock.expectedMessageCount(1);
+
+        template.setDefaultEndpointUri("direct:start");
+        template.sendBodyAndHeader("foo", Exchange.FILE_NAME, 
FILE_NAMES.get(0));
+        template.sendBodyAndHeader("bar", Exchange.FILE_NAME, 
FILE_NAMES.get(1));
+        mock.assertIsSatisfied();
+
+        File[] files = new File(TEST_DIR).listFiles();
+        assertNotNull(files);
+        assertTrue(files.length > 0, "Should be a file in " + TEST_DIR + " 
directory");
+
+        File resultFile = files[0];
+
+        final ZipFile file = new ZipFile(resultFile);
+        try {
+            final Enumeration<? extends ZipEntry> entries = file.entries();
+            int fileCount = 0;
+            while (entries.hasMoreElements()) {
+                fileCount++;
+                final ZipEntry entry = entries.nextElement();
+                assertTrue(FILE_NAMES.contains(entry.getName()), "Zip entry 
file name should be on of: " + FILE_NAMES);
+            }
+            assertEquals(FILE_NAMES.size(), fileCount, "Zip file should 
contain " + FILE_NAMES.size() + " files");
+        } finally {
+            IOHelper.close(file);
+        }
+    }
+    
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    from("direct:start")
+                            .aggregate(new ZipAggregationStrategy(false, true))
+                            .constant(true)
+                            .completionTimeout(50)
+                            .to("file:" + TEST_DIR)
+                            .to("mock:aggregateToZipEntry")
+                            .log("Done processing zip file: 
${header.CamelFileName}");
+                }
+            };
+        }
+    }
+    
+   
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/AggregationStrategyWithPreservationTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/AggregationStrategyWithPreservationTest.java
new file mode 100644
index 00000000000..fa025048397
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/AggregationStrategyWithPreservationTest.java
@@ -0,0 +1,143 @@
+/*
+ * 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.springboot;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.aggregate.zipfile.ZipAggregationStrategy;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.junit5.TestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.util.IOHelper;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        AggregationStrategyWithPreservationTest.class,
+        AggregationStrategyWithPreservationTest.TestConfiguration.class
+    }
+)
+public class AggregationStrategyWithPreservationTest {
+
+    private static final int EXPECTED_NO_FILES = 5;
+    private static final String TEST_DIR = 
"target/out_AggregationStrategyWithPreservationTest";
+
+    @Autowired
+    ProducerTemplate template;
+    
+    @EndpointInject("mock:aggregateToZipEntry")
+    MockEndpoint mock;
+    
+    @BeforeEach
+    public void setUp() throws Exception {
+        TestSupport.deleteDirectory(TEST_DIR);
+    }
+
+    @Test
+    public void testSplitter() throws Exception {
+        
+        mock.expectedMessageCount(1);
+        mock.assertIsSatisfied();
+
+        File[] files = new File(TEST_DIR).listFiles();
+        assertNotNull(files);
+        assertTrue(files.length > 0, "Should be a file in " + TEST_DIR + " 
directory");
+
+        File resultFile = files[0];
+        Set<String> expectedZipFiles = new HashSet<>(
+                Arrays.asList("another/hello.txt",
+                        "other/greetings.txt",
+                        "chiau.txt", "hi.txt", "hola.txt"));
+        ZipInputStream zin = new ZipInputStream(new 
FileInputStream(resultFile));
+        try {
+            int fileCount = 0;
+            for (ZipEntry ze = zin.getNextEntry(); ze != null; ze = 
zin.getNextEntry()) {
+                if (!ze.isDirectory()) {
+                    assertTrue(expectedZipFiles.remove(ze.toString()), "Found 
unexpected entry " + ze + " in zipfile");
+                    fileCount++;
+                }
+            }
+
+            
assertEquals(AggregationStrategyWithPreservationTest.EXPECTED_NO_FILES, 
fileCount,
+                    String.format("Zip file should contains %d files, got %d 
files",
+                            
AggregationStrategyWithPreservationTest.EXPECTED_NO_FILES, fileCount));
+            assertEquals(0, expectedZipFiles.size(),
+                    "Should have found all of the zip files in the file. 
Remaining: " + expectedZipFiles);
+        } finally {
+            IOHelper.close(zin);
+        }
+    }
+
+    
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    // Unzip file and Split it according to FileEntry
+                    
from("file:src/test/resources/org/apache/camel/aggregate/zipfile/data?delay=1000&noop=true&recursive=true")
+                            .aggregate(new ZipAggregationStrategy(true, true))
+                            .constant(true)
+                            .completionFromBatchConsumer()
+                            .eagerCheckCompletion()
+                            .to("file:" + TEST_DIR)
+                            .to("mock:aggregateToZipEntry")
+                            .log("Done processing zip file: 
${header.CamelFileName}");
+                }
+            };
+        }
+    }
+    
+   
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipAggregationStrategyEmptyFileTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipAggregationStrategyEmptyFileTest.java
new file mode 100644
index 00000000000..bf8ec623a71
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipAggregationStrategyEmptyFileTest.java
@@ -0,0 +1,138 @@
+/*
+ * 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.springboot;
+
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.aggregate.zipfile.ZipAggregationStrategy;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.junit5.TestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.util.IOHelper;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipAggregationStrategyEmptyFileTest.class,
+        ZipAggregationStrategyEmptyFileTest.TestConfiguration.class
+    }
+)
+public class ZipAggregationStrategyEmptyFileTest {
+
+    private static final int EXPECTED_NO_FILES = 3;
+    private static final String TEST_DIR = 
"target/out_ZipAggregationStrategyEmptyFileTest";
+
+    @Autowired
+    ProducerTemplate template;
+    
+    @EndpointInject("mock:aggregateToZipEntry")
+    MockEndpoint mock;
+    
+    @BeforeEach
+    public void setUp() throws Exception {
+        TestSupport.deleteDirectory("target/foo");
+        TestSupport.deleteDirectory(TEST_DIR);
+    }
+
+    @Test
+    public void testEmptyFile() throws Exception {
+        
+        mock.expectedMessageCount(1);
+
+        template.sendBody("file:target/foo", "Hello");
+        // empty file which is not aggregated
+        template.sendBody("file:target/foo", "");
+        template.sendBody("file:target/foo", "Bye");
+        template.sendBody("file:target/foo", "Howdy");
+
+        mock.assertIsSatisfied();
+
+        File[] files = new File(TEST_DIR).listFiles();
+        assertNotNull(files);
+        assertTrue(files.length > 0, "Should be a file in " + TEST_DIR + " 
directory");
+
+        File resultFile = files[0];
+
+        ZipInputStream zin = new ZipInputStream(new 
FileInputStream(resultFile));
+        try {
+            int fileCount = 0;
+            for (ZipEntry ze = zin.getNextEntry(); ze != null; ze = 
zin.getNextEntry()) {
+                fileCount++;
+            }
+            
assertEquals(ZipAggregationStrategyEmptyFileTest.EXPECTED_NO_FILES, fileCount,
+                    "Zip file should contains " + 
ZipAggregationStrategyEmptyFileTest.EXPECTED_NO_FILES + " files");
+        } finally {
+            IOHelper.close(zin);
+        }
+    }
+
+    
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    from("file:target/foo")
+                            .aggregate(new ZipAggregationStrategy())
+                            .constant(true)
+                            .completionSize(4)
+                            .eagerCheckCompletion()
+                            .to("file:" + TEST_DIR)
+                            .to("mock:aggregateToZipEntry")
+                            .log("Done processing zip file: 
${header.CamelFileName}");
+                }
+            };
+        }
+    }
+    
+   
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipAggregationStrategyTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipAggregationStrategyTest.java
new file mode 100644
index 00000000000..f92e56ad936
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipAggregationStrategyTest.java
@@ -0,0 +1,131 @@
+/*
+ * 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.springboot;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.aggregate.zipfile.ZipAggregationStrategy;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.junit5.TestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.util.IOHelper;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipAggregationStrategyTest.class,
+        ZipAggregationStrategyTest.TestConfiguration.class
+    }
+)
+public class ZipAggregationStrategyTest {
+
+    private static final int EXPECTED_NO_FILES = 3;
+    private static final String TEST_DIR = 
"target/out_ZipAggregationStrategyTest";
+    
+    @Autowired
+    ProducerTemplate template;
+    
+    @EndpointInject("mock:aggregateToZipEntry")
+    MockEndpoint mock;
+    
+    @BeforeEach
+    public void setUp() throws Exception {
+        TestSupport.deleteDirectory(TEST_DIR);
+    }
+
+    @Test
+    public void testSplitter() throws Exception {
+        
+        mock.expectedMessageCount(1);
+        mock.expectedHeaderReceived("foo", "bar");
+
+        mock.assertIsSatisfied();
+
+        File[] files = new File(TEST_DIR).listFiles();
+        assertNotNull(files);
+        assertTrue(files.length > 0, "Should be a file in " + TEST_DIR + " 
directory");
+
+        File resultFile = files[0];
+
+        ZipInputStream zin = new ZipInputStream(new 
FileInputStream(resultFile));
+        try {
+            int fileCount = 0;
+            for (ZipEntry ze = zin.getNextEntry(); ze != null; ze = 
zin.getNextEntry()) {
+                fileCount++;
+            }
+            assertEquals(ZipAggregationStrategyTest.EXPECTED_NO_FILES, 
fileCount,
+                    "Zip file should contains " + 
ZipAggregationStrategyTest.EXPECTED_NO_FILES + " files");
+        } finally {
+            IOHelper.close(zin);
+        }
+    }
+    
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    // Unzip file and Split it according to FileEntry
+                    
from("file:src/test/resources/org/apache/camel/aggregate/zipfile/data?delay=1000&noop=true")
+                            .setHeader("foo", constant("bar"))
+                            .aggregate(new ZipAggregationStrategy())
+                            .constant(true)
+                            .completionFromBatchConsumer()
+                            .eagerCheckCompletion()
+                            .to("file:" + TEST_DIR)
+                            .to("mock:aggregateToZipEntry")
+                            .log("Done processing zip file: 
${header.CamelFileName}");
+                }
+            };
+        }
+    }
+    
+   
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatTest.java
new file mode 100644
index 00000000000..3d13d49ee62
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatTest.java
@@ -0,0 +1,434 @@
+/*
+ * 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.springboot;
+
+
+import static org.apache.camel.Exchange.FILE_NAME;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.apache.camel.test.junit5.TestSupport.deleteDirectory;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.converter.stream.InputStreamCache;
+import org.apache.camel.dataformat.zipfile.ZipFileDataFormat;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.apache.camel.util.IOHelper;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipFileDataFormatTest.class,
+        ZipFileDataFormatTest.TestConfiguration.class
+    }
+)
+public class ZipFileDataFormatTest {
+
+    
+    private static final String TEXT = "The Masque of Queen Bersabe (excerpt) 
\n"
+        + "by: Algernon Charles Swinburne \n\n"
+        + "My lips kissed dumb the word of Ah \n"
+        + "Sighed on strange lips grown sick thereby. \n"
+        + "God wrought to me my royal bed; \n"
+        + "The inner work thereof was red, \n"
+        + "The outer work was ivory. \n"
+        + "My mouth's heat was the heat of flame \n"
+        + "For lust towards the kings that came \n"
+        + "With horsemen riding royally.";
+
+    private static final File TEST_DIR = new File("target/zip");
+
+    private static ZipFileDataFormat zip;
+    
+    @Autowired
+    ProducerTemplate template;
+    
+    @Autowired
+    CamelContext context;
+    
+   
+    
+    @EndpointInject("mock:zipStreamCache")
+    MockEndpoint mockZipStreamCache;
+    
+    @EndpointInject("mock:zip")
+    MockEndpoint mockZip;
+    
+    
+    @Test
+    public void testZipAndStreamCaching() throws Exception {
+        
+        mockZipStreamCache.setExpectedMessageCount(1);
+
+        template.sendBody("direct:zipStreamCache", TEXT);
+
+        mockZipStreamCache.assertIsSatisfied();
+
+        Exchange exchange = mockZipStreamCache.getReceivedExchanges().get(0);
+        assertEquals(exchange.getIn().getMessageId() + ".zip", 
exchange.getIn().getHeader(FILE_NAME));
+        assertIsInstanceOf(InputStreamCache.class, exchange.getIn().getBody());
+        assertArrayEquals(getZippedText(exchange.getIn().getMessageId()), 
exchange.getIn().getMandatoryBody(byte[].class));
+    }
+
+    @Test
+    public void testZipWithoutFileName() throws Exception {
+        mockZip.reset();
+        mockZip.expectedMessageCount(1);
+
+        template.sendBody("direct:zip", TEXT);
+
+        mockZip.assertIsSatisfied();
+
+        Exchange exchange = mockZip.getReceivedExchanges().get(0);
+        assertEquals(exchange.getIn().getMessageId() + ".zip", 
exchange.getIn().getHeader(FILE_NAME));
+        assertArrayEquals(getZippedText(exchange.getIn().getMessageId()), 
(byte[]) exchange.getIn().getBody());
+    }
+
+    @Test
+    public void testZipWithFileName() throws Exception {
+        mockZip.reset();
+        mockZip.expectedBodiesReceived(getZippedText("poem.txt"));
+        mockZip.expectedHeaderReceived(FILE_NAME, "poem.txt.zip");
+
+        template.sendBodyAndHeader("direct:zip", TEXT, FILE_NAME, "poem.txt");
+
+        mockZip.assertIsSatisfied();
+    }
+
+    @Test
+    public void testZipWithPathElements() throws Exception {
+        mockZip.reset();
+        mockZip.expectedBodiesReceived(getZippedText("poem.txt"));
+        mockZip.expectedHeaderReceived(FILE_NAME, "poem.txt.zip");
+
+        template.sendBodyAndHeader("direct:zip", TEXT, FILE_NAME, 
"poems/poem.txt");
+
+        mockZip.assertIsSatisfied();
+    }
+
+    @Test
+    public void testZipWithPreservedPathElements() throws Exception {
+        mockZip.reset();
+        zip.setPreservePathElements(true);
+
+        mockZip.expectedBodiesReceived(getZippedTextInFolder("poems/", 
"poems/poem.txt"));
+        mockZip.expectedHeaderReceived(FILE_NAME, "poem.txt.zip");
+
+        template.sendBodyAndHeader("direct:zip", TEXT, FILE_NAME, 
"poems/poem.txt");
+
+        mockZip.assertIsSatisfied();
+    }
+
+    @EndpointInject("mock:unzip")
+    MockEndpoint mockUnzip;
+    
+    @Test
+    public void testUnzip() throws Exception {
+        mockUnzip.expectedBodiesReceived(TEXT);
+        mockUnzip.expectedHeaderReceived(FILE_NAME, "file");
+
+        template.sendBody("direct:unzip", getZippedText("file"));
+
+        mockUnzip.assertIsSatisfied();
+    }
+
+    @Test
+    public void testUnzipWithEmptyDirectorySupported() {
+        deleteDirectory(new File("hello_out"));
+        zip.setUsingIterator(true);
+        zip.setAllowEmptyDirectory(true);
+        template.sendBody("direct:unzipWithEmptyDirectory", new 
File("src/test/resources/hello.odt"));
+        assertTrue(Files.exists(Paths.get("hello_out/Configurations2")));
+        deleteDirectory(new File("hello_out"));
+    }
+
+    @Test
+    public void testUnzipWithEmptyDirectoryUnsupported() {
+        deleteDirectory(new File("hello_out"));
+        zip.setUsingIterator(true);
+        zip.setAllowEmptyDirectory(false);
+        template.sendBody("direct:unzipWithEmptyDirectory", new 
File("src/test/resources/hello.odt"));
+        assertTrue(!Files.exists(Paths.get("hello_out/Configurations2")));
+        deleteDirectory(new File("hello_out"));
+    }
+
+    @Test
+    public void testUnzipWithCorruptedZipFile() {
+        deleteDirectory(new File("hello_out"));
+
+        assertThrows(CamelExecutionException.class,
+                () -> template.sendBody("direct:corruptUnzip", new 
File("src/test/resources/corrupt.zip")));
+    }
+
+    @EndpointInject("mock:zipAndUnzip")
+    MockEndpoint mockZipAndUnzip;
+    @Test
+    public void testZipAndUnzip() throws Exception {
+        mockZipAndUnzip.expectedMessageCount(1);
+
+        template.sendBody("direct:zipAndUnzip", TEXT);
+
+        mockZipAndUnzip.assertIsSatisfied();
+
+        Exchange exchange = mockZipAndUnzip.getReceivedExchanges().get(0);
+        assertEquals(exchange.getIn().getMessageId(), 
exchange.getIn().getHeader(FILE_NAME));
+        assertEquals(TEXT, new String((byte[]) exchange.getIn().getBody(), 
"UTF-8"));
+    }
+
+    @EndpointInject("mock:intercepted")
+    MockEndpoint mockIntercepted;
+    @Test
+    public void testZipToFileWithoutFileName() throws Exception {
+        mockIntercepted.reset();
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
+
+        String[] files = TEST_DIR.list();
+        assertTrue(files == null || files.length == 0);
+
+        
+        mockIntercepted.expectedMessageCount(1);
+
+        template.sendBody("direct:zipToFile", TEXT);
+
+        mockIntercepted.assertIsSatisfied();
+
+        // use builder to ensure the exchange is fully done before we check 
for file exists
+        assertTrue(notify.matches(5, TimeUnit.SECONDS), "The exchange is not 
done in time.");
+
+        Exchange exchange = mockIntercepted.getReceivedExchanges().get(0);
+        File file = new File(TEST_DIR, exchange.getIn().getMessageId() + 
".zip");
+        assertTrue(file.exists(), "The file should exist.");
+        assertArrayEquals(getZippedText(exchange.getIn().getMessageId()), 
getBytes(file), "Get a wrong message content.");
+    }
+
+    @EndpointInject("mock:zipToFile")
+    MockEndpoint mockZipToFile;
+    @Test
+    public void testZipToFileWithFileName() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
+
+        
+        mockZipToFile.expectedMessageCount(1);
+
+        File file = new File(TEST_DIR, "poem.txt.zip");
+        assertFalse(file.exists(), "The zip should not exit.");
+
+        template.sendBodyAndHeader("direct:zipToFile", TEXT, FILE_NAME, 
"poem.txt");
+
+        // just make sure the file is created
+        mockZipToFile.assertIsSatisfied();
+
+        // use builder to ensure the exchange is fully done before we check 
for file exists
+        assertTrue(notify.matches(5, TimeUnit.SECONDS), "The exchange is not 
done in time.");
+
+        assertTrue(file.exists(), "The file should exist.");
+        assertArrayEquals(getZippedText("poem.txt"), getBytes(file), "Get a 
wrong message content.");
+    }
+
+    @EndpointInject("mock:dslZip")
+    MockEndpoint mockDslZip;
+    @Test
+    public void testDslZip() throws Exception {
+        mockDslZip.expectedBodiesReceived(getZippedText("poem.txt"));
+        mockDslZip.expectedHeaderReceived(FILE_NAME, "poem.txt.zip");
+
+        template.sendBodyAndHeader("direct:dslZip", TEXT, FILE_NAME, 
"poem.txt");
+
+        mockDslZip.assertIsSatisfied();
+    }
+
+    @EndpointInject("mock:dslUnzip")
+    MockEndpoint mockDslUnzip;
+    @Test
+    public void testDslUnzip() throws Exception {
+        mockDslUnzip.expectedBodiesReceived(TEXT);
+        mockDslUnzip.expectedHeaderReceived(FILE_NAME, "test.txt");
+
+        template.sendBody("direct:dslUnzip", getZippedText("test.txt"));
+
+        mockDslUnzip.assertIsSatisfied();
+    }
+
+    @Test
+    public void testUnzipMaxDecompressedSize() {
+        // We are only allowing 10 bytes to be decompressed, so we expect an 
error
+        assertThrows(CamelExecutionException.class,
+                () -> template.sendBody("direct:unzipMaxDecompressedSize", 
getZippedText("file")));
+    }
+
+    @BeforeEach
+    public void setUp() throws Exception {
+        deleteDirectory(TEST_DIR);
+    }
+
+    private static void copy(InputStream in, OutputStream out) throws 
IOException {
+        byte[] buffer = new byte[1024];
+        while (true) {
+            int readCount = in.read(buffer);
+            if (readCount < 0) {
+                break;
+            }
+            out.write(buffer, 0, readCount);
+        }
+    }
+
+   
+
+    private static void copy(InputStream in, File file) throws IOException {
+        try (OutputStream out = new FileOutputStream(file)) {
+            copy(in, out);
+        }
+    }
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    interceptSendToEndpoint("file:*").to("mock:intercepted");
+
+                    zip = new ZipFileDataFormat();
+
+                    from("direct:zip").marshal(zip).to("mock:zip");
+                    from("direct:unzip").unmarshal(zip).to("mock:unzip");
+                    from("direct:unzipWithEmptyDirectory").unmarshal(zip)
+                            .split(bodyAs(Iterator.class))
+                            .streaming()
+                            //.to("file:hello_out?autoCreate=true")
+                            .process(new Processor() {
+                                @Override
+                                public void process(Exchange exchange) throws 
Exception {
+                                    ZipFile zfile = new ZipFile(new 
File("src/test/resources/hello.odt"));
+                                    ZipEntry entry = new ZipEntry((String) 
exchange.getIn().getHeader(Exchange.FILE_NAME));
+                                    File file = new File("hello_out", 
entry.getName());
+                                    if (entry.isDirectory()) {
+                                        file.mkdirs();
+                                    } else {
+                                        file.getParentFile().mkdirs();
+                                        InputStream in = 
zfile.getInputStream(entry);
+                                        try {
+                                            copy(in, file);
+                                        } finally {
+                                            in.close();
+                                        }
+                                    }
+                                }
+                            })
+                            .end();
+                    
from("direct:zipAndUnzip").marshal(zip).unmarshal(zip).to("mock:zipAndUnzip");
+                    from("direct:zipToFile").marshal(zip).to("file:" + 
TEST_DIR.getPath()).to("mock:zipToFile");
+                    
from("direct:dslZip").marshal().zipFile().to("mock:dslZip");
+                    
from("direct:dslUnzip").unmarshal().zipFile().to("mock:dslUnzip");
+                    
from("direct:corruptUnzip").unmarshal().zipFile().to("mock:corruptUnzip");
+                    
from("direct:zipStreamCache").streamCaching().marshal().zipFile().to("mock:zipStreamCache");
+
+                    ZipFileDataFormat maxDecompressedSizeZip = new 
ZipFileDataFormat();
+                    // Only allow 10 bytes to be decompressed
+                    maxDecompressedSizeZip.setMaxDecompressedSize(10L);
+                    
from("direct:unzipMaxDecompressedSize").unmarshal(maxDecompressedSizeZip).to("mock:unzip");
+                }
+            };
+        }
+    }
+    
+    private static byte[] getZippedText(String entryName) throws IOException {
+        ByteArrayInputStream bais = new 
ByteArrayInputStream(TEXT.getBytes("UTF-8"));
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ZipOutputStream zos = new ZipOutputStream(baos);
+        try {
+            zos.putNextEntry(new ZipEntry(entryName));
+            IOHelper.copy(bais, zos);
+        } finally {
+            IOHelper.close(bais, zos);
+        }
+        return baos.toByteArray();
+    }
+
+    private static byte[] getZippedTextInFolder(String folder, String file) 
throws IOException {
+        ByteArrayInputStream bais = new 
ByteArrayInputStream(TEXT.getBytes("UTF-8"));
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ZipOutputStream zos = new ZipOutputStream(baos);
+        try {
+            zos.putNextEntry(new ZipEntry(folder));
+            zos.putNextEntry(new ZipEntry(file));
+            IOHelper.copy(bais, zos);
+        } finally {
+            IOHelper.close(bais, zos);
+        }
+        return baos.toByteArray();
+    }
+
+    private static byte[] getBytes(File file) throws IOException {
+        FileInputStream fis = new FileInputStream(file);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try {
+            IOHelper.copy(fis, baos);
+        } finally {
+            IOHelper.close(fis, baos);
+        }
+        return baos.toByteArray();
+    }
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileIteratorDataFormatTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileIteratorDataFormatTest.java
new file mode 100644
index 00000000000..72087c04443
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileIteratorDataFormatTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.springboot;
+
+
+import java.io.File;
+import java.util.stream.Stream;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.Test;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipFileIteratorDataFormatTest.class,
+        ZipFileIteratorDataFormatTest.TestConfiguration.class
+    }
+)
+public class ZipFileIteratorDataFormatTest {
+
+    
+    @Autowired
+    ProducerTemplate template;
+    
+    @Autowired
+    CamelContext context;
+    
+   
+    
+    @EndpointInject("mock:result")
+    MockEndpoint mockResult;
+    
+    @EndpointInject("mock:unzip")
+    MockEndpoint mockUnzip;
+    
+    
+    @Test
+    public void testZipFileIterator() throws Exception {
+        mockResult.expectedMessageCount(1);
+
+        Stream body = Stream.of("ABC", "DEF", "1234567890");
+        template.sendBody("direct:zip", body);
+
+        mockResult.assertIsSatisfied();
+
+        mockResult.reset();
+
+        // unzip the file
+        mockUnzip.expectedBodiesReceived("ABCDEF1234567890");
+
+        File file = new File("target/output/report.txt.zip");
+        template.sendBody("direct:unzip", file);
+
+        mockUnzip.assertIsSatisfied();
+    }
+
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    from("direct:zip")
+                            .setHeader(Exchange.FILE_NAME, 
constant("report.txt"))
+                            .marshal().zipFile()
+                            .to("file:target/output")
+                            .to("mock:result");
+
+                    from("direct:unzip")
+                            .unmarshal().zipFile()
+                            .to("mock:unzip");
+                }
+            };
+        }
+    }
+    
+  
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileMultipleFilesSplitterTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileMultipleFilesSplitterTest.java
new file mode 100644
index 00000000000..ac7370a9bb9
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileMultipleFilesSplitterTest.java
@@ -0,0 +1,132 @@
+/*
+ * 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.springboot;
+
+
+import java.util.Iterator;
+
+import org.apache.camel.AggregationStrategy;
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.zipfile.ZipFileDataFormat;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.Test;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipFileMultipleFilesSplitterTest.class,
+        ZipFileMultipleFilesSplitterTest.TestConfiguration.class
+    }
+)
+public class ZipFileMultipleFilesSplitterTest extends ZipSplitterRouteTest {
+
+    static final String PROCESSED_FILES_HEADER_NAME = "processedFiles";
+    
+    @Autowired
+    ProducerTemplate template;
+    
+    @Autowired
+    CamelContext context;
+    
+   
+    
+    @EndpointInject("mock:splitResult")
+    MockEndpoint splitResult;
+    
+    
+    @Override
+    @Test
+    public void testSplitter() throws InterruptedException {
+        processZipEntry.expectedBodiesReceivedInAnyOrder("chau", "hi", "hola", 
"another_chiau", "another_hi");
+        splitResult.expectedBodiesReceivedInAnyOrder("chiau.txt", "hi.txt", 
"hola.txt", "directoryOne/another_chiau.txt",
+                "directoryOne/another_hi.txt");
+        processZipEntry.assertIsSatisfied();
+        splitResult.assertIsSatisfied();
+    }
+
+
+    
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    // Unzip file and Split it according to FileEntry
+                    ZipFileDataFormat zipFile = new ZipFileDataFormat();
+                    zipFile.setUsingIterator(true);
+                    
from("file:src/test/resources/org/apache/camel/dataformat/zipfile/data/?delay=1000&noop=true")
+                            .unmarshal(zipFile)
+                            .split(bodyAs(Iterator.class))
+                            .streaming()
+                            .aggregationStrategy(updateHeader())
+                            .convertBodyTo(String.class)
+                            .to("mock:processZipEntry")
+                            .end()
+                            .log("Done processing big file: 
${header.CamelFileName}")
+                            .setBody().header(PROCESSED_FILES_HEADER_NAME)
+                            .split().body()
+                            .to("mock:splitResult");
+                }
+                
+                private AggregationStrategy updateHeader() {
+                    return new AggregationStrategy() {
+                        @Override
+                        public Exchange aggregate(Exchange oldExchange, 
Exchange newExchange) {
+                            if (oldExchange != null) {
+                                String processedFiles = 
oldExchange.getIn().getHeader(PROCESSED_FILES_HEADER_NAME, String.class);
+                                if (processedFiles == null) {
+                                    processedFiles = 
oldExchange.getIn().getHeader("zipFileName", String.class);
+                                }
+                                processedFiles = processedFiles + "," + 
newExchange.getIn().getHeader("zipFileName", String.class);
+                                
newExchange.getIn().setHeader(PROCESSED_FILES_HEADER_NAME, processedFiles);
+                            }
+                            return newExchange;
+                        }
+
+                    };
+                }
+            };
+        }
+    }
+    
+    
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileSplitAndDeleteTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileSplitAndDeleteTest.java
new file mode 100644
index 00000000000..7e50e4ba935
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileSplitAndDeleteTest.java
@@ -0,0 +1,153 @@
+/*
+ * 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.springboot;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.Iterator;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.zipfile.ZipFileDataFormat;
+import org.apache.camel.dataformat.zipfile.ZipSplitter;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.junit5.TestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipFileSplitAndDeleteTest.class,
+        ZipFileSplitAndDeleteTest.TestConfiguration.class
+    }
+)
+public class ZipFileSplitAndDeleteTest {
+
+    
+    @Autowired
+    ProducerTemplate template;
+    
+    @Autowired
+    CamelContext context;
+    
+   
+    
+    @EndpointInject("mock:end")
+    MockEndpoint mockEnd;
+    
+    
+    @BeforeEach
+    public void setUp() throws Exception {
+        
TestSupport.deleteDirectory("target/testDeleteZipFileWhenUnmarshalWithDataFormat");
+        
TestSupport.deleteDirectory("target/testDeleteZipFileWhenUnmarshalWithSplitter");
+        
+    }
+
+    @Test
+    public void testDeleteZipFileWhenUnmarshalWithDataFormat() throws 
Exception {
+        NotifyBuilder notify = new NotifyBuilder(context)
+                .from("file://target/" + 
"testDeleteZipFileWhenUnmarshalWithDataFormat").whenDone(1).create();
+        mockEnd.expectedMessageCount(2);
+        String zipFile = 
createZipFile("testDeleteZipFileWhenUnmarshalWithDataFormat");
+
+        mockEnd.assertIsSatisfied();
+
+        notify.matchesWaitTime();
+
+        // the original file should have been deleted
+        assertFalse(new File(zipFile).exists(), "File should been deleted");
+    }
+
+    @Test
+    public void testDeleteZipFileWhenUnmarshalWithSplitter() throws Exception {
+        NotifyBuilder notify = new 
NotifyBuilder(context).from("file://target/" + 
"testDeleteZipFileWhenUnmarshalWithSplitter")
+                .whenDone(1).create();
+        mockEnd.expectedMessageCount(2);
+        String zipFile = 
createZipFile("testDeleteZipFileWhenUnmarshalWithSplitter");
+
+        mockEnd.assertIsSatisfied();
+
+        notify.matchesWaitTime();
+
+        // the original file should have been deleted,
+        assertFalse(new File(zipFile).exists(), "File should been deleted");
+    }
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    ZipFileDataFormat dataFormat = new ZipFileDataFormat();
+                    dataFormat.setUsingIterator(true);
+
+                    
from("file://target/testDeleteZipFileWhenUnmarshalWithDataFormat?delay=10&delete=true")
+                            .unmarshal(dataFormat)
+                            .split(bodyAs(Iterator.class)).streaming()
+                            .convertBodyTo(String.class)
+                            .to("mock:end")
+                            .end();
+
+                    
from("file://target/testDeleteZipFileWhenUnmarshalWithSplitter?delay=10&delete=true")
+                            .split(new ZipSplitter()).streaming()
+                            .convertBodyTo(String.class)
+                            .to("mock:end")
+                            .end();
+                }
+            };
+        }
+    }
+    
+    private String createZipFile(String folder) throws IOException {
+        Path source = Paths.get("src/test/resources/data.zip");
+        Path target = Paths.get("target" + File.separator + folder + 
File.separator + "data.zip");
+        target.toFile().getParentFile().mkdirs();
+        Path copy = Files.copy(source, target, 
StandardCopyOption.REPLACE_EXISTING);
+        return copy.toAbsolutePath().toString();
+    }
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileSplitIteratorCorruptTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileSplitIteratorCorruptTest.java
new file mode 100644
index 00000000000..5bb15ccde8c
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileSplitIteratorCorruptTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.springboot;
+
+import java.util.Iterator;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.zipfile.ZipFileDataFormat;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.Test;
+
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipFileSplitIteratorCorruptTest.class,
+        ZipFileSplitIteratorCorruptTest.TestConfiguration.class
+    }
+)
+public class ZipFileSplitIteratorCorruptTest {
+
+    
+    @Autowired
+    ProducerTemplate template;
+    
+    @EndpointInject("mock:dead")
+    MockEndpoint mockDead;
+    
+    @EndpointInject("mock:end")
+    MockEndpoint mockEnd;
+    
+    
+    @Test
+    public void testZipFileUnmarshal() throws Exception {
+        mockDead.expectedMessageCount(1);
+        mockDead.message(0).exchangeProperty(Exchange.EXCEPTION_CAUGHT)
+                .isInstanceOf(IllegalStateException.class);
+        mockEnd.expectedMessageCount(0);
+
+        mockDead.assertIsSatisfied();
+        mockEnd.assertIsSatisfied();
+    
+    }
+    
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    ZipFileDataFormat zf = new ZipFileDataFormat();
+                    zf.setUsingIterator(true);
+
+                    errorHandler(deadLetterChannel("mock:dead"));
+
+                    
from("file://src/test/resources?delay=10&fileName=corrupt.zip&noop=true")
+                            .unmarshal(zf)
+                            .split(bodyAs(Iterator.class)).streaming()
+                            .convertBodyTo(String.class)
+                            .to("mock:end")
+                            .end();
+                }
+            };
+        }
+    }
+    
+   
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileSplitOneFileTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileSplitOneFileTest.java
new file mode 100644
index 00000000000..849346534ec
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileSplitOneFileTest.java
@@ -0,0 +1,142 @@
+/*
+ * 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.springboot;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.zipfile.ZipFileDataFormat;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.junit5.TestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipFileSplitOneFileTest.class,
+        ZipFileSplitOneFileTest.TestConfiguration.class
+    }
+)
+public class ZipFileSplitOneFileTest {
+
+    
+    @Autowired
+    ProducerTemplate template;
+    
+    @Autowired
+    CamelContext context;
+    
+   
+    
+    @EndpointInject("mock:end")
+    MockEndpoint mockEnd;
+    
+    @EndpointInject("mock:input")
+    MockEndpoint mockInput;
+    
+    @BeforeEach
+    public void setUp() throws Exception {
+        TestSupport.deleteDirectory("target/zip-unmarshal");
+        
+    }
+
+    @Test
+    public void testZipFileUnmarshal() throws Exception {
+        mockInput.expectedHeaderReceived(Exchange.FILE_NAME_ONLY, "test.zip");
+        mockEnd.expectedBodiesReceived("Hello World");
+
+        createZipFile("Hello World");
+        mockEnd.assertIsSatisfied();
+        mockInput.assertIsSatisfied();
+    }
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    ZipFileDataFormat zf = new ZipFileDataFormat();
+                    zf.setUsingIterator(true);
+
+                    
from("file://target/zip-unmarshal?noop=true&include=.*zip").to("mock:input").unmarshal(zf)
+                        
.split(bodyAs(Iterator.class)).streaming().convertBodyTo(String.class).to("mock:end")
+                        .end();
+                }
+            };
+        }
+    }
+    
+    private void createZipFile(String content) throws IOException {
+        String basePath = "target" + File.separator + "zip-unmarshal" + 
File.separator;
+        File file = new File(basePath + "test.txt");
+        file.getParentFile().mkdirs();
+
+        try (FileWriter fw = new FileWriter(file);
+             FileOutputStream fos = new FileOutputStream(basePath + 
"test.zip");
+             ZipOutputStream zos = new ZipOutputStream(fos);
+             FileInputStream fis = new FileInputStream(basePath + "test.txt")) 
{
+
+            fw.write(content);
+            fw.close();
+
+            ZipEntry entry = new ZipEntry("test.txt");
+            zos.putNextEntry(entry);
+
+            int len;
+            byte[] buffer = new byte[1024];
+
+            while ((len = fis.read(buffer)) > 0) {
+                zos.write(buffer, 0, len);
+            }
+
+            zos.closeEntry();
+        }
+    }
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipSplitterRouteIssueTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipSplitterRouteIssueTest.java
new file mode 100644
index 00000000000..d3d9c5de1af
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipSplitterRouteIssueTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.springboot;
+
+
+
+import java.io.File;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.zipfile.ZipSplitter;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.junit5.TestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipSplitterRouteIssueTest.class,
+        ZipSplitterRouteIssueTest.TestConfiguration.class
+    }
+)
+public class ZipSplitterRouteIssueTest {
+
+    
+    @Autowired
+    ProducerTemplate template;
+    
+    @Autowired
+    CamelContext context;
+    
+   
+    
+    @EndpointInject("mock:entry")
+    MockEndpoint mockEntry;
+    
+    @EndpointInject("mock:errors")
+    MockEndpoint mockErrors;
+    
+    
+    @BeforeEach
+    public void setUp() throws Exception {
+        TestSupport.deleteDirectory("target/zip");
+              
+    }
+
+    @Test
+    public void testSplitter() throws Exception {
+        mockEntry.reset();
+        mockEntry.expectedMessageCount(2);
+
+        template.sendBody("direct:decompressFiles", new 
File("src/test/resources/data.zip"));
+
+        mockEntry.assertIsSatisfied();
+    }
+
+    @Test
+    public void testSplitterWithWrongFile() throws Exception {
+        mockEntry.reset();
+        mockEntry.expectedMessageCount(0);
+        mockErrors.expectedMessageCount(1);
+
+        //Send a file which is not exit
+        template.sendBody("direct:decompressFiles", new 
File("src/test/resources/data"));
+
+        mockEntry.assertIsSatisfied();
+        mockErrors.assertIsSatisfied();
+    }
+
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    errorHandler(deadLetterChannel("mock:errors"));
+
+                    from("direct:decompressFiles")
+                            .split(new 
ZipSplitter()).streaming().shareUnitOfWork()
+                            .to("log:entry")
+                            .to("mock:entry");
+                }
+            };
+        }
+    }
+    
+    
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipSplitterRouteTest.java
 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipSplitterRouteTest.java
new file mode 100644
index 00000000000..ab3efad44da
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/java/org/apache/camel/dataformat/zipfile/springboot/ZipSplitterRouteTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.springboot;
+
+
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.dataformat.zipfile.ZipSplitter;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+
+import org.junit.jupiter.api.Test;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.annotation.DirtiesContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+
+
+@DirtiesContext
+@CamelSpringBootTest
+@SpringBootTest(
+    classes = {
+        CamelAutoConfiguration.class,
+        ZipSplitterRouteTest.class,
+        ZipSplitterRouteTest.TestConfiguration.class
+    }
+)
+public class ZipSplitterRouteTest {
+
+    
+    @Autowired
+    ProducerTemplate template;
+    
+    @Autowired
+    CamelContext context;
+    
+   
+    
+    @EndpointInject("mock:processZipEntry")
+    MockEndpoint processZipEntry;
+    
+    
+    
+
+    @Test
+    public void testSplitter() throws InterruptedException {
+        
+        processZipEntry.expectedBodiesReceivedInAnyOrder("chau", "hi", "hola", 
"another_chiau", "another_hi");
+        processZipEntry.assertIsSatisfied();
+    }
+    
+    // *************************************
+    // Config
+    // *************************************
+
+    @Configuration
+    public static class TestConfiguration {
+
+        @Bean
+        public RouteBuilder routeBuilder() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() {
+                    // Unzip file and Split it according to FileEntry
+                    
from("file:src/test/resources/org/apache/camel/dataformat/zipfile/data?delay=1000&noop=true")
+                            .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}");
+                }
+            };
+        }
+    }
+    
+   
+
+}
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/corrupt.zip 
b/components-starter/camel-zipfile-starter/src/test/resources/corrupt.zip
new file mode 100644
index 00000000000..fc744046421
--- /dev/null
+++ b/components-starter/camel-zipfile-starter/src/test/resources/corrupt.zip
@@ -0,0 +1 @@
+I am corrupted
\ No newline at end of file
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/data.zip 
b/components-starter/camel-zipfile-starter/src/test/resources/data.zip
new file mode 100644
index 00000000000..fa6e598959d
Binary files /dev/null and 
b/components-starter/camel-zipfile-starter/src/test/resources/data.zip differ
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/hello.odt 
b/components-starter/camel-zipfile-starter/src/test/resources/hello.odt
new file mode 100644
index 00000000000..223391a470a
Binary files /dev/null and 
b/components-starter/camel-zipfile-starter/src/test/resources/hello.odt differ
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/log4j2.properties 
b/components-starter/camel-zipfile-starter/src/test/resources/log4j2.properties
new file mode 100644
index 00000000000..32fa9311108
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-zipfile-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/another/hello.txt
 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/another/hello.txt
new file mode 100644
index 00000000000..b6fc4c620b6
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/another/hello.txt
@@ -0,0 +1 @@
+hello
\ No newline at end of file
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/chiau.txt
 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/chiau.txt
new file mode 100644
index 00000000000..7842486f7b4
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/chiau.txt
@@ -0,0 +1 @@
+chau
\ No newline at end of file
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/hi.txt
 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/hi.txt
new file mode 100644
index 00000000000..32f95c0d124
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/hi.txt
@@ -0,0 +1 @@
+hi
\ No newline at end of file
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/hola.txt
 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/hola.txt
new file mode 100644
index 00000000000..b8b4a4e2a5d
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/hola.txt
@@ -0,0 +1 @@
+hola
\ No newline at end of file
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/other/greetings.txt
 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/other/greetings.txt
new file mode 100644
index 00000000000..9eaa11af390
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/aggregate/zipfile/data/other/greetings.txt
@@ -0,0 +1 @@
+greetings
\ No newline at end of file
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/dataformat/zipfile/SpringZipSplitterRouteTest.xml
 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/dataformat/zipfile/SpringZipSplitterRouteTest.xml
new file mode 100644
index 00000000000..77155fe4085
--- /dev/null
+++ 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/dataformat/zipfile/SpringZipSplitterRouteTest.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <!-- START SNIPPET: e1 -->
+
+  <!-- use a bean to define a custom expression -->
+  <bean id="zipSplitter" 
class="org.apache.camel.dataformat.zipfile.ZipSplitter"/>
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring";>
+    <route>
+      <from 
uri="file:src/test/resources/org/apache/camel/dataformat/zipfile/data?delay=1000&amp;noop=true"/>
+      <split streaming="true">
+        <!-- refer to our custom expression, using ref tag -->
+        <ref>zipSplitter</ref>
+        <convertBodyTo type="java.lang.String" charset="UTF-8"/>
+        <to uri="mock:processZipEntry"/>
+      </split>
+    </route>
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+</beans>
diff --git 
a/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/dataformat/zipfile/data/resources.zip
 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/dataformat/zipfile/data/resources.zip
new file mode 100644
index 00000000000..0f43245c019
Binary files /dev/null and 
b/components-starter/camel-zipfile-starter/src/test/resources/org/apache/camel/dataformat/zipfile/data/resources.zip
 differ

Reply via email to