use of org.springframework.boot.actuate.env.EnvironmentEndpoint.PropertySourceDescriptor in project spring-boot by spring-projects.
the class EnvironmentEndpointTests method basicResponse.
@Test
void basicResponse() {
ConfigurableEnvironment environment = emptyEnvironment();
environment.getPropertySources().addLast(singleKeyPropertySource("one", "my.key", "first"));
environment.getPropertySources().addLast(singleKeyPropertySource("two", "my.key", "second"));
EnvironmentDescriptor descriptor = new EnvironmentEndpoint(environment).environment(null);
assertThat(descriptor.getActiveProfiles()).isEmpty();
Map<String, PropertySourceDescriptor> sources = propertySources(descriptor);
assertThat(sources.keySet()).containsExactly("one", "two");
assertThat(sources.get("one").getProperties()).containsOnlyKeys("my.key");
assertThat(sources.get("two").getProperties()).containsOnlyKeys("my.key");
}
use of org.springframework.boot.actuate.env.EnvironmentEndpoint.PropertySourceDescriptor in project spring-boot by spring-projects.
the class EnvironmentEndpointTests method multipleSourcesWithSameProperty.
@Test
void multipleSourcesWithSameProperty() {
ConfigurableEnvironment environment = emptyEnvironment();
environment.getPropertySources().addFirst(singleKeyPropertySource("one", "a", "alpha"));
environment.getPropertySources().addFirst(singleKeyPropertySource("two", "a", "apple"));
EnvironmentDescriptor descriptor = new EnvironmentEndpoint(environment).environment(null);
Map<String, PropertySourceDescriptor> sources = propertySources(descriptor);
assertThat(sources.keySet()).containsExactly("two", "one");
assertThat(sources.get("one").getProperties().get("a").getValue()).isEqualTo("alpha");
assertThat(sources.get("two").getProperties().get("a").getValue()).isEqualTo("apple");
}
use of org.springframework.boot.actuate.env.EnvironmentEndpoint.PropertySourceDescriptor in project spring-boot by spring-projects.
the class EnvironmentEndpointTests method compositeSourceIsHandledCorrectly.
@Test
void compositeSourceIsHandledCorrectly() {
ConfigurableEnvironment environment = emptyEnvironment();
CompositePropertySource source = new CompositePropertySource("composite");
source.addPropertySource(new MapPropertySource("one", Collections.singletonMap("foo", "bar")));
source.addPropertySource(new MapPropertySource("two", Collections.singletonMap("foo", "spam")));
environment.getPropertySources().addFirst(source);
EnvironmentDescriptor descriptor = new EnvironmentEndpoint(environment).environment(null);
Map<String, PropertySourceDescriptor> sources = propertySources(descriptor);
assertThat(sources.keySet()).containsExactly("composite:one", "composite:two");
assertThat(sources.get("composite:one").getProperties().get("foo").getValue()).isEqualTo("bar");
assertThat(sources.get("composite:two").getProperties().get("foo").getValue()).isEqualTo("spam");
}
Aggregations