Renames environmentWebEndpointExtension to environmentEndpointWebExtension.
This matches boot, even though the boot bean shouldn't be created because of a @ConditionalOnMissingBean see gh-374
This commit is contained in:
@@ -38,7 +38,7 @@ public class LifecycleMvcAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void environmentWebEndpointExtensionEnabled() {
|
||||
beanCreated("environmentWebEndpointExtension",
|
||||
beanCreated("environmentEndpointWebExtension",
|
||||
"management.endpoint.env.enabled=true");
|
||||
}
|
||||
|
||||
|
||||
@@ -24,23 +24,26 @@ import javax.servlet.ServletException;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
|
||||
import org.springframework.boot.actuate.env.EnvironmentEndpoint;
|
||||
import org.springframework.boot.actuate.env.EnvironmentEndpointWebExtension;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.context.environment.EnvironmentManagerIntegrationTests.TestConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
@@ -64,6 +67,9 @@ public class EnvironmentManagerIntegrationTests {
|
||||
@Autowired
|
||||
private MockMvc mvc;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void testRefresh() throws Exception {
|
||||
assertEquals("Hello scope!", properties.getMessage());
|
||||
@@ -108,6 +114,21 @@ public class EnvironmentManagerIntegrationTests {
|
||||
.andExpect(status().isNotFound());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void environmentBeansConfiguredCorrectly() {
|
||||
Map<String, EnvironmentEndpoint> envbeans = this.context.getBeansOfType(EnvironmentEndpoint.class);
|
||||
assertThat(envbeans).hasSize(1)
|
||||
.containsKey("environmentEndpoint");
|
||||
assertThat(envbeans.get("environmentEndpoint"))
|
||||
.isInstanceOf(WritableEnvironmentEndpoint.class);
|
||||
|
||||
Map<String, EnvironmentEndpointWebExtension> extbeans = this.context.getBeansOfType(EnvironmentEndpointWebExtension.class);
|
||||
assertThat(extbeans).hasSize(1)
|
||||
.containsKey("environmentEndpointWebExtension");
|
||||
assertThat(extbeans.get("environmentEndpointWebExtension"))
|
||||
.isInstanceOf(WritableEnvironmentEndpointWebExtension.class);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
protected static class TestConfiguration {
|
||||
|
||||
Reference in New Issue
Block a user