From cf04fdcb4ec9aa61152f4160f369a1cb50e01741 Mon Sep 17 00:00:00 2001 From: Archana Rai Date: Mon, 19 Nov 2018 13:44:40 +0530 Subject: [PATCH] [OLINGO-1315]ODATA V4.0 Client: API to return HTTP Request details --- .../org/apache/olingo/fit/tecsvc/client/BasicITCase.java | 3 +++ .../client/api/communication/request/ODataRequest.java | 8 ++++++++ .../core/communication/request/AbstractODataRequest.java | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java index 960e63bfb..0cfb1635a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java @@ -41,6 +41,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.apache.http.client.methods.HttpUriRequest; import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; @@ -439,7 +440,9 @@ public class BasicITCase extends AbstractParamTecSvcITCase { .build(); final ODataEntityUpdateRequest request = getClient().getCUDRequestFactory().getEntityUpdateRequest( uri, UpdateType.REPLACE, newEntity); + HttpUriRequest req = request.getHttpRequest(); final ODataEntityUpdateResponse response = request.execute(); + assertNotNull(req); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); // Check that the updated properties have changed and that other properties have their default values. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java index ffc70b7f0..c783dab26 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java @@ -22,6 +22,7 @@ import java.io.InputStream; import java.net.URI; import java.util.Collection; +import org.apache.http.client.methods.HttpUriRequest; import org.apache.olingo.commons.api.http.HttpMethod; /** @@ -39,6 +40,13 @@ public interface ODataRequest { * @return OData request target URI. */ URI getURI(); + + /** + * Returns Http request Object. + * + * @return HttpUriRequest. + */ + HttpUriRequest getHttpRequest(); /** * Sets OData request target URI. diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java index 4642db0bb..12ad73252 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java @@ -111,6 +111,11 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD public URI getURI() { return uri; } + + @Override + public HttpUriRequest getHttpRequest() { + return request; + } @Override public void setURI(final URI uri) {