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/03/31 16:55:40 UTC

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

Repository: olingo-odata4
Updated Branches:
  refs/heads/olingo200 dc2922c95 -> de591bb58


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
index 96d9937..5442d1d 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
@@ -52,6 +52,8 @@ public enum ODataServiceVersion {
 
   public static final String JSON_ID = "jsonId";
 
+  public static final String JSON_ETAG = "jsonETag";
+
   public static final String JSON_READ_LINK = "jsonReadLink";
 
   public static final String JSON_EDIT_LINK = "jsonEditLink";
@@ -60,6 +62,10 @@ public enum ODataServiceVersion {
 
   public static final String JSON_MEDIAEDIT_LINK = "jsonMediaEditLink";
 
+  public static final String JSON_MEDIA_CONTENT_TYPE = "jsonMediaContentType";
+
+  public static final String JSON_MEDIA_ETAG = "jsonMediaETag";
+
   public static final String JSON_ASSOCIATION_LINK = "jsonAssociationLink";
 
   public static final String JSON_NAVIGATION_LINK = "jsonNavigationLink";
@@ -85,10 +91,13 @@ public enum ODataServiceVersion {
     {
       put(JSON_TYPE, "odata.type");
       put(JSON_ID, "odata.id");
+      put(JSON_ETAG, "odata.etag");
       put(JSON_READ_LINK, "odata.readLink");
       put(JSON_EDIT_LINK, "odata.editLink");
       put(JSON_MEDIAREAD_LINK, "odata.mediaReadLink");
       put(JSON_MEDIAEDIT_LINK, "odata.mediaEditLink");
+      put(JSON_MEDIA_CONTENT_TYPE, "odata.mediaContentType");
+      put(JSON_MEDIA_ETAG, "odata.mediaEtag");
       put(JSON_ASSOCIATION_LINK, "@odata.associationLinkUrl");
       put(JSON_NAVIGATION_LINK, "@odata.navigationLinkUrl");
     }
@@ -115,10 +124,13 @@ public enum ODataServiceVersion {
     {
       put(JSON_TYPE, "@odata.type");
       put(JSON_ID, "@odata.id");
+      put(JSON_ETAG, "@odata.etag");
       put(JSON_READ_LINK, "@odata.readLink");
       put(JSON_EDIT_LINK, "@odata.editLink");
       put(JSON_MEDIAREAD_LINK, "@odata.mediaReadLink");
       put(JSON_MEDIAEDIT_LINK, "@odata.mediaEditLink");
+      put(JSON_MEDIA_CONTENT_TYPE, "@odata.mediaContentType");
+      put(JSON_MEDIA_ETAG, "@odata.mediaEtag");
       put(JSON_ASSOCIATION_LINK, "@odata.associationLink");
       put(JSON_NAVIGATION_LINK, "@odata.navigationLink");
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
index 85d6775..4c0f346 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
@@ -55,6 +55,8 @@ public abstract class AbstractEntry extends AbstractODataObject implements Entry
 
   private String mediaContentType;
 
+  private String mediaETag;
+
   @Override
   public String getETag() {
     return eTag;
@@ -153,6 +155,16 @@ public abstract class AbstractEntry extends AbstractODataObject implements Entry
   }
 
   @Override
+  public String getMediaETag() {
+    return mediaETag;
+  }
+
+  @Override
+  public void setMediaETag(final String eTag) {
+    this.mediaETag = eTag;
+  }
+
+  @Override
   public boolean isMediaEntry() {
     return StringUtils.isNotBlank(this.mediaContentSource);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index a16d4ed..c2ffd8e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -232,6 +232,11 @@ public class AtomDeserializer extends AbstractAtomDealer {
               entry.setSelfLink(link);
             } else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
               entry.setEditLink(link);
+            } else if (Constants.EDITMEDIA_LINK_REL.equals(link.getRel())) {
+              final Attribute mediaETag = event.asStartElement().getAttributeByName(etagQName);
+              if (mediaETag != null) {
+                entry.setMediaETag(mediaETag.getValue());
+              }
             } else if (link.getRel().startsWith(
                     version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL))) {
               entry.getNavigationLinks().add(link);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
index 97da12d..d9106a7 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
@@ -66,8 +66,8 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
         foundEndProperty = true;
       }
     }
-    
-    return value == null? new PrimitiveValueImpl(StringUtils.EMPTY): value;
+
+    return value == null ? new PrimitiveValueImpl(StringUtils.EMPTY) : value;
   }
 
   private Value fromComplexOrEnum(final XMLEventReader reader, final StartElement start)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
index eaaa653..ef3eaf1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
@@ -100,14 +100,9 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
       entry.setBaseURI(contextURL.substring(0, contextURL.indexOf(Constants.METADATA)));
     }
 
-    if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) {
-      entry.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue());
-      tree.remove(Constants.JSON_MEDIA_ETAG);
-    }
-
-    if (tree.hasNonNull(Constants.JSON_ETAG)) {
-      entry.setETag(tree.get(Constants.JSON_ETAG).textValue());
-      tree.remove(Constants.JSON_ETAG);
+    if (tree.hasNonNull(jsonETag)) {
+      entry.setETag(tree.get(jsonETag).textValue());
+      tree.remove(jsonETag);
     }
 
     if (tree.hasNonNull(jsonType)) {
@@ -143,11 +138,16 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
       tree.remove(jsonMediaReadLink);
     }
     if (tree.hasNonNull(jsonMediaEditLink)) {
+      entry.setMediaContentSource(tree.get(jsonMediaEditLink).textValue());
       tree.remove(jsonMediaEditLink);
     }
-    if (tree.hasNonNull(Constants.JSON_MEDIA_CONTENT_TYPE)) {
-      entry.setMediaContentType(tree.get(Constants.JSON_MEDIA_CONTENT_TYPE).textValue());
-      tree.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+    if (tree.hasNonNull(jsonMediaContentType)) {
+      entry.setMediaContentType(tree.get(jsonMediaContentType).textValue());
+      tree.remove(jsonMediaContentType);
+    }
+    if (tree.hasNonNull(jsonMediaETag)) {
+      entry.setMediaETag(tree.get(jsonMediaETag).textValue());
+      tree.remove(jsonMediaETag);
     }
 
     final Set<String> toRemove = new HashSet<String>();
@@ -190,14 +190,14 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
         link.setType(ODataLinkType.MEDIA_EDIT.toString());
         entry.getMediaEditLinks().add(link);
 
-        if (tree.has(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX)) {
-          link.setMediaETag(tree.get(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX).asText());
-          toRemove.add(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX);
+        if (tree.has(link.getTitle() + getJSONAnnotation(jsonMediaETag))) {
+          link.setMediaETag(tree.get(link.getTitle() + getJSONAnnotation(jsonMediaETag)).asText());
+          toRemove.add(link.getTitle() + getJSONAnnotation(jsonMediaETag));
         }
 
         toRemove.add(field.getKey());
         toRemove.add(setInline(field.getKey(), getJSONAnnotation(jsonMediaEditLink), tree, parser.getCodec(), link));
-      } else if (field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE)) {
+      } else if (field.getKey().endsWith(getJSONAnnotation(jsonMediaContentType))) {
         final String linkTitle = getTitle(field);
         for (Link link : entry.getMediaEditLinks()) {
           if (linkTitle.equals(link.getTitle())) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
index a83332a..edf4366 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
@@ -30,25 +30,4 @@ public class JSONEntryImpl extends AbstractEntry {
 
   private static final long serialVersionUID = -5275365545400797758L;
 
-  private String mediaETag;
-
-  /**
-   * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
-   * media entity or named stream property.
-   *
-   * @return odata.mediaEtag annotation value.
-   */
-  public String getMediaETag() {
-    return mediaETag;
-  }
-
-  /**
-   * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
-   * media entity or named stream property.
-   *
-   * @param eTag odata.mediaEtag annotation value.
-   */
-  public void setMediaETag(final String eTag) {
-    this.mediaETag = eTag;
-  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
index 1215c5d..737ed53 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.DeserializationContext;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import java.io.IOException;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
 
 /**
@@ -40,20 +41,17 @@ public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPrope
 
     final JSONPropertyImpl property = new JSONPropertyImpl();
 
-    String contextURL = null;
     if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
-      contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
+      final String contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
+      property.setName(StringUtils.substringAfterLast(contextURL, "/"));
       tree.remove(Constants.JSON_CONTEXT);
     } else if (tree.hasNonNull(Constants.JSON_METADATA)) {
-      contextURL = tree.get(Constants.JSON_METADATA).textValue();
-      tree.remove(Constants.JSON_METADATA);
-    }
-
-    if (contextURL != null) {
-      final int dashIdx = contextURL.lastIndexOf('#');
+      final String metadata = tree.get(Constants.JSON_METADATA).textValue();
+      final int dashIdx = metadata.lastIndexOf('#');
       if (dashIdx != -1) {
-        property.setType(contextURL.substring(dashIdx + 1));
+        property.setType(metadata.substring(dashIdx + 1));
       }
+      tree.remove(Constants.JSON_METADATA);
     }
 
     if (tree.has(jsonType) && property.getType() == null) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
index baf418d..fa6e38f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
@@ -34,6 +34,8 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
 
   protected String jsonId;
 
+  protected String jsonETag;
+
   protected String jsonReadLink;
 
   protected String jsonEditLink;
@@ -42,6 +44,10 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
 
   protected String jsonMediaReadLink;
 
+  protected String jsonMediaContentType;
+
+  protected String jsonMediaETag;
+
   protected String jsonAssociationLink;
 
   protected String jsonNavigationLink;
@@ -61,10 +67,13 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
 
     jsonType = version.getJSONMap().get(ODataServiceVersion.JSON_TYPE);
     jsonId = version.getJSONMap().get(ODataServiceVersion.JSON_ID);
+    jsonETag = version.getJSONMap().get(ODataServiceVersion.JSON_ETAG);
     jsonReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_READ_LINK);
     jsonEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK);
     jsonMediaReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK);
     jsonMediaEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK);
+    jsonMediaContentType = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE);
+    jsonMediaETag = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG);
     jsonAssociationLink = version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK);
     jsonNavigationLink = version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
index fe2fd52..181f2da 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
@@ -56,9 +56,7 @@ public abstract class AbstractODataCollectionValue<OV extends ODataValue>
    */
   @Override
   public void add(final OV value) {
-    if (value.isPrimitive() || value.isComplex()) {
-      values.add(value);
-    }
+    values.add(value);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
index a1b729f..06b525c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
@@ -56,6 +56,11 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
   private String mediaContentSource;
 
   /**
+   * Media ETag.
+   */
+  private String mediaETag;
+
+  /**
    * Edit link.
    */
   private URI editLink;
@@ -80,41 +85,20 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
    */
   private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
 
-  /**
-   * Constructor.
-   *
-   * @param name OData entity name.
-   */
   public AbstractODataEntity(final String name) {
     super(name);
   }
 
-  /**
-   * Gets ETag.
-   *
-   * @return ETag.
-   */
   @Override
   public String getETag() {
     return eTag;
   }
 
-  /**
-   * Sets ETag.
-   *
-   * @param eTag ETag.
-   */
   @Override
   public void setETag(final String eTag) {
     this.eTag = eTag;
   }
 
-  /**
-   * Searches for operation with given title.
-   *
-   * @param title operation to look for
-   * @return operation if found with given title, <tt>null</tt> otherwise
-   */
   @Override
   public ODataOperation getOperation(final String title) {
     ODataOperation result = null;
@@ -137,12 +121,6 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
     return this.operations;
   }
 
-  /**
-   * Searches for property with given name.
-   *
-   * @param name property to look for
-   * @return property if found with given name, <tt>null</tt> otherwise
-   */
   @Override
   public CommonODataProperty getProperty(final String name) {
     CommonODataProperty result = null;
@@ -158,12 +136,6 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
     return result;
   }
 
-  /**
-   * Puts the given link into one of available lists, based on its type.
-   *
-   * @param link to be added
-   * @return <tt>true</tt> if the given link was added in one of available lists
-   */
   @Override
   public boolean addLink(final ODataLink link) {
     boolean result = false;
@@ -188,62 +160,57 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
     return result;
   }
 
-  /**
-   * Removes the given link from any list (association, navigation, edit-media).
-   *
-   * @param link to be removed
-   * @return <tt>true</tt> if the given link was contained in one of available lists
-   */
   @Override
   public boolean removeLink(final ODataLink link) {
     return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
   }
 
-  /**
-   * Returns all entity navigation links (including inline entities / feeds).
-   *
-   * @return OData entity links.
-   */
+  private ODataLink getLink(final List<ODataLink> links, final String name) {
+    ODataLink result = null;
+    for (ODataLink link : links) {
+      if (name.equals(link.getName())) {
+        result = link;
+      }
+    }
+
+    return result;
+  }
+
+  @Override
+  public ODataLink getNavigationLink(final String name) {
+    return getLink(navigationLinks, name);
+  }
+
   @Override
   public List<ODataLink> getNavigationLinks() {
     return navigationLinks;
   }
 
-  /**
-   * Returns all entity association links.
-   *
-   * @return OData entity links.
-   */
+  @Override
+  public ODataLink getAssociationLink(final String name) {
+    return getLink(associationLinks, name);
+  }
+
   @Override
   public List<ODataLink> getAssociationLinks() {
     return associationLinks;
   }
 
-  /**
-   * Returns all entity media edit links.
-   *
-   * @return OData entity links.
-   */
+  @Override
+  public ODataLink getEditMediaLink(final String name) {
+    return getLink(editMediaLinks, name);
+  }
+
   @Override
   public List<ODataLink> getEditMediaLinks() {
     return editMediaLinks;
   }
 
-  /**
-   * Returns OData entity edit link.
-   *
-   * @return entity edit link.
-   */
   @Override
   public URI getEditLink() {
     return editLink;
   }
 
-  /**
-   * Sets OData entity edit link.
-   *
-   * @param editLink edit link.
-   */
   @Override
   public void setEditLink(final URI editLink) {
     this.editLink = editLink;
@@ -254,73 +221,48 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
     return super.getLink() == null ? getEditLink() : super.getLink();
   }
 
-  /**
-   * TRUE if read-only entity.
-   *
-   * @return TRUE if read-only; FALSE otherwise.
-   */
   @Override
   public boolean isReadOnly() {
     return super.getLink() != null;
   }
 
-  /**
-   * Checks if the current entity is a media entity.
-   *
-   * @return 'TRUE' if media entity; 'FALSE' otherwise.
-   */
   @Override
   public boolean isMediaEntity() {
     return mediaEntity;
   }
 
-  /**
-   * Sets media entity flag.
-   *
-   * @param isMediaEntity media entity flag value.
-   */
   @Override
   public void setMediaEntity(final boolean isMediaEntity) {
     this.mediaEntity = isMediaEntity;
   }
 
-  /**
-   * Gets media content type.
-   *
-   * @return media content type.
-   */
   @Override
   public String getMediaContentType() {
     return mediaContentType;
   }
 
-  /**
-   * Sets media content type.
-   *
-   * @param mediaContentType media content type.
-   */
   @Override
   public void setMediaContentType(final String mediaContentType) {
     this.mediaContentType = mediaContentType;
   }
 
-  /**
-   * Gets media content source.
-   *
-   * @return media content source.
-   */
   @Override
   public String getMediaContentSource() {
     return mediaContentSource;
   }
 
-  /**
-   * Sets media content source.
-   *
-   * @param mediaContentSource media content source.
-   */
   @Override
   public void setMediaContentSource(final String mediaContentSource) {
     this.mediaContentSource = mediaContentSource;
   }
+
+  @Override
+  public String getMediaETag() {
+    return mediaETag;
+  }
+
+  @Override
+  public void setMediaETag(final String eTag) {
+    this.mediaETag = eTag;
+  }
 }


[3/3] git commit: [OLINGO-200] V3, V4 Error tests in

Posted by il...@apache.org.
[OLINGO-200] V3, V4 Error tests in


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

Branch: refs/heads/olingo200
Commit: de591bb58303c185d0739ad5902732039916d97a
Parents: eeb5d9b
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 16:55:31 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 16:55:31 2014 +0200

----------------------------------------------------------------------
 .../ODataClientErrorException.java              |  31 +--
 .../communication/request/ODataRequestImpl.java |  23 +-
 .../client/core/it/v3/ErrorTestITCase.java      |   1 -
 .../apache/olingo/client/core/v3/ErrorTest.java |   6 +-
 .../apache/olingo/client/core/v4/ErrorTest.java |  61 +++++
 .../org/apache/olingo/client/core/v3/error.xml  |   2 +-
 .../org/apache/olingo/client/core/v4/error.json |  14 ++
 .../org/apache/olingo/client/core/v4/error.xml  |  31 +++
 .../apache/olingo/commons/api/Constants.java    |   7 +
 .../olingo/commons/api/domain/ODataError.java   |  28 +--
 .../api/edm/constants/ODataServiceVersion.java  |   3 +
 .../commons/core/data/AbstractAtomDealer.java   |  13 +
 .../commons/core/data/AbstractODataError.java   |  58 +++++
 .../commons/core/data/AbstractProperty.java     |  80 +++++++
 .../commons/core/data/AbstractPropertyImpl.java |  80 -------
 .../commons/core/data/AtomDeserializer.java     |  60 ++++-
 .../commons/core/data/AtomPropertyImpl.java     |   2 +-
 .../commons/core/data/JSONErrorBundle.java      |  50 ----
 .../olingo/commons/core/data/JSONErrorImpl.java | 237 -------------------
 .../core/data/JSONODataErrorDeserializer.java   |  60 +++++
 .../commons/core/data/JSONODataErrorImpl.java   |  26 ++
 .../commons/core/data/JSONPropertyImpl.java     |   2 +-
 .../core/data/ODataJacksonDeserializer.java     |   3 +
 .../olingo/commons/core/data/XMLErrorImpl.java  | 213 -----------------
 .../commons/core/data/XMLODataErrorImpl.java    |  23 ++
 .../core/op/AbstractODataDeserializer.java      |  16 +-
 26 files changed, 465 insertions(+), 665 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
index 85ae888..6dc2f07 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
@@ -18,11 +18,6 @@
  */
 package org.apache.olingo.client.api.communication;
 
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Collections;
-import java.util.List;
-import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.StatusLine;
 import org.apache.olingo.commons.api.domain.ODataError;
@@ -60,34 +55,10 @@ public class ODataClientErrorException extends RuntimeException {
    */
   public ODataClientErrorException(final StatusLine statusLine, final ODataError error) {
     super((StringUtils.isBlank(error.getCode()) ? StringUtils.EMPTY : "(" + error.getCode() + ") ")
-            + error.getMessageValue() + " [" + statusLine.toString() + "]");
+            + error.getMessage() + " [" + statusLine.toString() + "]");
 
     this.statusLine = statusLine;
     this.error = error;
-
-    if (this.error.getInnerErrorType() != null && this.error.getInnerErrorMessage() != null) {
-      final RuntimeException cause =
-              new RuntimeException(this.error.getInnerErrorType() + ": " + this.error.getInnerErrorMessage());
-
-      if (this.error.getInnerErrorStacktrace() != null) {
-        List<String> stLines;
-        try {
-          stLines = IOUtils.readLines(new StringReader(this.error.getInnerErrorStacktrace()));
-        } catch (IOException e) {
-          stLines = Collections.<String>emptyList();
-        }
-        StackTraceElement[] stElements = new StackTraceElement[stLines.size()];
-        for (int i = 0; i < stLines.size(); i++) {
-          final String stLine = stLines.get(i).substring(stLines.get(i).indexOf("at ") + 3);
-          final int lastDotPos = stLine.lastIndexOf('.');
-          stElements[i] = new StackTraceElement(
-                  stLine.substring(0, lastDotPos), stLine.substring(lastDotPos + 1), null, 0);
-        }
-        cause.setStackTrace(stElements);
-      }
-
-      initCause(cause);
-    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index 65cca8d..12696a6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -24,7 +24,6 @@ import java.io.InputStream;
 import java.lang.reflect.Constructor;
 import java.net.URI;
 import java.util.Collection;
-import java.util.Collections;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.Header;
@@ -52,8 +51,8 @@ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.api.format.ODataMediaFormat;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.commons.api.format.ODataValueFormat;
-import org.apache.olingo.commons.core.data.JSONErrorImpl;
-import org.apache.olingo.commons.core.data.XMLErrorImpl;
+import org.apache.olingo.commons.core.data.JSONODataErrorImpl;
+import org.apache.olingo.commons.core.data.XMLODataErrorImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -479,19 +478,13 @@ public class ODataRequestImpl<T extends Format> implements ODataRequest {
   private ODataError getGenericError(final int code, final String errorMsg, final boolean isXML) {
     final ODataError error;
     if (isXML) {
-      error = new XMLErrorImpl();
-      final XMLErrorImpl.Message msg = new XMLErrorImpl.Message(
-              Collections.singletonMap("", (Object) errorMsg));
-
-      ((XMLErrorImpl) error).setMessage(msg);
-      ((XMLErrorImpl) error).setCode(String.valueOf(code));
+      error = new XMLODataErrorImpl();
+      ((XMLODataErrorImpl) error).setCode(String.valueOf(code));
+      ((XMLODataErrorImpl) error).setMessage(errorMsg);
     } else {
-      error = new JSONErrorImpl();
-      final JSONErrorImpl.Message msg = new JSONErrorImpl.Message();
-      msg.setValue(errorMsg);
-
-      ((JSONErrorImpl) error).setMessage(msg);
-      ((JSONErrorImpl) error).setCode(String.valueOf(code));
+      error = new JSONODataErrorImpl();
+      ((JSONODataErrorImpl) error).setCode(String.valueOf(code));
+      ((JSONODataErrorImpl) error).setMessage(errorMsg);
     }
 
     return error;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
index 04c41de..efb818b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
@@ -99,7 +99,6 @@ public class ErrorTestITCase extends AbstractTestITCase {
     } catch (ODataClientErrorException e) {
       LOG.error("ODataClientErrorException found", e);
       assertEquals(400, e.getStatusLine().getStatusCode());
-      assertNotNull(e.getCause());
       assertNotNull(e.getODataError());
     }
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
index 0b10d51..b2cf8e3 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
@@ -18,8 +18,8 @@
  */
 package org.apache.olingo.client.core.v3;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 
 import org.apache.olingo.client.api.v3.ODataClient;
 import org.apache.olingo.commons.api.domain.ODataError;
@@ -43,7 +43,7 @@ public class ErrorTest extends AbstractTest {
 
   private void simple(final ODataPubFormat format) {
     final ODataError error = error("error", format);
-    assertNull(error.getInnerErrorStacktrace());
+    assertEquals("The URL representing the root of the service only supports GET requests.", error.getMessage());
   }
 
   @Test
@@ -58,7 +58,7 @@ public class ErrorTest extends AbstractTest {
 
   private void stacktrace(final ODataPubFormat format) {
     final ODataError error = error("stacktrace", format);
-    assertNotNull(error.getInnerErrorStacktrace());
+    assertEquals("Unsupported media type requested.", error.getMessage());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
new file mode 100644
index 0000000..c89fa39
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.commons.api.domain.ODataError;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.client.core.AbstractTest;
+import org.junit.Test;
+
+public class ErrorTest extends AbstractTest {
+
+  @Override
+  protected ODataClient getClient() {
+    return v4Client;
+  }
+
+  private ODataError error(final String name, final ODataPubFormat format) {
+    final ODataError error = getClient().getDeserializer().toError(
+            getClass().getResourceAsStream(name + "." + getSuffix(format)), format == ODataPubFormat.ATOM);
+    assertNotNull(error);
+    return error;
+  }
+
+  private void simple(final ODataPubFormat format) {
+    final ODataError error = error("error", format);
+    assertEquals("501", error.getCode());
+    assertEquals("Unsupported functionality", error.getMessage());
+    assertEquals("query", error.getTarget());
+  }
+
+  @Test
+  public void jsonSimple() {
+    simple(ODataPubFormat.JSON);
+  }
+
+  @Test
+  public void atomSimple() {
+    simple(ODataPubFormat.ATOM);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
index 2ef78ad..9d999ff 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
@@ -21,5 +21,5 @@
 -->
 <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
   <m:code />
-  <m:message xml:lang="en-US">The URI 'http://192.168.0.160:8080/DefaultService.svc/Customer(100)' is not valid for POST operation. For POST operations, the URI must refer to a service operation or an entity set.</m:message>
+  <m:message xml:lang="en-US">The URL representing the root of the service only supports GET requests.</m:message>
 </m:error>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
new file mode 100644
index 0000000..30a50d8
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
@@ -0,0 +1,14 @@
+{
+  "error": {
+    "code": "501",
+    "message": "Unsupported functionality",
+    "target": "query",
+    "details": [
+      {
+        "code": "301",
+        "target": "$search",
+        "message": "$search query option not supported"
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml
new file mode 100644
index 0000000..149b799
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.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.
+-->
+<error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
+  <code>501</code>
+  <message>Unsupported functionality</message>
+  <target>query</target>
+  <details>
+    <detail>
+      <code>301</code>
+      <message>$search query option not supported</message>
+      <target>$search</target>
+    </detail>
+  </details>
+</error>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/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 f41c30c..a1aec31 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
@@ -224,4 +224,11 @@ public interface Constants {
 
   public static final String ATOM_ATTR_METADATAETAG = "metadata-etag";
 
+  // error stuff
+  public static final String ERROR_CODE = "code";
+
+  public static final String ERROR_MESSAGE = "message";
+
+  public static final String ERROR_TARGET = "target";
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
index 2993964..fc309d3 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
@@ -31,37 +31,17 @@ public interface ODataError {
   String getCode();
 
   /**
-   * Gets error message language.
-   *
-   * @return error message language.
-   */
-  String getMessageLang();
-
-  /**
    * Gets error message.
    *
    * @return error message.
    */
-  String getMessageValue();
-
-  /**
-   * Gets inner error message.
-   *
-   * @return inner error message.
-   */
-  String getInnerErrorMessage();
+  String getMessage();
 
   /**
-   * Gets inner error type.
+   * Gets error target.
    *
-   * @return inner error type.
+   * @return error message.
    */
-  String getInnerErrorType();
+  String getTarget();
 
-  /**
-   * Gets inner error stack-trace.
-   *
-   * @return inner error stack-trace
-   */
-  String getInnerErrorStacktrace();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
index 5442d1d..c6354ec 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
@@ -69,6 +69,7 @@ public enum ODataServiceVersion {
   public static final String JSON_ASSOCIATION_LINK = "jsonAssociationLink";
 
   public static final String JSON_NAVIGATION_LINK = "jsonNavigationLink";
+  public static final String JSON_ERROR = "jsonError";
 
   private static final Map<String, String> V30_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
 
@@ -100,6 +101,7 @@ public enum ODataServiceVersion {
       put(JSON_MEDIA_ETAG, "odata.mediaEtag");
       put(JSON_ASSOCIATION_LINK, "@odata.associationLinkUrl");
       put(JSON_NAVIGATION_LINK, "@odata.navigationLinkUrl");
+      put(JSON_ERROR, "odata.error");
     }
   });
 
@@ -133,6 +135,7 @@ public enum ODataServiceVersion {
       put(JSON_MEDIA_ETAG, "@odata.mediaEtag");
       put(JSON_ASSOCIATION_LINK, "@odata.associationLink");
       put(JSON_NAVIGATION_LINK, "@odata.navigationLink");
+      put(JSON_ERROR, "error");
     }
   });
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index 656207c..e9338f1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -60,6 +60,12 @@ abstract class AbstractAtomDealer {
 
   protected final QName v4PropertyValueQName;
 
+  protected final QName errorCodeQName;
+
+  protected final QName errorMessageQName;
+
+  protected final QName errorTargetQName;
+
   public AbstractAtomDealer(final ODataServiceVersion version) {
     this.version = version;
 
@@ -90,6 +96,13 @@ abstract class AbstractAtomDealer {
             new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ENTRY_REF);
     this.v4PropertyValueQName =
             new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.VALUE);
+
+    this.errorCodeQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_CODE);
+    this.errorMessageQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_MESSAGE);
+    this.errorTargetQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_TARGET);
   }
 
   protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java
new file mode 100644
index 0000000..e5324d8
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java
@@ -0,0 +1,58 @@
+/*
+ * 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.core.data;
+
+import org.apache.olingo.commons.api.domain.ODataError;
+
+public abstract class AbstractODataError implements ODataError {
+
+  private String code;
+
+  private String message;
+
+  private String target;
+
+  @Override
+  public String getCode() {
+    return code;
+  }
+
+  public void setCode(final String code) {
+    this.code = code;
+  }
+
+  @Override
+  public String getMessage() {
+    return message;
+  }
+
+  public void setMessage(final String message) {
+    this.message = message;
+  }
+
+  @Override
+  public String getTarget() {
+    return target;
+  }
+
+  public void setTarget(final String target) {
+    this.target = target;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
new file mode 100644
index 0000000..940bf89
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
@@ -0,0 +1,80 @@
+/*
+ * 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.core.data;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Value;
+
+public abstract class AbstractProperty implements Property {
+
+  private String name;
+
+  private String type;
+
+  private Value value;
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public void setName(final String name) {
+    this.name = name;
+  }
+
+  @Override
+  public String getType() {
+    return type;
+  }
+
+  @Override
+  public void setType(final String type) {
+    this.type = type;
+  }
+
+  @Override
+  public Value getValue() {
+    return value;
+  }
+
+  @Override
+  public void setValue(final Value value) {
+    this.value = value;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  @Override
+  public String toString() {
+    return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
deleted file mode 100644
index e005f98..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
+++ /dev/null
@@ -1,80 +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.core.data;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.Value;
-
-public abstract class AbstractPropertyImpl implements Property {
-
-  private String name;
-
-  private String type;
-
-  private Value value;
-
-  @Override
-  public String getName() {
-    return name;
-  }
-
-  @Override
-  public void setName(final String name) {
-    this.name = name;
-  }
-
-  @Override
-  public String getType() {
-    return type;
-  }
-
-  @Override
-  public void setType(final String type) {
-    this.type = type;
-  }
-
-  @Override
-  public Value getValue() {
-    return value;
-  }
-
-  @Override
-  public void setValue(final Value value) {
-    this.value = value;
-  }
-
-  @Override
-  public boolean equals(final Object obj) {
-    return EqualsBuilder.reflectionEquals(this, obj);
-  }
-
-  @Override
-  public int hashCode() {
-    return HashCodeBuilder.reflectionHashCode(this);
-  }
-
-  @Override
-  public String toString() {
-    return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index c2ffd8e..a786803 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -386,11 +386,69 @@ public class AtomDeserializer extends AbstractAtomDealer {
     return getContainer(start, feed(reader, start));
   }
 
+  private XMLODataErrorImpl error(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
+    final XMLODataErrorImpl error = new XMLODataErrorImpl();
+
+    boolean setCode = false;
+    boolean codeSet = false;
+    boolean setMessage = false;
+    boolean messageSet = false;
+    boolean setTarget = false;
+    boolean targetSet = false;
+
+    boolean foundEndElement = false;
+    while (reader.hasNext() && !foundEndElement) {
+      final XMLEvent event = reader.nextEvent();
+
+      if (event.isStartElement()) {
+        if (errorCodeQName.equals(event.asStartElement().getName())) {
+          setCode = true;
+        } else if (errorMessageQName.equals(event.asStartElement().getName())) {
+          setMessage = true;
+        } else if (errorTargetQName.equals(event.asStartElement().getName())) {
+          setTarget = true;
+        }
+      }
+
+      if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+        if (setCode && !codeSet) {
+          error.setCode(event.asCharacters().getData());
+          setCode = false;
+          codeSet = true;
+        }
+        if (setMessage && !messageSet) {
+          error.setMessage(event.asCharacters().getData());
+          setMessage = false;
+          messageSet = true;
+        }
+        if (setTarget && !targetSet) {
+          error.setTarget(event.asCharacters().getData());
+          setTarget = false;
+          targetSet = true;
+        }
+      }
+
+      if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+        foundEndElement = true;
+      }
+    }
+
+    return error;
+  }
+
+  private Container<XMLODataErrorImpl> error(final InputStream input) throws XMLStreamException {
+    final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+    final StartElement start = skipBeforeFirstStartElement(reader);
+    return getContainer(start, error(reader, start));
+  }
+
   @SuppressWarnings("unchecked")
   public <T, V extends T> Container<T> read(final InputStream input, final Class<V> reference)
           throws XMLStreamException {
 
-    if (AtomFeedImpl.class.equals(reference)) {
+    if (XMLODataErrorImpl.class.equals(reference)) {
+      return (Container<T>) error(input);
+    } else if (AtomFeedImpl.class.equals(reference)) {
       return (Container<T>) feed(input);
     } else if (AtomEntryImpl.class.equals(reference)) {
       return (Container<T>) entry(input);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
index 9688db2..e0018bc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
@@ -18,7 +18,7 @@
  */
 package org.apache.olingo.commons.core.data;
 
-public class AtomPropertyImpl extends AbstractPropertyImpl {
+public class AtomPropertyImpl extends AbstractProperty {
 
   private static final long serialVersionUID = 48748492242474814L;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
deleted file mode 100644
index 433b754..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
+++ /dev/null
@@ -1,50 +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.core.data;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * This class represents a bundle for an OData error returned as JSON.
- */
-public class JSONErrorBundle extends AbstractPayloadObject {
-
-  private static final long serialVersionUID = -4784910226259754450L;
-
-  @JsonProperty("odata.error")
-  private JSONErrorImpl error;
-
-  /**
-   * Gets error.
-   *
-   * @return OData error object.
-   */
-  public JSONErrorImpl getError() {
-    return error;
-  }
-
-  /**
-   * Sets error.
-   *
-   * @param error OData error object.
-   */
-  public void setError(final JSONErrorImpl error) {
-    this.error = error;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
deleted file mode 100644
index 4c6cb4a..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
+++ /dev/null
@@ -1,237 +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.core.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class JSONErrorImpl extends AbstractPayloadObject implements ODataError {
-
-  private static final long serialVersionUID = -3476499168507242932L;
-
-  /**
-   * Error message.
-   */
-  public static class Message extends AbstractPayloadObject {
-
-    private static final long serialVersionUID = 2577818040815637859L;
-
-    private String lang;
-
-    private String value;
-
-    /**
-     * Gets language.
-     *
-     * @return language.
-     */
-    public String getLang() {
-      return lang;
-    }
-
-    /**
-     * Sets language.
-     *
-     * @param lang language.
-     */
-    public void setLang(final String lang) {
-      this.lang = lang;
-    }
-
-    /**
-     * Gets message.
-     *
-     * @return message.
-     */
-    public String getValue() {
-      return value;
-    }
-
-    /**
-     * Sets message.
-     *
-     * @param value message.
-     */
-    public void setValue(final String value) {
-      this.value = value;
-    }
-  }
-
-  /**
-   * Inner error.
-   */
-  static class InnerError extends AbstractPayloadObject {
-
-    private static final long serialVersionUID = -3920947476143537640L;
-
-    private String message;
-
-    private String type;
-
-    private String stacktrace;
-
-    private InnerError internalexception;
-
-    /**
-     * Gets inner message.
-     *
-     * @return message.
-     */
-    public String getMessage() {
-      return message;
-    }
-
-    /**
-     * Sets inner message.
-     *
-     * @param message message.
-     */
-    public void setMessage(final String message) {
-      this.message = message;
-    }
-
-    /**
-     * Gets type.
-     *
-     * @return type.
-     */
-    public String getType() {
-      return type;
-    }
-
-    /**
-     * Sets type.
-     *
-     * @param type type.
-     */
-    public void setType(final String type) {
-      this.type = type;
-    }
-
-    /**
-     * Gets stack-trace.
-     *
-     * @return stack-trace.
-     */
-    public String getStacktrace() {
-      return stacktrace;
-    }
-
-    /**
-     * Sets stack-trace.
-     *
-     * @param stacktrace stack-trace.
-     */
-    public void setStacktrace(final String stacktrace) {
-      this.stacktrace = stacktrace;
-    }
-
-    public InnerError getInternalexception() {
-      return internalexception;
-    }
-
-    public void setInternalexception(final InnerError internalexception) {
-      this.internalexception = internalexception;
-    }
-  }
-
-  private String code;
-
-  @JsonProperty(value = "message")
-  private Message message;
-
-  @JsonProperty(value = "innererror", required = false)
-  private InnerError innererror;
-
-  /**
-   * {@inheritDoc }
-   */
-  @Override
-  public String getCode() {
-    return code;
-  }
-
-  /**
-   * Sets error code.
-   *
-   * @param code error code.
-   */
-  public void setCode(final String code) {
-    this.code = code;
-  }
-
-  /**
-   * {@inheritDoc }
-   */
-  @JsonIgnore
-  @Override
-  public String getMessageLang() {
-    return this.message == null ? null : this.message.getLang();
-  }
-
-  /**
-   * {@inheritDoc }
-   */
-  @JsonIgnore
-  @Override
-  public String getMessageValue() {
-    return this.message == null ? null : this.message.getValue();
-  }
-
-  /**
-   * Sets the value of the message property.
-   *
-   * @param value allowed object is {@link Error.Message }
-   *
-   */
-  public void setMessage(final Message value) {
-    this.message = value;
-  }
-
-  /**
-   * {@inheritDoc }
-   */
-  @JsonIgnore
-  @Override
-  public String getInnerErrorMessage() {
-    return this.innererror == null ? null : this.innererror.getMessage();
-  }
-
-  /**
-   * {@inheritDoc }
-   */
-  @JsonIgnore
-  @Override
-  public String getInnerErrorType() {
-    return this.innererror == null ? null : this.innererror.getType();
-  }
-
-  /**
-   * {@inheritDoc }
-   */
-  @JsonIgnore
-  @Override
-  public String getInnerErrorStacktrace() {
-    return this.innererror == null ? null : this.innererror.getStacktrace();
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
new file mode 100644
index 0000000..f033de1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
@@ -0,0 +1,60 @@
+/*
+ * 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.core.data;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import org.apache.olingo.commons.api.Constants;
+
+public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODataErrorImpl> {
+
+  @Override
+  protected JSONODataErrorImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+          throws IOException, JsonProcessingException {
+
+    final JSONODataErrorImpl error = new JSONODataErrorImpl();
+
+    final ObjectNode tree = parser.getCodec().readTree(parser);
+    if (tree.has(jsonError)) {
+      final JsonNode errorNode = tree.get(jsonError);
+
+      if (errorNode.has(Constants.ERROR_CODE)) {
+        error.setCode(errorNode.get(Constants.ERROR_CODE).textValue());
+      }
+      if (errorNode.has(Constants.ERROR_MESSAGE)) {
+        final JsonNode message = errorNode.get(Constants.ERROR_MESSAGE);
+        if (message.isValueNode()) {
+          error.setMessage(message.textValue());
+        } else if (message.isObject()) {
+          error.setMessage(message.get(Constants.VALUE).asText());
+        }
+      }
+      if (errorNode.has(Constants.ERROR_TARGET)) {
+        error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue());
+      }
+    }
+
+    return error;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java
new file mode 100644
index 0000000..c455d2d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java
@@ -0,0 +1,26 @@
+/*
+ * 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.core.data;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = JSONODataErrorDeserializer.class)
+public class JSONODataErrorImpl extends AbstractODataError {
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
index 1ef0294..1018666 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  */
 @JsonSerialize(using = JSONPropertySerializer.class)
 @JsonDeserialize(using = JSONPropertyDeserializer.class)
-public class JSONPropertyImpl extends AbstractPropertyImpl {
+public class JSONPropertyImpl extends AbstractProperty {
 
   private static final long serialVersionUID = 553414431536637434L;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
index fa6e38f..7b05248 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
@@ -52,6 +52,8 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
 
   protected String jsonNavigationLink;
 
+  protected String jsonError;
+
   protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
           throws IOException, JsonProcessingException;
 
@@ -76,6 +78,7 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
     jsonMediaETag = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG);
     jsonAssociationLink = version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK);
     jsonNavigationLink = version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK);
+    jsonError = version.getJSONMap().get(ODataServiceVersion.JSON_ERROR);
 
     return doDeserialize(jp, ctxt);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
deleted file mode 100644
index a8c3d84..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
+++ /dev/null
@@ -1,213 +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.core.data;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
-import java.util.Map;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class XMLErrorImpl extends AbstractPayloadObject implements ODataError {
-
-  private static final long serialVersionUID = -3476499168507242932L;
-
-  @JacksonXmlText(false)
-  private String code;
-
-  @JsonProperty
-  private Message message;
-
-  @JsonProperty(required = false)
-  private InnerError innererror;
-
-  @Override
-  public String getCode() {
-    return code;
-  }
-
-  /**
-   * Sets error code.
-   *
-   * @param code error code.
-   */
-  public void setCode(final String code) {
-    this.code = code;
-  }
-
-  @JsonIgnore
-  @Override
-  public String getMessageLang() {
-    return this.message == null ? null : this.message.getLang();
-  }
-
-  @JsonIgnore
-  @Override
-  public String getMessageValue() {
-    return this.message == null ? null : this.message.getValue();
-  }
-
-  /**
-   * Sets the value of the message property.
-   *
-   * @param value allowed object is {@link Error.Message }
-   *
-   */
-  public void setMessage(final Message value) {
-    this.message = value;
-  }
-
-  @JsonIgnore
-  @Override
-  public String getInnerErrorMessage() {
-    return this.innererror == null ? null : this.innererror.getMessage().getValue();
-  }
-
-  @JsonIgnore
-  @Override
-  public String getInnerErrorType() {
-    return this.innererror == null ? null : this.innererror.getType().getValue();
-  }
-
-  @JsonIgnore
-  @Override
-  public String getInnerErrorStacktrace() {
-    return this.innererror == null ? null : this.innererror.getStacktrace().getValue();
-  }
-
-  static class TextChildContainer extends AbstractPayloadObject {
-
-    private static final long serialVersionUID = -8908394095210115904L;
-
-    public TextChildContainer() {
-      super();
-    }
-
-    public TextChildContainer(final String value) {
-      super();
-      this.value = value;
-    }
-
-    @JsonCreator
-    public TextChildContainer(final Map<String, Object> props) {
-      super();
-      this.value = (String) props.get("");
-    }
-
-    private String value;
-
-    public String getValue() {
-      return value;
-    }
-
-    public void setValue(final String value) {
-      this.value = value;
-    }
-  }
-
-  /**
-   * Error message.
-   */
-  public static class Message extends TextChildContainer {
-
-    private static final long serialVersionUID = 2577818040815637859L;
-
-    private String lang;
-
-    public Message() {
-      super();
-    }
-
-    @JsonCreator
-    public Message(final Map<String, Object> props) {
-      super(props);
-      this.lang = (String) props.get("lang");
-    }
-
-    /**
-     * Gets language.
-     *
-     * @return language.
-     */
-    public String getLang() {
-      return lang;
-    }
-
-    /**
-     * Sets language.
-     *
-     * @param lang language.
-     */
-    public void setLang(final String lang) {
-      this.lang = lang;
-    }
-  }
-
-  /**
-   * Inner error.
-   */
-  static class InnerError extends AbstractPayloadObject {
-
-    private static final long serialVersionUID = -3920947476143537640L;
-
-    private TextChildContainer message;
-
-    private TextChildContainer type;
-
-    private TextChildContainer stacktrace;
-
-    private InnerError internalexception;
-
-    public TextChildContainer getMessage() {
-      return message;
-    }
-
-    public void setMessage(final TextChildContainer message) {
-      this.message = message;
-    }
-
-    public TextChildContainer getType() {
-      return type;
-    }
-
-    public void setType(final TextChildContainer type) {
-      this.type = type;
-    }
-
-    public TextChildContainer getStacktrace() {
-      return stacktrace;
-    }
-
-    public void setStacktrace(final TextChildContainer stacktrace) {
-      this.stacktrace = stacktrace;
-    }
-
-    public InnerError getInternalexception() {
-      return internalexception;
-    }
-
-    public void setInternalexception(final InnerError internalexception) {
-      this.internalexception = internalexception;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java
new file mode 100644
index 0000000..36cb682
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java
@@ -0,0 +1,23 @@
+/*
+ * 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.core.data;
+
+public class XMLODataErrorImpl extends AbstractODataError {
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index bf4bd57..616766b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -39,10 +39,10 @@ import org.apache.olingo.commons.core.data.AtomEntryImpl;
 import org.apache.olingo.commons.core.data.AtomFeedImpl;
 import org.apache.olingo.commons.core.data.AtomPropertyImpl;
 import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.core.data.JSONErrorBundle;
 import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONODataErrorImpl;
 import org.apache.olingo.commons.core.data.JSONPropertyImpl;
-import org.apache.olingo.commons.core.data.XMLErrorImpl;
+import org.apache.olingo.commons.core.data.XMLODataErrorImpl;
 
 public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
 
@@ -80,8 +80,8 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
   @Override
   public ODataError toError(final InputStream input, final boolean isXML) {
     return isXML
-            ? this.<ODataError, XMLErrorImpl>xml(input, XMLErrorImpl.class).getObject()
-            : this.<JSONErrorBundle, JSONErrorBundle>json(input, JSONErrorBundle.class).getObject().getError();
+            ? this.<ODataError, XMLODataErrorImpl>atom(input, XMLODataErrorImpl.class).getObject()
+            : this.<ODataError, JSONODataErrorImpl>json(input, JSONODataErrorImpl.class).getObject();
   }
 
   /*
@@ -90,21 +90,21 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
   @SuppressWarnings("unchecked")
   protected <T, V extends T> Container<T> xml(final InputStream input, final Class<V> reference) {
     try {
-      ByteArrayOutputStream bos = new ByteArrayOutputStream();
+      final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
       final XMLEventReader reader = AtomDeserializer.FACTORY.createXMLEventReader(input);
       final StartElement start = atomDeserializer.skipBeforeFirstStartElement(reader);
 
-      final XMLEventWriter writer = XMLOutputFactory.newFactory().createXMLEventWriter(bos);
+      final XMLEventWriter writer = XMLOutputFactory.newFactory().createXMLEventWriter(baos);
       writer.add(start);
       writer.add(reader);
       writer.flush();
       writer.close();
 
       return (Container<T>) atomDeserializer.getContainer(
-              start, getXmlMapper().readValue(new ByteArrayInputStream(bos.toByteArray()), reference));
-
+              start, getXmlMapper().readValue(new ByteArrayInputStream(baos.toByteArray()), reference));
     } catch (Exception e) {
+      e.printStackTrace();
       throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
     }
   }


[2/3] git commit: [OLINGO-200] V4 (de)serialization tests for EntitySet and Property

Posted by il...@apache.org.
[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/olingo200
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.
    *