[OLINGO-1315]ODATA V4.0 Client: API to return HTTP Request details

This commit is contained in:
Archana Rai 2018-11-19 13:44:40 +05:30
parent fb2d21d703
commit cf04fdcb4e
3 changed files with 16 additions and 0 deletions

View File

@ -41,6 +41,7 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.ODataClientErrorException;
@ -439,7 +440,9 @@ public class BasicITCase extends AbstractParamTecSvcITCase {
.build(); .build();
final ODataEntityUpdateRequest<ClientEntity> request = getClient().getCUDRequestFactory().getEntityUpdateRequest( final ODataEntityUpdateRequest<ClientEntity> request = getClient().getCUDRequestFactory().getEntityUpdateRequest(
uri, UpdateType.REPLACE, newEntity); uri, UpdateType.REPLACE, newEntity);
HttpUriRequest req = request.getHttpRequest();
final ODataEntityUpdateResponse<ClientEntity> response = request.execute(); final ODataEntityUpdateResponse<ClientEntity> response = request.execute();
assertNotNull(req);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
// Check that the updated properties have changed and that other properties have their default values. // Check that the updated properties have changed and that other properties have their default values.

View File

@ -22,6 +22,7 @@ import java.io.InputStream;
import java.net.URI; import java.net.URI;
import java.util.Collection; import java.util.Collection;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.commons.api.http.HttpMethod;
/** /**
@ -39,6 +40,13 @@ public interface ODataRequest {
* @return OData request target URI. * @return OData request target URI.
*/ */
URI getURI(); URI getURI();
/**
* Returns Http request Object.
*
* @return HttpUriRequest.
*/
HttpUriRequest getHttpRequest();
/** /**
* Sets OData request target URI. * Sets OData request target URI.

View File

@ -111,6 +111,11 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD
public URI getURI() { public URI getURI() {
return uri; return uri;
} }
@Override
public HttpUriRequest getHttpRequest() {
return request;
}
@Override @Override
public void setURI(final URI uri) { public void setURI(final URI uri) {