From 782e3f75b6b3565b8d8f0169deca818ca0a0c543 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 27 Jul 2022 08:13:26 +0200 Subject: [PATCH 1/3] Polish Hazelcast configuration This commit updates the XSD to 4.2 and removes the "tcp-ip" network option as it is disabled by default. See gh-31863 --- .../src/test/resources/hazelcast.xml | 3 +-- .../spring-boot-actuator/src/test/resources/hazelcast-3.xml | 1 - .../spring-boot-actuator/src/test/resources/hazelcast.xml | 3 +-- .../spring-boot-autoconfigure/src/test/resources/hazelcast.xml | 3 +-- .../boot/autoconfigure/hazelcast/hazelcast-specific.xml | 3 +-- .../springframework/boot/autoconfigure/session/hazelcast-3.xml | 1 - .../src/main/resources/hazelcast.xml | 1 - .../src/main/resources/hazelcast.xml | 2 +- 8 files changed, 5 insertions(+), 12 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml index cfb3b2e15b0..56f83540403 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml @@ -1,11 +1,10 @@ - diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast-3.xml b/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast-3.xml index 1d6e65e8892..b63c79dc467 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast-3.xml +++ b/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast-3.xml @@ -6,7 +6,6 @@ - diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml b/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml index 56298f8e790..94d867b6709 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml +++ b/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml @@ -1,12 +1,11 @@ + http://www.hazelcast.com/schema/config/hazelcast-config-4.2.xsd"> actuator-hazelcast - diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.xml b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.xml index 4e6920f3174..93c771d2b82 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.xml +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.xml @@ -1,11 +1,10 @@ default-instance - diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml index f5788c2e503..f1a414df8ad 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml @@ -1,4 +1,4 @@ - @@ -11,7 +11,6 @@ - diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/session/hazelcast-3.xml b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/session/hazelcast-3.xml index f8af5591502..dd3b3d7eff4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/session/hazelcast-3.xml +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/session/hazelcast-3.xml @@ -11,7 +11,6 @@ - diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-hazelcast3/src/main/resources/hazelcast.xml b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-hazelcast3/src/main/resources/hazelcast.xml index 4fbcdb0b596..c75a4194dcd 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-hazelcast3/src/main/resources/hazelcast.xml +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-hazelcast3/src/main/resources/hazelcast.xml @@ -14,7 +14,6 @@ - diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml index 4abe5ce1cb9..6781e5a2246 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml @@ -1,7 +1,7 @@ + http://www.hazelcast.com/schema/config/hazelcast-config-4.2.xsd"> From aad9c8906a95cc6e4197127e96d2e5a0e231fc41 Mon Sep 17 00:00:00 2001 From: Adrian Bob Date: Tue, 26 Jul 2022 12:03:59 +0300 Subject: [PATCH 2/3] Disable auto-detection in tests that start Hazelcast This commit updates test configurations to disable auto-detection of Hazelcast instances. See gh-31863 --- .../src/test/resources/hazelcast.xml | 1 + .../spring-boot-actuator/src/test/resources/hazelcast.xml | 1 + .../hazelcast/HazelcastAutoConfigurationServerTests.java | 2 ++ .../spring-boot-autoconfigure/src/test/resources/hazelcast.xml | 1 + .../spring-boot-autoconfigure/src/test/resources/hazelcast.yaml | 2 ++ .../boot/autoconfigure/hazelcast/hazelcast-specific.xml | 1 + .../boot/autoconfigure/hazelcast/hazelcast-specific.yaml | 2 ++ 7 files changed, 10 insertions(+) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml index 56f83540403..6cceb714af2 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml @@ -5,6 +5,7 @@ + diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml b/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml index 94d867b6709..592e5a10f3a 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml +++ b/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml @@ -6,6 +6,7 @@ + diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java index 3856dc99416..143641b961b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java @@ -131,6 +131,7 @@ class HazelcastAutoConfigurationServerTests { @Test void configInstanceWithName() { Config config = new Config("my-test-instance"); + config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false); HazelcastInstance existing = Hazelcast.newHazelcastInstance(config); try { this.contextRunner.withUserConfiguration(HazelcastConfigWithName.class) @@ -180,6 +181,7 @@ class HazelcastAutoConfigurationServerTests { @Bean Config anotherHazelcastConfig() { Config config = new Config(); + config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false); config.addQueueConfig(new QueueConfig("another-queue")); return config; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.xml b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.xml index 93c771d2b82..c3306dee24b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.xml +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.xml @@ -5,6 +5,7 @@ + diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.yaml b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.yaml index 1616ba2e78f..686d75638a9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.yaml +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/hazelcast.yaml @@ -1,5 +1,7 @@ hazelcast: network: join: + auto-detection: + enabled: false multicast: enabled: false diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml index f1a414df8ad..faca67f0fa5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml @@ -11,6 +11,7 @@ + diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yaml b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yaml index 614e99777ae..933c34ffd0c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yaml +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/resources/org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.yaml @@ -1,6 +1,8 @@ hazelcast: network: join: + auto-detection: + enabled: false multicast: enabled: false From 59139e632b88659b39744819d7b5751305b870f2 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 27 Jul 2022 08:11:24 +0200 Subject: [PATCH 3/3] Polish "Disable auto-detection in tests that start Hazelcast" See gh-31863 --- .../HazelcastAutoConfigurationServerTests.java | 17 ++++++++++++----- .../src/main/resources/hazelcast.xml | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java index 143641b961b..a1b92afa59d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastAutoConfigurationServerTests.java @@ -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,8 +131,7 @@ class HazelcastAutoConfigurationServerTests { @Test void configInstanceWithName() { - Config config = new Config("my-test-instance"); - config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false); + Config config = createTestConfig("my-test-instance"); HazelcastInstance existing = Hazelcast.newHazelcastInstance(config); try { this.contextRunner.withUserConfiguration(HazelcastConfigWithName.class) @@ -165,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 { @@ -180,8 +188,7 @@ class HazelcastAutoConfigurationServerTests { @Bean Config anotherHazelcastConfig() { - Config config = new Config(); - config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false); + Config config = createTestConfig("another-test-instance"); config.addQueueConfig(new QueueConfig("another-queue")); return config; } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml index 6781e5a2246..608cf7d9b0f 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-hazelcast/src/main/resources/hazelcast.xml @@ -11,6 +11,7 @@ +