Merge branch '1.4.x' into 1.5.x
This commit is contained in:
@@ -41,13 +41,10 @@ public class SolrHealthIndicator extends AbstractHealthIndicator {
|
||||
CoreAdminRequest request = new CoreAdminRequest();
|
||||
request.setAction(CoreAdminParams.CoreAdminAction.STATUS);
|
||||
CoreAdminResponse response = request.process(this.solrClient);
|
||||
int status = response.getStatus();
|
||||
if (status == 0) {
|
||||
builder.up().withDetail("solrStatus", "OK");
|
||||
}
|
||||
else {
|
||||
builder.down().withDetail("solrStatus", status);
|
||||
}
|
||||
int statusCode = response.getStatus();
|
||||
Status status = (statusCode == 0 ? Status.UP : Status.DOWN);
|
||||
builder.status(status).withDetail("solrStatus",
|
||||
(statusCode == 0 ? "OK" : statusCode));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
|
||||
add(trace, Include.USER_PRINCIPAL, "userPrincipal",
|
||||
(userPrincipal == null ? null : userPrincipal.getName()));
|
||||
if (isIncluded(Include.PARAMETERS)) {
|
||||
trace.put("parameters", getParameterMap(request));
|
||||
trace.put("parameters", getParameterMapCopy(request));
|
||||
}
|
||||
add(trace, Include.QUERY_STRING, "query", request.getQueryString());
|
||||
add(trace, Include.AUTH_TYPE, "authType", request.getAuthType());
|
||||
@@ -190,10 +190,8 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
|
||||
return value;
|
||||
}
|
||||
|
||||
private Map<String, String[]> getParameterMap(HttpServletRequest request) {
|
||||
Map<String, String[]> map = new LinkedHashMap<String, String[]>();
|
||||
map.putAll(request.getParameterMap());
|
||||
return map;
|
||||
private Map<String, String[]> getParameterMapCopy(HttpServletRequest request) {
|
||||
return new LinkedHashMap<String, String[]>(request.getParameterMap());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@ public class SolrHealthIndicatorTests {
|
||||
public void solrIsUp() throws Exception {
|
||||
SolrClient solrClient = mock(SolrClient.class);
|
||||
given(solrClient.request(any(CoreAdminRequest.class), (String) isNull()))
|
||||
.willReturn(mockResponse(0));
|
||||
.willReturn(mockResponse(0));
|
||||
SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient);
|
||||
Health health = healthIndicator.health();
|
||||
assertThat(health.getStatus()).isEqualTo(Status.UP);
|
||||
@@ -79,7 +79,7 @@ public class SolrHealthIndicatorTests {
|
||||
public void solrIsUpAndRequestFailed() throws Exception {
|
||||
SolrClient solrClient = mock(SolrClient.class);
|
||||
given(solrClient.request(any(CoreAdminRequest.class), (String) isNull()))
|
||||
.willReturn(mockResponse(400));
|
||||
.willReturn(mockResponse(400));
|
||||
SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient);
|
||||
Health health = healthIndicator.health();
|
||||
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
|
||||
@@ -90,7 +90,7 @@ public class SolrHealthIndicatorTests {
|
||||
public void solrIsDown() throws Exception {
|
||||
SolrClient solrClient = mock(SolrClient.class);
|
||||
given(solrClient.request(any(CoreAdminRequest.class), (String) isNull()))
|
||||
.willThrow(new IOException("Connection failed"));
|
||||
.willThrow(new IOException("Connection failed"));
|
||||
SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient);
|
||||
Health health = healthIndicator.health();
|
||||
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
|
||||
|
||||
Reference in New Issue
Block a user