Michael Blow has submitted this change and it was merged. Change subject: Update Commons-Httpclient Dep, Misc Cleanup ......................................................................
Update Commons-Httpclient Dep, Misc Cleanup Change-Id: Iaab8930ddf69a3202a6e7efff3533bfec8cff6c5 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1053 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Till Westmann <[email protected]> --- M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java M asterixdb/asterix-app/pom.xml M asterixdb/asterix-common/pom.xml M asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java M asterixdb/asterix-experiments/pom.xml M asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/client/SyntheticDataGeneratorForSpatialIndexEvaluation.java M asterixdb/asterix-metadata/pom.xml M asterixdb/asterix-tools/pom.xml M asterixdb/asterix-yarn/pom.xml M hyracks-fullstack/hyracks/hyracks-api/pom.xml M hyracks-fullstack/hyracks/hyracks-server/pom.xml M hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java 12 files changed, 99 insertions(+), 253 deletions(-) Approvals: Till Westmann: Looks good to me, approved Jenkins: Verified; No violations found; Verified diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java index ed489e5..a162209 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggregateIntoGroupbyRule.java @@ -24,13 +24,10 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; import org.apache.asterix.om.functions.AsterixBuiltinFunctions; import org.apache.commons.lang3.mutable.Mutable; import org.apache.commons.lang3.mutable.MutableObject; -import org.apache.hadoop.yarn.webapp.hamlet.HamletSpec; import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.algebricks.common.utils.Pair; import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression; diff --git a/asterixdb/asterix-app/pom.xml b/asterixdb/asterix-app/pom.xml index b06a03e..c2de29a 100644 --- a/asterixdb/asterix-app/pom.xml +++ b/asterixdb/asterix-app/pom.xml @@ -237,13 +237,6 @@ </dependency> <dependency> <groupId>org.apache.asterix</groupId> - <artifactId>asterix-tools</artifactId> - <version>${project.version}</version> - <type>jar</type> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.asterix</groupId> <artifactId>asterix-common</artifactId> <version>${project.version}</version> <type>jar</type> @@ -271,27 +264,9 @@ </dependency> <dependency> <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-client</artifactId> - </dependency> - <dependency> - <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-hdfs</artifactId> <type>jar</type> <scope>provided</scope> - </dependency> - <dependency> - <groupId>xerces</groupId> - <artifactId>xercesImpl</artifactId> - <version>2.9.1</version> - <type>jar</type> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>xalan</groupId> - <artifactId>xalan</artifactId> - <version>2.7.1</version> - <type>jar</type> - <scope>test</scope> </dependency> <dependency> <groupId>org.apache.asterix</groupId> diff --git a/asterixdb/asterix-common/pom.xml b/asterixdb/asterix-common/pom.xml index 5542186..ab511fb 100644 --- a/asterixdb/asterix-common/pom.xml +++ b/asterixdb/asterix-common/pom.xml @@ -180,9 +180,9 @@ <artifactId>commons-io</artifactId> </dependency> <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>3.0.1</version> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.5.2</version> </dependency> <dependency> <groupId>org.apache.hyracks</groupId> diff --git a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java index 58c6a91..fb1c69a 100644 --- a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java +++ b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java @@ -46,21 +46,19 @@ import org.apache.asterix.testframework.context.TestCaseContext; import org.apache.asterix.testframework.context.TestCaseContext.OutputFormat; import org.apache.asterix.testframework.context.TestFileContext; -import org.apache.asterix.testframework.xml.TestCase; import org.apache.asterix.testframework.xml.TestCase.CompilationUnit; import org.apache.asterix.testframework.xml.TestGroup; -import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpMethod; -import org.apache.commons.httpclient.HttpMethodBase; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.NameValuePair; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.StringRequestEntity; -import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.mutable.MutableInt; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.client.methods.RequestBuilder; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.client.StandardHttpRequestRetryHandler; +import org.apache.http.util.EntityUtils; import org.json.JSONObject; public class TestExecutor { @@ -252,49 +250,54 @@ } } - private int executeHttpMethod(HttpMethod method) throws Exception { - HttpClient client = new HttpClient(); - int statusCode; + private HttpResponse executeHttpRequest(HttpUriRequest method) throws Exception { + HttpClient client = HttpClients.custom() + .setRetryHandler(StandardHttpRequestRetryHandler.INSTANCE) + .build(); + HttpResponse httpResponse; + try { - statusCode = client.executeMethod(method); + httpResponse = client.execute(method); } catch (Exception e) { GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, e.getMessage(), e); e.printStackTrace(); throw e; } + int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { // QQQ For now, we are indeed assuming we get back JSON errors. // In future this may be changed depending on the requested // output format sent to the servlet. - String errorBody = method.getResponseBodyAsString(); + String errorBody = EntityUtils.toString(httpResponse.getEntity()); JSONObject result = new JSONObject(errorBody); String[] errors = { result.getJSONArray("error-code").getString(0), result.getString("summary"), result.getString("stacktrace") }; GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, errors[2]); - String exceptionMsg = "HTTP operation failed: " + errors[0] + "\nSTATUS LINE: " + method.getStatusLine() + String exceptionMsg = "HTTP operation failed: " + errors[0] + + "\nSTATUS LINE: " + httpResponse.getStatusLine() + "\nSUMMARY: " + errors[1] + "\nSTACKTRACE: " + errors[2]; throw new Exception(exceptionMsg); } - return statusCode; + return httpResponse; } public InputStream executeQuery(String str, OutputFormat fmt, String url, List<CompilationUnit.Parameter> params) throws Exception { - HttpMethod method = constructHttpMethod(str, url, "query", false, params); + HttpUriRequest method = constructHttpMethod(str, url, "query", false, params); // Set accepted output response type - method.setRequestHeader("Accept", fmt.mimeType()); - executeHttpMethod(method); - return method.getResponseBodyAsStream(); + method.setHeader("Accept", fmt.mimeType()); + HttpResponse response = executeHttpRequest(method); + return response.getEntity().getContent(); } public InputStream executeQueryService(String str, OutputFormat fmt, String url, List<CompilationUnit.Parameter> params) throws Exception { setFormatParam(params, fmt); - HttpMethod method = constructHttpMethod(str, url, "statement", true, params); + HttpUriRequest method = constructHttpMethod(str, url, "statement", true, params); // Set accepted output response type - method.setRequestHeader("Accept", OutputFormat.CLEAN_JSON.mimeType()); - executeHttpMethod(method); - return method.getResponseBodyAsStream(); + method.setHeader("Accept", OutputFormat.CLEAN_JSON.mimeType()); + HttpResponse response = executeHttpRequest(method); + return response.getEntity().getContent(); } private void setFormatParam(List<CompilationUnit.Parameter> params, OutputFormat fmt) { @@ -313,82 +316,63 @@ } } - private HttpMethod constructHttpMethod(String statement, String endpoint, String stmtParam, boolean postStmtAsParam, + private HttpUriRequest constructHttpMethod(String statement, String endpoint, String stmtParam, boolean postStmtAsParam, List<CompilationUnit.Parameter> otherParams) { - HttpMethod method; + RequestBuilder builder; if (statement.length() + endpoint.length() < MAX_URL_LENGTH) { // Use GET for small-ish queries - GetMethod getMethod = new GetMethod(endpoint); - NameValuePair[] parameters = new NameValuePair[otherParams.size() + 1]; - parameters[0] = new NameValuePair(stmtParam, statement); - int i = 1; + builder = RequestBuilder.get(endpoint); + builder.addParameter(stmtParam, statement); for (CompilationUnit.Parameter param : otherParams) { - parameters[i++] = new NameValuePair(param.getName(), param.getValue()); + builder.addParameter(param.getName(), param.getValue()); } - getMethod.setQueryString(parameters); - method = getMethod; } else { // Use POST for bigger ones to avoid 413 FULL_HEAD - PostMethod postMethod = new PostMethod(endpoint); + builder = RequestBuilder.post(endpoint); if (postStmtAsParam) { for (CompilationUnit.Parameter param : otherParams) { - postMethod.setParameter(param.getName(), param.getValue()); + builder.addParameter(param.getName(), param.getValue()); } - postMethod.setParameter("statement", statement); + builder.addParameter("statement", statement); } else { // this seems pretty bad - we should probably fix the API and not the client - postMethod.setRequestEntity(new StringRequestEntity(statement)); + builder.setEntity(new StringEntity(statement, StandardCharsets.UTF_8)); } - method = postMethod; } - // Provide custom retry handler is necessary - HttpMethodParams httpMethodParams = method.getParams(); - httpMethodParams.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); - httpMethodParams.setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, StandardCharsets.UTF_8.name()); - return method; + builder.setCharset(StandardCharsets.UTF_8); + return builder.build(); } public InputStream executeClusterStateQuery(OutputFormat fmt, String url) throws Exception { - HttpMethodBase method = new GetMethod(url); + HttpUriRequest request = RequestBuilder.get(url).setHeader("Accept", fmt.mimeType()).build(); - // Set accepted output response type - method.setRequestHeader("Accept", fmt.mimeType()); - // Provide custom retry handler is necessary - method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); - executeHttpMethod(method); - return method.getResponseBodyAsStream(); + HttpResponse response = executeHttpRequest(request); + return response.getEntity().getContent(); } // To execute Update statements // Insert and Delete statements are executed here public void executeUpdate(String str, String url) throws Exception { // Create a method instance. - PostMethod method = new PostMethod(url); - method.setRequestEntity(new StringRequestEntity(str)); - - // Provide custom retry handler is necessary - method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); + HttpUriRequest request = RequestBuilder.post(url) + .setEntity(new StringEntity(str, StandardCharsets.UTF_8)) + .build(); // Execute the method. - executeHttpMethod(method); + executeHttpRequest(request); } // Executes AQL in either async or async-defer mode. public InputStream executeAnyAQLAsync(String str, boolean defer, OutputFormat fmt, String url) throws Exception { // Create a method instance. - PostMethod method = new PostMethod(url); - if (defer) { - method.setQueryString(new NameValuePair[] { new NameValuePair("mode", "asynchronous-deferred") }); - } else { - method.setQueryString(new NameValuePair[] { new NameValuePair("mode", "asynchronous") }); - } - method.setRequestEntity(new StringRequestEntity(str)); - method.setRequestHeader("Accept", fmt.mimeType()); + HttpUriRequest request = RequestBuilder.post(url) + .addParameter("mode", defer ? "asynchronous-deferred" : "asynchronous") + .setEntity(new StringEntity(str, StandardCharsets.UTF_8)) + .setHeader("Accept", fmt.mimeType()) + .build(); - // Provide custom retry handler is necessary - method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); - executeHttpMethod(method); - InputStream resultStream = method.getResponseBodyAsStream(); + HttpResponse response = executeHttpRequest(request); + InputStream resultStream = response.getEntity().getContent(); String theHandle = IOUtils.toString(resultStream, "UTF-8"); @@ -401,15 +385,13 @@ final String url = "http://" + host + ":" + port + Servlets.QUERY_RESULT.getPath(); // Create a method instance. - GetMethod method = new GetMethod(url); - method.setQueryString(new NameValuePair[] { new NameValuePair("handle", handle) }); - method.setRequestHeader("Accept", fmt.mimeType()); + HttpUriRequest request = RequestBuilder.get(url) + .addParameter("handle", handle) + .setHeader("Accept", fmt.mimeType()) + .build(); - // Provide custom retry handler is necessary - method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); - - executeHttpMethod(method); - return method.getResponseBodyAsStream(); + HttpResponse response = executeHttpRequest(request); + return response.getEntity().getContent(); } // To execute DDL and Update statements @@ -420,13 +402,12 @@ // create function statement public void executeDDL(String str, String url) throws Exception { // Create a method instance. - PostMethod method = new PostMethod(url); - method.setRequestEntity(new StringRequestEntity(str)); - // Provide custom retry handler is necessary - method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); + HttpUriRequest request = RequestBuilder.post(url) + .setEntity(new StringEntity(str, StandardCharsets.UTF_8)) + .build(); // Execute the method. - executeHttpMethod(method); + executeHttpRequest(request); } // Method that reads a DDL/Update/Query File diff --git a/asterixdb/asterix-experiments/pom.xml b/asterixdb/asterix-experiments/pom.xml index 7a7d3c6..b923fba 100644 --- a/asterixdb/asterix-experiments/pom.xml +++ b/asterixdb/asterix-experiments/pom.xml @@ -122,13 +122,13 @@ <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> - <version>4.2.2</version> + <version>4.5.2</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> - <version>4.2.2</version> + <version>4.4.4</version> <scope>compile</scope> </dependency> <dependency> @@ -149,11 +149,11 @@ <artifactId>asterix-app</artifactId> <version>${project.version}</version> </dependency> - <!-- <dependency> - <groupId>net.schmizz</groupId> - <artifactId>sshj</artifactId> - <version>0.9.0</version> - </dependency> --> + <dependency> + <groupId>org.apache.asterix</groupId> + <artifactId>asterix-tools</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>com.hierynomus</groupId> <artifactId>sshj</artifactId> diff --git a/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/client/SyntheticDataGeneratorForSpatialIndexEvaluation.java b/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/client/SyntheticDataGeneratorForSpatialIndexEvaluation.java index 10bae07..25d56a0 100644 --- a/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/client/SyntheticDataGeneratorForSpatialIndexEvaluation.java +++ b/asterixdb/asterix-experiments/src/main/java/org/apache/asterix/experiment/client/SyntheticDataGeneratorForSpatialIndexEvaluation.java @@ -23,13 +23,12 @@ import java.io.FileOutputStream; import java.io.IOException; -import org.kohsuke.args4j.CmdLineException; -import org.kohsuke.args4j.CmdLineParser; - import org.apache.asterix.tools.external.data.DataGeneratorForSpatialIndexEvaluation; import org.apache.asterix.tools.external.data.DataGeneratorForSpatialIndexEvaluation.InitializationInfo; import org.apache.asterix.tools.external.data.DataGeneratorForSpatialIndexEvaluation.TweetMessageIterator; import org.apache.asterix.tools.external.data.GULongIDGenerator; +import org.kohsuke.args4j.CmdLineException; +import org.kohsuke.args4j.CmdLineParser; public class SyntheticDataGeneratorForSpatialIndexEvaluation { public static void main(String[] args) throws Exception { diff --git a/asterixdb/asterix-metadata/pom.xml b/asterixdb/asterix-metadata/pom.xml index 28e4ad1..3087b60 100644 --- a/asterixdb/asterix-metadata/pom.xml +++ b/asterixdb/asterix-metadata/pom.xml @@ -61,12 +61,6 @@ <scope>compile</scope> </dependency> <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-client</artifactId> - <type>jar</type> - <scope>compile</scope> - </dependency> - <dependency> <groupId>org.apache.hyracks</groupId> <artifactId>hyracks-storage-am-lsm-invertedindex</artifactId> </dependency> @@ -77,10 +71,6 @@ <dependency> <groupId>org.apache.hyracks</groupId> <artifactId>hyracks-storage-am-lsm-rtree</artifactId> - </dependency> - <dependency> - <groupId>org.apache.hyracks</groupId> - <artifactId>hyracks-hdfs-core</artifactId> </dependency> <dependency> <groupId>org.apache.asterix</groupId> diff --git a/asterixdb/asterix-tools/pom.xml b/asterixdb/asterix-tools/pom.xml index 649eb38..011d44b 100644 --- a/asterixdb/asterix-tools/pom.xml +++ b/asterixdb/asterix-tools/pom.xml @@ -58,35 +58,6 @@ </plugins> </build> - <repositories> - <repository> - <id>central</id> - <url>http://repo1.maven.org/maven2</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - <repository> - <releases> - <enabled>true</enabled> - <updatePolicy>always</updatePolicy> - <checksumPolicy>warn</checksumPolicy> - </releases> - <snapshots> - <enabled>false</enabled> - <updatePolicy>never</updatePolicy> - <checksumPolicy>fail</checksumPolicy> - </snapshots> - <id>HDPReleases</id> - <name>HDP Releases</name> - <url>http://repo.hortonworks.com/content/repositories/releases</url> - <layout>default</layout> - </repository> - </repositories> - <dependencies> <dependency> <groupId>org.apache.asterix</groupId> @@ -117,78 +88,6 @@ <groupId>org.apache.asterix</groupId> <artifactId>asterix-metadata</artifactId> <version>${project.version}</version> - <scope>compile</scope> - </dependency> - <!--<dependency> - <groupId>org.apache.asterix</groupId> - <artifactId>asterix-metadata</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency>--> - <dependency> - <groupId>org.apache.asterix</groupId> - <artifactId>asterix-events</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-yarn-common</artifactId> - </dependency> - <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-yarn-client</artifactId> - </dependency> - <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-common</artifactId> - </dependency> - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>1.4</version> - </dependency> - <dependency> - <groupId>commons-net</groupId> - <artifactId>commons-net</artifactId> - <version>3.1</version> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>2.5</version> - </dependency> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>3.2.1</version> - </dependency> - <dependency> - <groupId>commons-configuration</groupId> - <artifactId>commons-configuration</artifactId> - <version>1.6</version> - </dependency> - - <dependency> - <groupId>commons-cli</groupId> - <artifactId>commons-cli</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-math</artifactId> - <version>2.1</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.3</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> - <version>4.3</version> <scope>compile</scope> </dependency> </dependencies> diff --git a/asterixdb/asterix-yarn/pom.xml b/asterixdb/asterix-yarn/pom.xml index 1350f73..a9a4a36 100644 --- a/asterixdb/asterix-yarn/pom.xml +++ b/asterixdb/asterix-yarn/pom.xml @@ -196,13 +196,13 @@ <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> - <version>4.2.2</version> + <version>4.5.2</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> - <version>4.2.2</version> + <version>4.4.4</version> <scope>compile</scope> </dependency> <dependency> diff --git a/hyracks-fullstack/hyracks/hyracks-api/pom.xml b/hyracks-fullstack/hyracks/hyracks-api/pom.xml index 5f625fb..acb0f1d 100644 --- a/hyracks-fullstack/hyracks/hyracks-api/pom.xml +++ b/hyracks-fullstack/hyracks/hyracks-api/pom.xml @@ -67,7 +67,7 @@ <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> - <version>4.3</version> + <version>4.5.2</version> <type>jar</type> <scope>compile</scope> </dependency> diff --git a/hyracks-fullstack/hyracks/hyracks-server/pom.xml b/hyracks-fullstack/hyracks/hyracks-server/pom.xml index 3e739e7..ed82438 100644 --- a/hyracks-fullstack/hyracks/hyracks-server/pom.xml +++ b/hyracks-fullstack/hyracks/hyracks-server/pom.xml @@ -147,9 +147,9 @@ <scope>compile</scope> </dependency> <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>3.0.1</version> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.5.2</version> </dependency> <dependency> <groupId>junit</groupId> diff --git a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java index 3b40ea9..13607ad 100644 --- a/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java +++ b/hyracks-fullstack/hyracks/hyracks-server/src/test/java/org/apache/hyracks/server/test/NCServiceIT.java @@ -18,22 +18,25 @@ */ package org.apache.hyracks.server.test; +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.util.logging.Logger; + import junit.framework.Assert; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; import org.apache.hyracks.server.process.HyracksVirtualCluster; import org.json.JSONArray; import org.json.JSONObject; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; - -import java.io.File; -import java.io.IOException; -import java.net.InetAddress; -import java.util.logging.Logger; public class NCServiceIT { @@ -86,16 +89,18 @@ } private static String getHttp(String url) throws Exception { - HttpClient client = new HttpClient(); - GetMethod get = new GetMethod(url); + HttpClient client = HttpClients.createDefault(); + HttpGet get = new HttpGet(url); int statusCode; + final HttpResponse httpResponse; try { - statusCode = client.executeMethod(get); + httpResponse = client.execute(get); + statusCode = httpResponse.getStatusLine().getStatusCode(); } catch (Exception e) { e.printStackTrace(); throw e; } - String response = get.getResponseBodyAsString(); + String response = EntityUtils.toString(httpResponse.getEntity()); if (statusCode == HttpStatus.SC_OK) { return response; } else { -- To view, visit https://asterix-gerrit.ics.uci.edu/1053 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaab8930ddf69a3202a6e7efff3533bfec8cff6c5 Gerrit-PatchSet: 4 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael Blow <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]>
