You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/04/01 16:19:09 UTC

[42/51] [abbrv] git commit: [OLINGO-200] V4 (de)serialization tests for EntitySet and Property

[OLINGO-200] V4 (de)serialization tests for EntitySet and Property


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

Branch: refs/heads/master
Commit: eeb5d9b4ab459ed6a4e574e9b50b42919a634460
Parents: dc2922c
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 15:17:08 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 15:17:08 2014 +0200

----------------------------------------------------------------------
 .../client/core/op/AbstractODataBinder.java     |   2 +
 .../olingo/client/core/v3/EntitySetTest.java    |   3 +-
 .../olingo/client/core/v3/EntityTest.java       |  21 ++-
 .../apache/olingo/client/core/v3/JSONTest.java  |  10 +-
 .../olingo/client/core/v3/PropertyTest.java     |  11 +-
 .../olingo/client/core/v4/EntitySetTest.java    |  65 +++++++++
 .../olingo/client/core/v4/EntityTest.java       |  94 +++++++++++++
 .../apache/olingo/client/core/v4/JSONTest.java  |  10 +-
 .../olingo/client/core/v4/PropertyTest.java     | 138 ++++++++++++++++++
 ...ccounts_101_expand_MyPaymentInstruments.json |  94 +++++++++++++
 ...Accounts_101_expand_MyPaymentInstruments.xml | 129 +++++++++++++++++
 ...ts_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json |  16 +++
 ...nts_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml |  46 ++++++
 .../apache/olingo/client/core/v4/Customers.json |  57 ++++++++
 .../apache/olingo/client/core/v4/Customers.xml  | 106 ++++++++++++++
 .../client/core/v4/Employees_3_HomeAddress.json |   6 +
 .../client/core/v4/Employees_3_HomeAddress.xml  |  31 ++++
 .../olingo/client/core/v4/PersonDetails_1.json  |  22 +++
 .../olingo/client/core/v4/PersonDetails_1.xml   |  55 ++++++++
 .../olingo/client/core/v4/Products_5.json       |  30 +++-
 .../client/core/v4/Products_5_CoverColors.json  |   5 +
 .../client/core/v4/Products_5_CoverColors.xml   |  30 ++++
 .../olingo/client/core/v4/VipCustomer.xml       |   6 +
 .../apache/olingo/commons/api/Constants.java    |  12 +-
 .../apache/olingo/commons/api/data/Entry.java   |  14 ++
 .../commons/api/domain/CommonODataEntity.java   |  38 +++++
 .../olingo/commons/api/domain/ODataLink.java    |   8 ++
 .../api/edm/constants/ODataServiceVersion.java  |  12 ++
 .../olingo/commons/core/data/AbstractEntry.java |  12 ++
 .../commons/core/data/AtomDeserializer.java     |   5 +
 .../core/data/AtomPropertyDeserializer.java     |   4 +-
 .../core/data/JSONEntryDeserializer.java        |  30 ++--
 .../olingo/commons/core/data/JSONEntryImpl.java |  21 ---
 .../core/data/JSONPropertyDeserializer.java     |  16 +--
 .../core/data/ODataJacksonDeserializer.java     |   9 ++
 .../domain/AbstractODataCollectionValue.java    |   4 +-
 .../core/domain/AbstractODataEntity.java        | 140 ++++++-------------
 37 files changed, 1124 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index faed745..c41ad6b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -174,6 +174,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
     if (entity.isMediaEntity()) {
       entry.setMediaContentSource(entity.getMediaContentSource());
       entry.setMediaContentType(entity.getMediaContentType());
+      entry.setMediaETag(entity.getMediaETag());
     }
 
     for (CommonODataProperty property : entity.getProperties()) {
@@ -342,6 +343,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
       entity.setMediaEntity(true);
       entity.setMediaContentSource(resource.getMediaContentSource());
       entity.setMediaContentType(resource.getMediaContentType());
+      entity.setMediaETag(resource.getMediaETag());
     }
 
     for (Property property : resource.getProperties()) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/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 1f02432..0400321 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
@@ -27,6 +27,7 @@ import org.apache.olingo.client.api.v3.ODataClient;
 import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
 import org.apache.olingo.commons.core.op.ResourceFactory;
 import org.junit.Test;
 
