You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2014/03/26 16:23:29 UTC

[3/4] git commit: [OLINGO-175, OLINGO-205] provided (v4) context url and entity reference retrieving + it tests

[OLINGO-175, OLINGO-205] provided (v4) context url and entity reference retrieving + it tests


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

Branch: refs/heads/olingo200
Commit: 428277c26d79287b82b60f7a567be2ba5e2bb91d
Parents: f0edb50
Author: fmartelli <fa...@gmail.com>
Authored: Wed Mar 26 15:40:11 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Wed Mar 26 15:40:11 2014 +0100

----------------------------------------------------------------------
 .../org/apache/olingo/fit/AbstractServices.java |  37 +-
 .../olingo/fit/utils/AbstractXMLUtilities.java  |  20 +-
 .../org/apache/olingo/fit/utils/Commons.java    |  22 +-
 .../org/apache/olingo/fit/utils/Constants.java  |  10 +-
 .../olingo/fit/utils/MetadataLinkInfo.java      |  22 +
 .../olingo/fit/utils/v4/XMLUtilities.java       |   4 +
 .../main/resources/v4/Company/entity.full.json  |  38 ++
 fit/src/main/resources/v4/Company/entity.xml    |  49 +++
 .../resources/v4/Customers/1/entity.full.json   |  67 +++
 .../main/resources/v4/Customers/1/entity.xml    |  67 +++
 .../v4/Customers/1/links/Company.full.json      |   4 +
 .../resources/v4/Customers/1/links/Company.xml  |  22 +
 .../v4/Customers/1/links/Orders.full.json       |  10 +
 .../resources/v4/Customers/1/links/Orders.xml   |  25 ++
 .../main/resources/v4/Orders/8/entity.full.json |  23 +
 fit/src/main/resources/v4/Orders/8/entity.xml   |  50 +++
 fit/src/main/resources/v4/Orders/8/etag.txt     |   1 +
 .../main/resources/v4/Orders/8/links/.full.json |   4 +
 .../Orders/8/links/CustomerForOrder.full.json   |   4 +
 .../v4/Orders/8/links/CustomerForOrder.xml      |  22 +
 fit/src/main/resources/v4/Orders/feed.full.json |  48 +++
 fit/src/main/resources/v4/Orders/feed.xml       |  72 ++++
 .../main/resources/v4/People/5/entity.full.json |  51 +++
 fit/src/main/resources/v4/People/5/entity.xml   |  55 +++
 .../v4/ProductDetails/6 1/entity.full.json      |  19 +
 .../resources/v4/ProductDetails/6 1/entity.xml  |  41 ++
 fit/src/main/resources/v4/badRequest.json       |  17 +
 fit/src/main/resources/v4/badRequest.xml        |  30 ++
 fit/src/main/resources/v4/notFound.json         |  11 +
 fit/src/main/resources/v4/notFound.xml          |  25 ++
 ...JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json |   4 +
 .../T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml    |  22 +
 .../main/resources/v4/unsupportedMediaType.json |  17 +
 .../main/resources/v4/unsupportedMediaType.xml  |  34 ++
 .../api/communication/header/HeaderName.java    | 111 ++++-
 .../communication/header/ODataHeaderValues.java |  45 --
 .../communication/header/ODataPreferences.java  | 424 +++++++++++++++++++
 .../api/communication/request/ODataRequest.java |  24 +-
 .../olingo/client/api/uri/SegmentType.java      |   1 +
 .../olingo/client/api/uri/v3/URIBuilder.java    |   3 +-
 .../olingo/client/api/uri/v4/URIBuilder.java    |  19 +-
 .../communication/request/ODataRequestImpl.java |  30 +-
 .../data/JSONServiceDocumentDeserializer.java   |   2 +-
 .../client/core/op/AbstractODataBinder.java     |  53 ++-
 .../client/core/uri/AbstractURIBuilder.java     |  48 ++-
 .../client/core/uri/v4/URIBuilderImpl.java      |  15 +-
 .../olingo/client/core/v4/ODataClientImpl.java  |   4 +-
 .../core/it/v3/EntityCreateTestITCase.java      |   8 +-
 .../core/it/v3/EntityUpdateTestITCase.java      |   6 +-
 .../core/it/v3/PropertyValueTestITCase.java     |   6 +-
 .../core/it/v4/EntityRetrieveTestITCase.java    | 280 ++++++++++++
 .../client/core/it/v4/EntitySetTestITCase.java  |   3 +
 .../core/it/v4/PropertyValueTestITCase.java     | 144 +++++++
 .../olingo/client/core/v3/URIBuilderTest.java   |  20 +-
 .../olingo/client/core/v4/URIBuilderTest.java   |  18 +-
 .../apache/olingo/commons/api/Constants.java    |  10 +-
 .../apache/olingo/commons/api/data/Entry.java   |  24 +-
 .../apache/olingo/commons/api/data/Feed.java    |  16 +-
 .../olingo/commons/api/data/Property.java       |  10 +
 .../api/domain/AbstractODataPayload.java        |  52 +++
 .../olingo/commons/api/domain/ODataEntity.java  |  31 +-
 .../commons/api/domain/ODataEntitySet.java      |   2 +-
 .../olingo/commons/api/domain/ODataItem.java    |  26 +-
 .../olingo/commons/api/domain/ODataLink.java    |   2 -
 .../commons/core/data/AbstractAtomDealer.java   |  14 +-
 .../commons/core/data/AbstractAtomObject.java   |  21 +-
 .../commons/core/data/AbstractPropertyImpl.java |  18 +
 .../commons/core/data/AtomDeserializer.java     | 227 +++++-----
 .../core/data/AtomPropertyDeserializer.java     |  24 +-
 .../core/data/AtomPropertySerializer.java       |   8 +
 .../commons/core/data/AtomSerializer.java       |  14 +
 .../core/data/JSONEntryDeserializer.java        |  17 +-
 .../olingo/commons/core/data/JSONEntryImpl.java |  29 +-
 .../commons/core/data/JSONEntrySerializer.java  |   8 +-
 .../commons/core/data/JSONFeedDeserializer.java |  15 +-
 .../olingo/commons/core/data/JSONFeedImpl.java  |  26 +-
 .../commons/core/data/JSONFeedSerializer.java   |  10 +-
 .../core/data/JSONPropertyDeserializer.java     |  17 +-
 .../commons/core/data/JSONPropertyImpl.java     |  20 -
 .../core/data/JSONPropertySerializer.java       |  11 +-
 .../olingo/commons/core/edm/EdmTypeInfo.java    |   1 -
 81 files changed, 2497 insertions(+), 367 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
