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.git
The following commit(s) were added to refs/heads/main by this push:
new 9ca8d255ebc Added unit test
9ca8d255ebc is described below
commit 9ca8d255ebc772b0b5ff4216997b336d199b9d64
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Feb 9 16:54:26 2025 +0100
Added unit test
---
.../apache/camel/processor/LoopTestProcessor.java | 5 +++
.../apache/camel/processor/LoopThousandTest.java | 49 ++++++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git
a/core/camel-core/src/test/java/org/apache/camel/processor/LoopTestProcessor.java
b/core/camel-core/src/test/java/org/apache/camel/processor/LoopTestProcessor.java
index f5035848b3b..660e013a21a 100644
---
a/core/camel-core/src/test/java/org/apache/camel/processor/LoopTestProcessor.java
+++
b/core/camel-core/src/test/java/org/apache/camel/processor/LoopTestProcessor.java
@@ -50,5 +50,10 @@ public class LoopTestProcessor implements Processor {
if (i == null || i.intValue() != this.index++) {
exchange.setException(new CamelException("Invalid index value.
Expected " + this.index + " but was " + i));
}
+
+ int len = Thread.currentThread().getStackTrace().length;
+ if (len > 120) {
+ exchange.setException(new CamelException("Call strackframe is too
large. Expected 120 or less, was: " + len));
+ }
}
}
diff --git
a/core/camel-core/src/test/java/org/apache/camel/processor/LoopThousandTest.java
b/core/camel-core/src/test/java/org/apache/camel/processor/LoopThousandTest.java
new file mode 100644
index 00000000000..407e74ee948
--- /dev/null
+++
b/core/camel-core/src/test/java/org/apache/camel/processor/LoopThousandTest.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.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+public class LoopThousandTest extends ContextTestSupport {
+
+ @Test
+ public void testLoopThousand() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+
+ template.sendBody("direct:start", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ final Processor loopTest = new LoopTestProcessor(1000);
+
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:start").loop(1000)
+ .process(loopTest)
+ .to("log:loop")
+ .end()
+ .to("mock:result");
+ }
+ };
+ }
+}