Migrate Hazelcast 3 sanity tests to Hazelcast 4

Closes gh-31881
This commit is contained in:
Stephane Nicoll
2022-07-27 09:09:03 +02:00
parent bfc703a40d
commit 9cb614c626
7 changed files with 67 additions and 41 deletions

View File

@@ -40,18 +40,18 @@ import static org.mockito.Mockito.mock;
* @author Stephane Nicoll
*/
@ClassPathExclusions("hazelcast*.jar")
@ClassPathOverrides("com.hazelcast:hazelcast:3.12.12")
class Hazelcast3HazelcastHealthIndicatorTests {
@ClassPathOverrides("com.hazelcast:hazelcast:4.2.5")
class Hazelcast4HazelcastHealthIndicatorTests {
@Test
void hazelcastUp() {
new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class))
.withPropertyValues("spring.hazelcast.config=hazelcast-3.xml").run((context) -> {
.withPropertyValues("spring.hazelcast.config=hazelcast-4.xml").run((context) -> {
HazelcastInstance hazelcast = context.getBean(HazelcastInstance.class);
Health health = new HazelcastHealthIndicator(hazelcast).health();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails()).containsOnlyKeys("name", "uuid").containsEntry("name",
"actuator-hazelcast-3");
"actuator-hazelcast-4");
assertThat(health.getDetails().get("uuid")).asString().isNotEmpty();
});
}

View File

@@ -1,12 +1,12 @@
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.12.xsd">
<instance-name>actuator-hazelcast-3</instance-name>
http://www.hazelcast.com/schema/config/hazelcast-config-4.2.xsd">
<instance-name>actuator-hazelcast-4</instance-name>
<map name="defaultCache"/>
<network>
<join>
<tcp-ip enabled="false"/>
<auto-detection enabled="false"/>
<multicast enabled="false"/>
</join>
</network>