index 025e4fe..1ffba94 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -54,6 +54,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
+import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.fit.utils.Constants;
@@ -144,6 +145,40 @@ public abstract class AbstractServices {
     }
   }
 
+  /**
+   * Retrieve entity reference sample.
+   *
+   * @param accept Accept header.
+   * @param path path.
+   * @param format format query option.
+   * @return entity reference or feed of entity reference.
+   */
+  @GET
+  @Path("/{path:.*}/$ref")
+  public Response getEntityReference(
+          @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+          @PathParam("path") String path,
+          @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+
+    try {
+      final Map.Entry<Accept, AbstractUtilities> utils = getUtilities(accept, format);
+
+      if (utils.getKey() == Accept.TEXT) {
+        throw new UnsupportedMediaTypeException("Unsupported media type");
+      }
+
+      final String filename = Base64.encodeBase64String(path.getBytes("UTF-8"));
+
+      return utils.getValue().createResponse(
+              FSManager.instance(getVersion()).readFile(Constants.REF + File.separatorChar + filename, utils.getKey()),
+              null,
+              utils.getKey());
+    } catch (Exception e) {
+      LOG.error("Error retrieving entity", e);
+      return xml.createFaultResponse(accept, e);
+    }
+  }
+
   @MERGE
   @Path("/{entitySetName}/{entityId}")
   @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
@@ -386,7 +421,7 @@ public abstract class AbstractServices {
         } else if (StringUtils.isNotBlank(skiptoken)) {
           builder.append(SKIP_TOKEN).append(File.separatorChar).append(skiptoken);
         } else {
-          builder.append(FEED);
+          builder.append(Commons.getLinkInfo().get(getVersion()).isSingleton(name) ? ENTITY : FEED);
         }
 
         InputStream feed = FSManager.instance(getVersion()).readFile(builder.toString(), acceptType);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
index d02e828..cef564a 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
@@ -1208,11 +1208,21 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
     writer.add(eventFactory.createStartDocument("UTF-8", "1.0"));
     writer.add(property.getStart());
 
-    if (property.getStart().getAttributeByName(new QName(ATOM_DATASERVICE_NS)) == null) {
-      writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), DATASERVICES_NS));
-    }
-    if (property.getStart().getAttributeByName(new QName(ATOM_METADATA_NS)) == null) {
-      writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), METADATA_NS));
+    if (version == ODataVersion.v4) {
+
+      if (property.getStart().getAttributeByName(new QName(ATOM_DATASERVICE_NS)) == null) {
+        writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), V4_DATASERVICES_NS));
+      }
+      if (property.getStart().getAttributeByName(new QName(ATOM_METADATA_NS)) == null) {
+        writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), V4_METADATA_NS));
+      }
+    } else {
+      if (property.getStart().getAttributeByName(new QName(ATOM_DATASERVICE_NS)) == null) {
+        writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), V3_DATASERVICES_NS));
+      }
+      if (property.getStart().getAttributeByName(new QName(ATOM_METADATA_NS)) == null) {
+        writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), V3_METADATA_NS));
+      }
     }
 
     writer.add(property.getContentReader());

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
index dcc4807..4cf992a 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
@@ -41,6 +41,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
 import org.apache.commons.io.IOUtils;
