Merge pull request #31863 from adrianbob

* pr/31863:
  Polish "Disable auto-detection in tests that start Hazelcast"
  Disable auto-detection in tests that start Hazelcast

Closes gh-31863
This commit is contained in:
Stephane Nicoll 2022-07-27 08:37:25 +02:00
commit e92c64f633
8 changed files with 21 additions and 3 deletions

View File

@ -5,6 +5,7 @@
<map name="defaultCache" />
<network>
<join>
<auto-detection enabled="false"/>
<multicast enabled="false"/>
</join>
</network>

View File

@ -6,6 +6,7 @@
<map name="defaultCache" />
<network>
<join>
<auto-detection enabled="false" />
<multicast enabled="false"/>
</join>
</network>

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.hazelcast;
import java.util.Map;
import com.hazelcast.config.Config;
import com.hazelcast.config.JoinConfig;
import com.hazelcast.config.QueueConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
@ -130,7 +131,7 @@ class HazelcastAutoConfigurationServerTests {
@Test
void configInstanceWithName() {
Config config = new Config("my-test-instance");
Config config = createTestConfig("my-test-instance");
HazelcastInstance existing = Hazelcast.newHazelcastInstance(config);
try {
this.contextRunner.withUserConfiguration(HazelcastConfigWithName.class)
@ -164,6 +165,14 @@ class HazelcastAutoConfigurationServerTests {
});
}
private static Config createTestConfig(String instanceName) {
Config config = new Config(instanceName);
JoinConfig join = config.getNetworkConfig().getJoin();
join.getAutoDetectionConfig().setEnabled(false);
join.getMulticastConfig().setEnabled(false);
return config;
}
@Configuration(proxyBeanMethods = false)
static class HazelcastConfigWithName {
@ -179,7 +188,7 @@ class HazelcastAutoConfigurationServerTests {
@Bean
Config anotherHazelcastConfig() {
Config config = new Config();
Config config = createTestConfig("another-test-instance");
config.addQueueConfig(new QueueConfig("another-queue"));
return config;
}

View File

@ -5,6 +5,7 @@
<map name="defaultCache" />
<network>
<join>
<auto-detection enabled="false" />
<multicast enabled="false" />
</join>
</network>

View File

@ -1,5 +1,7 @@
hazelcast:
network:
join:
auto-detection:
enabled: false
multicast:
enabled: false

View File

@ -11,6 +11,7 @@
<network>
<join>
<auto-detection enabled="false" />
<multicast enabled="false"/>
</join>
</network>

View File

@ -1,6 +1,8 @@
hazelcast:
network:
join:
auto-detection:
enabled: false
multicast:
enabled: false

View File

@ -11,6 +11,7 @@
<network>
<join>
<auto-detection enabled="false"/>
<multicast enabled="false"/>
</join>
</network>