Skip to content

Commit

Permalink
Disable schema validation when testing against Hazelcast 3
Browse files Browse the repository at this point in the history
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
  • Loading branch information
wilkinsona committed Jul 27, 2022
1 parent 9184d54 commit a4bafa8
Showing 1 changed file with 14 additions and 1 deletion.
@@ -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.
Expand All @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit a4bafa8

Please sign in to comment.