@@ -39,7 +40,7 @@ public class EntitySetTest extends AbstractTest {
 
   private void read(final ODataPubFormat format) throws IOException {
     final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
-    final CommonODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+    final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
             getClient().getDeserializer().toFeed(input, format).getObject());
     assertNotNull(entitySet);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/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 41da651..99b9423 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
@@ -24,12 +24,11 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.InputStream;
 import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.client.core.AbstractTest;
 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;
 import org.apache.olingo.commons.core.op.ResourceFactory;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -82,12 +81,12 @@ public class EntityTest extends AbstractTest {
 
   private void readGeospatial(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-8." + getSuffix(format));
-    final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+    final ODataEntity entity = getClient().getBinder().getODataEntity(
             getClient().getDeserializer().toEntry(input, format).getObject());
     assertNotNull(entity);
 
     boolean found = false;
-    for (CommonODataProperty property : entity.getProperties()) {
+    for (ODataProperty property : entity.getProperties()) {
       if ("GeogMultiLine".equals(property.getName())) {
         found = true;
         assertTrue(property.hasPrimitiveValue());
@@ -96,7 +95,7 @@ public class EntityTest extends AbstractTest {
     }
     assertTrue(found);
 
-    final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
             getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
     assertEquals(entity, written);
   }
@@ -114,14 +113,14 @@ public class EntityTest extends AbstractTest {
 
   private void withActions(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("ComputerDetail_-10." + getSuffix(format));
-    final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+    final ODataEntity entity = getClient().getBinder().getODataEntity(
             getClient().getDeserializer().toEntry(input, format).getObject());
     assertNotNull(entity);
 
     assertEquals(1, entity.getOperations().size());
     assertEquals("ResetComputerDetailsSpecifications", entity.getOperations().get(0).getTitle());
 
-    final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
             getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
     entity.getOperations().clear();
     assertEquals(entity, written);
@@ -140,14 +139,14 @@ public class EntityTest extends AbstractTest {
 
   private void mediaEntity(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("Car_16." + getSuffix(format));
-    final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+    final ODataEntity entity = getClient().getBinder().getODataEntity(
             getClient().getDeserializer().toEntry(input, format).getObject());
     assertNotNull(entity);
     assertTrue(entity.isMediaEntity());
     assertNotNull(entity.getMediaContentSource());
     assertNotNull(entity.getMediaContentType());
 
-    final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
             getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
     assertEquals(entity, written);
   }
@@ -164,11 +163,11 @@ public class EntityTest extends AbstractTest {
 
   private void issue128(final ODataPubFormat format) throws EdmPrimitiveTypeException {
     final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-5." + getSuffix(format));
-    final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+    final ODataEntity entity = getClient().getBinder().getODataEntity(
             getClient().getDeserializer().toEntry(input, format).getObject());
     assertNotNull(entity);
 
-    final CommonODataProperty geogCollection = entity.getProperty("GeogCollection");
+    final ODataProperty geogCollection = entity.getProperty("GeogCollection");
     assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getPrimitiveValue().getTypeKind());
 
     int count = 0;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
index 522e686..64badc0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
@@ -67,8 +67,8 @@ public class JSONTest extends AtomTest {
     if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK))) {
       node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK));
     }
-    if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
-      node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+    if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))) {
+      node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE));
     }
     final List<String> toRemove = new ArrayList<String>();
     for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
@@ -79,10 +79,12 @@ public class JSONTest extends AtomTest {
                       getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
               || field.getKey().endsWith(
                       getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
-              || field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE_SUFFIX)
+              || field.getKey().endsWith(
+                      getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))
               || field.getKey().endsWith(
                       getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
-              || field.getKey().endsWith(Constants.JSON_MEDIA_ETAG_SUFFIX)) {
+              || field.getKey().endsWith(
+                      getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) {
 
         toRemove.add(field.getKey());
       } else if (field.getValue().isObject()) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
index 8676d6f..317d1ac 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -58,7 +58,7 @@ public class PropertyTest extends AbstractTest {
     assertEquals("-10", value.toString());
   }
 
-  private ODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
+  private void primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
     final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId." + getSuffix(format));
     final ODataProperty property = getClient().getReader().readProperty(input, format);
     assertNotNull(property);
@@ -80,8 +80,6 @@ public class PropertyTest extends AbstractTest {
     }
 
     assertEquals(property, comparable);
-
-    return property;
   }
 
   @Test
@@ -94,7 +92,7 @@ public class PropertyTest extends AbstractTest {
     primitive(ODataFormat.JSON);
   }
 
