Updates for changes to boot 2

parent 2be1fb51
......@@ -16,7 +16,6 @@
package org.springframework.cloud.netflix.hystrix;
import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect;
import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.servlet.ManagementServletContext;
import org.springframework.boot.actuate.health.Health;
......@@ -29,6 +28,7 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.actuator.HasFeatures;
import org.springframework.context.annotation.Bean;
import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
/**
......@@ -55,7 +55,7 @@ class HystrixManagementContextConfiguration {
@Bean
public ServletRegistrationBean<HystrixMetricsStreamServlet> hystrixMetricsStreamServlet() {
String path = this.managementServletContext.getContextPath()
String path = this.managementServletContext.getServletPath()
+ this.properties.getPath();
String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
ServletRegistrationBean<HystrixMetricsStreamServlet> registration = new ServletRegistrationBean<>(
......
......@@ -96,7 +96,7 @@ public class HystrixOnlyTests {
private Map getHealth() {
return new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/admin/health", HttpMethod.GET,
"http://localhost:" + this.port + "/application/health", HttpMethod.GET,
new HttpEntity<Void>(createBasicAuthHeader(USER, PASSWORD)),
Map.class).getBody();
}
......
......@@ -76,7 +76,7 @@ public class HystrixStreamEndpointTests {
String.class);
assertEquals("bad response code", HttpStatus.OK, response.getStatusCode());
URL hystrixUrl = new URL(url + "/admin/hystrix.stream");
URL hystrixUrl = new URL(url + "/application/hystrix.stream");
List<String> data = new ArrayList<>();
for (int i = 0; i < 5; i++) {
......
......@@ -39,7 +39,7 @@ import org.springframework.security.provisioning.InMemoryUserDetailsManager;
public class TestAutoConfiguration {
public static final String USER = "user";
public static final String PASSWORD = "password";
public static final String PASSWORD = "{noop}password";
@Configuration
@Order(Ordered.HIGHEST_PRECEDENCE)
......
......@@ -35,8 +35,6 @@ badClients:
ribbon:
MaxAutoRetriesNextServer: 10
ReadTimeout: 200
management:
context-path: /admin
endpoints:
health:
sensitive: false
......
......@@ -142,7 +142,7 @@ public class EurekaServerMockApplication {
@Bean
public UserDetailsService userDetailsService() {
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
manager.createUser(User.withUsername("test").password("test").roles("USER").build());
manager.createUser(User.withUsername("test").password("{noop}test").roles("USER").build());
return manager;
}
......
......@@ -104,12 +104,6 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-restassured</artifactId>
<scope>test</scope>
......
......@@ -18,14 +18,14 @@ package org.springframework.cloud.netflix.eureka.server.doc;
import java.util.UUID;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.filter.Filter;
import com.jayway.restassured.specification.RequestSpecification;
import com.netflix.appinfo.ApplicationInfoManager;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.eureka.registry.PeerAwareInstanceRegistryImpl;
import io.restassured.RestAssured;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.filter.Filter;
import io.restassured.specification.RequestSpecification;
import org.junit.After;
import org.junit.Rule;
import org.junit.runner.RunWith;
......@@ -42,8 +42,8 @@ import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.cloud.netflix.eureka.server.doc.AbstractDocumentationTests.Application;
import org.springframework.context.annotation.Configuration;
import org.springframework.restdocs.JUnitRestDocumentation;
import org.springframework.restdocs.restassured.RestAssuredRestDocumentation;
import org.springframework.restdocs.restassured.RestDocumentationFilter;
import org.springframework.restdocs.restassured3.RestAssuredRestDocumentation;
import org.springframework.restdocs.restassured3.RestDocumentationFilter;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.util.ReflectionTestUtils;
......@@ -51,8 +51,8 @@ import org.springframework.test.util.ReflectionTestUtils;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
import static org.springframework.restdocs.restassured.RestAssuredRestDocumentation.documentationConfiguration;
import static org.springframework.restdocs.restassured.operation.preprocess.RestAssuredPreprocessors.modifyUris;
import static org.springframework.restdocs.restassured3.RestAssuredRestDocumentation.documentationConfiguration;
import static org.springframework.restdocs.restassured3.operation.preprocess.RestAssuredPreprocessors.modifyUris;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
......
......@@ -20,12 +20,12 @@ import java.io.IOException;
import javax.ws.rs.core.MediaType;
import com.jayway.restassured.mapper.ObjectMapperDeserializationContext;
import com.jayway.restassured.mapper.ObjectMapperSerializationContext;
import com.netflix.discovery.converters.EntityBodyConverter;
import io.restassured.mapper.ObjectMapperDeserializationContext;
import io.restassured.mapper.ObjectMapperSerializationContext;
final class EurekaObjectMapper
implements com.jayway.restassured.mapper.ObjectMapper {
implements io.restassured.mapper.ObjectMapper {
private EntityBodyConverter converter = new EntityBodyConverter();
@Override
......
......@@ -35,13 +35,13 @@ import com.github.tomakehurst.wiremock.http.RequestMethod;
import com.github.tomakehurst.wiremock.matching.MatchResult;
import com.github.tomakehurst.wiremock.stubbing.StubMapping;
import com.jayway.jsonpath.JsonPath;
import com.jayway.restassured.filter.Filter;
import com.jayway.restassured.filter.FilterContext;
import com.jayway.restassured.response.Header;
import com.jayway.restassured.response.Response;
import com.jayway.restassured.specification.FilterableRequestSpecification;
import com.jayway.restassured.specification.FilterableResponseSpecification;
import io.restassured.filter.Filter;
import io.restassured.filter.FilterContext;
import io.restassured.http.Header;
import io.restassured.response.Response;
import io.restassured.specification.FilterableRequestSpecification;
import io.restassured.specification.FilterableResponseSpecification;
import org.springframework.util.Base64Utils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
......@@ -87,7 +87,7 @@ public class RequestVerifierFilter implements Filter {
@Override
public Response filter(FilterableRequestSpecification requestSpec,
FilterableResponseSpecification responseSpec, FilterContext context) {
FilterableResponseSpecification responseSpec, FilterContext context) {
Map<String, Object> configuration = getConfiguration(requestSpec, context);
configuration.put("contract.jsonPaths", this.jsonPaths.keySet());
Response response = context.next(requestSpec, responseSpec);
......@@ -213,7 +213,7 @@ class WireMockRestAssuredRequestAdapter implements Request {
@Override
public RequestMethod getMethod() {
return RequestMethod.fromString(request.getMethod().name());
return RequestMethod.fromString(request.getMethod());
}
@Override
......@@ -282,7 +282,7 @@ class WireMockRestAssuredRequestAdapter implements Request {
@Override
public Map<String, Cookie> getCookies() {
Map<String, Cookie> map = new LinkedHashMap<>();
for (com.jayway.restassured.response.Cookie cookie : request.getCookies()) {
for (io.restassured.http.Cookie cookie : request.getCookies()) {
Cookie value = new Cookie(cookie.getValue());
map.put(cookie.getName(), value);
}
......
......@@ -63,13 +63,13 @@ public class RoutesEndpointIntegrationTests {
@Test
public void getRoutesTest() {
Map<String, String> routes = restTemplate.getForObject("/admin/routes", Map.class);
Map<String, String> routes = restTemplate.getForObject("/application/routes", Map.class);
assertEquals("https://localhost:8443", routes.get("/sslservice/**"));
}
@Test
public void postRoutesTest() {
Map<String, String> routes = restTemplate.postForObject("/admin/routes", null, Map.class);
Map<String, String> routes = restTemplate.postForObject("/application/routes", null, Map.class);
assertEquals("https://localhost:8443", routes.get("/sslservice/**"));
assertTrue(refreshListener.wasCalled());
}
......@@ -77,7 +77,7 @@ public class RoutesEndpointIntegrationTests {
@Test
public void getRouteDetailsTest() {
ResponseEntity<Map<String, RoutesEndpoint.RouteDetails>> responseEntity = restTemplate.exchange(
"/admin/routes/details", HttpMethod.GET, null, new ParameterizedTypeReference<Map<String, RoutesEndpoint.RouteDetails>>() {
"/application/routes/details", HttpMethod.GET, null, new ParameterizedTypeReference<Map<String, RoutesEndpoint.RouteDetails>>() {
});
assertThat(responseEntity.getStatusCode(), is(HttpStatus.OK));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment