Andrea Cosentino created CAMEL-28048:
----------------------------------------

             Summary: camel-huaweicloud: move ClientConfigurations and the 
credential resolution into camel-huaweicloud-common
                 Key: CAMEL-28048
                 URL: https://issues.apache.org/jira/browse/CAMEL-28048
             Project: Camel
          Issue Type: Task
            Reporter: Andrea Cosentino


Found during an audit of the cloud components (camel-aws, camel-azure, 
camel-google, camel-huawei) at commit 7c0644752e17. Every item below was 
verified against the source.

{{camel-huaweicloud-common}} is 69 lines - a two-field {{ServiceKeys}} POJO and 
a three-value {{InputSourceType}} enum - and has no test sources at all. 
Everything that should be shared is instead duplicated across the seven feature 
modules.

h4. 1. Seven private copies of ClientConfigurations
{{find camel-huawei -name ClientConfigurations.java}} returns seven files 
totalling 1079 lines (functiongraph 230, frs 233, imagerecognition 161, dms 
200, smn 138, obs 63, iam 54), all carrying the same accessKey / secretKey / 
projectId / proxyHost / proxyPort / proxyUser / proxyPassword / 
ignoreSslVerification / endpoint block. The functiongraph copy is additionally 
in the package {{org.apache.camel.models}}, which matches no other class in the 
project.

h4. 2. Seven hand-rolled AK/SK resolutions
Every module repeats the same "endpoint key, else serviceKeys, else throw" 
logic; {{grep -rn "getServiceKeys().getAccessKey()"}} hits dms, frs, 
functiongraph, iam, imagerecognition, obs and smn.

camel-aws solves exactly this with {{AwsCommonConfiguration}} + 
{{AwsClientBuilderUtil}} in {{camel-aws-common}} (42 and 43 users 
respectively), and camel-google with {{GoogleCommonConfiguration}} + 
{{GoogleCredentialsHelper}} (21 users). The Huawei family has the pieces but 
not the shared home.

Proposed change: add a {{HuaweiCloudCommonConfiguration}} and a client helper 
to {{camel-huaweicloud-common}}, move the duplicated configuration and 
credential logic there, and give the module the tests it currently cannot have 
because it holds no logic.

h4. 3. Related: the family's integration tests never run
camel-huawei has zero {{*IT.java}} files, against 178 for camel-aws, 37 for 
camel-azure and 61 for camel-google. Its integration tests are named 
{{*Test.java}} and switched off with {{@Disabled}} - 59 of 148 test classes - 
so they run in no profile and are invisible to the {{-Pit}} convention. 
Renaming them would at least make the gap measurable.

h4. 4. Related: ServiceKeys exists twice
{{org.apache.camel.component.huaweicloud.common.models.ServiceKeys}} and 
{{org.apache.camel.component.alibaba.common.models.ServiceKeys}} are the same 
class with the same two fields and the same constructors (they differ by one 
blank line).

_Claude Code on behalf of oscerd_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to