Till Westmann has submitted this change and it was merged. Change subject: No-Issue: TestExecutor enhancements ......................................................................
No-Issue: TestExecutor enhancements - add ability to pass an http context to http executions - update cluster state wait from exact match to regex Change-Id: Ib3a33c9f5bda8211d404c6d2155b2c1d2ea078b9 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1884 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> BAD: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Till Westmann <[email protected]> --- M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java 1 file changed, 8 insertions(+), 4 deletions(-) Approvals: Till Westmann: Looks good to me, approved Jenkins: Verified; No violations found; No violations found; Verified diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java index 8791756..8442162 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java @@ -81,6 +81,7 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.StandardHttpRequestRetryHandler; +import org.apache.http.protocol.HttpContext; import org.apache.http.util.EntityUtils; import org.apache.hyracks.util.StorageUtil; import org.junit.Assert; @@ -445,12 +446,16 @@ protected HttpResponse executeHttpRequest(HttpUriRequest method) throws Exception { HttpClient client = HttpClients.custom().setRetryHandler(StandardHttpRequestRetryHandler.INSTANCE).build(); try { - return client.execute(method); + return client.execute(method, getHttpContext()); } catch (Exception e) { GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, e.getMessage(), e); e.printStackTrace(); throw e; } + } + + protected HttpContext getHttpContext() { + return null; } protected HttpResponse checkResponse(HttpResponse httpResponse, Predicate<Integer> responseCodeValidator) @@ -1441,9 +1446,8 @@ while (true) { try { final HttpClient client = HttpClients.createDefault(); - final HttpGet get = new HttpGet(getEndpoint(Servlets.CLUSTER_STATE)); - final HttpResponse httpResponse = client.execute(get); + final HttpResponse httpResponse = client.execute(get, getHttpContext()); final int statusCode = httpResponse.getStatusLine().getStatusCode(); final String response = EntityUtils.toString(httpResponse.getEntity()); if (statusCode != HttpStatus.SC_OK) { @@ -1451,7 +1455,7 @@ } ObjectMapper om = new ObjectMapper(); ObjectNode result = (ObjectNode) om.readTree(response); - if (desiredState.equals(result.get("state").asText())) { + if (result.get("state").asText().matches(desiredState)) { break; } } catch (Exception e) { -- To view, visit https://asterix-gerrit.ics.uci.edu/1884 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib3a33c9f5bda8211d404c6d2155b2c1d2ea078b9 Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael Blow <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]>
