Skip to content

Commit a4bafa8

Browse files
committed
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 <auto-detection enabled="false" />. To work around this, we configure a system property that causes Hazelcast to disable schema validation. See gh-38163
1 parent 9184d54 commit a4bafa8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/Hazelcast3AutoConfigurationTests.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,10 @@
2020
import com.hazelcast.config.Config;
2121
import com.hazelcast.core.Hazelcast;
2222
import com.hazelcast.core.HazelcastInstance;
23+
import com.hazelcast.instance.BuildInfoProvider;
2324
import org.assertj.core.api.Condition;
25+
import org.junit.jupiter.api.AfterEach;
26+
import org.junit.jupiter.api.BeforeEach;
2427
import org.junit.jupiter.api.Test;
2528

2629
import org.springframework.boot.autoconfigure.AutoConfigurations;
@@ -45,6 +48,16 @@ class Hazelcast3AutoConfigurationTests {
4548
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
4649
.withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class));
4750

51+
@BeforeEach
52+
void setHazelcastVersionOverride() {
53+
System.setProperty(BuildInfoProvider.HAZELCAST_INTERNAL_OVERRIDE_VERSION, "3.12.8");
54+
}
55+
56+
@AfterEach
57+
void clearHazelcastVersionOverride() {
58+
System.clearProperty(BuildInfoProvider.HAZELCAST_INTERNAL_OVERRIDE_VERSION);
59+
}
60+
4861
@Test
4962
void defaultConfigFile() {
5063
// no hazelcast-client.xml and hazelcast.xml is present in root classpath

0 commit comments

Comments
 (0)