Fix tests

See gh-15039
pull/16714/head
Madhura Bhave 6 years ago
parent de128fed20
commit e2b15c3f2a

@ -30,9 +30,12 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfi
import org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceAutoConfiguration;
import org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
import static org.assertj.core.api.Assertions.assertThat;
@ -50,6 +53,7 @@ public class JmxEndpointIntegrationTests {
EndpointAutoConfiguration.class, JmxEndpointAutoConfiguration.class,
HealthIndicatorAutoConfiguration.class,
HttpTraceAutoConfiguration.class))
.withUserConfiguration(HttpTraceRepositoryConfiguration.class)
.withPropertyValues("spring.jmx.enabled=true").withConfiguration(
AutoConfigurations.of(EndpointAutoConfigurationClasses.ALL));
@ -138,4 +142,14 @@ public class JmxEndpointIntegrationTests {
}
@Configuration(proxyBeanMethods = false)
public static class HttpTraceRepositoryConfiguration {
@Bean
public InMemoryHttpTraceRepository httpTraceRepository() {
return new InMemoryHttpTraceRepository();
}
}
}

@ -35,6 +35,7 @@ import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagem
import org.springframework.boot.actuate.endpoint.web.EndpointServlet;
import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint;
import org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
@ -45,6 +46,8 @@ import org.springframework.boot.test.context.assertj.AssertableWebApplicationCon
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.test.web.reactive.server.EntityExchangeResult;
@ -79,7 +82,8 @@ public class WebMvcEndpointExposureIntegrationTests {
.withConfiguration(
AutoConfigurations.of(EndpointAutoConfigurationClasses.ALL))
.withUserConfiguration(CustomMvcEndpoint.class,
CustomServletEndpoint.class)
CustomServletEndpoint.class,
HttpTraceRepositoryConfiguration.class)
.withPropertyValues("server.port:0");
@Test
@ -215,4 +219,14 @@ public class WebMvcEndpointExposureIntegrationTests {
}
@Configuration(proxyBeanMethods = false)
public static class HttpTraceRepositoryConfiguration {
@Bean
public InMemoryHttpTraceRepository httpTraceRepository() {
return new InMemoryHttpTraceRepository();
}
}
}

Loading…
Cancel
Save