gnodet commented on code in PR #26212: URL: https://github.com/apache/camel/pull/26212#discussion_r3959924385
########## components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIExternalServiceTestSupport.java: ########## @@ -0,0 +1,57 @@ +/* + * 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.openai.integration; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import org.apache.camel.CamelContext; +import org.apache.camel.component.openai.OpenAIComponent; +import org.apache.camel.test.junit6.CamelTestSupport; +import org.apache.camel.util.ObjectHelper; + +abstract class OpenAIExternalServiceTestSupport extends CamelTestSupport { + + static final String ENABLE_LIVE_TESTS = "openai.live.tests"; Review Comment: 🔵 **Nit:** `ENABLE_LIVE_TESTS`, `BASE_URL`, and `API_KEY` are declared as package-private constants, but all three subclass annotations hardcode the string values directly (e.g. `named = "openai.live.tests"`) instead of referencing these constants. Java annotation attributes accept `static final String` compile-time constants — using them here would eliminate the duplication and make a future key rename safe. ```suggestion static final String ENABLE_LIVE_TESTS = "openai.live.tests"; static final String BASE_URL = "openai.live.baseUrl"; static final String API_KEY = "openai.live.apiKey"; ``` The constant declarations are fine as-is; the fix is in each subclass annotation: ```java @EnabledIfSystemProperty(named = OpenAIExternalServiceTestSupport.ENABLE_LIVE_TESTS, matches = "true", ...) ``` -- 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]
