Repository: olingo-odata4
Updated Branches:
  refs/heads/master 39f0708d0 -> 5501e8e33


[OLINGO-663] ETag annotation again in entity collections of technical service

Change-Id: Ia150ba1705fa22e36c3821d5295f1b7f464a4852

Signed-off-by: Christian Amend <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/5501e8e3
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/5501e8e3
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/5501e8e3

Branch: refs/heads/master
Commit: 5501e8e3315b642ca904a598856dc9f7f1d0b2d7
Parents: 39f0708
Author: Klaus Straubinger <[email protected]>
Authored: Wed Jun 10 15:06:33 2015 +0200
Committer: Christian Amend <[email protected]>
Committed: Wed Jun 10 15:12:11 2015 +0200

----------------------------------------------------------------------
 .../tecsvc/client/FilterSystemQueryITCase.java  | 247 +++++++++----------
 .../tecsvc/client/SystemQueryOptionITCase.java  |  27 +-
 .../commons/api/data/AbstractODataObject.java   |   4 +-
 .../core/serialization/AtomDeserializer.java    |   6 +-
 .../core/serialization/AtomSerializer.java      |   2 +-
 .../serialization/JsonDeltaDeserializer.java    |   2 +-
 .../serialization/JsonEntityDeserializer.java   |   2 +-
 .../JsonEntitySetDeserializer.java              |   2 +-
 .../processor/TechnicalEntityProcessor.java     |   2 +-
 .../ExpandSystemQueryOptionHandler.java         |  17 +-
 .../json/ODataJsonSerializerTest.java           |  17 +-
 11 files changed, 159 insertions(+), 169 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
----------------------------------------------------------------------
diff --git 
a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
 
b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
index 75d58af..1e27357 100644
--- 
a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
+++ 
b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
@@ -32,7 +32,6 @@ import 
org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientEntitySet;
 import org.apache.olingo.client.api.domain.ClientObjectFactory;
-import org.apache.olingo.client.api.domain.ClientValuable;
 import org.apache.olingo.client.core.ODataClientFactory;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.format.ODataFormat;
@@ -62,7 +61,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -71,15 +70,15 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(2, response.getBody().getEntities().size());
 
     ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
     clientEntity = response.getBody().getEntities().get(1);