-  private ODataProperty complex(final ODataFormat format) throws IOException {
+  private void complex(final ODataFormat format) throws IOException {
     final InputStream input = getClass().getResourceAsStream("Customer_-10_PrimaryContactInfo." + getSuffix(format));
     final ODataProperty property = getClient().getReader().readProperty(input, format);
     assertNotNull(property);
@@ -118,8 +116,6 @@ public class PropertyTest extends AbstractTest {
     }
 
     assertEquals(property, comparable);
-
-    return property;
   }
 
   @Test
@@ -132,7 +128,7 @@ public class PropertyTest extends AbstractTest {
     complex(ODataFormat.JSON);
   }
 
-  private ODataProperty collection(final ODataFormat format) throws IOException {
+  private void collection(final ODataFormat format) throws IOException {
     final InputStream input = getClass().getResourceAsStream("Customer_-10_BackupContactInfo." + getSuffix(format));
     final ODataProperty property = getClient().getReader().readProperty(input, format);
     assertNotNull(property);
@@ -156,7 +152,6 @@ public class PropertyTest extends AbstractTest {
     }
 
     assertEquals(property, comparable);
-    return property;
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/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
new file mode 100644
index 0000000..6708be6
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.v4;
+
+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 org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.core.op.ResourceFactory;
+import org.junit.Test;
+
+public class EntitySetTest extends AbstractTest {
+
+  @Override
+  protected ODataClient getClient() {
+    return v4Client;
+  }
+
+  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());
+    assertNotNull(entitySet);
+
+    assertEquals(2, entitySet.getEntities().size());
+    assertNull(entitySet.getNext());
+
+    final CommonODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
+            getBinder().getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+    assertEquals(entitySet, written);
+  }
+
+  @Test
+  public void fromAtom() throws IOException {
+    read(ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void fromJSON() throws IOException {
+    read(ODataPubFormat.JSON);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/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 97b6a44..e061be6 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
@@ -19,6 +19,7 @@
 package org.apache.olingo.client.core.v4;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
@@ -26,6 +27,7 @@ import java.io.InputStream;
 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.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;
@@ -79,6 +81,12 @@ public class EntityTest extends AbstractTest {
     }
     assertEquals(3, checked);
 
+    assertEquals(2, entity.getOperations().size());
+    assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+            entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress").getMetadataAnchor());
+    assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+            entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress").getMetadataAnchor());
+
     // operations won't get serialized
     entity.getOperations().clear();
     final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
@@ -130,4 +138,90 @@ public class EntityTest extends AbstractTest {
   public void jsonWithEnums() {
     withEnums(ODataPubFormat.JSON_FULL_METADATA);
   }
+
+  private void withInlineEntitySet(final ODataPubFormat format) {
+    final InputStream input = getClass().getResourceAsStream(
+            "Accounts_101_expand_MyPaymentInstruments." + getSuffix(format));
+    final ODataEntity entity = getClient().getBinder().getODataEntity(
+            getClient().getDeserializer().toEntry(input, format).getObject());
+    assertNotNull(entity);
+
+    final ODataLink instruments = entity.getNavigationLink("MyPaymentInstruments");
+    assertNotNull(instruments);
+    assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, instruments.getType());
+
+    final ODataInlineEntitySet inline = instruments.asInlineEntitySet();
+    assertNotNull(inline);
+    assertEquals(3, inline.getEntitySet().getEntities().size());
+
+    // count shouldn't be serialized
+    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)));
+    assertEquals(entity, written);
+  }
+
+  @Test
+  public void atomWithInlineEntitySet() {
+    withInlineEntitySet(ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void jsonWithInlineEntitySet() {
+    withInlineEntitySet(ODataPubFormat.JSON_FULL_METADATA);
+  }
+
+  private void mediaEntity(final ODataPubFormat format) {
+    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());
+    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)));
+    assertEquals(entity, written);
+  }
+
+  @Test
+  public void atomMediaEntity() {
+    mediaEntity(ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void jsonMediaEntity() {
+    mediaEntity(ODataPubFormat.JSON_FULL_METADATA);
+  }
+
+  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());
+    assertNotNull(entity);
+
+    assertFalse(entity.isMediaEntity());
+
+    final ODataLink editMedia = entity.getEditMediaLink("Photo");
+    assertNotNull(editMedia);
+
+    final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+            getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+    assertEquals(entity, written);
+  }
+
+  @Test
+  public void atomWithStream() {
+    withStream(ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void jsonWithStream() {
+    withStream(ODataPubFormat.JSON_FULL_METADATA);
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/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 272ab13..770f112 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
@@ -73,8 +73,8 @@ public class JSONTest extends AbstractTest {
     if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK))) {
       node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK));
     }
-    if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
-      node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+    if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))) {
+      node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE));
     }
     final List<String> toRemove = new ArrayList<String>();
     for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
