[ 
https://issues.apache.org/jira/browse/CAMEL-24420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea Cosentino updated CAMEL-24420:
-------------------------------------
    Description: 
CAMEL-23414 added {{HazelcastSerializationFilterHelper.applyDefault(Config)}} 
and applied it to the Hazelcast configurations that Camel builds itself, i.e. 
when the user supplies neither a {{Config}} nor a {{HazelcastInstance}}. 
CAMEL-24413 then covered 
{{ReplicatedHazelcastAggregationRepository#doStart()}}, which had been missed 
because it overrides {{doStart()}} without calling {{super.doStart()}}.

One Camel-built configuration path is still not covered.

h4. HazelcastDefaultComponent#getOrCreateHzClientInstance()

With {{hazelcastMode=client}}, and when neither a referenced {{ClientConfig}} 
nor {{hazelcastConfigUri}} is supplied, Camel builds {{new 
XmlClientConfigBuilder().build()}} and creates the client without applying a 
default filter. The node-mode counterpart {{getOrCreateHzInstance()}} does 
apply it on the equivalent branch, so the two modes behave differently for an 
otherwise identical endpoint configuration.

{{ClientConfig}} exposes the same {{SerializationConfig}} as {{Config}}, so the 
helper needs a {{ClientConfig}} overload.

h4. Proposed change

* Add an {{applyDefault(ClientConfig)}} overload to 
{{HazelcastSerializationFilterHelper}}, sharing the existing logic.
* Call it on the Camel-built branch of {{getOrCreateHzClientInstance()}}, 
mirroring {{getOrCreateHzInstance()}}.
* Extend {{HazelcastSerializationFilterHelperTest}} to cover the new overload.
* Update the upgrade guide.

As established by CAMEL-23414, a user-supplied {{Config}}/{{ClientConfig}} or a 
pre-built {{HazelcastInstance}} is left untouched.

  was:
CAMEL-23414 added {{HazelcastSerializationFilterHelper.applyDefault(Config)}} 
and applied it to the Hazelcast configurations that Camel builds itself, i.e. 
when the user supplies neither a {{Config}} nor a {{HazelcastInstance}}. Two 
Camel-built configuration paths were not covered and are therefore inconsistent 
with the behaviour documented in the 4.21 upgrade guide.

h4. 1. ReplicatedHazelcastAggregationRepository#doStart()

The class extends {{HazelcastAggregationRepository}} but overrides 
{{doStart()}} with its own copy of the bootstrap block rather than delegating 
to the parent, so it did not pick up the parent's change. It builds {{new 
XmlConfigBuilder().build()}} and calls {{Hazelcast.newHazelcastInstance(cfg)}} 
without {{applyDefault(cfg)}}, while 
{{HazelcastAggregationRepository#doStart()}} does call it.

h4. 2. HazelcastDefaultComponent#getOrCreateHzClientInstance()

With {{hazelcastMode=client}}, and when neither a referenced {{ClientConfig}} 
nor {{hazelcastConfigUri}} is supplied, Camel builds {{new 
XmlClientConfigBuilder().build()}} and creates the client without applying a 
default filter. {{ClientConfig}} exposes the same {{SerializationConfig}}, so 
the helper needs a {{ClientConfig}} overload.

h4. Proposed change

* Call {{HazelcastSerializationFilterHelper.applyDefault(cfg)}} in 
{{ReplicatedHazelcastAggregationRepository#doStart()}} before 
{{Hazelcast.newHazelcastInstance(cfg)}}, matching the parent class.
* Add an {{applyDefault(ClientConfig)}} overload and call it on the Camel-built 
branch of {{getOrCreateHzClientInstance()}}.
* Extend {{HazelcastSerializationFilterHelperTest}} to cover both.
* Update the upgrade guide, which currently lists only the paths covered by 
CAMEL-23414.

As established by CAMEL-23414, a user-supplied {{Config}}/{{ClientConfig}} or a 
pre-built {{HazelcastInstance}} is left untouched.

Applies to main and the camel-4.22.x, camel-4.18.x and camel-4.14.x branches.

        Summary: camel-hazelcast: Apply the default 
JavaSerializationFilterConfig to Camel-built client configurations  (was: 
camel-hazelcast: Apply the default JavaSerializationFilterConfig to the 
remaining Camel-built configurations)

> camel-hazelcast: Apply the default JavaSerializationFilterConfig to 
> Camel-built client configurations
> -----------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24420
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24420
>             Project: Camel
>          Issue Type: Task
>          Components: camel-hazelcast
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Major
>
> CAMEL-23414 added {{HazelcastSerializationFilterHelper.applyDefault(Config)}} 
> and applied it to the Hazelcast configurations that Camel builds itself, i.e. 
> when the user supplies neither a {{Config}} nor a {{HazelcastInstance}}. 
> CAMEL-24413 then covered 
> {{ReplicatedHazelcastAggregationRepository#doStart()}}, which had been missed 
> because it overrides {{doStart()}} without calling {{super.doStart()}}.
> One Camel-built configuration path is still not covered.
> h4. HazelcastDefaultComponent#getOrCreateHzClientInstance()
> With {{hazelcastMode=client}}, and when neither a referenced {{ClientConfig}} 
> nor {{hazelcastConfigUri}} is supplied, Camel builds {{new 
> XmlClientConfigBuilder().build()}} and creates the client without applying a 
> default filter. The node-mode counterpart {{getOrCreateHzInstance()}} does 
> apply it on the equivalent branch, so the two modes behave differently for an 
> otherwise identical endpoint configuration.
> {{ClientConfig}} exposes the same {{SerializationConfig}} as {{Config}}, so 
> the helper needs a {{ClientConfig}} overload.
> h4. Proposed change
> * Add an {{applyDefault(ClientConfig)}} overload to 
> {{HazelcastSerializationFilterHelper}}, sharing the existing logic.
> * Call it on the Camel-built branch of {{getOrCreateHzClientInstance()}}, 
> mirroring {{getOrCreateHzInstance()}}.
> * Extend {{HazelcastSerializationFilterHelperTest}} to cover the new overload.
> * Update the upgrade guide.
> As established by CAMEL-23414, a user-supplied {{Config}}/{{ClientConfig}} or 
> a pre-built {{HazelcastInstance}} is left untouched.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to