use of org.springframework.boot.context.properties.source.MapConfigurationPropertySource in project spring-boot by spring-projects.
the class ProfilesTests method getDefaultWhenNoEnvironmentProfilesAndBinderProperty.
@Test
void getDefaultWhenNoEnvironmentProfilesAndBinderProperty() {
Environment environment = new MockEnvironment();
Binder binder = new Binder(new MapConfigurationPropertySource(Collections.singletonMap("spring.profiles.default", "a,b,c")));
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getDefault()).containsExactly("a", "b", "c");
}
use of org.springframework.boot.context.properties.source.MapConfigurationPropertySource in project spring-boot by spring-projects.
the class ProfilesTests method getDefaultWhenEnvironmentProfilesAndBinderProperty.
@Test
void getDefaultWhenEnvironmentProfilesAndBinderProperty() {
MockEnvironment environment = new MockEnvironment();
environment.setDefaultProfiles("a", "b", "c");
Binder binder = new Binder(new MapConfigurationPropertySource(Collections.singletonMap("spring.profiles.default", "d,e,f")));
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getDefault()).containsExactly("a", "b", "c");
}
use of org.springframework.boot.context.properties.source.MapConfigurationPropertySource in project spring-boot by spring-projects.
the class ConfigDataPropertiesTests method isActiveAgainstBoundDataWhenProfilesDontMatch.
@Test
void isActiveAgainstBoundDataWhenProfilesDontMatch() {
MapConfigurationPropertySource source = new MapConfigurationPropertySource();
source.put("spring.config.activate.on-cloud-platform", "kubernetes");
source.put("spring.config.activate.on-profile", "x | z");
Binder binder = new Binder(source);
ConfigDataProperties properties = ConfigDataProperties.get(binder);
ConfigDataActivationContext context = new ConfigDataActivationContext(CloudPlatform.KUBERNETES, createTestProfiles());
assertThat(properties.isActive(context)).isFalse();
}
use of org.springframework.boot.context.properties.source.MapConfigurationPropertySource in project spring-boot by spring-projects.
the class ConfigDataPropertiesTests method isActiveWhenBindingToLegacyProperty.
@Test
void isActiveWhenBindingToLegacyProperty() {
MapConfigurationPropertySource source = new MapConfigurationPropertySource();
source.put("spring.profiles", "a,b");
Binder binder = new Binder(source);
ConfigDataProperties properties = ConfigDataProperties.get(binder);
ConfigDataActivationContext context = new ConfigDataActivationContext(CloudPlatform.KUBERNETES, createTestProfiles());
assertThat(properties.isActive(context)).isTrue();
}
use of org.springframework.boot.context.properties.source.MapConfigurationPropertySource in project spring-boot by spring-projects.
the class ConfigDataPropertiesTests method isActiveAgainstBoundData.
@Test
void isActiveAgainstBoundData() {
MapConfigurationPropertySource source = new MapConfigurationPropertySource();
source.put("spring.config.activate.on-cloud-platform", "kubernetes");
source.put("spring.config.activate.on-profile", "a | b");
Binder binder = new Binder(source);
ConfigDataProperties properties = ConfigDataProperties.get(binder);
ConfigDataActivationContext context = new ConfigDataActivationContext(CloudPlatform.KUBERNETES, createTestProfiles());
assertThat(properties.isActive(context)).isTrue();
}
Aggregations