[OLINGO-175, OLINGO-205] Provided context url and metadata etag check in it test
This commit is contained in:
parent
3c4d7d1767
commit
645cdff844
|
@ -34,6 +34,8 @@ import org.apache.olingo.client.api.http.HttpMethod;
|
|||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
|
||||
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
||||
import org.apache.olingo.commons.api.data.Container;
|
||||
import org.apache.olingo.commons.api.data.Entry;
|
||||
|
||||
/**
|
||||
* This class implements an OData create request.
|
||||
|
@ -113,8 +115,10 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
|
|||
public ODataEntity getBody() {
|
||||
if (entity == null) {
|
||||
try {
|
||||
entity = odataClient.getReader().
|
||||
readEntity(getRawResponse(), ODataPubFormat.fromString(getAccept()));
|
||||
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
|
||||
ODataPubFormat.fromString(getAccept()));
|
||||
|
||||
entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
|
||||
} finally {
|
||||
this.close();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ import org.apache.olingo.client.api.http.HttpMethod;
|
|||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
|
||||
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
||||
import org.apache.olingo.commons.api.data.Container;
|
||||
import org.apache.olingo.commons.api.data.Entry;
|
||||
|
||||
/**
|
||||
* This class implements an OData update request.
|
||||
|
@ -119,8 +121,10 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
|
|||
public ODataEntity getBody() {
|
||||
if (entity == null) {
|
||||
try {
|
||||
entity = odataClient.getReader().
|
||||
readEntity(getRawResponse(), ODataPubFormat.fromString(getAccept()));
|
||||
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
|
||||
ODataPubFormat.fromString(getAccept()));
|
||||
|
||||
entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
|
||||
} finally {
|
||||
this.close();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ import org.apache.olingo.client.api.http.HttpMethod;
|
|||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
|
||||
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
||||
import org.apache.olingo.commons.api.data.Container;
|
||||
import org.apache.olingo.commons.api.data.Property;
|
||||
|
||||
/**
|
||||
* This class implements an OData update entity property request.
|
||||
|
@ -117,8 +119,10 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
|
|||
public ODataProperty getBody() {
|
||||
if (property == null) {
|
||||
try {
|
||||
property = odataClient.getReader().
|
||||
readProperty(getRawResponse(), ODataFormat.fromString(getAccept()));
|
||||
final Container<Property> container = odataClient.getDeserializer().toProperty(getRawResponse(),
|
||||
ODataFormat.fromString(getAccept()));
|
||||
|
||||
property = odataClient.getBinder().getODataProperty(extractFromContainer(container));
|
||||
} finally {
|
||||
this.close();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
|
|||
import org.apache.olingo.commons.api.domain.ODataProperty;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.client.api.http.HttpClientException;
|
||||
import org.apache.olingo.commons.api.data.Container;
|
||||
import org.apache.olingo.commons.api.data.Property;
|
||||
|
||||
/**
|
||||
* This class implements an OData entity property query request.
|
||||
|
@ -83,8 +85,11 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData
|
|||
public ODataProperty getBody() {
|
||||
if (property == null) {
|
||||
try {
|
||||
property = odataClient.getReader().readProperty(
|
||||
final Container<Property> container =
|
||||
odataClient.getDeserializer().toProperty(
|
||||
res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
|
||||
|
||||
property = odataClient.getBinder().getODataProperty(extractFromContainer(container));
|
||||
} catch (IOException e) {
|
||||
throw new HttpClientException(e);
|
||||
} finally {
|
||||
|
|
|
@ -32,6 +32,8 @@ import org.apache.olingo.commons.api.domain.ODataEntity;
|
|||
import org.apache.olingo.client.api.http.HttpMethod;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
|
||||
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
||||
import org.apache.olingo.commons.api.data.Container;
|
||||
import org.apache.olingo.commons.api.data.Entry;
|
||||
|
||||
/**
|
||||
* This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
|
||||
|
@ -123,7 +125,8 @@ public class ODataMediaEntityCreateRequestImpl
|
|||
public ODataEntity getBody() {
|
||||
if (entity == null) {
|
||||
try {
|
||||
entity = odataClient.getReader().readEntity(getRawResponse(), getFormat());
|
||||
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat());
|
||||
entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
|
||||
} finally {
|
||||
this.close();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ import org.apache.olingo.commons.api.domain.ODataEntity;
|
|||
import org.apache.olingo.client.api.http.HttpMethod;
|
||||
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
|
||||
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
|
||||
import org.apache.olingo.commons.api.data.Container;
|
||||
import org.apache.olingo.commons.api.data.Entry;
|
||||
|
||||
/**
|
||||
* This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
|
||||
|
@ -126,7 +128,8 @@ public class ODataMediaEntityUpdateRequestImpl
|
|||
public ODataEntity getBody() {
|
||||
if (entity == null) {
|
||||
try {
|
||||
entity = odataClient.getReader().readEntity(getRawResponse(), getFormat());
|
||||
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat());
|
||||
entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
|
||||
} finally {
|
||||
this.close();
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
|
|||
|
||||
protected <T, V extends T> Container<T> atom(final InputStream input, final Class<V> reference) {
|
||||
try {
|
||||
return atomDeserializer.read(input, reference);
|
||||
return atomDeserializer.<T, V>read(input, reference);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue