olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/6] [OLINGO-254] Specific client (EdmEnabledODataClient) provided to work with Edm: type information is derived from contextURL, hence such client is useful in JSON with full or minimal metadata
Date Sun, 27 Apr 2014 05:49:15 GMT
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
index a38b403..59eaef8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
@@ -64,8 +64,7 @@ public class PropertyRetrieveTestITCase extends AbstractTestITCase {
         assertTrue(value.isCollection());
       }
     } catch (ODataClientErrorException e) {
-      if (e.getStatusLine().getStatusCode() != 404
-              && e.getStatusLine().getStatusCode() != 400) {
+      if (e.getStatusLine().getStatusCode() != 404 && e.getStatusLine().getStatusCode() != 400) {
         fail(e.getMessage());
       }
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index c0ebc4c..2bdc18f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -38,6 +38,7 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
 import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
 import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.client.api.uri.v3.URIBuilder;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.ODataCollectionValue;
 import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.commons.api.domain.ODataValue;
@@ -284,7 +285,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
     }
     updateReq.setFormat(format);
 
-    ODataPropertyUpdateResponse updateRes = updateReq.execute();
+    final ODataPropertyUpdateResponse updateRes = updateReq.execute();
     assertEquals(204, updateRes.getStatusCode());
 
     retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
@@ -353,7 +354,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
     final ODataRawResponse res = req.execute();
     assertNotNull(res);
 
-    final ODataProperty property = res.getBodyAs(ODataProperty.class);
-    assertNotNull(property);
+    final ResWrap<ODataProperty> property = res.getBodyAs(ODataProperty.class);
+    assertNotNull(property.getPayload());
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index 03884df..827ad2a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -195,7 +195,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
     req.setFormat(ODataPubFormat.ATOM);
 
     final Entry atomEntry =
-            client.getDeserializer().toEntry(req.execute().getRawResponse(), ODataPubFormat.ATOM).getObject();
+            client.getDeserializer().toEntry(req.execute().getRawResponse(), ODataPubFormat.ATOM).getPayload();
     assertEquals("remotingdestructorprinterswitcheschannelssatellitelanguageresolve",
             ((AtomEntryImpl) atomEntry).getSummary());
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
index ea5b5e0..c090ec8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
@@ -25,6 +25,7 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateR
 import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
 import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.core.ODataClientFactory;
 import org.apache.olingo.client.core.it.AbstractBaseTestITCase;
@@ -42,7 +43,9 @@ import org.junit.BeforeClass;
 
 public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
 
-  protected static ODataClient client;
+  protected static final ODataClient client = ODataClientFactory.getV4();
+
+  protected static EdmEnabledODataClient edmClient;
 
   protected static String testStaticServiceRootURL;
 
@@ -61,11 +64,8 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
     testOpenTypeServiceRootURL = "http://localhost:9080/StaticService/V40/OpenType.svc";
     testLargeModelServiceRootURL = "http://localhost:9080/StaticService/V40/Static.svc/large";
     testAuthServiceRootURL = "http://localhost:9080/DefaultService.svc";
-  }
 
