This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch zip in repository https://gitbox.apache.org/repos/asf/camel.git
commit e50d9e2c749c608d3edd9f86697e4816b97533c9 Author: Claus Ibsen <[email protected]> AuthorDate: Mon Sep 2 10:01:56 2024 +0200 CAMEL-21114: camel-zipfile - ZipSplitter with AggregationStrategy does not aggregate all splits in transacted mode. --- .../camel/dataformat/zipfile/ZipIterator.java | 10 +++--- .../processor/aggregate/zipfile/DummyZip.java | 38 ---------------------- .../ZipSplitAggregateTransactedIssueTest.java | 2 -- .../src/test/resources/log4j2.properties | 2 +- .../apache/camel/processor/MulticastProcessor.java | 2 -- 5 files changed, 6 insertions(+), 48 deletions(-) diff --git a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java index 153bc9d3d6b..974b8d5b94d 100644 --- a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java +++ b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java @@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory; * <a href="http://camel.465427.n5.nabble.com/zip-file-best-practices-td5713437.html">zip file best practices</a> */ public class ZipIterator implements Iterator<Message>, Closeable { - static final Logger LOGGER = LoggerFactory.getLogger(ZipIterator.class); + private static final Logger LOG = LoggerFactory.getLogger(ZipIterator.class); private final Exchange exchange; private boolean allowEmptyDirectory; @@ -68,7 +68,7 @@ public class ZipIterator implements Iterator<Message>, Closeable { @Override public boolean hasNext() { boolean answer = doHasNext(); - System.out.println("hasNext: " + answer); + LOG.trace("hasNext: {}", answer); return answer; } @@ -100,7 +100,7 @@ public class ZipIterator implements Iterator<Message>, Closeable { @Override public Message next() { Message answer = doNext(); - System.out.println("next: " + answer); + LOG.trace("next: {}", answer); return answer; } @@ -130,7 +130,7 @@ public class ZipIterator implements Iterator<Message>, Closeable { ZipEntry current = getNextEntry(); if (current != null) { - LOGGER.debug("read zipEntry {}", current.getName()); + LOG.debug("read zipEntry {}", current.getName()); Message answer = new DefaultMessage(exchange.getContext()); answer.getHeaders().putAll(exchange.getIn().getHeaders()); answer.setHeader("zipFileName", current.getName()); @@ -138,7 +138,7 @@ public class ZipIterator implements Iterator<Message>, Closeable { answer.setBody(new ZipInputStreamWrapper(zipInputStream)); return answer; } else { - LOGGER.trace("close zipInputStream"); + LOG.trace("close zipInputStream"); return null; } } catch (IOException exception) { diff --git a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/DummyZip.java b/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/DummyZip.java deleted file mode 100644 index fdd9512d085..00000000000 --- a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/DummyZip.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.zipfile; - -import java.util.Iterator; -import java.util.List; - -import org.apache.camel.Exchange; -import org.apache.camel.Expression; - -public class DummyZip implements Expression { - - private final Iterator list = List.of("Orders1.xml", "Orders2.xml").iterator(); - - public Object evaluate(Exchange exchange) { - return list; - } - - @Override - public <T> T evaluate(Exchange exchange, Class<T> type) { - Object result = evaluate(exchange); - return exchange.getContext().getTypeConverter().convertTo(type, exchange, result); - } -} diff --git a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipSplitAggregateTransactedIssueTest.java b/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipSplitAggregateTransactedIssueTest.java index 52643993fb0..7a7c225d85d 100644 --- a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipSplitAggregateTransactedIssueTest.java +++ b/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipSplitAggregateTransactedIssueTest.java @@ -72,7 +72,6 @@ public class ZipSplitAggregateTransactedIssueTest extends CamelTestSupport { getContext().getRegistry().bind("transacted", springTransactionPolicy); getContext().getRegistry().bind("zipSplitter", new ZipSplitter()); - // getContext().getRegistry().bind("zipSplitter", new DummyZip()); from("direct:start") .transacted("transacted") @@ -90,7 +89,6 @@ public class ZipSplitAggregateTransactedIssueTest extends CamelTestSupport { @Override public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { String name = newExchange.getMessage().getHeader("CamelFileName", String.class); - // String name = newExchange.getMessage().getBody(String.class); LOG.info("Aggregating {}", name); return newExchange; } diff --git a/components/camel-zipfile/src/test/resources/log4j2.properties b/components/camel-zipfile/src/test/resources/log4j2.properties index 55263e9ebcb..32fa9311108 100644 --- a/components/camel-zipfile/src/test/resources/log4j2.properties +++ b/components/camel-zipfile/src/test/resources/log4j2.properties @@ -25,4 +25,4 @@ 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 = out +rootLogger.appenderRef.file.ref = file diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java index 5d254c1fbac..17c2a6abe94 100644 --- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java +++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java @@ -687,8 +687,6 @@ public class MulticastProcessor extends AsyncProcessorSupport next = false; } } - // fail-safe to ensure we trigger done - doDone(null, false); } boolean doRun() throws Exception {
