From a4bafa88bc167eaff7e0cbf7bfe36da742db2b15 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 27 Jul 2022 18:29:54 +0100 Subject: [PATCH] Disable schema validation when testing against Hazelcast 3 We have hazelcast configuration files that are used with multiple versions of Hazelcast. Version 3's scheme doesn't allow us to set . To work around this, we configure a system property that causes Hazelcast to disable schema validation. See gh-38163 --- .../Hazelcast3AutoConfigurationTests.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/Hazelcast3AutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/Hazelcast3AutoConfigurationTests.java index 1478cb35c725..59e646809e68 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/Hazelcast3AutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/Hazelcast3AutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 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. @@ -20,7 +20,10 @@ import com.hazelcast.config.Config; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; +import com.hazelcast.instance.BuildInfoProvider; import org.assertj.core.api.Condition; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -45,6 +48,16 @@ class Hazelcast3AutoConfigurationTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class)); + @BeforeEach + void setHazelcastVersionOverride() { + System.setProperty(BuildInfoProvider.HAZELCAST_INTERNAL_OVERRIDE_VERSION, "3.12.8"); + } + + @AfterEach + void clearHazelcastVersionOverride() { + System.clearProperty(BuildInfoProvider.HAZELCAST_INTERNAL_OVERRIDE_VERSION); + } + @Test void defaultConfigFile() { // no hazelcast-client.xml and hazelcast.xml is present in root classpath