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 2025/11/21 16:08:38 UTC
(camel) branch pollfile created (now d768a1277c3d)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch pollfile
in repository https://gitbox.apache.org/repos/asf/camel.git
at d768a1277c3d Run spring-ai last as they are slow
This branch includes the following new commits:
new 501617f88081 CAMEL-22707: camel-core: Fix poll/pollEnrich when using simple language should not include file language as this is not possible to use before polling. This requires to add a fake simple-no-file language that these EIPs are forced to use when simple is in use.
new d768a1277c3d Run spring-ai last as they are slow
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.
(camel) 01/02: CAMEL-22707: camel-core: Fix poll/pollEnrich when using simple language should not include file language as this is not possible to use before polling. This requires to add a fake simple-no-file language that these EIPs are forced to use when simple is in use.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch pollfile
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 501617f880812e96f7032c42d2ad46fedb1fca16
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Nov 21 16:48:12 2025 +0100
CAMEL-22707: camel-core: Fix poll/pollEnrich when using simple language should not include file language as this is not possible to use before polling. This requires to add a fake simple-no-file language that these EIPs are forced to use when simple is in use.
---
.../camel/impl/engine/DefaultLanguageResolver.java | 19 ++++++---
.../language/csimple/CSimpleExpressionParser.java | 2 +-
.../language/csimple/CSimplePredicateParser.java | 2 +-
.../language/simple/SimpleExpressionParser.java | 13 +++++-
.../camel/language/simple/SimpleLanguage.java | 13 +++++-
.../SimpleNoFileLanguage.java} | 21 ++--------
.../language/simple/SimplePredicateParser.java | 13 +++++-
.../simple/ast/SimpleFunctionExpression.java | 13 +++++-
.../language/simple/ast/SimpleFunctionStart.java | 12 +++---
.../model/language/SimpleNoFileExpression.java} | 23 ++++------
.../apache/camel/reifier/PollEnrichReifier.java | 7 ++++
.../java/org/apache/camel/reifier/PollReifier.java | 4 ++
.../component/file/PollEnrichSimpleMoveTest.java | 49 ++++++++++++++++++++++
.../camel/component/file/PollSimpleMoveTest.java | 49 ++++++++++++++++++++++
14 files changed, 188 insertions(+), 52 deletions(-)
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultLanguageResolver.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultLanguageResolver.java
index 54067ade9d28..f329272b880d 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultLanguageResolver.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultLanguageResolver.java
@@ -33,6 +33,8 @@ public class DefaultLanguageResolver implements LanguageResolver {
public static final String LANGUAGE_RESOURCE_PATH = "META-INF/services/org/apache/camel/language/";
public static final String LANGUAGE_RESOLVER_RESOURCE_PATH = LANGUAGE_RESOURCE_PATH + "resolver/";
+ private static final String SIMPLE_NO_FILE = "org.apache.camel.language.simple.SimpleNoFileLanguage";
+
private static final Logger LOG = LoggerFactory.getLogger(DefaultLanguageResolver.class);
protected FactoryFinder languageFactory;
@@ -41,12 +43,17 @@ public class DefaultLanguageResolver implements LanguageResolver {
@Override
public Language resolveLanguage(String name, CamelContext context) {
Class<?> type = null;
- try {
- type = findLanguage(name, context);
- } catch (NoFactoryAvailableException e) {
- // ignore
- } catch (Exception e) {
- throw new IllegalArgumentException("Invalid URI, no Language registered for scheme: " + name, e);
+
+ if ("simple-no-file".equals(name)) {
+ type = context.getClassResolver().resolveClass(SIMPLE_NO_FILE);
+ } else {
+ try {
+ type = findLanguage(name, context);
+ } catch (NoFactoryAvailableException e) {
+ // ignore
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Invalid URI, no Language registered for scheme: " + name, e);
+ }
}
if (type != null) {
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleExpressionParser.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleExpressionParser.java
index bc06af83f13a..3e41a6e1c8a7 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleExpressionParser.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleExpressionParser.java
@@ -30,7 +30,7 @@ public class CSimpleExpressionParser {
public String parseExpression(CamelContext camelContext, String expression) {
// reuse simple language parser but output the result as java code
- SimpleExpressionParser parser = new SimpleExpressionParser(camelContext, expression, true, null);
+ SimpleExpressionParser parser = new SimpleExpressionParser(camelContext, expression, true, false, null);
return parser.parseCode();
}
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java
index b2ce514f1113..1f14d42f2084 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java
@@ -30,7 +30,7 @@ public class CSimplePredicateParser {
public String parsePredicate(CamelContext camelContext, String predicate) {
// reuse simple language parser but output the result as java code
- SimplePredicateParser parser = new SimplePredicateParser(camelContext, predicate, true, null);
+ SimplePredicateParser parser = new SimplePredicateParser(camelContext, predicate, true, false, null);
return parser.parseCode();
}
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionParser.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionParser.java
index 1ee19757064d..33efc4c65c99 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionParser.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleExpressionParser.java
@@ -44,11 +44,20 @@ public class SimpleExpressionParser extends BaseSimpleParser {
// use caches to avoid re-parsing the same expressions over and over again
private final Map<String, Expression> cacheExpression;
+ private boolean skipFileFunctions;
- public SimpleExpressionParser(CamelContext camelContext, String expression, boolean allowEscape,
+ public SimpleExpressionParser(CamelContext camelContext, String expression,
+ boolean allowEscape,
+ Map<String, Expression> cacheExpression) {
+ this(camelContext, expression, allowEscape, false, cacheExpression);
+ }
+
+ public SimpleExpressionParser(CamelContext camelContext, String expression,
+ boolean allowEscape, boolean skipFileFunctions,
Map<String, Expression> cacheExpression) {
super(camelContext, expression, allowEscape);
this.cacheExpression = cacheExpression;
+ this.skipFileFunctions = skipFileFunctions;
}
public Expression parseExpression() {
@@ -172,7 +181,7 @@ public class SimpleExpressionParser extends BaseSimpleParser {
if (token.getType().isFunctionStart()) {
// starting a new function
functions.incrementAndGet();
- return new SimpleFunctionStart(token, cacheExpression);
+ return new SimpleFunctionStart(token, cacheExpression, skipFileFunctions);
} else if (functions.get() > 0 && token.getType().isFunctionEnd()) {
// there must be a start function already, to let this be a end function
functions.decrementAndGet();
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
index 88411c2efd53..1681730fe86e 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
@@ -49,6 +49,7 @@ public class SimpleLanguage extends LanguageSupport implements StaticService {
private static final String CACHE_KEY_PREFIX = "@SIMPLE@";
boolean allowEscape = true;
+ boolean skipFileFunctions;
// use caches to avoid re-parsing the same expressions over and over again
private Map<String, Expression> cacheExpression;
@@ -60,6 +61,13 @@ public class SimpleLanguage extends LanguageSupport implements StaticService {
public SimpleLanguage() {
}
+ /**
+ * Special purpose for {@link SimpleNoFileLanguage}
+ */
+ SimpleLanguage(boolean skipFileFunctions) {
+ this.skipFileFunctions = skipFileFunctions;
+ }
+
@Override
public void init() {
// setup cache which requires CamelContext to be set first
@@ -123,7 +131,7 @@ public class SimpleLanguage extends LanguageSupport implements StaticService {
// using the expression cache here with the predicate parser is okay
SimplePredicateParser parser
- = new SimplePredicateParser(getCamelContext(), expression, allowEscape, cacheExpression);
+ = new SimplePredicateParser(getCamelContext(), expression, allowEscape, skipFileFunctions, cacheExpression);
answer = parser.parsePredicate();
if (cachePredicate != null && answer != null) {
@@ -182,7 +190,8 @@ public class SimpleLanguage extends LanguageSupport implements StaticService {
// only parse if there are simple functions
SimpleExpressionParser parser
- = new SimpleExpressionParser(getCamelContext(), expression, allowEscape, cacheExpression);
+ = new SimpleExpressionParser(
+ getCamelContext(), expression, allowEscape, skipFileFunctions, cacheExpression);
answer = parser.parseExpression();
if (cacheExpression != null && answer != null) {
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleNoFileLanguage.java
similarity index 56%
copy from core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java
copy to core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleNoFileLanguage.java
index b2ce514f1113..f598f1a61603 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleNoFileLanguage.java
@@ -14,24 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.language.csimple;
+package org.apache.camel.language.simple;
-import org.apache.camel.CamelContext;
-import org.apache.camel.language.simple.SimplePredicateParser;
+public class SimpleNoFileLanguage extends SimpleLanguage {
-/**
- * Predicate parser for csimple.
- */
-public class CSimplePredicateParser {
-
- public String parsePredicate(String predicate) {
- return parsePredicate(null, predicate);
+ public SimpleNoFileLanguage() {
+ super(true);
}
-
- public String parsePredicate(CamelContext camelContext, String predicate) {
- // reuse simple language parser but output the result as java code
- SimplePredicateParser parser = new SimplePredicateParser(camelContext, predicate, true, null);
- return parser.parseCode();
- }
-
}
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimplePredicateParser.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimplePredicateParser.java
index 32386e86852b..c4204c01cf94 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimplePredicateParser.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimplePredicateParser.java
@@ -62,11 +62,20 @@ public class SimplePredicateParser extends BaseSimpleParser {
// use caches to avoid re-parsing the same expressions over and over again
private final Map<String, Expression> cacheExpression;
+ private boolean skipFileFunctions;
- public SimplePredicateParser(CamelContext camelContext, String expression, boolean allowEscape,
+ public SimplePredicateParser(CamelContext camelContext, String expression,
+ boolean allowEscape,
+ Map<String, Expression> cacheExpression) {
+ this(camelContext, expression, allowEscape, false, cacheExpression);
+ }
+
+ public SimplePredicateParser(CamelContext camelContext, String expression,
+ boolean allowEscape, boolean skipFileFunctions,
Map<String, Expression> cacheExpression) {
super(camelContext, expression, allowEscape);
this.cacheExpression = cacheExpression;
+ this.skipFileFunctions = skipFileFunctions;
}
public Predicate parsePredicate() {
@@ -295,7 +304,7 @@ public class SimplePredicateParser extends BaseSimpleParser {
AtomicBoolean startFunction) {
if (token.getType().isFunctionStart()) {
startFunction.set(true);
- return new SimpleFunctionStart(token, cacheExpression);
+ return new SimpleFunctionStart(token, cacheExpression, skipFileFunctions);
} else if (token.getType().isFunctionEnd()) {
startFunction.set(false);
return new SimpleFunctionEnd(token);
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
index 79704aa41d71..705518942aed 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
@@ -26,6 +26,7 @@ import java.util.StringJoiner;
import org.apache.camel.CamelContext;
import org.apache.camel.Expression;
import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.language.constant.ConstantLanguage;
import org.apache.camel.language.simple.BaseSimpleParser;
import org.apache.camel.language.simple.SimpleExpressionBuilder;
import org.apache.camel.language.simple.types.SimpleParserException;
@@ -47,10 +48,12 @@ public class SimpleFunctionExpression extends LiteralExpression {
// use caches to avoid re-parsing the same expressions over and over again
private final Map<String, Expression> cacheExpression;
+ private final boolean skipFileFunctions;
- public SimpleFunctionExpression(SimpleToken token, Map<String, Expression> cacheExpression) {
+ public SimpleFunctionExpression(SimpleToken token, Map<String, Expression> cacheExpression, boolean skipFileFunctions) {
super(token);
this.cacheExpression = cacheExpression;
+ this.skipFileFunctions = skipFileFunctions;
}
/**
@@ -195,7 +198,13 @@ public class SimpleFunctionExpression extends LiteralExpression {
// file: prefix
remainder = ifStartsWithReturnRemainder("file:", function);
if (remainder != null) {
- Expression fileExpression = createSimpleFileExpression(remainder, strict);
+ Expression fileExpression;
+ if (skipFileFunctions) {
+ // do not create file expressions but keep the function as-is as a constant value
+ fileExpression = ConstantLanguage.constant("${" + function + "}");
+ } else {
+ fileExpression = createSimpleFileExpression(remainder, strict);
+ }
if (fileExpression != null) {
return fileExpression;
}
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionStart.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionStart.java
index 852a6d64db25..1953dbb8ea1a 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionStart.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionStart.java
@@ -34,11 +34,13 @@ public class SimpleFunctionStart extends BaseSimpleNode implements BlockStart {
// use caches to avoid re-parsing the same expressions over and over again
private final Map<String, Expression> cacheExpression;
private final CompositeNodes block;
+ private final boolean skipFileFunctions;
- public SimpleFunctionStart(SimpleToken token, Map<String, Expression> cacheExpression) {
+ public SimpleFunctionStart(SimpleToken token, Map<String, Expression> cacheExpression, boolean skipFileFunctions) {
super(token);
this.block = new CompositeNodes(token);
this.cacheExpression = cacheExpression;
+ this.skipFileFunctions = skipFileFunctions;
}
public CompositeNodes getBlock() {
@@ -68,7 +70,7 @@ public class SimpleFunctionStart extends BaseSimpleNode implements BlockStart {
}
private Expression doCreateLiteralExpression(CamelContext camelContext, String expression) {
- SimpleFunctionExpression function = new SimpleFunctionExpression(this.getToken(), cacheExpression);
+ SimpleFunctionExpression function = new SimpleFunctionExpression(this.getToken(), cacheExpression, skipFileFunctions);
LiteralNode literal = (LiteralNode) block.getChildren().get(0);
function.addText(literal.getText());
return function.createExpression(camelContext, expression);
@@ -119,7 +121,7 @@ public class SimpleFunctionStart extends BaseSimpleNode implements BlockStart {
// we have now concat the block as a String which contains the function expression
// which we then need to evaluate as a function
String exp = sb.toString();
- SimpleFunctionExpression function = new SimpleFunctionExpression(token, cacheExpression);
+ SimpleFunctionExpression function = new SimpleFunctionExpression(token, cacheExpression, skipFileFunctions);
function.addText(exp);
try {
return function.createExpression(camelContext, exp).evaluate(exchange, type);
@@ -161,7 +163,7 @@ public class SimpleFunctionStart extends BaseSimpleNode implements BlockStart {
}
private String doCreateLiteralCode(CamelContext camelContext, String expression) {
- SimpleFunctionExpression function = new SimpleFunctionExpression(this.getToken(), cacheExpression);
+ SimpleFunctionExpression function = new SimpleFunctionExpression(this.getToken(), cacheExpression, skipFileFunctions);
LiteralNode literal = (LiteralNode) block.getChildren().get(0);
function.addText(literal.getText());
return function.createCode(camelContext, expression);
@@ -203,7 +205,7 @@ public class SimpleFunctionStart extends BaseSimpleNode implements BlockStart {
// we have now concat the block as a String which contains inlined functions parsed
// so now we should reparse as a single function
String exp = sb.toString();
- SimpleFunctionExpression function = new SimpleFunctionExpression(token, cacheExpression);
+ SimpleFunctionExpression function = new SimpleFunctionExpression(token, cacheExpression, skipFileFunctions);
function.addText(exp);
try {
return function.createCode(camelContext, exp);
diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java b/core/camel-core-model/src/main/java/org/apache/camel/model/language/SimpleNoFileExpression.java
similarity index 57%
copy from core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java
copy to core/camel-core-model/src/main/java/org/apache/camel/model/language/SimpleNoFileExpression.java
index b2ce514f1113..6395cd77f3a2 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimplePredicateParser.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/language/SimpleNoFileExpression.java
@@ -14,24 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.language.csimple;
+package org.apache.camel.model.language;
-import org.apache.camel.CamelContext;
-import org.apache.camel.language.simple.SimplePredicateParser;
+import jakarta.xml.bind.annotation.XmlTransient;
-/**
- * Predicate parser for csimple.
- */
-public class CSimplePredicateParser {
+@XmlTransient
+public class SimpleNoFileExpression extends TypedExpressionDefinition {
- public String parsePredicate(String predicate) {
- return parsePredicate(null, predicate);
+ public SimpleNoFileExpression(SimpleExpression expression) {
+ super(expression);
}
- public String parsePredicate(CamelContext camelContext, String predicate) {
- // reuse simple language parser but output the result as java code
- SimplePredicateParser parser = new SimplePredicateParser(camelContext, predicate, true, null);
- return parser.parseCode();
+ @Override
+ public String getLanguage() {
+ return "simple-no-file";
}
-
}
diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/PollEnrichReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/PollEnrichReifier.java
index 0733b3730860..fd2325066bea 100644
--- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/PollEnrichReifier.java
+++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/PollEnrichReifier.java
@@ -26,6 +26,8 @@ import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.ProcessorDefinitionHelper;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.model.language.ConstantExpression;
+import org.apache.camel.model.language.SimpleExpression;
+import org.apache.camel.model.language.SimpleNoFileExpression;
import org.apache.camel.processor.PollEnricher;
import org.apache.camel.support.DefaultExchange;
import org.apache.camel.support.EndpointHelper;
@@ -44,6 +46,11 @@ public class PollEnrichReifier extends ProcessorReifier<PollEnrichDefinition> {
exp = createExpression(definition.getExpression());
Exchange ex = new DefaultExchange(camelContext);
uri = exp.evaluate(ex, String.class);
+ } else if (definition.getExpression() instanceof SimpleExpression se) {
+ // special for simple as we need to not include file functions
+ SimpleNoFileExpression copy = new SimpleNoFileExpression(se);
+ exp = createExpression(copy);
+ uri = definition.getExpression().getExpression();
} else {
exp = createExpression(definition.getExpression());
uri = definition.getExpression().getExpression();
diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/PollReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/PollReifier.java
index 9f919d7c43f8..e9fd1f752892 100644
--- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/PollReifier.java
+++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/PollReifier.java
@@ -75,6 +75,10 @@ public class PollReifier extends ProcessorReifier<PollDefinition> {
// only use simple language if needed
language = LanguageSupport.hasSimpleFunction(uri) ? "simple" : "constant";
}
+ if ("simple".equals(language)) {
+ // special for simple as we need to not include file functions
+ language = "simple-no-file";
+ }
Language lan = camelContext.resolveLanguage(language);
return lan.createExpression(uri);
}
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/PollEnrichSimpleMoveTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/PollEnrichSimpleMoveTest.java
new file mode 100644
index 000000000000..6c492442bfef
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/component/file/PollEnrichSimpleMoveTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.component.file;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+public class PollEnrichSimpleMoveTest extends ContextTestSupport {
+
+ @Test
+ public void testPollEnrichSimpleMove() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+ getMockEndpoint("mock:result").expectedFileExists(fileUri().substring(5) + "/backup/my-hello.txt");
+
+ template.sendBodyAndHeader(fileUri(), "Hello World", Exchange.FILE_NAME, "hello.txt");
+
+ template.sendBody("direct:start", "Trigger");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:start")
+ .pollEnrich().simple(fileUri() + "?move=backup/my-${file:onlyname}").timeout(5000).end()
+ .to("mock:result");
+ }
+ };
+ }
+
+}
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/PollSimpleMoveTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/PollSimpleMoveTest.java
new file mode 100644
index 000000000000..ec04eb780543
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/component/file/PollSimpleMoveTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.component.file;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+public class PollSimpleMoveTest extends ContextTestSupport {
+
+ @Test
+ public void testPollSimpleMove() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+ getMockEndpoint("mock:result").expectedFileExists(fileUri().substring(5) + "/backup/my-hello.txt");
+
+ template.sendBodyAndHeader(fileUri(), "Hello World", Exchange.FILE_NAME, "hello.txt");
+
+ template.sendBody("direct:start", "Trigger");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:start")
+ .poll(fileUri() + "?move=backup/my-${file:onlyname}", 5000)
+ .to("mock:result");
+ }
+ };
+ }
+
+}
(camel) 02/02: Run spring-ai last as they are slow
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch pollfile
in repository https://gitbox.apache.org/repos/asf/camel.git
commit d768a1277c3de5ea1b2b78eb226948145e27aff4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Nov 21 17:02:13 2025 +0100
Run spring-ai last as they are slow
---
components/camel-spring-parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/camel-spring-parent/pom.xml b/components/camel-spring-parent/pom.xml
index 39dfbfd2309e..1f1d1a796beb 100644
--- a/components/camel-spring-parent/pom.xml
+++ b/components/camel-spring-parent/pom.xml
@@ -35,7 +35,6 @@
<modules>
<module>camel-spring</module>
- <module>camel-spring-ai</module>
<module>camel-spring-batch</module>
<module>camel-spring-jdbc</module>
<module>camel-spring-ldap</module>
@@ -47,6 +46,7 @@
<module>camel-spring-xml</module>
<module>camel-undertow-spring-security</module>
<module>camel-spring-cloud-config</module>
+ <module>camel-spring-ai</module>
</modules>
</project>