You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/06/24 16:42:44 UTC
[12/15] olingo-odata4 git commit: [OLINGO-704] Test added
[OLINGO-704] Test added
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/9d4cf6ad
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/9d4cf6ad
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/9d4cf6ad
Branch: refs/heads/master
Commit: 9d4cf6ad4c95b0ef7e3b97f590f39ee7d1776dd0
Parents: 91d0427
Author: Christian Holzer <c....@sap.com>
Authored: Fri Jun 19 16:26:25 2015 +0200
Committer: Christian Holzer <c....@sap.com>
Committed: Fri Jun 19 16:28:26 2015 +0200
----------------------------------------------------------------------
.../olingo/fit/tecsvc/client/BasicITCase.java | 37 ++++++++++++++++++++
1 file changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9d4cf6ad/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
----------------------------------------------------------------------
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 ae25894..2073df4 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
@@ -1105,6 +1105,43 @@ public class BasicITCase extends AbstractBaseTestITCase {
}
@Test
+ public void updateComplexPropertyWithIEEE754CompatibleParamter() {
+ final ODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .appendKeySegment(1)
+ .appendPropertySegment(PROPERTY_COMP_ALL_PRIM).build();
+
+ final ODataPropertyUpdateRequest requestUpdate = client.getCUDRequestFactory()
+ .getPropertyComplexValueUpdateRequest(uri, UpdateType.PATCH,
+ of.newComplexProperty(PROPERTY_COMP_ALL_PRIM,
+ of.newComplexValue("CTAllPrim")
+ .add(of.newPrimitiveProperty(PROPERTY_INT64,
+ of.newPrimitiveValueBuilder().buildInt64(Long.MIN_VALUE)))
+ .add(of.newPrimitiveProperty(PROPERTY_DECIMAL,
+ of.newPrimitiveValueBuilder().buildDecimal(BigDecimal.valueOf(12345678912L))))
+ .add(of.newPrimitiveProperty(PROPERTY_INT16,
+ of.newPrimitiveValueBuilder().buildInt16((short) 2)))));
+
+ requestUpdate.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ requestUpdate.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataPropertyUpdateResponse responseUpdate = requestUpdate.execute();
+ String cookie = responseUpdate.getHeader(HttpHeader.SET_COOKIE).iterator().next();
+
+ final ODataPropertyRequest<ClientProperty> requestGet = client.getRetrieveRequestFactory().getPropertyRequest(uri);
+ requestGet.addCustomHeader(HttpHeader.COOKIE, cookie);
+ requestGet.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientProperty> responseGet = requestGet.execute();
+
+ final ClientComplexValue complexValue = responseGet.getBody().getComplexValue();
+
+ assertEquals(Long.MIN_VALUE, complexValue.get(PROPERTY_INT64).getPrimitiveValue().toValue());
+ assertEquals(BigDecimal.valueOf(12345678912L), complexValue.get(PROPERTY_DECIMAL).getPrimitiveValue().toValue());
+ assertEquals(2, complexValue.get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ }
+
+ @Test
public void updateProperyEdmDecimaltWithIEE754CompatibleParameter() {
final ODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
client.getConfiguration().setDefaultPubFormat(ContentType.JSON);