@@ -85,10 +85,12 @@ public class JSONTest extends AbstractTest {
                       getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
               || field.getKey().endsWith(
                       getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
-              || field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE_SUFFIX)
+              || field.getKey().endsWith(
+                      getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))
               || field.getKey().endsWith(
                       getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
-              || field.getKey().endsWith(Constants.JSON_MEDIA_ETAG_SUFFIX)) {
+              || field.getKey().endsWith(
+                      getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) {
 
         toRemove.add(field.getKey());
       } else if (field.getValue().isObject()) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
new file mode 100644
index 0000000..022496c
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
@@ -0,0 +1,138 @@
+/*
+ * 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.v4;
+
+import java.io.IOException;
+import java.io.InputStream;
+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.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class PropertyTest extends AbstractTest {
+
+  @Override
+  protected ODataClient getClient() {
+    return v4Client;
+  }
+
+  private void _enum(final ODataFormat format) {
+    final InputStream input = getClass().getResourceAsStream("Products_5_SkinColor." + getSuffix(format));
+    final ODataProperty property = getClient().getReader().readProperty(input, format);
+    assertNotNull(property);
+    assertTrue(property.hasEnumValue());
+
+    final ODataProperty written = getClient().getReader().readProperty(
+            getClient().getWriter().writeProperty(property, format), format);
+    // This is needed because type information gets lost with serialization
+    if (format == ODataFormat.XML) {
+      final ODataProperty comparable = getClient().getObjectFactory().newEnumProperty(property.getName(),
+              getClient().getObjectFactory().
+              newEnumValue(property.getEnumValue().getTypeName(), written.getEnumValue().getValue()));
+
+      assertEquals(property, comparable);
+    }
+  }
+
+  @Test
+  public void xmlEnum() throws IOException, EdmPrimitiveTypeException {
+    _enum(ODataFormat.XML);
+  }
+
+  @Test
+  public void jsonEnum() throws IOException, EdmPrimitiveTypeException {
+    _enum(ODataFormat.JSON);
+  }
+
+  private void complex(final ODataFormat format) throws IOException {
+    final InputStream input = getClass().getResourceAsStream("Employees_3_HomeAddress." + getSuffix(format));
+    final ODataProperty property = getClient().getReader().readProperty(input, format);
+    assertNotNull(property);
+    assertTrue(property.hasComplexValue());
+    assertEquals(3, property.getComplexValue().size());
+
+    final ODataProperty written = getClient().getReader().readProperty(
+            getClient().getWriter().writeProperty(property, format), format);
+    // This is needed because type information gets lost with JSON serialization
+    final ODataComplexValue<ODataProperty> typedValue = getClient().getObjectFactory().
+            newComplexValue(property.getComplexValue().getTypeName());
+    for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
+      final ODataProperty prop = itor.next();
+      typedValue.add(prop);
+    }
+    final ODataProperty comparable = getClient().getObjectFactory().
+            newComplexProperty(property.getName(), typedValue);
+
+    assertEquals(property, comparable);
+  }
+
+  @Test
+  public void xmlComplex() throws IOException {
+    complex(ODataFormat.XML);
+  }
+
+  @Test
+  public void jsonComplex() throws IOException {
+    complex(ODataFormat.JSON);
+  }
+
+  private void collection(final ODataFormat format) throws IOException {
+    final InputStream input = getClass().getResourceAsStream("Products_5_CoverColors." + getSuffix(format));
+    final ODataProperty property = getClient().getReader().readProperty(input, format);
+    assertNotNull(property);
+    assertTrue(property.hasCollectionValue());
+    assertEquals(3, property.getCollectionValue().size());
+
+    final ODataProperty written = getClient().getReader().readProperty(
+            getClient().getWriter().writeProperty(property, format), format);
+    // This is needed because type information gets lost with JSON serialization
+    if (format == ODataFormat.XML) {
+      final ODataCollectionValue<ODataValue> typedValue = getClient().getObjectFactory().
+              newCollectionValue(property.getCollectionValue().getTypeName());
+      for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
+        final ODataValue value = itor.next();
+        typedValue.add(value);
+      }
+      final ODataProperty comparable = getClient().getObjectFactory().
+              newCollectionProperty(property.getName(), typedValue);
+
+      assertEquals(property, comparable);
+    }
+  }
+
+  @Test
+  public void xmlCollection() throws IOException {
+    collection(ODataFormat.XML);
+  }
+
+  @Test
+  public void jsonCollection() throws IOException {
+    collection(ODataFormat.JSON);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
new file mode 100644
index 0000000..776d578
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
@@ -0,0 +1,94 @@
+{
+  "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts/$entity",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Account",
+  "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)",
+  "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)",
+  "AccountID": 101,
+  "Country": "US",
+  "AccountInfo": {
+    "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
+    "FirstName": "Alex",
+    "LastName": "Green",
+    "MiddleName": "Hood"
+  },
+  "MyPaymentInstruments@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts(101)/MyPaymentInstruments",
+  "MyPaymentInstruments@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments/$ref",
+  "MyPaymentInstruments@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments",
+  "MyPaymentInstruments": [{
+      "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+      "@odata.id": "Accounts(101)/MyPaymentInstruments(101901)",
+      "@odata.editLink": "Accounts(101)/MyPaymentInstruments(101901)",
+      "PaymentInstrumentID": 101901,
+      "FriendlyName": "101 first PI",
+      "CreatedDate@odata.type": "#DateTimeOffset",
+      "CreatedDate": "2012-11-01T00:00:00Z",
+      "TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI/$ref",
+      "TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI",
+      "BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements/$ref",
+      "BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements",
+      "BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI/$ref",
+      "BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"
+    }, {
+      "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+      "@odata.id": "Accounts(101)/MyPaymentInstruments(101902)",
+      "@odata.editLink": "Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+      "PaymentInstrumentID": 101902,
+      "FriendlyName": "101 frist credit PI",
+      "CreatedDate@odata.type": "#DateTimeOffset",
+      "CreatedDate": "2012-11-01T00:00:00Z",
+      "CardNumber": "6000000000000000",
+      "CVV": "234",
+      "HolderName": "Alex",
+      "Balance": 100.0,
+      "ExperationDate@odata.type": "#DateTimeOffset",
+      "ExperationDate": "2022-11-01T00:00:00Z",
+      "TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
+      "TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
+      "BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
+      "BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
+      "BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
+      "BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
+      "CreditRecords@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
+      "CreditRecords@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
+    }, {
+      "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+      "@odata.id": "Accounts(101)/MyPaymentInstruments(101903)",
+      "@odata.editLink": "Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+      "PaymentInstrumentID": 101903,
+      "FriendlyName": "101 second credit PI",
+      "CreatedDate@odata.type": "#DateTimeOffset",
+      "CreatedDate": "2012-11-01T00:00:00Z",
+      "CardNumber": "8000000000000000",
+      "CVV": "012",
+      "HolderName": "James",
+      "Balance": 300.0,
+      "ExperationDate@odata.type": "#DateTimeOffset",
+      "ExperationDate": "2022-10-02T00:00:00Z",
+      "TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
+      "TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
+      "BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
+      "BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
+      "BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
+      "BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
+      "CreditRecords@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
+      "CreditRecords@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
+    }],
+  "MyGiftCard@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard/$ref",
+  "MyGiftCard@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard",
+  "ActiveSubscriptions@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions/$ref",
+  "ActiveSubscriptions@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions",
+  "AvailableSubscriptionTemplatess@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess/$ref",
+  "AvailableSubscriptionTemplatess@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess",
+  "#Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI": {
+    "title": "Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI",
+    "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
+  },
+  "#Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI": {
+    "title": "Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI",
+    "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
+  },
+  "#Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo": {
+    "title": "Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo",
+    "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
new file mode 100644
index 0000000..75ec28d
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    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.
+
+-->
+<entry xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/" 
+       xmlns="http://www.w3.org/2005/Atom" 
+       xmlns:d="http://docs.oasis-open.org/odata/ns/data" 
+       xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" 
+       xmlns:georss="http://www.georss.org/georss" 
+       xmlns:gml="http://www.opengis.net/gml" 
+       m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts/$entity">
+  <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)</id>
+  <category term="#Microsoft.Test.OData.Services.ODataWCFService.Account" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+  <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/MyGiftCard" type="application/atom+xml;type=entry" title="MyGiftCard" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/MyPaymentInstruments" type="application/atom+xml;type=feed" title="MyPaymentInstruments" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments">
+    <m:inline>
+      <feed>
+        <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/MyPaymentInstruments</id>
+        <title />
+        <updated>2014-03-31T09:46:15Z</updated>
+        <entry>
+          <category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="potato" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="potato" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="potato" />
+          <id />
+          <title />
+          <updated>2014-03-31T09:46:15Z</updated>
+          <author>
+            <name />
+          </author>
+          <content type="application/xml">
+            <m:properties>
+              <d:PaymentInstrumentID m:type="Int32">101901</d:PaymentInstrumentID>
+              <d:FriendlyName>101 first PI</d:FriendlyName>
+              <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+            </m:properties>
+          </content>
+        </entry>
+        <entry>
+          <category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="potato" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="potato" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="potato" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="potato" />
+          <id />
+          <title />
+          <updated>2014-03-31T09:46:15Z</updated>
+          <author>
+            <name />
+          </author>
+          <content type="application/xml">
+            <m:properties>
+              <d:PaymentInstrumentID m:type="Int32">101902</d:PaymentInstrumentID>
+              <d:FriendlyName>101 frist credit PI</d:FriendlyName>
+              <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+              <d:CardNumber>6000000000000000</d:CardNumber>
+              <d:CVV>234</d:CVV>
+              <d:HolderName>Alex</d:HolderName>
+              <d:Balance m:type="Double">100</d:Balance>
+              <d:ExperationDate m:type="DateTimeOffset">2022-11-01T00:00:00Z</d:ExperationDate>
+            </m:properties>
+          </content>
+        </entry>
+        <entry>
+          <category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="potato" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="potato" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="potato" />
+          <link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="potato" />
+          <id />
+          <title />
+          <updated>2014-03-31T09:46:15Z</updated>
+          <author>
+            <name />
+          </author>
+          <content type="application/xml">
+            <m:properties>
+              <d:PaymentInstrumentID m:type="Int32">101903</d:PaymentInstrumentID>
+              <d:FriendlyName>101 second credit PI</d:FriendlyName>
+              <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+              <d:CardNumber>8000000000000000</d:CardNumber>
+              <d:CVV>012</d:CVV>
+              <d:HolderName>James</d:HolderName>
+              <d:Balance m:type="Double">300</d:Balance>
+              <d:ExperationDate m:type="DateTimeOffset">2022-10-02T00:00:00Z</d:ExperationDate>
+            </m:properties>
+          </content>
+        </entry>
+      </feed>
+    </m:inline>
+  </link>
+  <link rel="http://docs.oasis-open.org/odata/ns/related/ActiveSubscriptions" type="application/atom+xml;type=feed" title="ActiveSubscriptions" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/AvailableSubscriptionTemplatess" type="application/atom+xml;type=feed" title="AvailableSubscriptionTemplatess" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess" />
+  <title />
+  <updated>2014-03-31T09:46:15Z</updated>
+  <author>
+    <name />
+  </author>
+  <content type="application/xml">
+    <m:properties>
+      <d:AccountID m:type="Int32">101</d:AccountID>
+      <d:Country>US</d:Country>
+      <d:AccountInfo m:type="#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo">
+        <d:FirstName>Alex</d:FirstName>
+        <d:LastName>Green</d:LastName>
+        <d:MiddleName>Hood</d:MiddleName>
+      </d:AccountInfo>
+    </m:properties>
+  </content>
+</entry>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
new file mode 100644
index 0000000..eceecbb
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
@@ -0,0 +1,16 @@
+{
+  "@odata.context": "http://services.odata.org/V4/OData/OData.svc/$metadata#Advertisements/$entity",
+  "@odata.type": "#ODataDemo.Advertisement",
+  "@odata.id": "http://services.odata.org/V4/OData/OData.svc/Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)",
+  "@odata.editLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)",
+  "@odata.mediaEditLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value",
+  "@odata.mediaContentType": "*/*",
+  "@odata.mediaEtag": "\"8zOOKKvgOtptr4gt8IrnapX3jds=\"",
+  "ID@odata.type": "#Guid",
+  "ID": "f89dee73-af9f-4cd4-b330-db93c25ff3c7",
+  "Name": "Old School Lemonade Store, Retro Style",
+  "AirDate@odata.type": "#DateTimeOffset",
+  "AirDate": "2012-11-07T00:00:00Z",
+  "FeaturedProduct@odata.associationLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct/$ref",
+  "FeaturedProduct@odata.navigationLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct"
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
new file mode 100644
index 0000000..068cb53
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    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.
+
+-->
+<entry xml:base="http://services.odata.org/V4/OData/OData.svc/" 
+       xmlns="http://www.w3.org/2005/Atom" 
+       xmlns:d="http://docs.oasis-open.org/odata/ns/data" 
+       xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" 
+       xmlns:georss="http://www.georss.org/georss" 
+       xmlns:gml="http://www.opengis.net/gml" 
+       m:context="http://services.odata.org/V4/OData/OData.svc/$metadata#Advertisements/$entity">
+  <id>http://services.odata.org/V4/OData/OData.svc/Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)</id>
+  <category term="#ODataDemo.Advertisement" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+  <link rel="edit" title="Advertisement" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)" />
+  <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/FeaturedProduct" type="application/xml" title="FeaturedProduct" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct/$ref" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/FeaturedProduct" type="application/atom+xml;type=entry" title="FeaturedProduct" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct" />
+  <title />
+  <updated>2014-03-31T10:24:52Z</updated>
+  <author>
+    <name />
+  </author>
+  <link rel="edit-media" title="Advertisement" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value" m:etag="&quot;8zOOKKvgOtptr4gt8IrnapX3jds=&quot;" />
+  <content type="*/*" src="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value" />
+  <m:properties>
+    <d:ID m:type="Guid">f89dee73-af9f-4cd4-b330-db93c25ff3c7</d:ID>
+    <d:Name>Old School Lemonade Store, Retro Style</d:Name>
+    <d:AirDate m:type="DateTimeOffset">2012-11-07T00:00:00Z</d:AirDate>
+  </m:properties>
+</entry>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
new file mode 100644
index 0000000..c8e2cdf
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
@@ -0,0 +1,57 @@
+{
+  "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers",
+  "odata.count": 2,
+  "value": [{
+      "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
+      "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
+      "PersonID": 1,
+      "FirstName": "Bob",
+      "LastName": "Cat",
+      "MiddleName": null,
+      "HomeAddress": {
+        "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress",
+        "Street": "1 Microsoft Way",
+        "City": "London",
+        "PostalCode": "98052",
+        "FamilyName": "Cats"
+      },
+      "Home": {
+        "type": "Point",
+        "coordinates": [23.1, 32.1],
+        "crs": {
+          "type": "name",
+          "properties": {
+            "name": "EPSG:4326"
+          }
+        }
+      },
+      "Numbers": ["111-111-1111"],
+      "Emails": ["abc@abc.com"],
+      "City": "London",
+      "Birthday": "1957-04-03T00:00:00Z",
+      "TimeBetweenLastTwoOrders": "PT0.0000001S"
+    }, {
+      "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)",
+      "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)",
+      "PersonID": 2,
+      "FirstName": "Jill",
+      "LastName": "Jones",
+      "MiddleName": null,
+      "HomeAddress": null,
+      "Home": {
+        "type": "Point",
+        "coordinates": [161.8, 15.0],
+        "crs": {
+          "type": "name",
+          "properties": {
+            "name": "EPSG:4326"
+          }
+        }
+      },
+      "Numbers": [],
+      "Emails": [],
+      "City": "Sydney",
+      "Birthday": "1983-01-15T00:00:00Z",
+      "TimeBetweenLastTwoOrders": "PT0.0000002S"
+    }]
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
new file mode 100644
index 0000000..9b3d870
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    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.
+
+-->
+<feed xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/" 
+      xmlns="http://www.w3.org/2005/Atom" 
+      xmlns:d="http://docs.oasis-open.org/odata/ns/data" 
+      xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" 
+      xmlns:georss="http://www.georss.org/georss" 
+      xmlns:gml="http://www.opengis.net/gml" 
+      m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers">
+  <m:count>2</m:count>
+  <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers</id>
+  <title />
+  <updated>2014-03-31T09:35:14Z</updated>
+  <entry>
+    <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)</id>
+    <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+    <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company" />
+    <title />
+    <updated>2014-03-31T09:35:14Z</updated>
+    <author>
+      <name />
+    </author>
+    <content type="application/xml">
+      <m:properties>
+        <d:PersonID m:type="Int32">1</d:PersonID>
+        <d:FirstName>Bob</d:FirstName>
+        <d:LastName>Cat</d:LastName>
+        <d:MiddleName m:null="true" />
+        <d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress">
+          <d:Street>1 Microsoft Way</d:Street>
+          <d:City>London</d:City>
+          <d:PostalCode>98052</d:PostalCode>
+          <d:FamilyName>Cats</d:FamilyName>
+        </d:HomeAddress>
+        <d:Home m:type="GeographyPoint">
+          <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+            <gml:pos>32.1 23.1</gml:pos>
+          </gml:Point>
+        </d:Home>
+        <d:Numbers m:type="#Collection(String)">
+          <m:element>111-111-1111</m:element>
+        </d:Numbers>
+        <d:Emails m:type="#Collection(String)">
+          <m:element>abc@abc.com</m:element>
+        </d:Emails>
+        <d:City>London</d:City>
+        <d:Birthday m:type="DateTimeOffset">1957-04-03T00:00:00Z</d:Birthday>
+        <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000001S</d:TimeBetweenLastTwoOrders>
+      </m:properties>
+    </content>
+  </entry>
+  <entry>
+    <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)</id>
+    <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+    <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Parent" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Company" />
+    <title />
+    <updated>2014-03-31T09:35:14Z</updated>
+    <author>
+      <name />
+    </author>
+    <content type="application/xml">
+      <m:properties>
+        <d:PersonID m:type="Int32">2</d:PersonID>
+        <d:FirstName>Jill</d:FirstName>
+        <d:LastName>Jones</d:LastName>
+        <d:MiddleName m:null="true" />
+        <d:HomeAddress m:null="true" />
+        <d:Home m:type="GeographyPoint">
+          <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+            <gml:pos>15 161.8</gml:pos>
+          </gml:Point>
+        </d:Home>
+        <d:Numbers m:type="#Collection(String)" />
+        <d:Emails m:type="#Collection(String)" />
+        <d:City>Sydney</d:City>
+        <d:Birthday m:type="DateTimeOffset">1983-01-15T00:00:00Z</d:Birthday>
+        <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
+      </m:properties>
+    </content>
+  </entry>
+</feed>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
new file mode 100644
index 0000000..8748df3
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
@@ -0,0 +1,6 @@
+{
+  "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Employees(3)/HomeAddress",
+  "Street": "1 Microsoft Way",
+  "City": "Sydney",
+  "PostalCode": "98052"
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
new file mode 100644
index 0000000..5029af5
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    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.
+
+-->
+<m:value xmlns:d="http://docs.oasis-open.org/odata/ns/data" 
+         xmlns:georss="http://www.georss.org/georss" 
+         xmlns:gml="http://www.opengis.net/gml" 
+         m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Employees(3)/HomeAddress" 
+         m:type="#Microsoft.Test.OData.Services.ODataWCFService.Address" 
+         xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">
+  <d:Street>1 Microsoft Way</d:Street>
+  <d:City>Sydney</d:City>
+  <d:PostalCode>98052</d:PostalCode>
+</m:value>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
new file mode 100644
index 0000000..c8b62d3
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
@@ -0,0 +1,22 @@
+{
+  "@odata.context": "http://services.odata.org/V4/OData/OData.svc/$metadata#PersonDetails/$entity",
+  "@odata.type": "#ODataDemo.PersonDetail",
+  "@odata.id": "http://services.odata.org/V4/OData/OData.svc/PersonDetails(1)",
+  "@odata.editLink": "PersonDetails(1)",
+  "PersonID": 1,
+  "Age@odata.type": "#Byte",
+  "Age": 24,
+  "Gender": true,
+  "Phone": "(208) 555-8097",
+  "Address": {
+    "@odata.type": "#ODataDemo.Address",
+    "Street": "187 Suffolk Ln.",
+    "City": "Boise",
+    "State": "ID",
+    "ZipCode": "83720",
+    "Country": "USA"
+  },
+  "Photo@odata.mediaEditLink": "PersonDetails(1)/Photo",
+  "Person@odata.associationLink": "PersonDetails(1)/Person/$ref",
+  "Person@odata.navigationLink": "PersonDetails(1)/Person"
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
new file mode 100644
index 0000000..e7fce12
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    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.
+
+-->
+<entry xml:base="http://services.odata.org/V4/OData/OData.svc/" 
+       xmlns="http://www.w3.org/2005/Atom" 
+       xmlns:d="http://docs.oasis-open.org/odata/ns/data" 
+       xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" 
+       xmlns:georss="http://www.georss.org/georss" 
+       xmlns:gml="http://www.opengis.net/gml" 
+       m:context="http://services.odata.org/V4/OData/OData.svc/$metadata#PersonDetails/$entity">
+  <id>http://services.odata.org/V4/OData/OData.svc/PersonDetails(1)</id>
+  <category term="#ODataDemo.PersonDetail" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+  <link rel="edit" title="PersonDetail" href="PersonDetails(1)" />
+  <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Person" type="application/xml" title="Person" href="PersonDetails(1)/Person/$ref" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Person" type="application/atom+xml;type=entry" title="Person" href="PersonDetails(1)/Person" />
+  <title />
+  <updated>2014-03-31T10:28:24Z</updated>
+  <author>
+    <name />
+  </author>
+  <link rel="http://docs.oasis-open.org/odata/ns/edit-media/Photo" title="Photo" href="PersonDetails(1)/Photo" />
+  <content type="application/xml">
+    <m:properties>
+      <d:PersonID m:type="Int32">1</d:PersonID>
+      <d:Age m:type="Byte">24</d:Age>
+      <d:Gender m:type="Boolean">true</d:Gender>
+      <d:Phone>(208) 555-8097</d:Phone>
+      <d:Address m:type="#ODataDemo.Address">
+        <d:Street>187 Suffolk Ln.</d:Street>
+        <d:City>Boise</d:City>
+        <d:State>ID</d:State>
+        <d:ZipCode>83720</d:ZipCode>
+        <d:Country>USA</d:Country>
+      </d:Address>
+    </m:properties>
+  </content>
+</entry>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
index 22c8473..0545d78 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
@@ -1 +1,29 @@
-{"@odata.context":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products/$entity","@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.Product","@odata.id":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)","@odata.editLink":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)","ProductID":5,"Name":"Cheetos","QuantityPerUnit":"100g Bag","UnitPrice@odata.type":"#Single","UnitPrice":3.24,"QuantityInStock":100,"Discontinued":true,"UserAccess@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.AccessLevel","UserAccess":"None","SkinColor@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.Color","SkinColor":"Red","CoverColors@odata.type":"#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)","CoverColors":["Green","Blue","Blue"],"Details@odata.associationLink":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details/$ref","Details@odata.navigationLink":
 "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details","#Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight":{"title":"Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight","target":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"},"#Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails":{"title":"Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails","target":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"}}
+{
+  "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products/$entity",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Product",
+  "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)",
+  "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)",
+  "ProductID": 5,
+  "Name": "Cheetos",
+  "QuantityPerUnit": "100g Bag",
+  "UnitPrice@odata.type": "#Single",
+  "UnitPrice": 3.24,
+  "QuantityInStock": 100,
+  "Discontinued": true,
+  "UserAccess@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
+  "UserAccess": "None",
+  "SkinColor@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Color",
+  "SkinColor": "Red",
+  "CoverColors@odata.type": "#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)",
+  "CoverColors": ["Green", "Blue", "Blue"],
+  "Details@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details/$ref",
+  "Details@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details",
+  "#Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight": {
+    "title": "Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight",
+    "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"
+  },
+  "#Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails": {
+    "title": "Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails",
+    "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
new file mode 100644
index 0000000..96bf22a
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
@@ -0,0 +1,5 @@
+{
+  "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products(5)/CoverColors",
+  "@odata.type": "#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)",
+  "value": ["Green", "Blue", "Blue"]
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
new file mode 100644
index 0000000..0dab08c
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    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.
+
+-->
+<m:value xmlns:d="http://docs.oasis-open.org/odata/ns/data" 
+         xmlns:georss="http://www.georss.org/georss" 
+         xmlns:gml="http://www.opengis.net/gml" 
+         m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products(5)/CoverColors" m:type="#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" 
+         xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">
+  <m:element>Green</m:element>
+  <m:element>Blue</m:element>
+  <m:element>Blue</m:element>
+</m:value>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
index 001c1a9..d233ce9 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
@@ -37,6 +37,12 @@
   <author>
     <name />
   </author>
+  <m:action metadata="#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress" 
+            target="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress" 
+            title="Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"/>
+  <m:action metadata="#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress" 
+            target="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress" 
+            title="Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"/>
   <content type="application/xml">
     <m:properties>
       <d:PersonID m:type="Int32">1</d:PersonID>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index 0a8bafb..f41c30c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -57,6 +57,8 @@ public interface Constants {
 
   public static final String SELF_LINK_REL = "self";
 
+  public static final String EDITMEDIA_LINK_REL = "edit-media";
+
   public static final String NEXT_LINK_REL = "next";
 
   // XML elements and attributes
@@ -143,16 +145,6 @@ public interface Constants {
 
   public final static String JSON_METADATA_ETAG = "@odata.metadataEtag";
 
-  public final static String JSON_ETAG = "odata.etag";
-
-  public final static String JSON_MEDIA_ETAG = "odata.mediaETag";
-
-  public final static String JSON_MEDIA_ETAG_SUFFIX = "@" + JSON_MEDIA_ETAG;
-
-  public final static String JSON_MEDIA_CONTENT_TYPE = "odata.mediaContentType";
-
-  public final static String JSON_MEDIA_CONTENT_TYPE_SUFFIX = "@" + JSON_MEDIA_CONTENT_TYPE;
-
   public final static String JSON_BIND_LINK_SUFFIX = "@odata.bind";
 
   public final static String JSON_NULL = "odata.null";

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
index c064216..5e24e8a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
@@ -166,6 +166,20 @@ public interface Entry {
   void setMediaContentType(String mediaContentType);
 
   /**
+   * ETag of the binary stream represented by this media entity or named stream property.
+   *
+   * @return media ETag value
+   */
+  String getMediaETag();
+
+  /**
+   * Set media ETag.
+   *
+   * @param eTag media ETag value
+   */
+  void setMediaETag(String eTag);
+
+  /**
    * Checks if the current entry is a media entry.
    *
    * @return 'TRUE' if is a media entry; 'FALSE' otherwise.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
index f4b0d2f..6d832c8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
@@ -91,6 +91,14 @@ public interface CommonODataEntity extends ODataInvokeResult {
   boolean removeLink(ODataLink link);
 
   /**
+   * Gets association link with given name, if available, otherwise <tt>null</tt>.
+   *
+   * @param name candidate link name
+   * @return association link with given name, if available, otherwise <tt>null</tt>
+   */
+  ODataLink getAssociationLink(String name);
+
+  /**
    * Returns all entity association links.
    *
    * @return OData entity links.
@@ -98,6 +106,14 @@ public interface CommonODataEntity extends ODataInvokeResult {
   List<ODataLink> getAssociationLinks();
 
   /**
+   * Gets navigation link with given name, if available, otherwise <tt>null</tt>.
+   *
+   * @param name candidate link name
+   * @return navigation link with given name, if available, otherwise <tt>null</tt>
+   */
+  ODataLink getNavigationLink(String name);
+
+  /**
    * Returns all entity navigation links (including inline entities / feeds).
    *
    * @return OData entity links.
@@ -105,6 +121,14 @@ public interface CommonODataEntity extends ODataInvokeResult {
   List<ODataLink> getNavigationLinks();
 
   /**
+   * Gets media-edit link with given name, if available, otherwise <tt>null</tt>.
+   *
+   * @param name candidate link name
+   * @return media-edit link with given name, if available, otherwise <tt>null</tt>
+   */
+  ODataLink getEditMediaLink(String name);
+
+  /**
    * Returns all entity media edit links.
    *
    * @return OData entity links.
@@ -174,4 +198,18 @@ public interface CommonODataEntity extends ODataInvokeResult {
    */
   void setMediaContentSource(String mediaContentSource);
 
+  /**
+   * ETag of the binary stream represented by this media entity or named stream property.
+   *
+   * @return media ETag value
+   */
+  String getMediaETag();
+
+  /**
+   * Set media ETag.
+   *
+   * @param eTag media ETag value
+   */
+  void setMediaETag(String eTag);
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
index 2735f99..d463511 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
@@ -168,6 +168,14 @@ public class ODataLink extends ODataItem {
     return type;
   }
 
+  public ODataInlineEntity asInlineEntity() {
+    return (this instanceof ODataInlineEntity) ? (ODataInlineEntity) this : null;
+  }
+
+  public ODataInlineEntitySet asInlineEntitySet() {
+    return (this instanceof ODataInlineEntitySet) ? (ODataInlineEntitySet) this : null;
+  }
+
   /**
    * Gets link rel.
    *