davsclaus commented on code in PR #25816: URL: https://github.com/apache/camel/pull/25816#discussion_r3904898392
########## components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastKeyValueRepositoryTest.java: ########## @@ -0,0 +1,298 @@ +/* + * 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.hazelcast; + +import java.time.Duration; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import com.hazelcast.core.Hazelcast; +import com.hazelcast.core.HazelcastInstance; +import com.hazelcast.map.IMap; +import org.apache.camel.test.infra.hazelcast.services.HazelcastService; +import org.apache.camel.test.infra.hazelcast.services.HazelcastServiceFactory; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.RegisterExtension; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +class HazelcastKeyValueRepositoryTest { + + @RegisterExtension + static HazelcastService hazelcastService = HazelcastServiceFactory.createSingletonService(); Review Comment: Minor: this `@RegisterExtension` field is never used elsewhere in the class — the test creates its own instance directly via `Hazelcast.newHazelcastInstance(null)` a few lines below instead of going through `hazelcastService`. The sibling `HazelcastIdempotentRepositoryTest` at least calls `hazelcastService.createConfiguration(...)` to get a `Config` with multicast/auto-detection disabled, avoiding one test's embedded node accidentally joining another's cluster (though that test then also passes `null` to `newHazelcastInstance` instead of the computed config, so the pattern is already a bit inconsistent in the codebase). Consider either wiring this into `createConfiguration(...)` for test isolation, or dropping the unused field. -- 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]
