You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/08/16 09:44:06 UTC

[camel] branch camel-3.14.x updated (10542a61e3a -> 6efd8de3a40)

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

davsclaus pushed a change to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


    from 10542a61e3a Regen for commit 4766731eb75c27249bf790a61056d08156f865a5 (#8160)
     new c4d618804cd Upgrade dependencies
     new 6efd8de3a40 CAMEL-18387: Fix bug in TarAggregationStrategy when first file is empty (#8166)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 camel-dependencies/pom.xml                         |  22 ++--
 .../aggregate/tarfile/TarAggregationStrategy.java  |   9 +-
 .../TarAggregationStrategyEmptyFirstFileTest.java  | 140 +++++++++++++++++++++
 parent/pom.xml                                     |  24 ++--
 4 files changed, 166 insertions(+), 29 deletions(-)
 create mode 100644 components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyEmptyFirstFileTest.java


[camel] 01/02: Upgrade dependencies

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c4d618804cd5141280d9fd27b9df650dc2ad6882
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Aug 15 13:17:24 2022 +0200

    Upgrade dependencies
---
 camel-dependencies/pom.xml | 22 +++++++++++-----------
 parent/pom.xml             | 24 ++++++++++++------------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml
index 49b297062e6..e21b2c93656 100644
--- a/camel-dependencies/pom.xml
+++ b/camel-dependencies/pom.xml
@@ -158,10 +158,10 @@
     <corda-version>4.8</corda-version>
     <couchbase-client-version>3.2.7</couchbase-client-version>
     <curator-version>4.3.0</curator-version>
-    <cxf-codegen-plugin-version>3.4.5</cxf-codegen-plugin-version>
-    <cxf-version>3.4.5</cxf-version>
+    <cxf-codegen-plugin-version>3.4.8</cxf-codegen-plugin-version>
+    <cxf-version>3.4.8</cxf-version>
     <cxf-version-range>[3.4,3.5)</cxf-version-range>
-    <cxf-xjc-plugin-version>3.3.1</cxf-xjc-plugin-version>
+    <cxf-xjc-plugin-version>3.3.2</cxf-xjc-plugin-version>
     <cxf-xjc-utils-version>3.3.1</cxf-xjc-utils-version>
     <cxf.codegen.jvmArgs></cxf.codegen.jvmArgs>
     <cxf.codegenplugin.forkmode>once</cxf.codegenplugin.forkmode>
@@ -169,7 +169,7 @@
     <datasonnet-mapper-version>2.1.4</datasonnet-mapper-version>
     <debezium-mysql-connector-version>8.0.27</debezium-mysql-connector-version>
     <debezium-version>1.7.1.Final</debezium-version>
-    <deltaspike-version>1.9.4</deltaspike-version>
+    <deltaspike-version>1.9.5</deltaspike-version>
     <depends-maven-plugin-version>1.4.0</depends-maven-plugin-version>
     <derby-version>10.14.2.0</derby-version>
     <digitalocean-api-client-version>2.17</digitalocean-api-client-version>
@@ -432,7 +432,7 @@
     <nessus-ipfs-version>1.0.0.Beta4</nessus-ipfs-version>
     <nessus-weka-version>1.0.1</nessus-weka-version>
     <netty-reactive-streams-version>2.0.5</netty-reactive-streams-version>
-    <netty-version>4.1.77.Final</netty-version>
+    <netty-version>4.1.79.Final</netty-version>
     <networknt-json-schema-validator-version>1.0.64</networknt-json-schema-validator-version>
     <nimbus-jose-jwt>8.9</nimbus-jose-jwt>
     <nitrite-version>3.4.3</nitrite-version>
@@ -517,14 +517,14 @@
     <spock-version>2.0-M4-groovy-3.0</spock-version>
     <spring-batch-version>4.3.6</spring-batch-version>
     <spring-data-redis-version>2.5.6</spring-data-redis-version>
-    <spring-integration-version>5.5.12</spring-integration-version>
+    <spring-integration-version>5.5.14</spring-integration-version>
     <spring-ldap-version>2.3.8.RELEASE</spring-ldap-version>
     <spring-rabbitmq-version>2.4.2</spring-rabbitmq-version>
     <spring-security-version>5.6.5</spring-security-version>
     <spring-version>${spring5-version}</spring-version>
     <spring-version-range>[5,6)</spring-version-range>
     <spring-ws-version>3.1.3</spring-ws-version>
-    <spring5-version>5.3.20</spring5-version>
+    <spring5-version>5.3.22</spring5-version>
     <sql-maven-plugin-version>1.5</sql-maven-plugin-version>
     <squareup-okhttp-version>3.14.7</squareup-okhttp-version>
     <squareup-okio-version>1.17.2</squareup-okio-version>
@@ -533,9 +533,9 @@
     <stompjms-version>1.19</stompjms-version>
     <stringtemplate-version>4.3</stringtemplate-version>
     <swagger-java-guava-version>27.1-jre</swagger-java-guava-version>
-    <swagger-java-parser-version>1.0.51</swagger-java-parser-version>
-    <swagger-java-version>1.6.2</swagger-java-version>
-    <swagger-openapi3-version>2.1.11</swagger-openapi3-version>
+    <swagger-java-parser-version>1.0.56</swagger-java-parser-version>
+    <swagger-java-version>1.6.4</swagger-java-version>
+    <swagger-openapi3-version>2.1.13</swagger-openapi3-version>
     <tagsoup-version>1.2.1</tagsoup-version>
     <templating-maven-plugin-version>1.0.0</templating-maven-plugin-version>
     <testcontainers-version>1.16.2</testcontainers-version>
@@ -549,7 +549,7 @@
     <vavr-version>0.10.2</vavr-version>
     <velocity-tools-version>3.1</velocity-tools-version>
     <velocity-version>2.3</velocity-version>
-    <vertx-version>4.1.6</vertx-version>
+    <vertx-version>4.1.8</vertx-version>
     <vysper-version>0.7</vysper-version>
     <web3j-quorum-version>0.8.0</web3j-quorum-version>
     <web3j-version>3.6.0</web3j-version>
diff --git a/parent/pom.xml b/parent/pom.xml
index 7896f9f8a93..a30e8d28f0d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -141,14 +141,14 @@
         <corda-version>4.8</corda-version>
         <couchbase-client-version>3.2.7</couchbase-client-version>
         <curator-version>4.3.0</curator-version>
-        <cxf-version>3.4.5</cxf-version>
+        <cxf-version>3.4.8</cxf-version>
         <cxf-version-range>[3.4,3.5)</cxf-version-range>
-        <cxf-codegen-plugin-version>3.4.5</cxf-codegen-plugin-version>
+        <cxf-codegen-plugin-version>3.4.8</cxf-codegen-plugin-version>
         <!-- cxf-xjc is not released as often -->
-        <cxf-xjc-plugin-version>3.3.1</cxf-xjc-plugin-version>
+        <cxf-xjc-plugin-version>3.3.2</cxf-xjc-plugin-version>
         <cxf-xjc-utils-version>3.3.1</cxf-xjc-utils-version>
         <datasonnet-mapper-version>2.1.4</datasonnet-mapper-version>
-        <deltaspike-version>1.9.4</deltaspike-version>
+        <deltaspike-version>1.9.5</deltaspike-version>
         <depends-maven-plugin-version>1.4.0</depends-maven-plugin-version>
         <derby-version>10.14.2.0</derby-version>
         <digitalocean-api-client-version>2.17</digitalocean-api-client-version>
@@ -418,7 +418,7 @@
         <nessus-weka-version>1.0.1</nessus-weka-version>
         <nsq-client-version>1.0.0.RC4</nsq-client-version>
         <neoscada-version>0.4.0</neoscada-version>
-        <netty-version>4.1.77.Final</netty-version>
+        <netty-version>4.1.79.Final</netty-version>
         <netty-reactive-streams-version>2.0.5</netty-reactive-streams-version>
         <networknt-json-schema-validator-version>1.0.64</networknt-json-schema-validator-version>
         <nimbus-jose-jwt>8.9</nimbus-jose-jwt>
@@ -507,11 +507,11 @@
         <spock-version>2.0-M4-groovy-3.0</spock-version>
         <spring-batch-version>4.3.6</spring-batch-version>
         <spring-data-redis-version>2.5.6</spring-data-redis-version>
-        <spring-integration-version>5.5.12</spring-integration-version>
+        <spring-integration-version>5.5.14</spring-integration-version>
         <spring-ldap-version>2.3.8.RELEASE</spring-ldap-version>
         <spring-version-range>[5,6)</spring-version-range>
         <spring-version>${spring5-version}</spring-version>
-        <spring5-version>5.3.20</spring5-version>
+        <spring5-version>5.3.22</spring5-version>
         <spring-rabbitmq-version>2.4.2</spring-rabbitmq-version>
         <spring-security-version>5.6.5</spring-security-version>
         <spring-ws-version>3.1.3</spring-ws-version>
@@ -520,9 +520,9 @@
         <squareup-okio-version>1.17.2</squareup-okio-version>
         <sshd-version>2.8.0</sshd-version>
         <stompjms-version>1.19</stompjms-version>
-        <swagger-java-version>1.6.2</swagger-java-version>
-        <swagger-openapi3-version>2.1.11</swagger-openapi3-version>
-        <swagger-java-parser-version>1.0.51</swagger-java-parser-version>
+        <swagger-java-version>1.6.4</swagger-java-version>
+        <swagger-openapi3-version>2.1.13</swagger-openapi3-version>
+        <swagger-java-parser-version>1.0.56</swagger-java-parser-version>
         <swagger-java-guava-version>27.1-jre</swagger-java-guava-version>
         <apicurio-version>1.1.16</apicurio-version>
         <stax-api-version>1.0.1</stax-api-version>
@@ -530,7 +530,7 @@
         <tagsoup-version>1.2.1</tagsoup-version>
         <templating-maven-plugin-version>1.0.0</templating-maven-plugin-version>
         <testcontainers-version>1.16.2</testcontainers-version>
-	<tika-version>1.28.4</tika-version>
+        <tika-version>1.28.4</tika-version>
         <twilio-version>7.55.3</twilio-version>
         <twitter4j-version>4.0.7</twitter4j-version>
         <undertow-version>2.2.17.Final</undertow-version>
@@ -539,7 +539,7 @@
         <vavr-version>0.10.2</vavr-version>
         <velocity-tools-version>3.1</velocity-tools-version>
         <velocity-version>2.3</velocity-version>
-        <vertx-version>4.1.6</vertx-version>
+        <vertx-version>4.1.8</vertx-version>
         <vysper-version>0.7</vysper-version>
         <web3j-version>3.6.0</web3j-version>
         <web3j-quorum-version>0.8.0</web3j-quorum-version>


[camel] 02/02: CAMEL-18387: Fix bug in TarAggregationStrategy when first file is empty (#8166)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6efd8de3a405c0a1ad95fe98a7adc841ebecb726
Author: chbecker2 <11...@users.noreply.github.com>
AuthorDate: Tue Aug 16 11:41:48 2022 +0200

    CAMEL-18387: Fix bug in TarAggregationStrategy when first file is empty (#8166)
---
 .../aggregate/tarfile/TarAggregationStrategy.java  |   9 +-
 .../TarAggregationStrategyEmptyFirstFileTest.java  | 140 +++++++++++++++++++++
 2 files changed, 143 insertions(+), 6 deletions(-)

diff --git a/components/camel-tarfile/src/main/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategy.java b/components/camel-tarfile/src/main/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategy.java
index 78c05bde6d8..82b97315aef 100644
--- a/components/camel-tarfile/src/main/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategy.java
+++ b/components/camel-tarfile/src/main/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategy.java
@@ -172,9 +172,6 @@ public class TarAggregationStrategy implements AggregationStrategy {
                             ? newExchange.getIn().getHeader(Exchange.FILE_NAME, String.class)
                             : newExchange.getIn().getMessageId();
                     addFileToTar(tarFile, appendFile, this.preserveFolderStructure ? entryName : null);
-                    GenericFile<File> genericFile = FileConsumer.asGenericFile(
-                            tarFile.getParent(), tarFile, Charset.defaultCharset().toString(), false);
-                    genericFile.bindToExchange(answer);
                 }
             } catch (Exception e) {
                 throw new GenericFileOperationFailedException(e.getMessage(), e);
@@ -189,14 +186,14 @@ public class TarAggregationStrategy implements AggregationStrategy {
                             ? newExchange.getIn().getHeader(Exchange.FILE_NAME, String.class)
                             : newExchange.getIn().getMessageId();
                     addEntryToTar(tarFile, entryName, buffer, buffer.length);
-                    GenericFile<File> genericFile = FileConsumer.asGenericFile(
-                            tarFile.getParent(), tarFile, Charset.defaultCharset().toString(), false);
-                    genericFile.bindToExchange(answer);
                 }
             } catch (Exception e) {
                 throw new GenericFileOperationFailedException(e.getMessage(), e);
             }
         }
+        GenericFile<File> genericFile = FileConsumer.asGenericFile(
+                tarFile.getParent(), tarFile, Charset.defaultCharset().toString(), false);
+        genericFile.bindToExchange(answer);
         return answer;
     }
 
diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyEmptyFirstFileTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyEmptyFirstFileTest.java
new file mode 100644
index 00000000000..a681b05f42c
--- /dev/null
+++ b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/TarAggregationStrategyEmptyFirstFileTest.java
@@ -0,0 +1,140 @@
+/*
+ * 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.processor.aggregate.tarfile;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.test.junit5.TestSupport;
+import org.apache.camel.util.IOHelper;
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.apache.logging.log4j.core.util.IOUtils;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class TarAggregationStrategyEmptyFirstFileTest extends CamelTestSupport {
+
+    @Override
+    @BeforeEach
+    public void setUp() throws Exception {
+        TestSupport.deleteDirectory("target/out");
+        super.setUp();
+    }
+
+    @Test
+    public void testNormal() throws Exception {
+        doTest("A", "B", "C");
+    }
+
+    @Test
+    public void testEmptyFirst() throws Exception {
+        doTest("", "A");
+    }
+
+    @Test
+    public void testEmptyOnly() throws Exception {
+        doTest("");
+    }
+
+    @Test
+    public void testEmptyMiddle() throws Exception {
+        doTest("Start", "", "", "End");
+    }
+
+    public void doTest(String... messages) throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:aggregateToTarEntry");
+        mock.expectedMessageCount(1);
+
+        StringBuilder input = new StringBuilder();
+        int nonEmptyFile = 0;
+        for (String m : messages) {
+            input.append("#").append(m);
+            if (!m.isEmpty()) {
+                nonEmptyFile++;
+            }
+        }
+        if (input.toString().endsWith("#")) {
+            input.append("#");
+        }
+
+        template.sendBody("direct:start", input.toString());
+
+        assertMockEndpointsSatisfied();
+
+        File[] files = new File("target/out").listFiles();
+        if (files != null) {
+            assertEquals(1, files.length, "Should only be one file in target/out directory");
+            Map<String, String> tar = readTar(files[0]);
+            assertEquals(nonEmptyFile, tar.size(), "Tar file " + tar + " should contain " + nonEmptyFile + " files");
+            Iterator<Entry<String, String>> i = tar.entrySet().iterator();
+            for (int n = 0; n < messages.length; n++) {
+                if (!messages[n].isEmpty()) {
+                    Map.Entry<String, String> entry = i.next();
+                    assertEquals(Integer.toString(n), entry.getKey(), "Tar file should contain entry named " + n);
+                    assertEquals(messages[n], entry.getValue(), "Tar entry " + n + " content is wrong");
+                }
+            }
+        }
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // @formatter:off
+                from("direct:start")
+                    .split(body().tokenize("#"), new TarAggregationStrategy(false, true))
+                    .setHeader(Exchange.FILE_NAME, simple("${exchangeProperty.CamelSplitIndex}"))
+                .end()
+                .to("file:target/out")
+                .to("mock:aggregateToTarEntry");
+                // @formatter:on
+            }
+        };
+    }
+
+    private static Map<String, String> readTar(File file) throws FileNotFoundException, IOException {
+        Map<String, String> content = new TreeMap<>();
+        TarArchiveInputStream tin = new TarArchiveInputStream(new FileInputStream(file));
+        try {
+            for (TarArchiveEntry te = (TarArchiveEntry) tin.getNextEntry();
+                 te != null;
+                 te = (TarArchiveEntry) tin.getNextEntry()) {
+                String c = IOUtils.toString(new InputStreamReader(tin));
+                content.put(te.getName(), c);
+            }
+        } finally {
+            IOHelper.close(tin);
+        }
+        return content;
+    }
+}