This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch fix/CAMEL-23730 in repository https://gitbox.apache.org/repos/asf/camel.git
commit aafa5e26a62b4f896480e1a585bfe95277b8476e Author: Claus Ibsen <[email protected]> AuthorDate: Wed Jun 10 17:30:10 2026 +0200 CAMEL-23730: Export dry-run should add StubBeanRepository when stub pattern is component:* Signed-off-by: Claus Ibsen <[email protected]> Co-Authored-By: Claude <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../java/org/apache/camel/main/KameletMain.java | 4 +- .../apache/camel/main/StubBeanRepositoryTest.java | 44 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java index 416409f792a2..c3ca1353fdd3 100644 --- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java +++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java @@ -524,8 +524,8 @@ public class KameletMain extends MainCommandLineSupport { infos.forEach(LOG::info); answer.getCamelContextExtension().setRegistry(registry); - if (silent || "*".equals(stubPattern)) { - registry.addBeanRepository(new StubBeanRepository(stubPattern)); + if (silent || "*".equals(stubPattern) || "component:*".equals(stubPattern)) { + registry.addBeanRepository(new StubBeanRepository("*")); } // load camel component and custom health-checks diff --git a/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/StubBeanRepositoryTest.java b/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/StubBeanRepositoryTest.java new file mode 100644 index 000000000000..61c068c3f23f --- /dev/null +++ b/dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/StubBeanRepositoryTest.java @@ -0,0 +1,44 @@ +/* + * 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.main; + +import org.apache.camel.main.stub.StubBeanRepository; +import org.apache.camel.spi.AggregationRepository; +import org.apache.camel.spi.IdempotentRepository; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +public class StubBeanRepositoryTest { + + @Test + public void testWildcardPatternStubsBeanReferences() { + StubBeanRepository repo = new StubBeanRepository("*"); + + assertNotNull(repo.lookupByNameAndType("myAggRepo", AggregationRepository.class)); + assertNotNull(repo.lookupByNameAndType("myIdempotentRepo", IdempotentRepository.class)); + } + + @Test + public void testComponentPatternDoesNotStubBeanReferences() { + StubBeanRepository repo = new StubBeanRepository("component:*"); + + assertNull(repo.lookupByNameAndType("myAggRepo", AggregationRepository.class)); + assertNull(repo.lookupByNameAndType("myIdempotentRepo", IdempotentRepository.class)); + } +}