+import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -79,11 +80,14 @@ public abstract class Commons {
   }
 
   public static String getEntityURI(final String entitySetName, final String entityKey) {
-    return entitySetName + "(" + entityKey + ")";
+    // expected singleton in case of null key
+    return entitySetName + (StringUtils.isNotBlank(entityKey) ? "(" + entityKey + ")" : "");
   }
 
   public static String getEntityBasePath(final String entitySetName, final String entityKey) {
-    return entitySetName + File.separatorChar + getEntityKey(entityKey) + File.separatorChar;
+    // expected singleton in case of null key
+    return entitySetName + File.separatorChar
+            + (StringUtils.isNotBlank(entityKey) ? getEntityKey(entityKey) + File.separatorChar : "");
   }
 
   public static String getLinksURI(
@@ -266,8 +270,18 @@ public abstract class Commons {
   public static Map.Entry<String, String> parseEntityURI(final String uri) {
     final String relPath = uri.substring(uri.lastIndexOf("/"));
     final int branchIndex = relPath.indexOf('(');
-    final String es = relPath.substring(0, branchIndex);
-    final String eid = relPath.substring(branchIndex + 1, relPath.indexOf(')'));
+
+    final String es;
+    final String eid;
+
+    if (branchIndex > -1) {
+      es = relPath.substring(0, branchIndex);
+      eid = relPath.substring(branchIndex + 1, relPath.indexOf(')'));
+    } else {
+      es = relPath;
+      eid = null;
+    }
+
     return new SimpleEntry<String, String>(es, eid);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
index 72309c2..be522d9 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
@@ -60,9 +60,13 @@ public class Constants {
 
   public final static String LINK = "link";
 
-  public final static String DATASERVICES_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices";
+  public final static String V3_DATASERVICES_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices";
 
-  public final static String METADATA_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
+  public final static String V4_DATASERVICES_NS = "http://docs.oasis-open.org/odata/ns/dataservices";
+
+  public final static String V3_METADATA_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
+
+  public final static String V4_METADATA_NS = "http://docs.oasis-open.org/odata/ns/metadata";
 
   public final static String METADATA = "metadata";
 
@@ -72,6 +76,8 @@ public class Constants {
 
   public final static String ENTITY = "entity";
 
+  public final static String REF = "references";
+
   public final static String MEDIA_CONTENT_FILENAME = "$value.bin";
 
   public final static String SKIP_TOKEN = "skiptoken";

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java b/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java
index 737fa7b..f18b8b8 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/MetadataLinkInfo.java
@@ -28,6 +28,14 @@ public class MetadataLinkInfo {
 
   private Map<String, EntitySet> entitySets = new HashMap<String, EntitySet>();
 
+  public void setSingleton(final String entitySetName) {
+    entitySets.get(entitySetName).setSingleton(true);
+  }
+
+  public boolean isSingleton(final String entitySetName) {
+    return entitySets.get(entitySetName).isSingleton();
+  }
+
   public Set<String> getEntitySets() {
     return entitySets.keySet();
   }
@@ -92,6 +100,8 @@ public class MetadataLinkInfo {
 
     private Set<NavigationLink> links;
 
+    private boolean singleton;
+
     public EntitySet(final String name) {
       this.name = name;
       links = new HashSet<NavigationLink>();
@@ -135,6 +145,18 @@ public class MetadataLinkInfo {
       this.links = links;
     }
 
+    public EntitySet(boolean singleton) {
+      this.singleton = singleton;
+    }
+
+    public boolean isSingleton() {
+      return singleton;
+    }
+
+    public void setSingleton(boolean singleton) {
+      this.singleton = singleton;
+    }
+
     @Override
     public String toString() {
       return name + ": " + links;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
index c61d272..1cf8d38 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
@@ -138,5 +138,9 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti
     if (size == 0) {
       metadataLinkInfo.addEntitySet(entitySetName);
     }
+
+    if (singletons.contains(entitySetName)) {
+      metadataLinkInfo.setSingleton(entitySetName);
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Company/entity.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Company/entity.full.json b/fit/src/main/resources/v4/Company/entity.full.json
new file mode 100644
index 0000000..41d4ffd
--- /dev/null
+++ b/fit/src/main/resources/v4/Company/entity.full.json
@@ -0,0 +1,38 @@
+{
+  "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Company",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Company",
+  "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company",
+  "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company",
+  "CompanyID": 0,
+  "CompanyCategory@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
+  "CompanyCategory": "IT",
+  "Revenue@odata.type": "#Int64",
+  "Revenue": 100000,
+  "Name": "MS",
+  "Address":
+          {
+            "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
+            "Street": "1 Microsoft Way",
+            "City": "Redmond",
+            "PostalCode": "98052",
+            "CompanyName": "Microsoft"
+          },
+  "Employees@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Employees/$ref",
+  "Employees@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Employees",
+  "VipCustomer@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/VipCustomer/$ref",
+  "VipCustomer@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/VipCustomer",
+  "Departments@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Departments/$ref",
+  "Departments@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Departments",
+  "CoreDepartment@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/CoreDepartment/$ref",
+  "CoreDepartment@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/CoreDepartment",
+  "#Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue":
+          {
+            "title": "Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue",
+            "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue"
+          },
+  "#Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount":
+          {
+            "title": "Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount",
+            "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount"
+          }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Company/entity.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Company/entity.xml b/fit/src/main/resources/v4/Company/entity.xml
new file mode 100644
index 0000000..6beed3b
--- /dev/null
+++ b/fit/src/main/resources/v4/Company/entity.xml
@@ -0,0 +1,49 @@
+<?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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Company">
+  <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company</id>
+  <category term="#Microsoft.Test.OData.Services.ODataWCFService.Company" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+  <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Employees" type="application/atom+xml;type=feed" title="Employees" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Employees" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/VipCustomer" type="application/atom+xml;type=entry" title="VipCustomer" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/VipCustomer" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Departments" type="application/atom+xml;type=feed" title="Departments" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/Departments" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/CoreDepartment" type="application/atom+xml;type=entry" title="CoreDepartment" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company/CoreDepartment" />
+  <title />
+  <updated>2014-03-24T17:09:31Z</updated>
+  <author>
+    <name />
+  </author>
+  <content type="application/xml">
+    <m:properties>
+      <d:CompanyID m:type="Int32">0</d:CompanyID>
+      <d:CompanyCategory m:type="#Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory">IT</d:CompanyCategory>
+      <d:Revenue m:type="Int64">100000</d:Revenue>
+      <d:Name>MS</d:Name>
+      <d:Address m:type="#Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress">
+        <d:Street>1 Microsoft Way</d:Street>
+        <d:City>Redmond</d:City>
+        <d:PostalCode>98052</d:PostalCode>
+        <d:CompanyName>Microsoft</d:CompanyName>
+      </d:Address>
+    </m:properties>
+  </content>
+</entry>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Customers/1/entity.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Customers/1/entity.full.json b/fit/src/main/resources/v4/Customers/1/entity.full.json
new file mode 100644
index 0000000..77ce055
--- /dev/null
+++ b/fit/src/main/resources/v4/Customers/1/entity.full.json
@@ -0,0 +1,67 @@
+{
+  "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Customers/$entity",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
+  "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)",
+  "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/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@odata.type": "#GeographyPoint",
+  "Home":
+          {
+            "type": "Point",
+            "coordinates":
+                    [
+                      23.1,
+                      32.1
+                    ],
+            "crs":
+                    {
+                      "type": "name",
+                      "properties":
+                              {
+                                "name": "EPSG:4326"
+                              }
+                    }
+          },
+  "Numbers@odata.type": "#Collection(String)",
+  "Numbers":
+          [
+            "111-111-1111"
+          ],
+  "Emails@odata.type": "#Collection(String)",
+  "Emails":
+          [
+            "abc@abc.com"
+          ],
+  "City": "London",
+  "Birthday@odata.type": "#DateTimeOffset",
+  "Birthday": "1957-04-03T00:00:00Z",
+  "TimeBetweenLastTwoOrders@odata.type": "#Duration",
+  "TimeBetweenLastTwoOrders": "PT0.0000001S",
+  "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Parent/$ref",
+  "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Parent",
+  "Orders@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Orders/$ref",
+  "Orders@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Orders",
+  "Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Company/$ref",
+  "Company@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Company",
+  "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress":
+          {
+            "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+            "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+          },
+  "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress":
+          {
+            "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+            "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+          }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Customers/1/entity.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Customers/1/entity.xml b/fit/src/main/resources/v4/Customers/1/entity.xml
new file mode 100644
index 0000000..d3e25a6
--- /dev/null
+++ b/fit/src/main/resources/v4/Customers/1/entity.xml
@@ -0,0 +1,67 @@
+<?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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Customers/$entity">
+  <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)/Company" />
+  <title />
+  <updated>2014-03-24T17:03:20Z</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>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Customers/1/links/Company.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Customers/1/links/Company.full.json b/fit/src/main/resources/v4/Customers/1/links/Company.full.json
new file mode 100644
index 0000000..3d307c8
--- /dev/null
+++ b/fit/src/main/resources/v4/Customers/1/links/Company.full.json
@@ -0,0 +1,4 @@
+{
+  "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Customer/$links/Info",
+  "url": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Customers/1/links/Company.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Customers/1/links/Company.xml b/fit/src/main/resources/v4/Customers/1/links/Company.xml
new file mode 100644
index 0000000..1bf9575
--- /dev/null
+++ b/fit/src/main/resources/v4/Customers/1/links/Company.xml
@@ -0,0 +1,22 @@
+<?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.
+
+-->
+<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Company</uri>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Customers/1/links/Orders.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Customers/1/links/Orders.full.json b/fit/src/main/resources/v4/Customers/1/links/Orders.full.json
new file mode 100644
index 0000000..d684d9a
--- /dev/null
+++ b/fit/src/main/resources/v4/Customers/1/links/Orders.full.json
@@ -0,0 +1,10 @@
+{
+  "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#Customer/$links/Orders",
+  "value":
+          [
+            {
+              "url": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Orders(8)"
+            }
+          ],
+  "odata.nextLink": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Customers(1)/$links/Orders?$skiptoken=2"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Customers/1/links/Orders.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Customers/1/links/Orders.xml b/fit/src/main/resources/v4/Customers/1/links/Orders.xml
new file mode 100644
index 0000000..52bd53d
--- /dev/null
+++ b/fit/src/main/resources/v4/Customers/1/links/Orders.xml
@@ -0,0 +1,25 @@
+<?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.
+
+-->
+<links xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">
+  <uri>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Orders(8)</uri>
+  <next>http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/Customers(1)/$links/Orders?$skiptoken=2</next>
+</links>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Orders/8/entity.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Orders/8/entity.full.json b/fit/src/main/resources/v4/Orders/8/entity.full.json
new file mode 100644
index 0000000..69199f2
--- /dev/null
+++ b/fit/src/main/resources/v4/Orders/8/entity.full.json
@@ -0,0 +1,23 @@
+{
+  "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders/$entity",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Order",
+  "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)",
+  "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)",
+  "@odata.etag": "W/\"123456789001\"",
+  "OrderID": 8,
+  "OrderDate@odata.type": "#DateTimeOffset",
+  "OrderDate": "2011-03-04T16:03:57Z",
+  "ShelfLife@odata.type": "#Duration",
+  "ShelfLife": "PT0.0000001S",
+  "OrderShelfLifes@odata.type": "#Collection(Duration)",
+  "OrderShelfLifes":
+          [
+            "PT0.0000001S"
+          ],
+  "LoggedInEmployee@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee/$ref",
+  "LoggedInEmployee@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee",
+  "CustomerForOrder@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder/$ref",
+  "CustomerForOrder@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder",
+  "OrderDetails@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails/$ref",
+  "OrderDetails@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Orders/8/entity.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Orders/8/entity.xml b/fit/src/main/resources/v4/Orders/8/entity.xml
new file mode 100644
index 0000000..8dec66d
--- /dev/null
+++ b/fit/src/main/resources/v4/Orders/8/entity.xml
@@ -0,0 +1,50 @@
+<?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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders/$entity"
+       m:etag="W/&quot;123456789001&quot;">
+  <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)</id>
+  <category term="#Microsoft.Test.OData.Services.ODataWCFService.Order" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+  <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/LoggedInEmployee" type="application/atom+xml;type=entry" title="LoggedInEmployee" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/CustomerForOrder" type="application/atom+xml;type=entry" title="CustomerForOrder" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/OrderDetails" type="application/atom+xml;type=feed" title="OrderDetails" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails" />
+  <title />
+  <updated>2014-03-24T17:36:01Z</updated>
+  <author>
+    <name />
+  </author>
+  <content type="application/xml">
+    <m:properties>
+      <d:OrderID m:type="Int32">8</d:OrderID>
+      <d:OrderDate m:type="DateTimeOffset">2011-03-04T16:03:57Z</d:OrderDate>
+      <d:ShelfLife m:type="Duration">PT0.0000001S</d:ShelfLife>
+      <d:OrderShelfLifes m:type="#Collection(Duration)">
+        <m:element>PT0.0000001S</m:element>
+      </d:OrderShelfLifes>
+    </m:properties>
+  </content>
+</entry>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Orders/8/etag.txt
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Orders/8/etag.txt b/fit/src/main/resources/v4/Orders/8/etag.txt
new file mode 100644
index 0000000..46cda31
--- /dev/null
+++ b/fit/src/main/resources/v4/Orders/8/etag.txt
@@ -0,0 +1 @@
+W/"123456789001"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Orders/8/links/.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Orders/8/links/.full.json b/fit/src/main/resources/v4/Orders/8/links/.full.json
new file mode 100644
index 0000000..ae6a7fd
--- /dev/null
+++ b/fit/src/main/resources/v4/Orders/8/links/.full.json
@@ -0,0 +1,4 @@
+{
+  "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/$metadata#Customer/$links/Info",
+  "url": "http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/CustomerInfo(11)"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.full.json b/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.full.json
new file mode 100644
index 0000000..3a57fd0
--- /dev/null
+++ b/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.full.json
@@ -0,0 +1,4 @@
+{
+  "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders/$links/CustomerForOrder",
+  "url": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(1)"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.xml b/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.xml
new file mode 100644
index 0000000..f7e70fc
--- /dev/null
+++ b/fit/src/main/resources/v4/Orders/8/links/CustomerForOrder.xml
@@ -0,0 +1,22 @@
+<?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.
+
+-->
+<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(1)</uri>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Orders/feed.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Orders/feed.full.json b/fit/src/main/resources/v4/Orders/feed.full.json
new file mode 100644
index 0000000..1752c62
--- /dev/null
+++ b/fit/src/main/resources/v4/Orders/feed.full.json
@@ -0,0 +1,48 @@
+{
+  "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders",
+  "value":
+          [
+            {
+              "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Order",
+              "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)",
+              "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)",
+              "OrderID": 7,
+              "OrderDate@odata.type": "#DateTimeOffset",
+              "OrderDate": "2011-05-29T14:21:12Z",
+              "ShelfLife@odata.type": "#Duration",
+              "ShelfLife": "PT0.0000001S",
+              "OrderShelfLifes@odata.type": "#Collection(Duration)",
+              "OrderShelfLifes":
+                      [
+                        "PT0.0000001S"
+                      ],
+              "LoggedInEmployee@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/LoggedInEmployee/$ref",
+              "LoggedInEmployee@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/LoggedInEmployee",
+              "CustomerForOrder@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/CustomerForOrder/$ref",
+              "CustomerForOrder@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/CustomerForOrder",
+              "OrderDetails@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/OrderDetails/$ref",
+              "OrderDetails@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/OrderDetails"
+            },
+            {
+              "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Order",
+              "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)",
+              "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)",
+              "OrderID": 8,
+              "OrderDate@odata.type": "#DateTimeOffset",
+              "OrderDate": "2011-03-04T16:03:57Z",
+              "ShelfLife@odata.type": "#Duration",
+              "ShelfLife": "PT0.0000001S",
+              "OrderShelfLifes@odata.type": "#Collection(Duration)",
+              "OrderShelfLifes":
+                      [
+                        "PT0.0000001S"
+                      ],
+              "LoggedInEmployee@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee/$ref",
+              "LoggedInEmployee@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee",
+              "CustomerForOrder@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder/$ref",
+              "CustomerForOrder@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder",
+              "OrderDetails@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails/$ref",
+              "OrderDetails@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails"
+            }
+          ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/Orders/feed.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/Orders/feed.xml b/fit/src/main/resources/v4/Orders/feed.xml
new file mode 100644
index 0000000..2a32d31
--- /dev/null
+++ b/fit/src/main/resources/v4/Orders/feed.xml
@@ -0,0 +1,72 @@
+<?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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#Orders">
+  <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders</id>
+  <title />
+  <updated>2014-03-24T17:17:25Z</updated>
+  <entry>
+    <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)</id>
+    <category term="#Microsoft.Test.OData.Services.ODataWCFService.Order" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+    <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/LoggedInEmployee" type="application/atom+xml;type=entry" title="LoggedInEmployee" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/LoggedInEmployee" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/CustomerForOrder" type="application/atom+xml;type=entry" title="CustomerForOrder" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/CustomerForOrder" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/OrderDetails" type="application/atom+xml;type=feed" title="OrderDetails" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(7)/OrderDetails" />
+    <title />
+    <updated>2014-03-24T17:17:25Z</updated>
+    <author>
+      <name />
+    </author>
+    <content type="application/xml">
+      <m:properties>
+        <d:OrderID m:type="Int32">7</d:OrderID>
+        <d:OrderDate m:type="DateTimeOffset">2011-05-29T14:21:12Z</d:OrderDate>
+        <d:ShelfLife m:type="Duration">PT0.0000001S</d:ShelfLife>
+        <d:OrderShelfLifes m:type="#Collection(Duration)">
+          <m:element>PT0.0000001S</m:element>
+        </d:OrderShelfLifes>
+      </m:properties>
+    </content>
+  </entry>
+  <entry>
+    <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)</id>
+    <category term="#Microsoft.Test.OData.Services.ODataWCFService.Order" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+    <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/LoggedInEmployee" type="application/atom+xml;type=entry" title="LoggedInEmployee" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/LoggedInEmployee" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/CustomerForOrder" type="application/atom+xml;type=entry" title="CustomerForOrder" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/CustomerForOrder" />
+    <link rel="http://docs.oasis-open.org/odata/ns/related/OrderDetails" type="application/atom+xml;type=feed" title="OrderDetails" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Orders(8)/OrderDetails" />
+    <title />
+    <updated>2014-03-24T17:17:25Z</updated>
+    <author>
+      <name />
+    </author>
+    <content type="application/xml">
+      <m:properties>
+        <d:OrderID m:type="Int32">8</d:OrderID>
+        <d:OrderDate m:type="DateTimeOffset">2011-03-04T16:03:57Z</d:OrderDate>
+        <d:ShelfLife m:type="Duration">PT0.0000001S</d:ShelfLife>
+        <d:OrderShelfLifes m:type="#Collection(Duration)">
+          <m:element>PT0.0000001S</m:element>
+        </d:OrderShelfLifes>
+      </m:properties>
+    </content>
+  </entry>
+</feed>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/People/5/entity.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/People/5/entity.full.json b/fit/src/main/resources/v4/People/5/entity.full.json
new file mode 100644
index 0000000..3596881
--- /dev/null
+++ b/fit/src/main/resources/v4/People/5/entity.full.json
@@ -0,0 +1,51 @@
+{
+  "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#People/$entity",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Person",
+  "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)",
+  "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)",
+  "PersonID": 5,
+  "FirstName": "Peter",
+  "LastName": "Bee",
+  "MiddleName": null,
+  "HomeAddress": null,
+  "Home@odata.type": "#GeographyPoint",
+  "Home":
+          {
+            "type": "Point",
+            "coordinates":
+                    [
+                      -261.8,
+                      -16
+                    ],
+            "crs":
+                    {
+                      "type": "name",
+                      "properties":
+                              {
+                                "name": "EPSG:4326"
+                              }
+                    }
+          },
+  "Numbers@odata.type": "#Collection(String)",
+  "Numbers":
+          [
+            "555-555-5555"
+          ],
+  "Emails@odata.type": "#Collection(String)",
+  "Emails":
+          [
+            "def@test.msn"
+          ],
+  "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Parent/$ref",
+  "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Parent",
+  "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress":
+          {
+            "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+            "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+          },
+  "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress":
+          {
+            "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+            "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+          }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/People/5/entity.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/People/5/entity.xml b/fit/src/main/resources/v4/People/5/entity.xml
new file mode 100644
index 0000000..daebef8
--- /dev/null
+++ b/fit/src/main/resources/v4/People/5/entity.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#People/$entity">
+  <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)</id>
+  <category term="#Microsoft.Test.OData.Services.ODataWCFService.Person" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+  <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/People(5)/Parent" />
+  <title />
+  <updated>2014-03-24T17:20:17Z</updated>
+  <author>
+    <name />
+  </author>
+  <content type="application/xml">
+    <m:properties>
+      <d:PersonID m:type="Int32">5</d:PersonID>
+      <d:FirstName>Peter</d:FirstName>
+      <d:LastName>Bee</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>-16 -261.8</gml:pos>
+        </gml:Point>
+      </d:Home>
+      <d:Numbers m:type="#Collection(String)">
+        <m:element>555-555-5555</m:element>
+      </d:Numbers>
+      <d:Emails m:type="#Collection(String)">
+        <m:element>def@test.msn</m:element>
+      </d:Emails>
+      <d:IsRegistered m:type="Boolean">true</d:IsRegistered>
+      <d:Height m:type="Decimal">179</d:Height>
+      <d:PDC m:type="Binary">fi653p3+MklA/LdoBlhWgnMTUUEo8tEgtbMXnF0a3CUNL9BZxXpSRiD9ebTnmNR0zWPjJVIDx4tdmCnq55XrJh+RW9aI/b34wAogK3kcORw=</d:PDC>
+    </m:properties>
+  </content>
+</entry>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/ProductDetails/6 1/entity.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/ProductDetails/6 1/entity.full.json b/fit/src/main/resources/v4/ProductDetails/6 1/entity.full.json
new file mode 100644
index 0000000..38e347f
--- /dev/null
+++ b/fit/src/main/resources/v4/ProductDetails/6 1/entity.full.json	
@@ -0,0 +1,19 @@
+{
+  "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#ProductDetails/$entity",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.ProductDetail",
+  "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)",
+  "@odata.editLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)",
+  "ProductID": 6,
+  "ProductDetailID": 1,
+  "ProductName": "Candy",
+  "Description": "sweet snack",
+  "RelatedProduct@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/RelatedProduct/$ref",
+  "RelatedProduct@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/RelatedProduct",
+  "Reviews@odata.associationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/Reviews/$ref",
+  "Reviews@odata.navigationLink": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/Reviews",
+  "#Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct":
+          {
+            "title": "Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct",
+            "target": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct"
+          }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/ProductDetails/6 1/entity.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/ProductDetails/6 1/entity.xml b/fit/src/main/resources/v4/ProductDetails/6 1/entity.xml
new file mode 100644
index 0000000..ae66ac8
--- /dev/null
+++ b/fit/src/main/resources/v4/ProductDetails/6 1/entity.xml	
@@ -0,0 +1,41 @@
+<?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://localhost:${cargo.servlet.port}/StaticService/V40/Static.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://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#ProductDetails/$entity">
+  <id>http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)</id>
+  <category term="#Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+  <link rel="edit" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/RelatedProduct" type="application/atom+xml;type=entry" title="RelatedProduct" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/RelatedProduct" />
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Reviews" type="application/atom+xml;type=feed" title="Reviews" href="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/ProductDetails(ProductID=6,ProductDetailID=1)/Reviews" />
+  <title />
+  <updated>2014-03-24T17:23:51Z</updated>
+  <author>
+    <name />
+  </author>
+  <content type="application/xml">
+    <m:properties>
+      <d:ProductID m:type="Int32">6</d:ProductID>
+      <d:ProductDetailID m:type="Int32">1</d:ProductDetailID>
+      <d:ProductName>Candy</d:ProductName>
+      <d:Description>sweet snack</d:Description>
+    </m:properties>
+  </content>
+</entry>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/badRequest.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/badRequest.json b/fit/src/main/resources/v4/badRequest.json
new file mode 100644
index 0000000..b6bc3ac
--- /dev/null
+++ b/fit/src/main/resources/v4/badRequest.json
@@ -0,0 +1,17 @@
+{
+  "odata.error":
+          {
+            "code": "",
+            "message":
+                    {
+                      "lang": "en-US",
+                      "value": "Bad request."
+                    },
+            "innererror":
+                    {
+                      "message": "Bad request.",
+                      "type": "Microsoft.Data.OData.BadRequest",
+                      "stacktrace": " at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings...."
+                    }
+          }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/badRequest.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/badRequest.xml b/fit/src/main/resources/v4/badRequest.xml
new file mode 100644
index 0000000..febd2fe
--- /dev/null
+++ b/fit/src/main/resources/v4/badRequest.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:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
+  <m:code />
+  <m:message xml:lang="en-US">Bad request.</m:message>
+  <m:innererror>
+    <m:message>Bad request.</m:message>
+    <m:type>Microsoft.Data.OData.BadRequest</m:type>
+    <m:stacktrace> at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings...</m:stacktrace>
+  </m:innererror>
+</m:error>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/notFound.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/notFound.json b/fit/src/main/resources/v4/notFound.json
new file mode 100644
index 0000000..fba2ac4
--- /dev/null
+++ b/fit/src/main/resources/v4/notFound.json
@@ -0,0 +1,11 @@
+{
+  "odata.error":
+          {
+            "code": "",
+            "message":
+                    {
+                      "lang": "en-US",
+                      "value": "Resource not found for the segment 'Customer'."
+                    }
+          }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/notFound.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/notFound.xml b/fit/src/main/resources/v4/notFound.xml
new file mode 100644
index 0000000..189d9ad
--- /dev/null
+++ b/fit/src/main/resources/v4/notFound.xml
@@ -0,0 +1,25 @@
+<?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:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
+  <m:code />
+  <m:message xml:lang="en-US">Resource not found for the segment 'Customer'.</m:message>
+</m:error>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json b/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json
new file mode 100644
index 0000000..e23e70c
--- /dev/null
+++ b/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json
@@ -0,0 +1,4 @@
+{
+  "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#$ref",
+  "@odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml b/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml
new file mode 100644
index 0000000..6d847fc
--- /dev/null
+++ b/fit/src/main/resources/v4/references/T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml
@@ -0,0 +1,22 @@
+<?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:ref m:context="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata#$ref" id="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/Customers(PersonID=1)" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" />
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/unsupportedMediaType.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/unsupportedMediaType.json b/fit/src/main/resources/v4/unsupportedMediaType.json
new file mode 100644
index 0000000..4dc5a1f
--- /dev/null
+++ b/fit/src/main/resources/v4/unsupportedMediaType.json
@@ -0,0 +1,17 @@
+{
+  "odata.error":
+          {
+            "code": "",
+            "message":
+                    {
+                      "lang": "en-US",
+                      "value": "Unsupported media type requested."
+                    },
+            "innererror":
+                    {
+                      "message": "Unsupported media type requested.",
+                      "type": "Microsoft.Data.OData.ODataContentTypeException",
+                      "stacktrace": " at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings(ODataMessageWriterSettings settings, ODataPayloadKind payloadKind, MediaTypeResolver mediaTypeResolver, MediaType&amp; mediaType, Encoding&amp; encoding)\n at Microsoft.Data.OData.ODataMessageWriter.EnsureODataFormatAndContentType()\n at Microsoft.Data.OData.ODataMessageWriter.SetHeaders(ODataPayloadKind payloadKind)\n at Microsoft.Data.OData.ODataUtils.SetHeadersForPayload(ODataMessageWriter messageWriter, ODataPayloadKind payloadKind)\n at System.Data.Services.ResponseContentTypeNegotiator.DetermineResponseFormat(ODataPayloadKind payloadKind, String acceptableMediaTypes, String acceptableCharSets)"
+                    }
+          }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/fit/src/main/resources/v4/unsupportedMediaType.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/unsupportedMediaType.xml b/fit/src/main/resources/v4/unsupportedMediaType.xml
new file mode 100644
index 0000000..c157fb1
--- /dev/null
+++ b/fit/src/main/resources/v4/unsupportedMediaType.xml
@@ -0,0 +1,34 @@
+<?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:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
+  <m:code />
+  <m:message xml:lang="en-US">Unsupported media type requested.</m:message>
+  <m:innererror>
+    <m:message>A supported MIME type could not be found that matches the acceptable MIME types for the request. The supported type(s) 'application/atom+xml;type=feed, application/atom+xml, application/json;odata=minimalmetadata;streaming=true, application/json;odata=minimalmetadata;streaming=false, application/json;odata=minimalmetadata, application/json;odata=fullmetadata;streaming=true, application/json;odata=fullmetadata;streaming=false, application/json;odata=fullmetadata, application/json;odata=nometadata;streaming=true, application/json;odata=nometadata;streaming=false, application/json;odata=nometadata, application/json;streaming=true, application/json;streaming=false, application/json;odata=verbose, application/json' do not match any of the acceptable MIME types 'application/xml'.</m:message>
+    <m:type>Microsoft.Data.OData.ODataContentTypeException</m:type>
+    <m:stacktrace> at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings(ODataMessageWriterSettings settings, ODataPayloadKind payloadKind, MediaTypeResolver mediaTypeResolver, MediaType&amp; mediaType, Encoding&amp; encoding)&#xD;
+      at Microsoft.Data.OData.ODataMessageWriter.EnsureODataFormatAndContentType()&#xD;
+      at Microsoft.Data.OData.ODataMessageWriter.SetHeaders(ODataPayloadKind payloadKind)&#xD;
+      at Microsoft.Data.OData.ODataUtils.SetHeadersForPayload(ODataMessageWriter messageWriter, ODataPayloadKind payloadKind)&#xD;
+      at System.Data.Services.ResponseContentTypeNegotiator.DetermineResponseFormat(ODataPayloadKind payloadKind, String acceptableMediaTypes, String acceptableCharSets)</m:stacktrace>
+  </m:innererror>
+</m:error>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/428277c2/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java
index b68cf3d..67b3043 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java
@@ -18,6 +18,11 @@
  */
 package org.apache.olingo.client.api.communication.header;
 
+import java.util.Arrays;
+import java.util.List;
+import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
 /**
  * Major OData request/response header names.
  */
@@ -26,7 +31,17 @@ public enum HeaderName {
   /**
    * The OData protocol uses the Accept request-header field, as specified in [RFC2616].
    */
-  accept("Accept"),
+  accept("Accept", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)),
+  /**
+   * As specified in [RFC2616], the client MAY specify the set of accepted character sets with the Accept-Charset
+   * header.
+   */
+  acceptCharset("Accept-Charset", Arrays.asList(ODataServiceVersion.V40)),
+  /**
+   * As specified in [RFC2616], the client MAY specify the set of accepted natural languages with the Accept-Language
+   * header.
+   */
+  acceptLanguage("Accept-Language", Arrays.asList(ODataServiceVersion.V40)),
   /**
    * The Content-Type header is used as specified in [RFC2616].
    * <br/>
@@ -44,76 +59,129 @@ public enum HeaderName {
    * <li>multipart/mixed</li>
    * </ul>
    */
-  contentType("Content-Type"),
+  contentType("Content-Type", Arrays.asList(ODataServiceVersion.V30)),
+  /**
+   * This header is a custom HTTP header defined for protocol versioning purposes. This header MAY be present on any
+   * request or response message.
+   */
+  dataServiceVersion("DataServiceVersion", Arrays.asList(ODataServiceVersion.V30)),
   /**
    * This header is a custom HTTP header defined for protocol versioning purposes. This header MAY be present on any
    * request or response message.
    */
-  dataServiceVersion("DataServiceVersion"),
+  odataVersion("OData-Version", Arrays.asList(ODataServiceVersion.V40)),
+  /**
+   * A response to a create operation that returns 204 No Content MUST include an OData-EntityId response header. The
+   * value of the header is the entity-id of the entity that was acted on by the request. The syntax of the
+   * OData-EntityId preference is specified in [OData-ABNF].
+   */
+  odataEntityId("OData-EntityId", Arrays.asList(ODataServiceVersion.V40)),
   /**
    * An ETag (entity tag) is an HTTP response header returned by an HTTP/1.1 compliant web server used to determine
    * change in content of a resource at a given URL. The value of the header is an opaque string representing the state
    * of the resource at the time the response was generated.
    */
-  etag("ETag"),
+  etag("ETag", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)),
   /**
    * The If-Match request-header field is used with a method to make it conditional. As specified in [RFC2616], "the
    * purpose of this feature is to allow efficient updates of cached information with a minimum amount of transaction
    * overhead. It is also used, on updating requests, to prevent inadvertent modification of the wrong version of a
    * resource".
    */
-  ifMatch("If-Match"),
+  ifMatch("If-Match", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)),
   /**
    * The If-None-Match request header is used with a method to make it conditional. As specified in [RFC2616], "The
    * purpose of this feature is to allow efficient updates of cached information with a minimum amount of transaction
    * overhead. It is also used to prevent a method (for example, PUT) from inadvertently modifying an existing resource
    * when the client believes that the resource does not exist."
    */
-  ifNoneMatch("If-None-Match"),
+  ifNoneMatch("If-None-Match", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)),
+  /**
+   * Clients SHOULD specify an OData-MaxVersion request header.
+   * <br />
+   * If specified the service MUST generate a response with an OData-Version less than or equal to the specified
+   * OData-MaxVersion.
+   * <br />
+   * If OData-MaxVersion is not specified, then the service SHOULD interpret the request as having an OData-MaxVersion
+   * equal to the maximum version supported by the service.
+   */
+  odataMaxVersion("OData-MaxVersion", Arrays.asList(ODataServiceVersion.V40)),
   /**
    * This header is a custom HTTP request only header defined for protocol versioning purposes. This header MAY be
    * present on any request message from client to server.
    */
-  maxDataServiceVersion("MaxDataServiceVersion"),
+  maxDataServiceVersion("MaxDataServiceVersion", Arrays.asList(ODataServiceVersion.V30)),
   /**
    * This header is a custom HTTP request only header defined for protocol versioning purposes. This header MAY be
    * present on any request message from client to server.
    */
-  minDataServiceVersion("MinDataServiceVersion"),
+  minDataServiceVersion("MinDataServiceVersion", Arrays.asList(ODataServiceVersion.V30)),
+  /**
+   * The OData-Isolation header specifies the isolation of the current request from external changes. The only supported
+   * value for this header is snapshot.
+   * <br />
+   * If the service doesn’t support OData-Isolation:snapshot and this header was specified on the request, the service
+   * MUST NOT process the request and MUST respond with 412 Precondition Failed.
+   * <br />
+   * Snapshot isolation guarantees that all data returned for a request, including multiple requests within a batch or
+   * results retrieved across multiple pages, will be consistent as of a single point in time. Only data modifications
+   * made within the request (for example, by a data modification request within the same batch) are visible. The effect
+   * is as if the request generates a "snapshot" of the committed data as it existed at the start of the request.
+   * <br />
+   * The OData-Isolation header may be specified on a single or batch request. If it is specified on a batch then the
+   * value is applied to all statements within the batch.
+   * <br />
+   * Next links returned within a snapshot return results within the same snapshot as the initial request; the client is
+   * not required to repeat the header on each individual page request.
+   * <br />
+   * The OData-Isolation header has no effect on links other than the next link. Navigation links, read links, and edit
+   * links return the current version of the data.
+   * <br />
+   * A service returns 410 Gone or 404 Not Found if a consumer tries to follow a next link referring to a snapshot that
+   * is no longer available.
+   * <br />
+   * The syntax of the OData-Isolation header is specified in [OData-ABNF].
+   * <br />
+   * A service MAY specify the support for OData-Isolation:snapshot using an annotation with term
+   * Capabilities.IsolationSupport, see [OData-VocCap].
+   */
+  odataIsolation("OData-Isolation", Arrays.asList(ODataServiceVersion.V40)),
   /**
    * A Prefer header is included in a request to state the client’s preferred, but not required, server behavior (that
    * is, a hint to the server). The Prefer header MAY be included on any request type (within a standalone or batch
    * request), and a server MAY honor the header for HTTP POST, PUT, PATCH, and MERGE requests. A Prefer header with a
    * value of “return-content” MUST NOT be specified on a DELETE request, a batch request as a whole, or a PUT request
    * to update a named stream.
+   *
+   * @see ODataPreferenceNames.
    */
-  prefer("Prefer"),
+  prefer("Prefer", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)),
   /**
    * When a Prefer header value is successfully honored by the server, it MAY include a Preference-Applied response
    * header that states which preference values were honored by the server.
    */
-  preferenceApplied("Preference-Applied"),
+  preferenceApplied("Preference-Applied", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)),
   /**
    * The DataServiceId response header is returned by the server when the response payload for an HTTP PUT, POST, PATCH,
    * or MERGE request is empty. The value of the header is the identifier of the entity that was acted on by the PUT,
    * POST, PATCH, or MERGE request. The identifier, in this case, is the same identifier that would have been returned
    * in the response payload (for example, as the value of the atom:id element for Atom responses)
    */
-  dataServiceId("DataServiceId"),
+  dataServiceId("DataServiceId", Arrays.asList(ODataServiceVersion.V30)),
   /**
    * Location header is used to specify the URL of an entity modified through a Data Modification request, or the
    * request URL to check on the status of an asynchronous operation as described in
    * <code>202 Accepted</code>.
    */
-  location("Location"),
+  location("Location", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)),
   /**
    * A service must include a
    * <code>Retry-After</code> header in a
    * <code>202 Accepted</code>.
    */
-  retryAfter("Retry-After"),
-  dataServiceUrlConventions("DataServiceUrlConventions"),
-  slug("Slug"),
+  retryAfter("Retry-After", Arrays.asList(ODataServiceVersion.V30, ODataServiceVersion.V40)),
+  dataServiceUrlConventions("DataServiceUrlConventions", Arrays.asList(ODataServiceVersion.V30)),
+  slug("Slug", Arrays.asList(ODataServiceVersion.V30)),
   /**
    * This header is a custom HTTP request header.
    * <br/>
@@ -132,12 +200,21 @@ public enum HeaderName {
    * <br/>
    * This header is only valid when on POST requests.
    */
-  xHttpMethod("X-HTTP-METHOD");
+  xHttpMethod("X-HTTP-METHOD", Arrays.asList(ODataServiceVersion.V30));
 
   private final String headerName;
 
-  private HeaderName(final String headerName) {
+  private final List<ODataServiceVersion> supportedVersions;
+
+  private HeaderName(final String headerName, final List<ODataServiceVersion> supportedVersions) {
     this.headerName = headerName;
+    this.supportedVersions = supportedVersions;
+  }
+
+  final void isSupportedBy(final ODataServiceVersion serviceVersion) {
+    if (!supportedVersions.contains(serviceVersion)) {
+      throw new ODataRuntimeException("Unsupported header " + this.toString());
+    }
   }
 
   @Override