-  @BeforeClass
-  public static void setClientInstance() {
-    client = ODataClientFactory.getV4();
+    edmClient = ODataClientFactory.getEdmEnabledV4(testStaticServiceRootURL);  
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
index db69cca..4feea96 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
@@ -32,12 +32,16 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataRawReque
 import org.apache.olingo.client.api.communication.response.ODataRawResponse;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.uri.v4.URIBuilder;
+import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
 import org.apache.olingo.commons.api.domain.ODataInlineEntity;
 import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
 import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -49,12 +53,8 @@ import org.junit.Test;
  */
 public class EntityRetrieveTestITCase extends AbstractTestITCase {
 
-  protected String getServiceRoot() {
-    return testStaticServiceRootURL;
-  }
-
-  private void withInlineEntry(final ODataPubFormat format) {
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).
+  private void withInlineEntry(final ODataClient client, final ODataPubFormat format) {
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
             appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
 
     final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().
@@ -66,56 +66,65 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
 
     assertNotNull(entity);
     assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
-    assertEquals(getServiceRoot() + "/Customers(1)", entity.getEditLink().toASCIIString());
-
-    assertEquals(3, entity.getNavigationLinks().size());
-
-    if (ODataPubFormat.ATOM == format) {
-      assertTrue(entity.getAssociationLinks().isEmpty());
-      // In JSON, association links for each $ref link will exist.
-    }
+    assertTrue(entity.getProperty("Home").hasPrimitiveValue());
+    assertEquals("Edm.GeographyPoint", entity.getProperty("Home").getPrimitiveValue().getTypeName());
+    assertEquals(testStaticServiceRootURL + "/Customers(1)", entity.getEditLink().toASCIIString());
 
-    boolean found = false;
+    // In JSON with minimal metadata, links are not provided
+    if (format == ODataPubFormat.ATOM || format == ODataPubFormat.JSON_FULL_METADATA) {
+      assertEquals(3, entity.getNavigationLinks().size());
 
-    for (ODataLink link : entity.getNavigationLinks()) {
-      if (link instanceof ODataInlineEntity) {
-        final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
-        assertNotNull(inline);
-
-        final List<? extends CommonODataProperty> properties = inline.getProperties();
-        assertEquals(5, properties.size());
-
-        assertTrue(properties.get(0).getName().equals("CompanyID")
-                || properties.get(1).getName().equals("CompanyID")
-                || properties.get(2).getName().equals("CompanyID")
-                || properties.get(3).getName().equals("CompanyID")
-                || properties.get(4).getName().equals("CompanyID"));
-        assertTrue(properties.get(0).getValue().toString().equals("0")
-                || properties.get(1).getValue().toString().equals("0")
-                || properties.get(2).getValue().toString().equals("0")
-                || properties.get(3).getValue().toString().equals("0")
-                || properties.get(4).getValue().toString().equals("0"));
+      if (ODataPubFormat.ATOM == format) {
+        assertTrue(entity.getAssociationLinks().isEmpty());
+        // In JSON, association links for each $ref link will exist.
+      }
 
-        found = true;
+      boolean found = false;
+
+      for (ODataLink link : entity.getNavigationLinks()) {
+        if (link instanceof ODataInlineEntity) {
+          final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
+          assertNotNull(inline);
+
+          final List<? extends CommonODataProperty> properties = inline.getProperties();
+          assertEquals(5, properties.size());
+
+          assertTrue(properties.get(0).getName().equals("CompanyID")
+                  || properties.get(1).getName().equals("CompanyID")
+                  || properties.get(2).getName().equals("CompanyID")
+                  || properties.get(3).getName().equals("CompanyID")
+                  || properties.get(4).getName().equals("CompanyID"));
+          assertTrue(properties.get(0).getValue().toString().equals("0")
+                  || properties.get(1).getValue().toString().equals("0")
+                  || properties.get(2).getValue().toString().equals("0")
+                  || properties.get(3).getValue().toString().equals("0")
+                  || properties.get(4).getValue().toString().equals("0"));
+
+          found = true;
+        }
       }
-    }
 
-    assertTrue(found);
+      assertTrue(found);
+    }
   }
 
   @Test
   public void withInlineEntryFromAtom() {
-    withInlineEntry(ODataPubFormat.ATOM);
+    withInlineEntry(client, ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void withInlineEntryFromFullJSON() {
+    withInlineEntry(client, ODataPubFormat.JSON_FULL_METADATA);
   }
 
   @Test
   public void withInlineEntryFromJSON() {
-    // this needs to be full, otherwise there is no mean to recognize links
-    withInlineEntry(ODataPubFormat.JSON_FULL_METADATA);
+    withInlineEntry(edmClient, ODataPubFormat.JSON);
   }
 
-  private void withInlineFeed(final ODataPubFormat format) {
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).
+  private void withInlineFeed(final ODataClient client, final ODataPubFormat format) {
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
             appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders");
 
     final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().
@@ -125,34 +134,40 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     final ODataRetrieveResponse<ODataEntity> res = req.execute();
     final ODataEntity entity = res.getBody();
     assertNotNull(entity);
+    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
 
-    boolean found = false;
-
-    for (ODataLink link : entity.getNavigationLinks()) {
-      if (link instanceof ODataInlineEntitySet) {
-        final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
-        assertNotNull(inline);
+    // In JSON with minimal metadata, links are not provided
+    if (format == ODataPubFormat.ATOM || format == ODataPubFormat.JSON_FULL_METADATA) {
+      boolean found = false;
+      for (ODataLink link : entity.getNavigationLinks()) {
+        if (link instanceof ODataInlineEntitySet) {
+          final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+          assertNotNull(inline);
 
-        found = true;
+          found = true;
+        }
       }
+      assertTrue(found);
     }
-
-    assertTrue(found);
   }
 
   @Test
   public void withInlineFeedFromAtom() {
-    withInlineFeed(ODataPubFormat.ATOM);
+    withInlineFeed(client, ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void withInlineFeedFromFullJSON() {
+    withInlineFeed(client, ODataPubFormat.JSON_FULL_METADATA);
   }
 
   @Test
   public void withInlineFeedFromJSON() {
-    // this needs to be full, otherwise there is no mean to recognize links
-    withInlineFeed(ODataPubFormat.JSON_FULL_METADATA);
+    withInlineFeed(edmClient, ODataPubFormat.JSON);
   }
 
   private void rawRequest(final ODataPubFormat format) {
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
             appendEntitySetSegment("People").appendKeySegment(5);
 
     final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
@@ -161,11 +176,11 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     final ODataRawResponse res = req.execute();
     assertNotNull(res);
 
-    final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
+    final ResWrap<ODataEntitySet> entitySet = res.getBodyAs(ODataEntitySet.class);
     assertNull(entitySet);
 
-    final ODataEntity entity = res.getBodyAs(ODataEntity.class);
-    assertTrue(entity.getReference().endsWith("/StaticService/V40/Static.svc/People(5)"));
+    final ResWrap<ODataEntity> entity = res.getBodyAs(ODataEntity.class);
+    assertTrue(entity.getPayload().getReference().endsWith("/StaticService/V40/Static.svc/People(5)"));
   }
 
   @Test
@@ -175,7 +190,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
 
   @Test
   public void rawRequestAsJSON() {
-    // this needs to be full, otherwise actions will not be provided
+    // this needs to be full, otherwise reference will not be provided
     rawRequest(ODataPubFormat.JSON_FULL_METADATA);
   }
 
@@ -184,7 +199,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     multiKey.put("ProductID", "6");
     multiKey.put("ProductDetailID", 1);
 
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
             appendEntitySetSegment("ProductDetails").appendKeySegment(multiKey);
 
     final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
@@ -207,19 +222,9 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     multiKey(ODataPubFormat.JSON_FULL_METADATA);
   }
 
-  @Test
-  public void checkForETagAsATOM() {
-    checkForETag(ODataPubFormat.ATOM);
-  }
-
-  @Test
-  public void checkForETagAsJSON() {
-    checkForETag(ODataPubFormat.JSON_FULL_METADATA);
-  }
-
-  private void checkForETag(final ODataPubFormat format) {
+  private void checkForETag(final ODataClient client, final ODataPubFormat format) {
     final URIBuilder uriBuilder =
-            client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Orders").appendKeySegment(8);
+            client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8);
 
     final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
     req.setFormat(format);
@@ -227,16 +232,36 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     final ODataRetrieveResponse<ODataEntity> res = req.execute();
     assertEquals(200, res.getStatusCode());
 
-    final String etag = res.getEtag();
+    final String etag = res.getETag();
     assertTrue(StringUtils.isNotBlank(etag));
 
     final ODataEntity order = res.getBody();
     assertEquals(etag, order.getETag());
+    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Order", order.getTypeName().toString());
+    assertEquals("Edm.Int32", order.getProperty("OrderID").getPrimitiveValue().getTypeName());
+    assertEquals("Edm.DateTimeOffset", order.getProperty("OrderDate").getPrimitiveValue().getTypeName());
+    assertEquals("Edm.Duration", order.getProperty("ShelfLife").getPrimitiveValue().getTypeName());
+    assertEquals("Collection(Edm.Duration)", order.getProperty("OrderShelfLifes").getCollectionValue().getTypeName());
+  }
+
+  @Test
+  public void checkForETagAsATOM() {
+    checkForETag(client, ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void checkForETagAsFullJSON() {
+    checkForETag(client, ODataPubFormat.JSON_FULL_METADATA);
+  }
+
+  @Test
+  public void checkForETagAsJSON() {
+    checkForETag(edmClient, ODataPubFormat.JSON);
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void issue99() {
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Orders");
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
 
     final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
     req.setFormat(ODataPubFormat.JSON);
@@ -246,18 +271,8 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     req.execute().getBody();
   }
 
-  @Test
-  public void atomReference() {
-    reference(ODataPubFormat.ATOM);
-  }
-
-  @Test
-  public void jsonReference() {
-    reference(ODataPubFormat.JSON_FULL_METADATA);
-  }
-
   private void reference(final ODataPubFormat format) {
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
             appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder").
             appendRefSegment();
 
@@ -272,7 +287,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     assertTrue(entity.getReference().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)"));
 
     final URI referenceURI =
-            client.getURIBuilder(getServiceRoot()).appendEntityIdSegment(entity.getReference()).build();
+            client.getURIBuilder(testStaticServiceRootURL).appendEntityIdSegment(entity.getReference()).build();
 
     req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI);
     req.setFormat(format);
@@ -282,27 +297,71 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
     assertNotNull(res.getBody());
   }
 
-  private void contained(final ODataPubFormat format) throws EdmPrimitiveTypeException {
-    final URI uri = getClient().getURIBuilder(getServiceRoot()).
+  @Test
+  public void atomReference() {
+    reference(ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void jsonReference() {
+    reference(ODataPubFormat.JSON_FULL_METADATA);
+  }
+
+  private void contained(final ODataClient client, final ODataPubFormat format) throws EdmPrimitiveTypeException {
+    final URI uri = client.getURIBuilder(testStaticServiceRootURL).
             appendEntitySetSegment("Accounts").appendKeySegment(101).
             appendNavigationSegment("MyPaymentInstruments").appendKeySegment(101901).build();
-
-    final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(uri);
+    final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uri);
     req.setFormat(format);
 
     final ODataEntity contained = req.execute().getBody();
     assertNotNull(contained);
+    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", contained.getTypeName().toString());
     assertEquals(101901,
             contained.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
+    assertEquals("Edm.DateTimeOffset", contained.getProperty("CreatedDate").getPrimitiveValue().getTypeName());
+  }
+
+  @Test
+  public void containedFromAtom() throws EdmPrimitiveTypeException {
+    contained(client, ODataPubFormat.ATOM);
   }
 
   @Test
-  public void atomContained() throws EdmPrimitiveTypeException {
-    contained(ODataPubFormat.ATOM);
+  public void containedFromFullJSON() throws EdmPrimitiveTypeException {
+    contained(client, ODataPubFormat.JSON_FULL_METADATA);
   }
 
   @Test
-  public void jsonContained() throws EdmPrimitiveTypeException {
-    contained(ODataPubFormat.JSON);
+  public void containedFromJSON() throws EdmPrimitiveTypeException {
+    contained(edmClient, ODataPubFormat.JSON);
   }
+
+  private void entitySetNavigationLink(final ODataClient client, final ODataPubFormat format) {
+    final URI uri = client.getURIBuilder(testStaticServiceRootURL).
+            appendEntitySetSegment("Accounts").appendKeySegment(101).build();
+    final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uri);
+    req.setFormat(format);
+
+    final ODataEntity entity = req.execute().getBody();
+    assertNotNull(entity);
+
+    // With JSON, entity set navigation links are only recognizable via Edm
+    if (format == ODataPubFormat.ATOM || client instanceof EdmEnabledODataClient) {
+      assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType());
+      assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType());
+    }
+  }
+
+  @Test
+  public void entitySetNavigationLinkFromAtom() {
+    entitySetNavigationLink(client, ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void entitySetNavigationLinkFromJSON() {
+    // only JSON_FULL_METADATA has links, only Edm can recognize entity set navigation
+    entitySetNavigationLink(edmClient, ODataPubFormat.JSON_FULL_METADATA);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index 1c9e301..e4265fe 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -31,7 +31,9 @@ import org.apache.olingo.client.api.communication.response.ODataRawResponse;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
 import org.apache.olingo.client.api.uri.v4.URIBuilder;
+import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -42,8 +44,19 @@ import org.junit.Test;
  */
 public class EntitySetTestITCase extends AbstractTestITCase {
 
-  protected String getServiceRoot() {
-    return testStaticServiceRootURL;
+  private void rawRequest(final ODataPubFormat format) {
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
+    uriBuilder.appendEntitySetSegment("People");
+
+    final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
+    req.setFormat(format.toString(client.getServiceVersion()));
+
+    final ODataRawResponse res = req.execute();
+    assertNotNull(res);
+
+    final ResWrap<ODataEntitySet> entitySet = res.getBodyAs(ODataEntitySet.class);
+    assertNotNull(entitySet.getPayload());
+    assertTrue(entitySet.getContextURL().getURI().toASCIIString().endsWith("$metadata#People"));
   }
 
   @Test
@@ -56,14 +69,59 @@ public class EntitySetTestITCase extends AbstractTestITCase {
     rawRequest(ODataPubFormat.JSON);
   }
 
+  private void readWithInlineCount(final ODataClient client, final ODataPubFormat format) {
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
+    uriBuilder.appendEntitySetSegment("People").count(true);
+
+    final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
+    req.setFormat(format.toString(client.getServiceVersion()));
+
+    final ODataRawResponse res = req.execute();
+    assertNotNull(res);
+
+    final ResWrap<ODataEntitySet> entitySet = res.getBodyAs(ODataEntitySet.class);
+    assertEquals(5, entitySet.getPayload().getCount());
+
+    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Address",
+            entitySet.getPayload().getEntities().get(2).getProperty("HomeAddress").getComplexValue().getTypeName());
+  }
+
   @Test
   public void readWithInlineCountAsJSON() throws IOException {
-    readWithInlineCount(ODataPubFormat.JSON);
+    readWithInlineCount(edmClient, ODataPubFormat.JSON);
+  }
+
+  @Test
+  public void readWithInlineCountAsFullJSON() throws IOException {
+    readWithInlineCount(client, ODataPubFormat.JSON_FULL_METADATA);
   }
 
   @Test
   public void readWithInlineCountAsAtom() throws IOException {
-    readWithInlineCount(ODataPubFormat.ATOM);
+    readWithInlineCount(client, ODataPubFormat.ATOM);
+  }
+
+  private void readODataEntitySetIterator(final ODataPubFormat format) {
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
+    uriBuilder.appendEntitySetSegment("People");
+
+    final ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> req =
+            client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
+    req.setFormat(format);
+
+    final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
+    final ODataEntitySetIterator<ODataEntitySet, ODataEntity> feedIterator = res.getBody();
+
+    assertNotNull(feedIterator);
+
+    int count = 0;
+
+    while (feedIterator.hasNext()) {
+      assertNotNull(feedIterator.next());
+      count++;
+    }
+    assertEquals(5, count);
+    assertTrue(feedIterator.getNext().toASCIIString().endsWith("People?$skiptoken=5"));
   }
 
   @Test
@@ -77,27 +135,17 @@ public class EntitySetTestITCase extends AbstractTestITCase {
   }
 
   @Test
-  public void readODataEntitySetIteratorFromJSONFullMeta() {
+  public void readODataEntitySetIteratorFromJSONFull() {
     readODataEntitySetIterator(ODataPubFormat.JSON_FULL_METADATA);
   }
 
   @Test
-  public void readODataEntitySetIteratorFromJSONNoMeta() {
+  public void readODataEntitySetIteratorFromJSONNo() {
     readODataEntitySetIterator(ODataPubFormat.JSON_NO_METADATA);
   }
 
-  @Test
-  public void readODataEntitySetWithNextFromAtom() {
-    readEntitySetWithNextLink(ODataPubFormat.ATOM);
-  }
-
-  @Test
-  public void readODataEntitySetWithNextFromJSON() {
-    readEntitySetWithNextLink(ODataPubFormat.JSON_FULL_METADATA);
-  }
-
   private void readEntitySetWithNextLink(final ODataPubFormat format) {
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot());
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
     uriBuilder.appendEntitySetSegment("People");
 
     final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
@@ -109,66 +157,23 @@ public class EntitySetTestITCase extends AbstractTestITCase {
 
     assertNotNull(feed);
 
-    assertTrue(res.getContextURL().toASCIIString().endsWith("$metadata#People"));
-
     assertEquals(5, feed.getEntities().size());
     assertNotNull(feed.getNext());
 
-    final URI expected = URI.create(getServiceRoot() + "/People?$skiptoken=5");
-    final URI found = URIUtils.getURI(getServiceRoot(), feed.getNext().toASCIIString());
+    final URI expected = URI.create(testStaticServiceRootURL + "/People?$skiptoken=5");
+    final URI found = URIUtils.getURI(testStaticServiceRootURL, feed.getNext().toASCIIString());
 
     assertEquals(expected, found);
   }
 
-  private void readODataEntitySetIterator(final ODataPubFormat format) {
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot());
-    uriBuilder.appendEntitySetSegment("People");
-
-    final ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> req =
-            client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
-    req.setFormat(format);
-
-    final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
-    final ODataEntitySetIterator<ODataEntitySet, ODataEntity> feedIterator = res.getBody();
-
-    assertNotNull(feedIterator);
-
-    int count = 0;
-
-    while (feedIterator.hasNext()) {
-      assertNotNull(feedIterator.next());
-      count++;
-    }
-    assertEquals(5, count);
-    assertTrue(feedIterator.getNext().toASCIIString().endsWith("People?$skiptoken=5"));
+  @Test
+  public void readODataEntitySetWithNextFromAtom() {
+    readEntitySetWithNextLink(ODataPubFormat.ATOM);
   }
 
-  private void readWithInlineCount(final ODataPubFormat format) {
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot());
-    uriBuilder.appendEntitySetSegment("People").count(true);
-
-    final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
-    req.setFormat(format.toString(client.getServiceVersion()));
-
-    final ODataRawResponse res = req.execute();
-    assertNotNull(res);
-
-    final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
-    assertEquals(5, entitySet.getCount());
+  @Test
+  public void readODataEntitySetWithNextFromJSON() {
+    readEntitySetWithNextLink(ODataPubFormat.JSON_FULL_METADATA);
   }
 
-  private void rawRequest(final ODataPubFormat format) {
-    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot());
-    uriBuilder.appendEntitySetSegment("People");
-
-    final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
-    req.setFormat(format.toString(client.getServiceVersion()));
-
-    final ODataRawResponse res = req.execute();
-    assertNotNull(res);
-
-    final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
-    assertNotNull(entitySet);
-    assertTrue(res.getContextURL().toASCIIString().endsWith("$metadata#People"));
-  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/FilterFactoryTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/FilterFactoryTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/FilterFactoryTestITCase.java
index 595c6c6..4062de5 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/FilterFactoryTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/FilterFactoryTestITCase.java
@@ -18,14 +18,14 @@
  */
 package org.apache.olingo.client.core.it.v4;
 
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
 import static org.junit.Assert.assertEquals;
+import static org.apache.olingo.client.core.it.v4.AbstractTestITCase.client;
 
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
 import org.apache.olingo.client.api.uri.URIFilter;
 import org.apache.olingo.client.api.uri.v4.FilterArgFactory;
 import org.apache.olingo.client.api.uri.v4.FilterFactory;
 import org.apache.olingo.client.api.uri.v4.URIBuilder;
-import static org.apache.olingo.client.core.it.v4.AbstractTestITCase.client;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -43,7 +43,6 @@ public class FilterFactoryTestITCase extends AbstractTestITCase {
 
   @Test
   public void crossjoin() {
-
     final URIFilter filter = getFilterFactory().eq(
             getFilterArgFactory().property("Orders/OrderID"), getFilterArgFactory().property("Customers/Order"));
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/KeyAsSegmentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/KeyAsSegmentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/KeyAsSegmentTestITCase.java
index 4a0c369..91d4c85 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/KeyAsSegmentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/KeyAsSegmentTestITCase.java
@@ -18,11 +18,13 @@
  */
 package org.apache.olingo.client.core.it.v4;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.net.URI;
 import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
 import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
-import static org.junit.Assert.assertFalse;
-
 import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
 import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
@@ -32,8 +34,6 @@ import org.apache.olingo.commons.api.domain.v4.ODataProperty;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.junit.AfterClass;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
index 887a46d..4bac063 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
@@ -27,6 +27,8 @@ import org.apache.olingo.client.core.it.AbstractMetadataTestITCase;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmEntityContainer;
 import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.junit.Test;
 
@@ -42,6 +44,14 @@ public class MetadataTestITCase extends AbstractMetadataTestITCase {
     final Edm metadata = getClient().getRetrieveRequestFactory().
             getMetadataRequest(getTestServiceRoot()).execute().getBody();
     assertNotNull(metadata);
+
+    final EdmEntityType order = metadata.getEntityType(
+            new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order"));
+    assertNotNull(order);
+
+    final EdmProperty orderDate = order.getStructuralProperty("OrderDate");
+    assertNotNull(orderDate);
+    assertEquals("Edm.DateTimeOffset", orderDate.getType().getFullQualifiedName().toString());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyTestITCase.java
new file mode 100644
index 0000000..00247ae
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyTestITCase.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.it.v4;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.junit.Test;
+
+public class PropertyTestITCase extends AbstractTestITCase {
+  
+  private void _enum(final ODataClient client, final ODataFormat format) {
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+            appendEntitySetSegment("Products").appendKeySegment(5).appendPropertySegment("CoverColors");
+    final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory().
+            getPropertyRequest(uriBuilder.build());
+    req.setFormat(format);
+
+    final ODataProperty prop = req.execute().getBody();
+    assertNotNull(prop);
+    assertEquals("Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)", prop.getValue().getTypeName());    
+  }
+
+  @Test
+  public void enumFromXML() {
+    _enum(client, ODataFormat.XML);
+  }
+
+  @Test
+  public void enumFromJSON() {
+    _enum(edmClient, ODataFormat.JSON);
+  }
+
+  @Test
+  public void enumFromFullJSON() {
+    _enum(client, ODataFormat.JSON_FULL_METADATA);
+  }
+  
+  private void geospatial(final ODataClient client, final ODataFormat format) {
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+            appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Home");
+    final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory().
+            getPropertyRequest(uriBuilder.build());
+    req.setFormat(format);
+
+    final ODataProperty prop = req.execute().getBody();
+    assertNotNull(prop);
+    assertEquals("Edm.GeographyPoint", prop.getValue().getTypeName());
+  }
+
+  @Test
+  public void geospatialFromXML() {
+    geospatial(client, ODataFormat.XML);
+  }
+
+  @Test
+  public void geospatialFromJSON() {
+    geospatial(edmClient, ODataFormat.JSON);
+  }
+
+  @Test
+  public void geospatialFromFullJSON() {
+    geospatial(client, ODataFormat.JSON_FULL_METADATA);
+  }
+
+  private void complex(final ODataClient client, final ODataFormat format) {
+    final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+            appendEntitySetSegment("Customers").appendKeySegment(2).appendPropertySegment("HomeAddress");
+    final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory().
+            getPropertyRequest(uriBuilder.build());
+    req.setFormat(format);
+
+    final ODataProperty prop = req.execute().getBody();
+    assertNotNull(prop);
+    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Address", prop.getValue().getTypeName());
+  }
+
+  @Test
+  public void complexFromXML() {
+    complex(client, ODataFormat.XML);
+  }
+
+  @Test
+  public void complexFromJSON() {
+    complex(edmClient, ODataFormat.JSON);
+  }
+
+  @Test
+  public void complexFromFullJSON() {
+    complex(client, ODataFormat.JSON_FULL_METADATA);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
index 133c929..3e7653d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
@@ -19,7 +19,6 @@
 package org.apache.olingo.client.core.it.v4;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
 import java.net.URI;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
@@ -43,7 +42,6 @@ public class ServiceDocumentTestITCase extends AbstractTestITCase {
     assertEquals(6, serviceDocument.getSingletons().size());
     assertEquals(6, serviceDocument.getFunctionImports().size());
 
-    assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
     assertEquals(URI.create(testStaticServiceRootURL + "/ProductDetails"),
             serviceDocument.getEntitySetURI("ProductDetails"));
     assertEquals(URI.create(testStaticServiceRootURL + "/Boss"),

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
index ce2ef71..1e6df49 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
@@ -70,7 +70,7 @@ public class AtomTest extends AbstractTest {
   protected void feed(final String filename, final ODataPubFormat format) throws Exception {
     final StringWriter writer = new StringWriter();
     getClient().getSerializer().feed(getClient().getDeserializer().toFeed(
-            getClass().getResourceAsStream("Customer." + getSuffix(format)), format).getObject(), writer);
+            getClass().getResourceAsStream("Customer." + getSuffix(format)), format).getPayload(), writer);
 
     assertSimilar("Customer." + getSuffix(format), writer.toString());
   }
@@ -83,7 +83,7 @@ public class AtomTest extends AbstractTest {
   protected void entry(final String filename, final ODataPubFormat format) throws Exception {
     final StringWriter writer = new StringWriter();
     getClient().getSerializer().entry(getClient().getDeserializer().toEntry(
-            getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
+            getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getPayload(), writer);
 
     assertSimilar(filename + "." + getSuffix(format), writer.toString());
   }
@@ -103,7 +103,8 @@ public class AtomTest extends AbstractTest {
   protected void property(final String filename, final ODataFormat format) throws Exception {
     final StringWriter writer = new StringWriter();
     getClient().getSerializer().property(getClient().getDeserializer().
-            toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
+            toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getPayload(),
+            writer);
 
     assertSimilar(filename + "." + getSuffix(format), writer.toString());
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index 67edef3..f01a7f5 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -23,9 +23,12 @@ import static org.junit.Assert.assertEquals;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URI;
 import org.apache.olingo.client.api.v3.ODataClient;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
 import org.apache.olingo.commons.core.op.ResourceFactory;
 import org.junit.Test;
@@ -40,14 +43,15 @@ public class EntitySetTest extends AbstractTest {
   private void read(final ODataPubFormat format) throws IOException {
     final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
     final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
-            getClient().getDeserializer().toFeed(input, format).getObject());
+            getClient().getDeserializer().toFeed(input, format));
     assertNotNull(entitySet);
 
     assertEquals(2, entitySet.getEntities().size());
     assertNotNull(entitySet.getNext());
 
-    final ODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
-            getBinder().getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntitySet written = getClient().getBinder().getODataEntitySet(new ResWrap<Feed>((URI) null, null,
+            getClient().getBinder().getFeed(
+                    entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entitySet, written);
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 631a45d..cbc8041 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -23,10 +23,13 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.InputStream;
+import java.net.URI;
 import org.apache.olingo.client.api.v3.ODataClient;
 import org.apache.olingo.commons.api.domain.ODataLink;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.v3.ODataEntity;
 import org.apache.olingo.commons.api.domain.v3.ODataProperty;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -46,7 +49,7 @@ public class EntityTest extends AbstractTest {
   private void readAndWrite(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("Customer_-10." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     assertEquals("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer", entity.getTypeName().toString());
@@ -64,8 +67,8 @@ public class EntityTest extends AbstractTest {
 
     assertTrue(check);
 
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -82,7 +85,7 @@ public class EntityTest extends AbstractTest {
   private void readGeospatial(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-8." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     boolean found = false;
@@ -95,8 +98,8 @@ public class EntityTest extends AbstractTest {
     }
     assertTrue(found);
 
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -114,14 +117,14 @@ public class EntityTest extends AbstractTest {
   private void withActions(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("ComputerDetail_-10." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     assertEquals(1, entity.getOperations().size());
     assertEquals("ResetComputerDetailsSpecifications", entity.getOperations().get(0).getTitle());
 
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     entity.getOperations().clear();
     assertEquals(entity, written);
   }
@@ -140,14 +143,14 @@ public class EntityTest extends AbstractTest {
   private void mediaEntity(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("Car_16." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
     assertTrue(entity.isMediaEntity());
     assertNotNull(entity.getMediaContentSource());
     assertNotNull(entity.getMediaContentType());
 
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -164,7 +167,7 @@ public class EntityTest extends AbstractTest {
   private void issue128(final ODataPubFormat format) throws EdmPrimitiveTypeException {
     final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-5." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     final ODataProperty geogCollection = entity.getProperty("GeogCollection");

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
index cbca942..88a0f07 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
@@ -18,17 +18,20 @@
  */
 package org.apache.olingo.client.core.v4;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertEquals;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URI;
 import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.commons.core.op.ResourceFactory;
 import org.junit.Test;
 
@@ -42,14 +45,15 @@ public class EntitySetTest extends AbstractTest {
   private void read(final ODataPubFormat format) throws IOException {
     final InputStream input = getClass().getResourceAsStream("Customers." + getSuffix(format));
     final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
-            getClient().getDeserializer().toFeed(input, format).getObject());
+            getClient().getDeserializer().toFeed(input, format));
     assertNotNull(entitySet);
 
     assertEquals(2, entitySet.getEntities().size());
     assertNull(entitySet.getNext());
 
-    final ODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().getBinder().
-            getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntitySet written = getClient().getBinder().getODataEntitySet(new ResWrap<Feed>((URI) null, null,
+            getClient().getBinder().getFeed(
+                    entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entitySet, written);
   }
 
@@ -66,7 +70,7 @@ public class EntitySetTest extends AbstractTest {
   private void ref(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("collectionOfEntityReferences." + getSuffix(format));
     final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
-            getClient().getDeserializer().toFeed(input, format).getObject());
+            getClient().getDeserializer().toFeed(input, format));
     assertNotNull(entitySet);
 
     for (ODataEntity entity : entitySet.getEntities()) {
@@ -74,8 +78,9 @@ public class EntitySetTest extends AbstractTest {
     }
     entitySet.setCount(entitySet.getEntities().size());
 
-    final ODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().getBinder().
-            getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntitySet written = getClient().getBinder().getODataEntitySet(new ResWrap<Feed>((URI) null, null,
+            getClient().getBinder().getFeed(
+                    entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entitySet, written);
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index 5707985..317f916 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -24,9 +24,12 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.InputStream;
+import java.net.URI;
 import java.util.Iterator;
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
 import org.apache.olingo.commons.api.domain.ODataLink;
 import org.apache.olingo.commons.api.domain.ODataLinkType;
@@ -50,7 +53,7 @@ public class EntityTest extends AbstractTest {
   private void singleton(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
@@ -90,8 +93,8 @@ public class EntityTest extends AbstractTest {
 
     // operations won't get serialized
     entity.getOperations().clear();
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -108,7 +111,7 @@ public class EntityTest extends AbstractTest {
   private void withEnums(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("Products_5." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     final ODataProperty skinColor = entity.getProperty("SkinColor");
@@ -125,8 +128,8 @@ public class EntityTest extends AbstractTest {
 
     // operations won't get serialized
     entity.getOperations().clear();
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -144,7 +147,7 @@ public class EntityTest extends AbstractTest {
     final InputStream input = getClass().getResourceAsStream(
             "Accounts_101_expand_MyPaymentInstruments." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     final ODataLink instruments = entity.getNavigationLink("MyPaymentInstruments");
@@ -159,8 +162,8 @@ public class EntityTest extends AbstractTest {
     inline.getEntitySet().setCount(3);
     // operations won't get serialized
     entity.getOperations().clear();
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -178,15 +181,15 @@ public class EntityTest extends AbstractTest {
     final InputStream input = getClass().getResourceAsStream(
             "Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     assertTrue(entity.isMediaEntity());
     assertNotNull(entity.getMediaContentSource());
     assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag());
 
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -203,7 +206,7 @@ public class EntityTest extends AbstractTest {
   private void withStream(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("PersonDetails_1." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     assertFalse(entity.isMediaEntity());
@@ -211,8 +214,8 @@ public class EntityTest extends AbstractTest {
     final ODataLink editMedia = entity.getEditMediaLink("Photo");
     assertNotNull(editMedia);
 
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -229,13 +232,13 @@ public class EntityTest extends AbstractTest {
   private void ref(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("entityReference." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     assertNotNull(entity.getReference());
 
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -252,7 +255,7 @@ public class EntityTest extends AbstractTest {
   private void complexNavigationProperties(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("entity.withcomplexnavigation." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
-            getClient().getDeserializer().toEntry(input, format).getObject());
+            getClient().getDeserializer().toEntry(input, format));
     assertNotNull(entity);
 
     final ODataLinkedComplexValue addressValue = entity.getProperty("Address").getLinkedComplexValue();
@@ -261,8 +264,8 @@ public class EntityTest extends AbstractTest {
 
     // ETag is not serialized
     entity.setETag(null);
-    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
-            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    final ODataEntity written = getClient().getBinder().getODataEntity(new ResWrap<Entry>((URI) null, null, getClient().
+            getBinder().getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
index c2add62..904e35e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
@@ -123,7 +123,7 @@ public class JSONTest extends AbstractTest {
   protected void feed(final String filename, final ODataPubFormat format) throws Exception {
     final StringWriter writer = new StringWriter();
     getClient().getSerializer().feed(getClient().getDeserializer().toFeed(
-            getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
+            getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getPayload(), writer);
 
     assertSimilar(filename + "." + getSuffix(format), writer.toString());
   }
@@ -137,7 +137,7 @@ public class JSONTest extends AbstractTest {
   protected void entry(final String filename, final ODataPubFormat format) throws Exception {
     final StringWriter writer = new StringWriter();
     getClient().getSerializer().entry(getClient().getDeserializer().toEntry(
-            getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
+            getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getPayload(), writer);
 
     assertSimilar(filename + "." + getSuffix(format), writer.toString());
   }
@@ -163,7 +163,8 @@ public class JSONTest extends AbstractTest {
   protected void property(final String filename, final ODataFormat format) throws Exception {
     final StringWriter writer = new StringWriter();
     getClient().getSerializer().property(getClient().getDeserializer().
-            toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
+            toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getPayload(),
+            writer);
 
     assertSimilar(filename + "." + getSuffix(format), writer.toString());
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
index 08067ab..c03619c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
@@ -24,12 +24,11 @@ import static org.junit.Assert.assertTrue;
 
 import java.net.URI;
 import org.apache.olingo.client.api.data.ServiceDocument;
-
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.commons.api.domain.ODataServiceDocument;
 import org.apache.olingo.commons.api.format.ODataFormat;
 import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.junit.Test;
 
 public class ServiceDocumentTest extends AbstractTest {
@@ -44,13 +43,13 @@ public class ServiceDocumentTest extends AbstractTest {
   }
 
   private ODataServiceDocument parse(final ODataFormat format) {
-    Container<ServiceDocument> service = getClient().getDeserializer().toServiceDocument(
+    ResWrap<ServiceDocument> service = getClient().getDeserializer().toServiceDocument(
             getClass().getResourceAsStream("serviceDocument." + getFileExtension(format)), format);
 
-    assertEquals(URI.create("http://host/service/$metadata"), service.getContextURL());
+    assertEquals(URI.create("http://host/service/$metadata"), service.getContextURL().getURI());
     assertEquals("W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"", service.getMetadataETag());
 
-    final ODataServiceDocument serviceDocument = getClient().getBinder().getODataServiceDocument(service.getObject());
+    final ODataServiceDocument serviceDocument = getClient().getBinder().getODataServiceDocument(service.getPayload());
     assertNotNull(serviceDocument);
 
     assertTrue(serviceDocument.getEntitySetTitles().contains("Order Details"));
@@ -69,6 +68,6 @@ public class ServiceDocumentTest extends AbstractTest {
 
   @Test
   public void xml() {
-    final ODataServiceDocument serviceDocument = parse(ODataFormat.XML);
+    parse(ODataFormat.XML);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml
index 619703e..ce6849a 100644
--- a/lib/commons-api/pom.xml
+++ b/lib/commons-api/pom.xml
@@ -44,6 +44,12 @@
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>    
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
     
 </project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java
deleted file mode 100644
index be3476b..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.api.data;
-
-import java.net.URI;
-
-/**
- * Outermost response object container.
- */
-public class Container<T> {
-
-  private final URI contextURL;
-
-  private final String metadataETag;
-
-  private final T object;
-
-  public Container(final URI contextURL, final String metadataETag, final T object) {
-    this.contextURL = contextURL;
-    this.metadataETag = metadataETag;
-    this.object = object;
-  }
-
-  /**
-   * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
-   * fragment identifying the relevant portion of the metadata document.
-   * <br />
-   * Request payloads generally do not require context URLs as the type of the payload can generally be determined from
-   * the request URL.
-   * <br />
-   * For details on how the context URL is used to describe a payload, see the relevant sections in the particular
-   * format.
-   *
-   * @return context URL.
-   */
-  public URI getContextURL() {
-    return contextURL;
-  }
-
-  /**
-   * An ETag header MAY also be returned on a metadata document request or service document request to allow the client
-   * subsequently to make a conditional request for the metadata or service document. Clients can also compare the value
-   * of the ETag header returned from a metadata document request to the metadata ETag returned in a response in order
-   * to verify the version of the metadata used to generate that response.
-   *
-   * @return metadata ETag.
-   */
-  public String getMetadataETag() {
-    return metadataETag;
-  }
-
-  /**
-   * Gets contained object.
-   *
-   * @return contained object.
-   */
-  public T getObject() {
-    return object;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
new file mode 100644
index 0000000..c2d503e
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.data;
+
+import java.net.URI;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+
+/**
+ * High-level representation of a context URL, built from the string value returned by a service; provides access to the
+ * various components of the context URL, defined in the protocol specification.
+ *
+ * {@link http://docs.oasis-open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html#_Toc372793655}
+ */
+public class ContextURL {
+
+  private URI uri;
+
+  private URI serviceRoot;
+
+  private String entitySetOrSingletonOrType;
+
+  private String derivedEntity;
+
+  private String selectList;
+
+  private String navOrPropertyPath;
+
+  public static ContextURL getInstance(final URI contextURL) {
+    final ContextURL instance = new ContextURL();
+    instance.uri = contextURL;
+
+    final String contextURLasString = instance.uri.toASCIIString().
+            replace("/$entity", StringUtils.EMPTY).
+            replace("/@Element", StringUtils.EMPTY);
+    
+    instance.serviceRoot = URI.create(StringUtils.substringBefore(contextURLasString, Constants.METADATA));
+
+    final String rest = StringUtils.substringAfter(contextURLasString, Constants.METADATA + "#");
+
+    String firstToken;
+    if (rest.startsWith("Collection(")) {
+      firstToken = rest.substring(0, rest.indexOf(')') + 1);
+      instance.entitySetOrSingletonOrType = firstToken;
+    } else {
+      final int openParIdx = rest.indexOf('(');
+      if (openParIdx == -1) {
+        firstToken = StringUtils.substringBefore(rest, "/");
+
+        instance.entitySetOrSingletonOrType = firstToken;
+      } else {
+        firstToken = StringUtils.substringBeforeLast(rest, ")") + ")";
+
+        instance.entitySetOrSingletonOrType = firstToken.substring(0, openParIdx);
+        final int commaIdx = firstToken.indexOf(',');
+        if (commaIdx != -1) {
+          instance.selectList = firstToken.substring(openParIdx + 1, firstToken.length() - 1);
+        }
+      }
+    }
+
+    final int slashIdx = instance.entitySetOrSingletonOrType.indexOf('/');
+    if (slashIdx != -1) {
+      final String clone = instance.entitySetOrSingletonOrType;
+      instance.entitySetOrSingletonOrType = clone.substring(0, slashIdx);
+      instance.derivedEntity = clone.substring(slashIdx + 1);
+    }
+
+    if (!firstToken.equals(rest)) {
+      final String[] pathElems = StringUtils.substringAfter(rest, "/").split("/");
+      if (pathElems.length > 0) {
+        if (pathElems[0].indexOf('.') == -1) {
+          instance.navOrPropertyPath = pathElems[0];
+        } else {
+          instance.derivedEntity = pathElems[0];
+        }
+
+        if (pathElems.length > 1) {
+          instance.navOrPropertyPath = pathElems[1];
+        }
+      }
+    }
+
+    return instance;
+  }
+
+  public URI getURI() {
+    return uri;
+  }
+
+  public URI getServiceRoot() {
+    return serviceRoot;
+  }
+
+  public String getEntitySetOrSingletonOrType() {
+    return entitySetOrSingletonOrType;
+  }
+
+  public String getDerivedEntity() {
+    return derivedEntity;
+  }
+
+  public String getSelectList() {
+    return selectList;
+  }
+
+  public String getNavOrPropertyPath() {
+    return navOrPropertyPath;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    final ContextURL other = (ContextURL) obj;
+    if (this.uri != other.uri && (this.uri == null || !this.uri.equals(other.uri))) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return this.uri.hashCode();
+  }
+
+  @Override
+  public String toString() {
+    return this.uri.toString();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ResWrap.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ResWrap.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ResWrap.java
new file mode 100644
index 0000000..41c6c7b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ResWrap.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.data;
+
+import java.net.URI;
+
+/**
+ * Outermost response payload wrapper.
+ *
+ * @param <T> the actual response payload
+ */
+public class ResWrap<T> {
+
+  private final ContextURL contextURL;
+
+  private final String metadataETag;
+
+  private final T payload;
+
+  public ResWrap(final URI contextURL, final String metadataETag, final T payload) {
+    this(contextURL == null ? null : ContextURL.getInstance(contextURL), metadataETag, payload);
+  }
+
+  public ResWrap(final ContextURL contextURL, final String metadataETag, final T payload) {
+    this.contextURL = contextURL;
+    this.metadataETag = metadataETag;
+    this.payload = payload;
+  }
+
+  /**
+   * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
+   * fragment identifying the relevant portion of the metadata document.
+   * <br />
+   * Request payloads generally do not require context URLs as the type of the payload can generally be determined from
+   * the request URL.
+   * <br />
+   * For details on how the context URL is used to describe a payload, see the relevant sections in the particular
+   * format.
+   *
+   * @return context URL.
+   */
+  public ContextURL getContextURL() {
+    return contextURL;
+  }
+
+  /**
+   * An ETag header MAY also be returned on a metadata document request or service document request to allow the client
+   * subsequently to make a conditional request for the metadata or service document. Clients can also compare the value
+   * of the ETag header returned from a metadata document request to the metadata ETag returned in a response in order
+   * to verify the version of the metadata used to generate that response.
+   *
+   * @return metadata ETag.
+   */
+  public String getMetadataETag() {
+    return metadataETag;
+  }
+
+  /**
+   * Gets contained object.
+   *
+   * @return contained object.
+   */
+  public T getPayload() {
+    return payload;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
index 4fb9de9..29f6510 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
@@ -79,7 +79,6 @@ public abstract class AbstractODataValue implements ODataValue {
    *
    * @return complex value.
    */
-//  @SuppressWarnings("unchecked")
   @Override
   public <OP extends CommonODataProperty> ODataComplexValue<OP> asComplex() {
     return isComplex() ? (ODataComplexValue<OP>) this : null;
@@ -100,7 +99,6 @@ public abstract class AbstractODataValue implements ODataValue {
    *
    * @return collection value.
    */
-//  @SuppressWarnings("unchecked")
   @Override
   public <OV extends ODataValue> ODataCollectionValue<OV> asCollection() {
     return isCollection() ? (ODataCollectionValue<OV>) this : null;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
index a0ad0c7..77173b6 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
@@ -31,6 +31,7 @@ public interface ODataComplexValue<OP extends CommonODataProperty> extends OData
    * Adds field to the complex type.
    *
    * @param field field to be added.
+   * @return this (for fluent-style calls)
    */
   ODataComplexValue<OP> add(OP field);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/15e7718a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
index 5f54154..b53e617 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
@@ -27,12 +27,20 @@ import java.util.List;
  */
 public interface EdmNavigationProperty extends EdmElement {
 
+  @Override
+  EdmEntityType getType();
+
   /**
    * @return true if nullable or null if not specified
    */
   Boolean isNullable();
 
   /**
+   * @return true if containsTarget or null if not specified
+   */
+  Boolean containsTarget();
+
+  /**
    * @return the partner navigation property
    */
   EdmNavigationProperty getPartner();


Mime
View raw message