asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject asterixdb git commit: No-Issue: TestExecutor enhancements
Date Thu, 20 Jul 2017 04:48:07 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 7d68c6707 -> b38d8f1ac


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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/b38d8f1a
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/b38d8f1a
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/b38d8f1a

Branch: refs/heads/master
Commit: b38d8f1ac039f435788535150c9b881519a34adc
Parents: 7d68c67
Author: Michael Blow <mblow@apache.org>
Authored: Tue Jul 18 18:58:35 2017 -0400
Committer: Till Westmann <tillw@apache.org>
Committed: Wed Jul 19 21:47:48 2017 -0700

----------------------------------------------------------------------
 .../org/apache/asterix/test/common/TestExecutor.java    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/b38d8f1a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
----------------------------------------------------------------------
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.ContentType;
 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,7 +446,7 @@ public class TestExecutor {
     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();
@@ -453,6 +454,10 @@ public class TestExecutor {
         }
     }
 
+    protected HttpContext getHttpContext() {
+        return null;
+    }
+
     protected HttpResponse checkResponse(HttpResponse httpResponse, Predicate<Integer>
responseCodeValidator)
             throws Exception {
         if (!responseCodeValidator.test(httpResponse.getStatusLine().getStatusCode())) {
@@ -1441,9 +1446,8 @@ public class TestExecutor {
             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 @@ public class TestExecutor {
                     }
                     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) {


Mime
View raw message