-    assertEquals("0", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(0, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
 
     response = sendRequest(ES_ALL_PRIM, "PropertyBoolean eq true");
     assertEquals(1, response.getBody().getEntities().size());
 
     clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -88,7 +87,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -98,7 +97,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -109,7 +108,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -121,7 +120,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -130,12 +129,12 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
 
     assertEquals(2, result.getBody().getEntities().size());
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(1, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(1, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("2", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -145,8 +144,8 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
 
     assertEquals(1, result.getBody().getEntities().size());
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -166,8 +165,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
 
     assertEquals(1, response.getBody().getEntities().size());
     ClientEntity clientEntity = response.getBody().getEntities().get(0);
-
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -176,7 +174,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
 
     assertEquals(1, result.getBody().getEntities().size());
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals("2", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -185,18 +183,18 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
         sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2' and PropertyInt16 
eq 1");
     assertEquals(1, result.getBody().getEntities().size());
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(1, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("2", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     result = sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2' or 
PropertyInt16 eq 1");
     assertEquals(2, result.getBody().getEntities().size());
     clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(1, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(1, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("2", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -296,26 +294,17 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
         .appendKeySegment(32766)
         .build()));
 
-    final URI uri = 
client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").build();
+    final URI uri = 
client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).build();
     ODataEntityCreateResponse<ClientEntity> createResponse =
         client.getCUDRequestFactory().getEntityCreateRequest(uri, 
entity).execute();
 
-    final URI receiveURI =
-        client.newURIBuilder(SERVICE_URI)
-        .appendEntitySetSegment("ESAllPrim")
-        .filter(filterString)
-        .build();
-
-    ODataEntitySetRequest<ClientEntitySet> filterRequest =
-        client.getRetrieveRequestFactory().getEntitySetRequest(receiveURI);
-    filterRequest.addCustomHeader(HttpHeader.COOKIE, 
createResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next());
-    ODataRetrieveResponse<ClientEntitySet> filterResponse = 
filterRequest.execute();
-
+    ODataRetrieveResponse<ClientEntitySet> filterResponse = 
sendRequest(ES_ALL_PRIM, filterString,
+        createResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next());
     assertEquals(1, filterResponse.getBody().getEntities().size());
   }
 
   @Test
-  public void testNumericComparisionOperators() {
+  public void numericComparisonOperators() {
     ODataRetrieveResponse<ClientEntitySet> result = 
sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 ge 1");
     assertEquals(4, result.getBody().getEntities().size());
 
@@ -355,25 +344,22 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(3, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
-    assertEquals("11", ((ClientValuable) ((ClientValuable) 
clientEntity.getProperty("PropertyComp")).getComplexValue()
-        .get("PropertyInt16")).getValue()
-        .toString());
+    assertEquals(1, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
+    assertEquals(11, 
clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
+        .getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
-    assertEquals("11", ((ClientValuable) ((ClientValuable) 
clientEntity.getProperty("PropertyComp")).getComplexValue()
-        .get("PropertyInt16")).getValue()
-        .toString());
+    assertEquals(1, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("2", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
+    assertEquals(11, 
clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
+        .getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(2);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
-    assertEquals("11", ((ClientValuable) ((ClientValuable) 
clientEntity.getProperty("PropertyComp")).getComplexValue()
-        .get("PropertyInt16")).getValue()
-        .toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
+    assertEquals(11, 
clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
+        .getPrimitiveValue().toValue());
   }
 
   @Test
@@ -382,12 +368,12 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(2, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(2, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -396,12 +382,12 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(2, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(2, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -410,12 +396,12 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(2, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(2, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -444,7 +430,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -455,30 +441,27 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(4, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(1, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(1, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("2", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(2);
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(2, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(3);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
   public void testSubstringDouble() {
-    try {
-      sendRequest(ES_ALL_PRIM, "substring(PropertyString, length('First')"
-          + "add 1, 2.0 * 4) eq ('Resource')");
-    } catch (ODataClientErrorException e) {
-      assertEquals(400, e.getStatusLine().getStatusCode());
-    }
+    fail(ES_ALL_PRIM,
+        "substring(PropertyString, length('First') add 1, 2.0 * 4) eq 
('Resource')",
+        HttpStatusCode.BAD_REQUEST);
   }
 
   @Test
@@ -487,7 +470,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -496,7 +479,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -505,13 +488,13 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(3, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(2);
-    assertEquals("0", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(0, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -520,7 +503,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -529,13 +512,13 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(3, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(2);
-    assertEquals("0", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(0, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -544,7 +527,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -553,10 +536,10 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(2, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -565,7 +548,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -574,7 +557,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -583,7 +566,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -592,7 +575,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -601,7 +584,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -611,10 +594,12 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(2, response.getBody().getEntities().size());
 
     ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("W/\"32767\"", clientEntity.getETag());
 
     clientEntity = response.getBody().getEntities().get(1);
-    assertEquals("0", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(0, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("W/\"0\"", clientEntity.getETag());
   }
 
   @Test
@@ -653,15 +638,15 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq floor(3.1)");
     assertEquals(1, result.getBody().getEntities().size());
 
     clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -670,15 +655,15 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq ceiling(2.6)");
     assertEquals(1, result.getBody().getEntities().size());
 
     clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -687,29 +672,29 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.4)");
     assertEquals(1, result.getBody().getEntities().size());
 
     clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("2", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(2, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.6)");
     assertEquals(1, result.getBody().getEntities().size());
 
     clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
 
     result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(3.1)");
     assertEquals(1, result.getBody().getEntities().size());
 
     clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("3", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
-    assertEquals("1", ((ClientValuable) 
clientEntity.getProperty("PropertyString")).getValue().toString());
+    assertEquals(3, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+    assertEquals("1", 
clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -718,10 +703,10 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(2, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
 
     clientEntity = result.getBody().getEntities().get(1);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -731,7 +716,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -740,7 +725,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -750,7 +735,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -760,7 +745,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -770,7 +755,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -780,7 +765,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("-32768", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(-32768, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -790,7 +775,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, result.getBody().getEntities().size());
 
     ClientEntity clientEntity = result.getBody().getEntities().get(0);
-    assertEquals("0", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(0, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -808,7 +793,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     final ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -818,7 +803,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     final ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -835,7 +820,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     final ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -845,7 +830,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     final ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -855,7 +840,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     final ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -865,7 +850,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     final ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("32767", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(32767, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -875,7 +860,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     final ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("0", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(0, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test
@@ -885,7 +870,7 @@ public class FilterSystemQueryITCase extends 
AbstractBaseTestITCase {
     assertEquals(1, response.getBody().getEntities().size());
 
     final ClientEntity clientEntity = response.getBody().getEntities().get(0);
-    assertEquals("0", ((ClientValuable) 
clientEntity.getProperty("PropertyInt16")).getValue().toString());
+    assertEquals(0, 
clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
----------------------------------------------------------------------
diff --git 
a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
 
b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
index c8d1d0c..bbd9d51 100644
--- 
a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
+++ 
b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
@@ -28,7 +28,6 @@ import 
org.apache.olingo.client.api.communication.ODataClientErrorException;
 import 
org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.uri.QueryOption;
 import org.apache.olingo.client.core.ODataClientFactory;
 import org.apache.olingo.commons.api.format.ODataFormat;
 import org.apache.olingo.commons.api.http.HttpStatusCode;
@@ -47,7 +46,7 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
     ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_ALL_PRIM)
-        .addQueryOption(QueryOption.COUNT, "true")
+        .count(true)
         .build();
 
     ODataRetrieveResponse<ClientEntitySet> response = 
client.getRetrieveRequestFactory()
@@ -63,7 +62,7 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
     ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
-        .addQueryOption(QueryOption.COUNT, "true")
+        .count(true)
         .build();
 
     ODataRetrieveResponse<ClientEntitySet> response = 
client.getRetrieveRequestFactory()
@@ -79,7 +78,7 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
     ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
-        .addQueryOption(QueryOption.TOP, new Integer(5).toString())
+        .top(5)
         .build();
 
     ODataRetrieveResponse<ClientEntitySet> response = 
client.getRetrieveRequestFactory()
@@ -99,7 +98,7 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
     ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
-        .addQueryOption(QueryOption.SKIP, new Integer(5).toString())
+        .skip(5)
         .build();
 
     ODataRetrieveResponse<ClientEntitySet> response = 
client.getRetrieveRequestFactory()
@@ -119,8 +118,8 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
     ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
-        .addQueryOption(QueryOption.TOP, new Integer(20).toString())
-        .addQueryOption(QueryOption.SKIP, new Integer(503).toString())
+        .top(20)
+        .skip(503)
         .build();
 
     ODataRetrieveResponse<ClientEntitySet> response = 
client.getRetrieveRequestFactory()
@@ -135,7 +134,7 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
     ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
-        .addQueryOption(QueryOption.SKIP, new Integer(10000).toString())
+        .skip(10000)
         .build();
 
     ODataRetrieveResponse<ClientEntitySet> response = 
client.getRetrieveRequestFactory()
@@ -152,9 +151,9 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
         .appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
         .filter("PropertyInt16 le 105") // 1, 2, ... , 105
         .orderBy("PropertyInt16 desc") // 105, 104, ..., 2, 1
-        .addQueryOption(QueryOption.COUNT, Boolean.TRUE.toString()) // 105
-        .addQueryOption(QueryOption.SKIP, new Integer(3).toString()) // 102, 
101, ..., 2, 1
-        .addQueryOption(QueryOption.TOP, new Integer(43).toString()) // 102, 
101, ...., 59
+        .count(true) // 105
+        .skip(3) // 102, 101, ..., 2, 1
+        .top(43) // 102, 101, ...., 59
         .build();
 
     ODataRetrieveResponse<ClientEntitySet> response = 
client.getRetrieveRequestFactory()
@@ -228,7 +227,7 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
     ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
-        .addQueryOption(QueryOption.COUNT, Boolean.TRUE.toString())
+        .count(true)
         .build();
 
     ODataRetrieveResponse<ClientEntitySet> response = 
client.getRetrieveRequestFactory()
@@ -264,7 +263,7 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
     ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_ALL_PRIM)
-        .addQueryOption(QueryOption.SKIP, new Integer(-5).toString())
+        .skip(-5)
         .build();
 
     try {
@@ -282,7 +281,7 @@ public class SystemQueryOptionITCase extends 
AbstractBaseTestITCase {
     ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_ALL_PRIM)
-        .addQueryOption(QueryOption.TOP, new Integer(-5).toString())
+        .top(-5)
         .build();
     try {
       client.getRetrieveRequestFactory()

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/AbstractODataObject.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/AbstractODataObject.java
 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/AbstractODataObject.java
index 237b8ef..7e89123 100644
--- 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/AbstractODataObject.java
+++ 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/AbstractODataObject.java
@@ -36,8 +36,8 @@ public abstract class AbstractODataObject extends Annotatable 
{
     return baseURI;
   }
 
-  public void setBaseURI(final String baseURI) {
-    this.baseURI = baseURI == null ? null : URI.create(baseURI);
+  public void setBaseURI(final URI baseURI) {
+    this.baseURI = baseURI;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
index c25da60..b8b5167 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
@@ -431,7 +431,7 @@ public class AtomDeserializer extends AbstractAtomDealer 
implements ODataDeseria
     final Delta delta = new Delta();
     final Attribute xmlBase = 
start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
     if (xmlBase != null) {
-      delta.setBaseURI(xmlBase.getValue());
+      delta.setBaseURI(URI.create(xmlBase.getValue()));
     }
 
     boolean foundEndFeed = false;
@@ -579,7 +579,7 @@ public class AtomDeserializer extends AbstractAtomDealer 
implements ODataDeseria
       entity = new Entity();
       final Attribute xmlBase = 
start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
       if (xmlBase != null) {
-        entity.setBaseURI(xmlBase.getValue());
+        entity.setBaseURI(URI.create(xmlBase.getValue()));
       }
 
       final Attribute etag = start.getAttributeByName(etagQName);
@@ -737,7 +737,7 @@ public class AtomDeserializer extends AbstractAtomDealer 
implements ODataDeseria
     final EntityCollection entitySet = new EntityCollection();
     final Attribute xmlBase = 
start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
     if (xmlBase != null) {
-      entitySet.setBaseURI(xmlBase.getValue());
+      entitySet.setBaseURI(URI.create(xmlBase.getValue()));
     }
 
     boolean foundEndFeed = false;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
index 1ef177a..ecd7be0 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
@@ -550,7 +550,7 @@ public class AtomSerializer extends AbstractAtomDealer 
implements ODataSerialize
 
     if (container.getContextURL() != null) {
       final ContextURL contextURL = 
ContextURLParser.parse(container.getContextURL());
-      String base = contextURL.getServiceRoot().toASCIIString();
+      final URI base = contextURL.getServiceRoot();
       if (container.getPayload() instanceof EntityCollection) {
         ((EntityCollection) container.getPayload()).setBaseURI(base);
       }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java
index 64f6c8a..89f327f 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java
@@ -52,7 +52,7 @@ public class JsonDeltaDeserializer extends JsonDeserializer {
     final URI contextURL = tree.hasNonNull(Constants.JSON_CONTEXT) ?
         URI.create(tree.get(Constants.JSON_CONTEXT).textValue()) : null;
     if (contextURL != null) {
-      delta.setBaseURI(StringUtils.substringBefore(contextURL.toASCIIString(), 
Constants.METADATA));
+      
delta.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(),
 Constants.METADATA)));
     }
 
     if (tree.hasNonNull(Constants.JSON_COUNT)) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
index 99abccb..10cc3bb 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
@@ -76,7 +76,7 @@ public class JsonEntityDeserializer extends JsonDeserializer {
       contextURL = null;
     }
     if (contextURL != null) {
-      
entity.setBaseURI(StringUtils.substringBefore(contextURL.toASCIIString(), 
Constants.METADATA));
+      
entity.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(),
 Constants.METADATA)));
     }
 
     final String metadataETag;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java
index 01f2f65..354d4dd 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java
@@ -66,7 +66,7 @@ public class JsonEntitySetDeserializer extends 
JsonDeserializer {
       contextURL = null;
     }
     if (contextURL != null) {
-      
entitySet.setBaseURI(StringUtils.substringBefore(contextURL.toASCIIString(), 
Constants.METADATA));
+      
entitySet.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(),
 Constants.METADATA)));
     }
 
     final String metadataETag;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
----------------------------------------------------------------------
diff --git 
a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
 
b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
index aae4f7a..575b914 100644
--- 
a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
+++ 
b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
@@ -435,7 +435,7 @@ public class TechnicalEntityProcessor extends 
TechnicalProcessor
     final CountOption countOption = uriInfo.getCountOption();
 
     // Serialize
-    final SerializerResult serializerResult = (isReference) ?
+    final SerializerResult serializerResult = isReference ?
         serializeReferenceCollection(entitySetSerialization, edmEntitySet, 
format) :
         serializeEntityCollection(entitySetSerialization, edmEntitySet, 
edmEntityType, format,
             expand, select, countOption);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java
----------------------------------------------------------------------
diff --git 
a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java
 
b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java
index f9ac6e7..c641516 100644
--- 
a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java
+++ 
b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java
@@ -41,6 +41,7 @@ import 
org.apache.olingo.server.api.uri.queryoption.FilterOption;
 import org.apache.olingo.server.api.uri.queryoption.OrderByOption;
 import org.apache.olingo.server.api.uri.queryoption.SkipOption;
 import org.apache.olingo.server.api.uri.queryoption.TopOption;
+import 
org.apache.olingo.server.tecsvc.processor.queryoptions.options.CountHandler;
 import 
org.apache.olingo.server.tecsvc.processor.queryoptions.options.FilterHandler;
 import 
org.apache.olingo.server.tecsvc.processor.queryoptions.options.OrderByHandler;
 import 
org.apache.olingo.server.tecsvc.processor.queryoptions.options.SkipHandler;
@@ -105,7 +106,7 @@ public class ExpandSystemQueryOptionHandler {
 
     FilterHandler.applyFilterSystemQuery(filterOption, entitySet, 
edmBindingTarget);
     OrderByHandler.applyOrderByOption(orderByOption, entitySet, 
edmBindingTarget);
-    // TODO Add CountHandler
+    CountHandler.applyCountSystemQueryOption(countOption, entitySet);
     SkipHandler.applySkipSystemQueryHandler(skipOption, entitySet);
     TopHandler.applyTopSystemQueryOption(topOption, entitySet);
 
@@ -168,25 +169,29 @@ public class ExpandSystemQueryOptionHandler {
     newEntitySet.setCount(entitySet.getCount());
     newEntitySet.setDeltaLink(entitySet.getDeltaLink());
     newEntitySet.setNext(entitySet.getNext());
+    newEntitySet.setId(entitySet.getId());
+    newEntitySet.setBaseURI(entitySet.getBaseURI());
 
     return newEntitySet;
   }
 
   private Entity newEntity(final Entity entity) {
-    final Entity newEntity = new Entity();
+    Entity newEntity = new Entity();
 
     newEntity.getProperties().addAll(entity.getProperties());
     newEntity.getAnnotations().addAll(entity.getAnnotations());
-    newEntity.getAssociationLinks().addAll(entity.getAssociationLinks());
-    newEntity.setEditLink(entity.getEditLink());
     newEntity.setId(entity.getId());
+    newEntity.setBaseURI(entity.getBaseURI());
+    newEntity.setType(entity.getType());
+    newEntity.setETag(entity.getETag());
     newEntity.setMediaContentSource(entity.getMediaContentSource());
     newEntity.setMediaContentType(entity.getMediaContentType());
     newEntity.setMediaETag(entity.getMediaETag());
-    newEntity.getOperations().addAll(entity.getOperations());
     newEntity.setSelfLink(entity.getSelfLink());
-    newEntity.setType(entity.getType());
+    newEntity.setEditLink(entity.getEditLink());
+    newEntity.getAssociationLinks().addAll(entity.getAssociationLinks());
     newEntity.getNavigationBindings().addAll(entity.getNavigationBindings());
+    newEntity.getOperations().addAll(entity.getOperations());
 
     return newEntity;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5501e8e3/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
----------------------------------------------------------------------
diff --git 
a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
 
b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
index 311ec08..c9cfde9 100644
--- 
a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
+++ 
b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
@@ -37,7 +37,6 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
 import org.apache.olingo.server.api.ServiceMetadata;
 import org.apache.olingo.server.api.edmx.EdmxReference;
 import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
@@ -53,6 +52,7 @@ import 
org.apache.olingo.server.api.uri.queryoption.ExpandItem;
 import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
 import org.apache.olingo.server.api.uri.queryoption.SelectItem;
 import org.apache.olingo.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.server.core.ServiceMetadataImpl;
 import org.apache.olingo.server.core.serializer.ExpandSelectMock;
 import org.apache.olingo.server.core.uri.UriHelperImpl;
 import org.apache.olingo.server.tecsvc.MetadataETagSupport;
@@ -64,7 +64,7 @@ import org.junit.Test;
 import org.mockito.Mockito;
 
 public class ODataJsonSerializerTest {
-  private static final ServiceMetadata metadata = 
OData.newInstance().createServiceMetadata(
+  private static final ServiceMetadata metadata = new ServiceMetadataImpl(
       new EdmTechProvider(), Collections.<EdmxReference> emptyList(), new 
MetadataETagSupport("W/\"metadataETag\""));
   private static final EdmEntityContainer entityContainer = 
metadata.getEdm().getEntityContainer();
   private final DataProvider data = new DataProvider();
@@ -157,8 +157,8 @@ public class ODataJsonSerializerTest {
   }
 
   @Test
-  public void entitySetAllPrim() throws Exception {
-    final EdmEntitySet edmEntitySet = 
entityContainer.getEntitySet("ESAllPrim");
+  public void entitySetCompAllPrim() throws Exception {
+    final EdmEntitySet edmEntitySet = 
entityContainer.getEntitySet("ESCompAllPrim");
     EntityCollection entitySet = data.readAll(edmEntitySet);
     entitySet.setCount(entitySet.getEntities().size());
     entitySet.setNext(URI.create("/next"));
@@ -172,10 +172,11 @@ public class ODataJsonSerializerTest {
     final String resultString = IOUtils.toString(result);
 
     Assert.assertThat(resultString, CoreMatchers.startsWith("{"
-        + "\"@odata.context\":\"$metadata#ESAllPrim\","
+        + "\"@odata.context\":\"$metadata#ESCompAllPrim\","
         + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
-        + "\"@odata.count\":3,\"value\":["));
-    Assert.assertThat(resultString, CoreMatchers.endsWith("],"
+        + "\"@odata.count\":3,\"value\":["
+        + "{\"@odata.etag\":\"W/\\\"32767\\\"\","));
+    Assert.assertThat(resultString, CoreMatchers.endsWith("\"}}],"
         + "\"@odata.nextLink\":\"/next\"}"));
 
     int count = 0;
@@ -183,7 +184,7 @@ public class ODataJsonSerializerTest {
     while ((index = resultString.indexOf("PropertyInt16\":", ++index)) > 0) {
       count++;
     }
-    Assert.assertEquals(3, count);
+    Assert.assertEquals(6, count);
   }
 
   @Test

Reply via email to