HazelcastAutoConfigurationTests.java (spring-boot-2.7.3) | : | HazelcastAutoConfigurationTests.java (spring-boot-2.7.4) | ||
---|---|---|---|---|
/* | /* | |||
* 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"); | * Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | |||
* | * | |||
* https://www.apache.org/licenses/LICENSE-2.0 | * https://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
skipping to change at line 48 | skipping to change at line 48 | |||
*/ | */ | |||
class HazelcastAutoConfigurationTests { | class HazelcastAutoConfigurationTests { | |||
private final ApplicationContextRunner contextRunner = new ApplicationCon textRunner() | private final ApplicationContextRunner contextRunner = new ApplicationCon textRunner() | |||
.withConfiguration(AutoConfigurations.of(HazelcastAutoCon figuration.class)); | .withConfiguration(AutoConfigurations.of(HazelcastAutoCon figuration.class)); | |||
@Test | @Test | |||
void defaultConfigFile() { | void defaultConfigFile() { | |||
// no hazelcast-client.xml and hazelcast.xml is present in root c lasspath | // no hazelcast-client.xml and hazelcast.xml is present in root c lasspath | |||
// this also asserts that XML has priority over YAML | // this also asserts that XML has priority over YAML | |||
// as both hazelcast.yaml and hazelcast.xml in test classpath. | // as hazelcast.yaml, hazelcast.yml, and hazelcast.xml are availa ble. | |||
this.contextRunner.run((context) -> { | this.contextRunner.run((context) -> { | |||
Config config = context.getBean(HazelcastInstance.class). getConfig(); | Config config = context.getBean(HazelcastInstance.class). getConfig(); | |||
assertThat(config.getConfigurationUrl()).isEqualTo(new Cl assPathResource("hazelcast.xml").getURL()); | assertThat(config.getConfigurationUrl()).isEqualTo(new Cl assPathResource("hazelcast.xml").getURL()); | |||
}); | }); | |||
} | } | |||
@Test | @Test | |||
void hazelcastInstanceNotCreatedWhenJetIsPresent() { | void hazelcastInstanceNotCreatedWhenJetIsPresent() { | |||
this.contextRunner.withClassLoader(new JetConfigClassLoader()) | this.contextRunner.withClassLoader(new JetConfigClassLoader()) | |||
.run((context) -> assertThat(context).doesNotHave Bean(HazelcastInstance.class)); | .run((context) -> assertThat(context).doesNotHave Bean(HazelcastInstance.class)); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |