oscerd commented on code in PR #26520: URL: https://github.com/apache/camel/pull/26520#discussion_r4029071098
########## dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/download/DependencyDownloaderPropertiesFunctionResolverTest.java: ########## @@ -0,0 +1,107 @@ +/* + * 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.download; + +import java.lang.reflect.Proxy; +import java.util.ArrayList; +import java.util.List; + +import org.apache.camel.impl.engine.SimpleCamelContext; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Regression test for CAMEL-24776: a normal run (not only export) must auto-download the JAR that backs a secret + * properties function - e.g. camel-kubernetes for {@code {{secret:...}}} and {@code {{configmap:...}}} - so the + * function can be resolved. Otherwise the placeholder is silently parsed as a key with a default value and resolves to + * the wrong literal. + */ +public class DependencyDownloaderPropertiesFunctionResolverTest { + + private static final String KUBERNETES = "org.apache.camel:camel-kubernetes"; + + @Test + void runDownloadsKubernetesForSecretFunction() { + assertTrue(resolveAndRecordDownloads(false, false, "secret").contains(KUBERNETES), + "run must auto-download camel-kubernetes for the secret function"); + } + + @Test + void runDownloadsKubernetesForConfigmapFunction() { + assertTrue(resolveAndRecordDownloads(false, false, "configmap").contains(KUBERNETES), + "run must auto-download camel-kubernetes for the configmap function"); + } + + @Test + void exportStillDownloadsKubernetesForSecretFunction() { + assertTrue(resolveAndRecordDownloads(true, false, "secret").contains(KUBERNETES), + "export must keep auto-downloading camel-kubernetes for the secret function"); + } + + @Test + void transformStubsWithoutDownloading() { + assertEquals(List.of(), resolveAndRecordDownloads(false, true, "secret"), Review Comment: Good catch — extended the regression test to cover the remaining mappings on run as well: `base64`→`camel-base64`, `aws`→`camel-aws-secrets-manager`, `azure`→`camel-azure-key-vault`, `gcp`→`camel-google-secret-manager`, `hashicorp`→`camel-hashicorp-vault`, alongside the existing `secret`/`configmap`→`camel-kubernetes` cases (9 tests total). A removed branch or a wrong artifactId in any mapping is now caught. Done in f38bcb5. _Claude Code on behalf of oscerd_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
