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/05/12 12:47:57 UTC

[2/3] git commit: Various small improvements, added test for instance annotations

Various small improvements, added test for instance annotations


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

Branch: refs/heads/master
Commit: 8720a30e21948d0984339c8dc1ec8d8b89049621
Parents: c32f4a0
Author: Francesco Chicchiriccò <--global>
Authored: Mon May 12 12:41:25 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Mon May 12 12:41:25 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/olingo/fit/V4Services.java  |  11 +
 .../org/apache/olingo/fit/utils/DataBinder.java |   2 +
 .../main/resources/V40/Boss/entity.full.json    |  46 ++
 fit/src/main/resources/V40/Boss/entity.xml      |  51 ++
 fit/src/main/resources/V40/badRequest.json      |  25 +-
 fit/src/main/resources/V40/metadata.xml         | 523 ++++++++++---------
 fit/src/main/resources/V40/notFound.json        |  26 +-
 .../olingo/fit/v4/ErrorResponseTestITCase.java  |  65 +--
 .../olingo/fit/v4/MetadataTestITCase.java       |  36 +-
 .../olingo/fit/v4/SingletonTestITCase.java      |  37 +-
 .../core/edm/v4/annotation/EdmRecordImpl.java   |   8 +-
 .../client/core/op/impl/v4/ODataBinderImpl.java |  11 +-
 .../apache/olingo/commons/api/Constants.java    |   4 +-
 .../olingo/commons/api/domain/ODataError.java   |   7 +-
 .../commons/api/domain/ODataErrorDetail.java    |   4 +-
 .../core/data/AbstractJsonSerializer.java       |   2 +-
 .../commons/core/data/AbstractODataError.java   |  42 +-
 .../core/data/JSONODataErrorDeserializer.java   |  39 +-
 .../data/JSONODataErrorDetailDeserializer.java  |  56 +-
 .../core/data/JSONODataErrorDetailImpl.java     |  50 +-
 20 files changed, 589 insertions(+), 456 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/main/java/org/apache/olingo/fit/V4Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
index fb31f09..49b2e4c 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -346,6 +346,17 @@ public class V4Services extends AbstractServices {
   }
 
   @GET
+  @Path("/Boss")
+  public Response getSingletonBoss(
+          @Context UriInfo uriInfo,
+          @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+          @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+
+    return getEntityInternal(
+            uriInfo.getRequestUri().toASCIIString(), accept, "Boss", StringUtils.EMPTY, format, null, null, false);
+  }
+
+  @GET
   @Path("/Company")
   public Response getSingletonCompany(
           @Context UriInfo uriInfo,

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java b/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java
index bddb017..58e5772 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java
@@ -125,6 +125,8 @@ public class DataBinder {
       properties.add(toJSONProperty((AtomPropertyImpl) property));
     }
 
+    jsonEntity.getAnnotations().addAll(atomEntity.getAnnotations());
+    
     return jsonEntity;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/main/resources/V40/Boss/entity.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Boss/entity.full.json b/fit/src/main/resources/V40/Boss/entity.full.json
new file mode 100644
index 0000000..d89b4a5
--- /dev/null
+++ b/fit/src/main/resources/V40/Boss/entity.full.json
@@ -0,0 +1,46 @@
+{
+  "@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Boss",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
+  "@odata.id": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss",
+  "@odata.editLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer",
+  "@Microsoft.Test.OData.Services.ODataWCFService.IsBoss": true,
+  "PersonID": 2,
+  "FirstName": "Jill",
+  "LastName": "Jones",
+  "MiddleName": null,
+  "HomeAddress": null,
+  "Home@odata.type": "#GeographyPoint",
+  "Home": {
+    "type": "Point",
+    "coordinates": [161.8, 15.0],
+    "crs": {
+      "type": "name",
+      "properties": {
+        "name": "EPSG:4326"
+      }
+    }
+  },
+  "Numbers@odata.type": "#Collection(String)",
+  "Numbers": [],
+  "Emails@odata.type": "#Collection(String)",
+  "Emails": [],
+  "City": "Sydney",
+  "Birthday@odata.type": "#DateTimeOffset",
+  "Birthday": "1983-01-15T00:00:00Z",
+  "TimeBetweenLastTwoOrders@odata.type": "#Duration",
+  "TimeBetweenLastTwoOrders": "PT0.0000002S",
+  "Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref",
+  "Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent",
+  "Orders@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref",
+  "Orders@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders",
+  "Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref",
+  "Company@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company",
+  "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress": {
+    "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+    "target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/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}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/main/resources/V40/Boss/entity.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Boss/entity.xml b/fit/src/main/resources/V40/Boss/entity.xml
new file mode 100644
index 0000000..72ccb4c
--- /dev/null
+++ b/fit/src/main/resources/V40/Boss/entity.xml
@@ -0,0 +1,51 @@
+<?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 xmlns="http://www.w3.org/2005/Atom" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss">
+  <id>http://localhost:9080/stub/StaticService/V40/Static.svc/Boss</id>
+  <category scheme="http://docs.oasis-open.org/odata/ns/scheme" term="#Microsoft.Test.OData.Services.ODataWCFService.Customer"/>
+  <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Parent" title="Parent" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref" type="application/xml"/>
+  <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Orders" title="Orders" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref" type="application/xml"/>
+  <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Company" title="Company" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref" type="application/xml"/>
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" title="Parent" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent" type="application/atom+xml;type=entry"/>
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" title="Orders" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders" type="application/atom+xml;type=entry"/>
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Company" title="Company" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company" type="application/atom+xml;type=entry"/>
+  <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>161.8 15.0</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-15T01:00:00+01:00</d:Birthday>
+      <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
+    </m:properties>
+  </content>
+  <m:annotation term="Microsoft.Test.OData.Services.ODataWCFService.IsBoss" m:type="Boolean">true</m:annotation>
+</entry>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/main/resources/V40/badRequest.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/badRequest.json b/fit/src/main/resources/V40/badRequest.json
index fbc0c63..a7150b1 100644
--- a/fit/src/main/resources/V40/badRequest.json
+++ b/fit/src/main/resources/V40/badRequest.json
@@ -1,35 +1,24 @@
 {
-
   "error": {
-
     "code": "400",
-
     "message": "Bad request.",
-
     "target": "query",
-
     "details": [
-
       {
-
-       "code": "400",
-
-       "target": "$search" ,
-
-       "message": "Microsoft.Data.OData.BadRequest"
+        "code": "400",
+        "target": "$search",
+        "message": "Microsoft.Data.OData.BadRequest"
 
       }
 
     ],
-
     "innererror": {
-
-      "trace": ["at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings....","callmethod2 etc"],
-
-      "context": {"key1":"for debug deployment only"}
+      "trace": ["at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings....", "callmethod2 etc"],
+      "context": {
+        "key1": "for debug deployment only"
+      }
 
     }
 
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/main/resources/V40/metadata.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/metadata.xml b/fit/src/main/resources/V40/metadata.xml
index 5e7c9c6..4bb360c 100644
--- a/fit/src/main/resources/V40/metadata.xml
+++ b/fit/src/main/resources/V40/metadata.xml
@@ -22,418 +22,441 @@
 <edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
   <edmx:DataServices>
     <Schema Namespace="Microsoft.Test.OData.Services.ODataWCFService" xmlns="http://docs.oasis-open.org/odata/ns/edm">
+      <Term Name="IsBoss" Type="Edm.Boolean"/>
       <ComplexType Name="Address">
-        <Property Name="Street" Type="Edm.String" Nullable="false" />
-        <Property Name="City" Type="Edm.String" Nullable="false" />
-        <Property Name="PostalCode" Type="Edm.String" Nullable="false" />
+        <Property Name="Street" Type="Edm.String" Nullable="false"/>
+        <Property Name="City" Type="Edm.String" Nullable="false"/>
+        <Property Name="PostalCode" Type="Edm.String" Nullable="false"/>
       </ComplexType>
       <ComplexType Name="HomeAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
-        <Property Name="FamilyName" Type="Edm.String" />
+        <Property Name="FamilyName" Type="Edm.String"/>
       </ComplexType>
       <ComplexType Name="CompanyAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
-        <Property Name="CompanyName" Type="Edm.String" Nullable="false" />
-        <NavigationProperty Name="Contact" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="true" />
+        <Property Name="CompanyName" Type="Edm.String" Nullable="false"/>
       </ComplexType>
       <EnumType Name="AccessLevel" IsFlags="true">
-        <Member Name="None" Value="0" />
-        <Member Name="Read" Value="1" />
-        <Member Name="Write" Value="2" />
-        <Member Name="Execute" Value="4" />
-        <Member Name="ReadWrite" Value="3" />
+        <Member Name="None" Value="0"/>
+        <Member Name="Read" Value="1"/>
+        <Member Name="Write" Value="2"/>
+        <Member Name="Execute" Value="4"/>
+        <Member Name="ReadWrite" Value="3"/>
       </EnumType>
       <EnumType Name="Color">
-        <Member Name="Red" Value="1" />
-        <Member Name="Green" Value="2" />
-        <Member Name="Blue" Value="4" />
+        <Member Name="Red" Value="1"/>
+        <Member Name="Green" Value="2"/>
+        <Member Name="Blue" Value="4"/>
       </EnumType>
       <EnumType Name="CompanyCategory">
-        <Member Name="IT" Value="0" />
-        <Member Name="Communication" Value="1" />
-        <Member Name="Electronics" Value="2" />
-        <Member Name="Others" Value="4" />
+        <Member Name="IT" Value="0"/>
+        <Member Name="Communication" Value="1"/>
+        <Member Name="Electronics" Value="2"/>
+        <Member Name="Others" Value="4"/>
       </EnumType>
       <EntityType Name="Person">
         <Key>
-          <PropertyRef Name="PersonID" />
+          <PropertyRef Name="PersonID"/>
         </Key>
-        <Property Name="PersonID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="FirstName" Type="Edm.String" Nullable="false" />
-        <Property Name="LastName" Type="Edm.String" Nullable="false" />
-        <Property Name="MiddleName" Type="Edm.String" />
-        <Property Name="HomeAddress" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" />
-        <Property Name="Home" Type="Edm.GeographyPoint" SRID="4326" />
-        <Property Name="Numbers" Type="Collection(Edm.String)" Nullable="false" />
-        <Property Name="Emails" Type="Collection(Edm.String)" />
-        <NavigationProperty Name="Parent" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
+        <Property Name="PersonID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="FirstName" Type="Edm.String" Nullable="false"/>
+        <Property Name="LastName" Type="Edm.String" Nullable="false"/>
+        <Property Name="MiddleName" Type="Edm.String"/>
+        <Property Name="HomeAddress" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
+        <Property Name="Home" Type="Edm.GeographyPoint" SRID="4326"/>
+        <Property Name="Numbers" Type="Collection(Edm.String)" Nullable="false"/>
+        <Property Name="Emails" Type="Collection(Edm.String)"/>
+        <NavigationProperty Name="Parent" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
       </EntityType>
       <EntityType Name="Customer" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
-        <Property Name="City" Type="Edm.String" Nullable="false" />
-        <Property Name="Birthday" Type="Edm.DateTimeOffset" Nullable="false" />
-        <Property Name="TimeBetweenLastTwoOrders" Type="Edm.Duration" Nullable="false" />
-        <NavigationProperty Name="Orders" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Order)" />
-        <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="VipCustomer" />
+        <Property Name="City" Type="Edm.String" Nullable="false"/>
+        <Property Name="Birthday" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="TimeBetweenLastTwoOrders" Type="Edm.Duration" Nullable="false"/>
+        <NavigationProperty Name="Orders" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Order)"/>
+        <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="VipCustomer"/>
       </EntityType>
       <EntityType Name="Employee" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
-        <Property Name="DateHired" Type="Edm.DateTimeOffset" Nullable="false" />
-        <Property Name="Office" Type="Edm.GeographyPoint" SRID="4326" />
-        <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Employees" />
+        <Property Name="DateHired" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="Office" Type="Edm.GeographyPoint" SRID="4326"/>
+        <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Employees"/>
       </EntityType>
       <EntityType Name="Product">
         <Key>
-          <PropertyRef Name="ProductID" />
+          <PropertyRef Name="ProductID"/>
         </Key>
-        <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="Name" Type="Edm.String" Nullable="false" />
-        <Property Name="QuantityPerUnit" Type="Edm.String" Nullable="false" />
-        <Property Name="UnitPrice" Type="Edm.Single" Nullable="false" />
-        <Property Name="QuantityInStock" Type="Edm.Int32" Nullable="false" />
-        <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" />
-        <Property Name="UserAccess" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
-        <Property Name="SkinColor" Type="Microsoft.Test.OData.Services.ODataWCFService.Color" />
-        <Property Name="CoverColors" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" Nullable="false" />
+        <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String" Nullable="false"/>
+        <Property Name="QuantityPerUnit" Type="Edm.String" Nullable="false"/>
+        <Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
+        <Property Name="QuantityInStock" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false"/>
+        <Property Name="UserAccess" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
+        <Property Name="SkinColor" Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
+        <Property Name="CoverColors" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" Nullable="false"/>
         <NavigationProperty Name="Details" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)">
-          <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" />
+          <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
         </NavigationProperty>
       </EntityType>
       <EntityType Name="ProductDetail">
         <Key>
-          <PropertyRef Name="ProductID" />
-          <PropertyRef Name="ProductDetailID" />
+          <PropertyRef Name="ProductID"/>
+          <PropertyRef Name="ProductDetailID"/>
         </Key>
-        <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="ProductName" Type="Edm.String" Nullable="false" />
-        <Property Name="Description" Type="Edm.String" Nullable="false" />
-        <NavigationProperty Name="RelatedProduct" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" />
+        <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ProductName" Type="Edm.String" Nullable="false"/>
+        <Property Name="Description" Type="Edm.String" Nullable="false"/>
+        <NavigationProperty Name="RelatedProduct" Type="Microsoft.Test.OData.Services.ODataWCFService.Product"/>
         <NavigationProperty Name="Reviews" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductReview)">
-          <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" />
-          <ReferentialConstraint Property="ProductDetailID" ReferencedProperty="ProductDetailID" />
+          <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
+          <ReferentialConstraint Property="ProductDetailID" ReferencedProperty="ProductDetailID"/>
         </NavigationProperty>
       </EntityType>
       <EntityType Name="ProductReview">
         <Key>
-          <PropertyRef Name="ProductID" />
-          <PropertyRef Name="ProductDetailID" />
-          <PropertyRef Name="ReviewTitle" />
-          <PropertyRef Name="RevisionID" />
+          <PropertyRef Name="ProductID"/>
+          <PropertyRef Name="ProductDetailID"/>
+          <PropertyRef Name="ReviewTitle"/>
+          <PropertyRef Name="RevisionID"/>
         </Key>
-        <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="ReviewTitle" Type="Edm.String" Nullable="false" />
-        <Property Name="RevisionID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="Comment" Type="Edm.String" Nullable="false" />
-        <Property Name="Author" Type="Edm.String" Nullable="false" />
+        <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ReviewTitle" Type="Edm.String" Nullable="false"/>
+        <Property Name="RevisionID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Comment" Type="Edm.String" Nullable="false"/>
+        <Property Name="Author" Type="Edm.String" Nullable="false"/>
       </EntityType>
       <EntityType Name="Order">
         <Key>
-          <PropertyRef Name="OrderID" />
+          <PropertyRef Name="OrderID"/>
         </Key>
-        <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="OrderDate" Type="Edm.DateTimeOffset" Nullable="false" />
-        <Property Name="ShelfLife" Type="Edm.Duration" />
-        <Property Name="OrderShelfLifes" Type="Collection(Edm.Duration)" />
-        <NavigationProperty Name="LoggedInEmployee" Type="Microsoft.Test.OData.Services.ODataWCFService.Employee" Nullable="false" />
-        <NavigationProperty Name="CustomerForOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" />
-        <NavigationProperty Name="OrderDetails" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.OrderDetail)" />
+        <Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="OrderDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="ShelfLife" Type="Edm.Duration"/>
+        <Property Name="OrderShelfLifes" Type="Collection(Edm.Duration)"/>
+        <NavigationProperty Name="LoggedInEmployee" Type="Microsoft.Test.OData.Services.ODataWCFService.Employee" Nullable="false"/>
+        <NavigationProperty Name="CustomerForOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false"/>
+        <NavigationProperty Name="OrderDetails" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.OrderDetail)"/>
       </EntityType>
       <EntityType Name="OrderDetail">
         <Key>
-          <PropertyRef Name="OrderID" />
-          <PropertyRef Name="ProductID" />
+          <PropertyRef Name="OrderID"/>
+          <PropertyRef Name="ProductID"/>
         </Key>
-        <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="OrderPlaced" Type="Edm.DateTimeOffset" Nullable="false" />
-        <Property Name="Quantity" Type="Edm.Int32" Nullable="false" />
-        <Property Name="UnitPrice" Type="Edm.Single" Nullable="false" />
-        <NavigationProperty Name="ProductOrdered" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" />
-        <NavigationProperty Name="AssociatedOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Order" Nullable="false" />
+        <Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="OrderPlaced" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="Quantity" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
+        <NavigationProperty Name="ProductOrdered" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)"/>
+        <NavigationProperty Name="AssociatedOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Order" Nullable="false"/>
       </EntityType>
       <EntityType Name="Department">
         <Key>
-          <PropertyRef Name="DepartmentID" />
+          <PropertyRef Name="DepartmentID"/>
         </Key>
-        <Property Name="DepartmentID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="Name" Type="Edm.String" Nullable="false" />
-        <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Departments" />
+        <Property Name="DepartmentID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String" Nullable="false"/>
+        <Property Name="DepartmentNO" Type="Edm.String"/>
+        <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Departments"/>
       </EntityType>
-      <EntityType Name="Company">
+      <EntityType Name="Company" OpenType="true">
         <Key>
-          <PropertyRef Name="CompanyID" />
+          <PropertyRef Name="CompanyID"/>
         </Key>
-        <Property Name="CompanyID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="CompanyCategory" Type="Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory" />
-        <Property Name="Revenue" Type="Edm.Int64" Nullable="false" />
-        <Property Name="Name" Type="Edm.String" />
-        <Property Name="Address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" />
-        <NavigationProperty Name="Employees" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Employee)" Partner="Company" />
-        <NavigationProperty Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" Partner="Company" />
-        <NavigationProperty Name="Departments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Department)" Partner="Company" />
-        <NavigationProperty Name="CoreDepartment" Type="Microsoft.Test.OData.Services.ODataWCFService.Department" Nullable="false" />
+        <Property Name="CompanyID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="CompanyCategory" Type="Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory"/>
+        <Property Name="Revenue" Type="Edm.Int64" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String"/>
+        <Property Name="Address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
+        <NavigationProperty Name="Employees" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Employee)" Partner="Company"/>
+        <NavigationProperty Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" Partner="Company"/>
+        <NavigationProperty Name="Departments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Department)" Partner="Company"/>
+        <NavigationProperty Name="CoreDepartment" Type="Microsoft.Test.OData.Services.ODataWCFService.Department" Nullable="false"/>
       </EntityType>
-      <EntityType Name="PublicCompany" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Company">
-        <Property Name="StockExchange" Type="Edm.String" />
-        <NavigationProperty Name="Assets" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Asset)" ContainsTarget="true" />
-        <NavigationProperty Name="Club" Type="Microsoft.Test.OData.Services.ODataWCFService.Club" Nullable="false" ContainsTarget="true" />
-        <NavigationProperty Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" Nullable="false" />
+      <EntityType Name="PublicCompany" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Company" OpenType="true">
+        <Property Name="StockExchange" Type="Edm.String"/>
+        <NavigationProperty Name="Assets" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Asset)" ContainsTarget="true"/>
+        <NavigationProperty Name="Club" Type="Microsoft.Test.OData.Services.ODataWCFService.Club" Nullable="false" ContainsTarget="true"/>
+        <NavigationProperty Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" Nullable="false"/>
       </EntityType>
       <EntityType Name="Asset">
         <Key>
-          <PropertyRef Name="AssetID" />
+          <PropertyRef Name="AssetID"/>
         </Key>
-        <Property Name="AssetID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="Name" Type="Edm.String" />
-        <Property Name="Number" Type="Edm.Int32" Nullable="false" />
+        <Property Name="AssetID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String"/>
+        <Property Name="Number" Type="Edm.Int32" Nullable="false"/>
       </EntityType>
       <EntityType Name="Club">
         <Key>
-          <PropertyRef Name="ClubID" />
+          <PropertyRef Name="ClubID"/>
         </Key>
-        <Property Name="ClubID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="Name" Type="Edm.String" />
+        <Property Name="ClubID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String"/>
       </EntityType>
       <EntityType Name="LabourUnion">
         <Key>
-          <PropertyRef Name="LabourUnionID" />
+          <PropertyRef Name="LabourUnionID"/>
         </Key>
-        <Property Name="LabourUnionID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="Name" Type="Edm.String" />
+        <Property Name="LabourUnionID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String"/>
       </EntityType>
       <Action Name="AddAccessRight" IsBound="true">
-        <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" />
-        <Parameter Name="accessRight" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
+        <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
+        <Parameter Name="accessRight" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
       </Action>
       <Action Name="IncreaseRevenue" IsBound="true">
-        <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" />
-        <Parameter Name="IncreaseValue" Type="Edm.Int64" />
-        <ReturnType Type="Edm.Int64" Nullable="false" />
+        <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
+        <Parameter Name="IncreaseValue" Type="Edm.Int64"/>
+        <ReturnType Type="Edm.Int64" Nullable="false"/>
       </Action>
       <Action Name="ResetAddress" IsBound="true" EntitySetPath="person">
-        <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
-        <Parameter Name="addresses" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)" Nullable="false" />
-        <Parameter Name="index" Type="Edm.Int32" Nullable="false" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
+        <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+        <Parameter Name="addresses" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)" Nullable="false"/>
+        <Parameter Name="index" Type="Edm.Int32" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
       </Action>
       <Action Name="Discount" IsBound="true" EntitySetPath="products">
-        <Parameter Name="products" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" />
-        <Parameter Name="percentage" Type="Edm.Int32" Nullable="false" />
-        <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" />
+        <Parameter Name="products" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
+        <Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
+        <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
       </Action>
       <Action Name="Discount">
-        <Parameter Name="percentage" Type="Edm.Int32" Nullable="false" />
+        <Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
       </Action>
       <Action Name="ResetBossEmail">
-        <Parameter Name="emails" Type="Collection(Edm.String)" Nullable="false" />
-        <ReturnType Type="Collection(Edm.String)" Nullable="false" />
+        <Parameter Name="emails" Type="Collection(Edm.String)" Nullable="false"/>
+        <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
       </Action>
       <Action Name="ResetBossAddress">
-        <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" />
+        <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
       </Action>
+      <Action Name="ResetDataSource"/>
       <Function Name="GetEmployeesCount" IsBound="true">
-        <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" />
-        <ReturnType Type="Edm.Int32" Nullable="false" />
+        <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
+        <ReturnType Type="Edm.Int32" Nullable="false"/>
       </Function>
       <Function Name="GetProductDetails" IsBound="true" EntitySetPath="product/Details" IsComposable="true">
-        <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" />
-        <Parameter Name="count" Type="Edm.Int32" />
-        <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)" Nullable="false" />
+        <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
+        <Parameter Name="count" Type="Edm.Int32"/>
+        <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)" Nullable="false"/>
       </Function>
-      <Function Name="GetRelatedProduct" IsBound="true" EntitySetPath="productDetail/Products" IsComposable="true">
-        <Parameter Name="productDetail" Type="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" Nullable="false" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" />
+      <Function Name="GetRelatedProduct" IsBound="true" EntitySetPath="productDetail/RelatedProduct" IsComposable="true">
+        <Parameter Name="productDetail" Type="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
       </Function>
       <Function Name="GetDefaultColor" IsComposable="true">
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Color" />
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
       </Function>
       <Function Name="GetPerson" IsComposable="true">
-        <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
+        <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
       </Function>
       <Function Name="GetPerson2" IsComposable="true">
-        <Parameter Name="city" Type="Edm.String" Nullable="false" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
+        <Parameter Name="city" Type="Edm.String" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
       </Function>
       <Function Name="GetAllProducts" IsComposable="true">
-        <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" />
+        <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
       </Function>
       <Function Name="GetBossEmails">
-        <Parameter Name="start" Type="Edm.Int32" Nullable="false" />
-        <Parameter Name="count" Type="Edm.Int32" Nullable="false" />
-        <ReturnType Type="Collection(Edm.String)" Nullable="false" />
+        <Parameter Name="start" Type="Edm.Int32" Nullable="false"/>
+        <Parameter Name="count" Type="Edm.Int32" Nullable="false"/>
+        <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
       </Function>
       <Function Name="GetProductsByAccessLevel">
-        <Parameter Name="accessLevel" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
-        <ReturnType Type="Collection(Edm.String)" Nullable="false" />
+        <Parameter Name="accessLevel" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" Nullable="false"/>
+        <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
       </Function>
       <Function Name="GetActualAmount" IsBound="true">
-        <Parameter Name="giftcard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" Nullable="false" />
-        <Parameter Name="bonusRate" Type="Edm.Double" />
-        <ReturnType Type="Edm.Double" Nullable="false" />
+        <Parameter Name="giftcard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" Nullable="false"/>
+        <Parameter Name="bonusRate" Type="Edm.Double"/>
+        <ReturnType Type="Edm.Double" Nullable="false"/>
       </Function>
       <Function Name="GetDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
-        <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" />
+        <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
       </Function>
       <Action Name="RefreshDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
-        <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" />
-        <Parameter Name="newDate" Type="Edm.DateTimeOffset" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" />
+        <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
+        <Parameter Name="newDate" Type="Edm.DateTimeOffset"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
       </Action>
       <Function Name="GetHomeAddress" IsBound="true" IsComposable="true">
-        <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.HomeAddress" Nullable="false" />
+        <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.HomeAddress" Nullable="false"/>
       </Function>
       <Function Name="GetAccountInfo" IsBound="true" IsComposable="true">
-        <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" />
-        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" Nullable="false" />
+        <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" Nullable="false"/>
       </Function>
       <ComplexType Name="AccountInfo" OpenType="true">
-        <Property Name="FirstName" Type="Edm.String" Nullable="false" />
-        <Property Name="LastName" Type="Edm.String" Nullable="false" />
+        <Property Name="FirstName" Type="Edm.String" Nullable="false"/>
+        <Property Name="LastName" Type="Edm.String" Nullable="false"/>
       </ComplexType>
       <EntityType Name="Account">
         <Key>
-          <PropertyRef Name="AccountID" />
+          <PropertyRef Name="AccountID"/>
         </Key>
-        <Property Name="AccountID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="Country" Type="Edm.String" Nullable="false" />
-        <Property Name="AccountInfo" Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" />
-        <NavigationProperty Name="MyGiftCard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" ContainsTarget="true" />
-        <NavigationProperty Name="MyPaymentInstruments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument)" ContainsTarget="true" />
-        <NavigationProperty Name="ActiveSubscriptions" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" ContainsTarget="true" />
-        <NavigationProperty Name="AvailableSubscriptionTemplatess" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" />
+        <Property Name="AccountID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Country" Type="Edm.String" Nullable="false"/>
+        <Property Name="AccountInfo" Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo"/>
+        <NavigationProperty Name="MyGiftCard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" ContainsTarget="true"/>
+        <NavigationProperty Name="MyPaymentInstruments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument)" ContainsTarget="true"/>
+        <NavigationProperty Name="ActiveSubscriptions" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" ContainsTarget="true"/>
+        <NavigationProperty Name="AvailableSubscriptionTemplatess" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)"/>
       </EntityType>
       <EntityType Name="GiftCard">
         <Key>
-          <PropertyRef Name="GiftCardID" />
+          <PropertyRef Name="GiftCardID"/>
         </Key>
-        <Property Name="GiftCardID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="GiftCardNO" Type="Edm.String" Nullable="false" />
-        <Property Name="Amount" Type="Edm.Double" Nullable="false" />
-        <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false" />
+        <Property Name="GiftCardID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="GiftCardNO" Type="Edm.String" Nullable="false"/>
+        <Property Name="Amount" Type="Edm.Double" Nullable="false"/>
+        <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="OwnerName" Type="Edm.String"/>
       </EntityType>
       <EntityType Name="PaymentInstrument">
         <Key>
-          <PropertyRef Name="PaymentInstrumentID" />
+          <PropertyRef Name="PaymentInstrumentID"/>
         </Key>
-        <Property Name="PaymentInstrumentID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="FriendlyName" Type="Edm.String" Nullable="false" />
-        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
-        <NavigationProperty Name="TheStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false" />
-        <NavigationProperty Name="BillingStatements" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Statement)" ContainsTarget="true" />
-        <NavigationProperty Name="BackupStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false" />
+        <Property Name="PaymentInstrumentID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="FriendlyName" Type="Edm.String" Nullable="false"/>
+        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <NavigationProperty Name="TheStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
+        <NavigationProperty Name="BillingStatements" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Statement)" ContainsTarget="true"/>
+        <NavigationProperty Name="BackupStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
       </EntityType>
       <EntityType Name="CreditCardPI" BaseType="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument">
-        <Property Name="CardNumber" Type="Edm.String" Nullable="false" />
-        <Property Name="CVV" Type="Edm.String" Nullable="false" />
-        <Property Name="HolderName" Type="Edm.String" Nullable="false" />
-        <Property Name="Balance" Type="Edm.Double" Nullable="false" />
-        <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false" />
-        <NavigationProperty Name="CreditRecords" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.CreditRecord)" ContainsTarget="true" />
+        <Property Name="CardNumber" Type="Edm.String" Nullable="false"/>
+        <Property Name="CVV" Type="Edm.String" Nullable="false"/>
+        <Property Name="HolderName" Type="Edm.String" Nullable="false"/>
+        <Property Name="Balance" Type="Edm.Double" Nullable="false"/>
+        <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <NavigationProperty Name="CreditRecords" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.CreditRecord)" ContainsTarget="true"/>
       </EntityType>
       <EntityType Name="StoredPI">
         <Key>
-          <PropertyRef Name="StoredPIID" />
+          <PropertyRef Name="StoredPIID"/>
         </Key>
-        <Property Name="StoredPIID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="PIName" Type="Edm.String" Nullable="false" />
-        <Property Name="PIType" Type="Edm.String" Nullable="false" />
-        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
+        <Property Name="StoredPIID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="PIName" Type="Edm.String" Nullable="false"/>
+        <Property Name="PIType" Type="Edm.String" Nullable="false"/>
+        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
       </EntityType>
       <EntityType Name="Statement">
         <Key>
-          <PropertyRef Name="StatementID" />
+          <PropertyRef Name="StatementID"/>
         </Key>
-        <Property Name="StatementID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="TransactionType" Type="Edm.String" Nullable="false" />
-        <Property Name="TransactionDescription" Type="Edm.String" Nullable="false" />
-        <Property Name="Amount" Type="Edm.Double" Nullable="false" />
+        <Property Name="StatementID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="TransactionType" Type="Edm.String" Nullable="false"/>
+        <Property Name="TransactionDescription" Type="Edm.String" Nullable="false"/>
+        <Property Name="Amount" Type="Edm.Double" Nullable="false"/>
       </EntityType>
       <EntityType Name="CreditRecord">
         <Key>
-          <PropertyRef Name="CreditRecordID" />
+          <PropertyRef Name="CreditRecordID"/>
         </Key>
-        <Property Name="CreditRecordID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="IsGood" Type="Edm.Boolean" Nullable="false" />
-        <Property Name="Reason" Type="Edm.String" Nullable="false" />
-        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
+        <Property Name="CreditRecordID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="IsGood" Type="Edm.Boolean" Nullable="false"/>
+        <Property Name="Reason" Type="Edm.String" Nullable="false"/>
+        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
       </EntityType>
       <EntityType Name="Subscription">
         <Key>
-          <PropertyRef Name="SubscriptionID" />
+          <PropertyRef Name="SubscriptionID"/>
         </Key>
-        <Property Name="SubscriptionID" Type="Edm.Int32" Nullable="false" />
-        <Property Name="TemplateGuid" Type="Edm.String" Nullable="false" />
-        <Property Name="Title" Type="Edm.String" Nullable="false" />
-        <Property Name="Category" Type="Edm.String" Nullable="false" />
-        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
+        <Property Name="SubscriptionID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="TemplateGuid" Type="Edm.String" Nullable="false"/>
+        <Property Name="Title" Type="Edm.String" Nullable="false"/>
+        <Property Name="Category" Type="Edm.String" Nullable="false"/>
+        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
       </EntityType>
       <EntityContainer Name="InMemoryEntities">
         <EntitySet Name="People" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Person">
-          <NavigationPropertyBinding Path="Parent" Target="People" />
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
         </EntitySet>
-        <Singleton Name="Boss" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" />
+        <Singleton Name="Boss" Type="Microsoft.Test.OData.Services.ODataWCFService.Person">
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
+        </Singleton>
         <EntitySet Name="Customers" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Customer">
-          <NavigationPropertyBinding Path="Orders" Target="Orders" />
+          <NavigationPropertyBinding Path="Orders" Target="Orders"/>
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
         </EntitySet>
         <Singleton Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer">
-          <NavigationPropertyBinding Path="Orders" Target="Orders" />
-          <NavigationPropertyBinding Path="Company" Target="Company" />
+          <NavigationPropertyBinding Path="Orders" Target="Orders"/>
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
+          <NavigationPropertyBinding Path="Company" Target="Company"/>
         </Singleton>
         <EntitySet Name="Employees" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Employee">
-          <NavigationPropertyBinding Path="Company" Target="Company" />
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
+          <NavigationPropertyBinding Path="Company" Target="Company"/>
         </EntitySet>
         <EntitySet Name="Products" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Product">
-          <NavigationPropertyBinding Path="Details" Target="ProductDetails" />
+          <NavigationPropertyBinding Path="Details" Target="ProductDetails"/>
         </EntitySet>
         <EntitySet Name="ProductDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail">
-          <NavigationPropertyBinding Path="RelatedProduct" Target="Products" />
-          <NavigationPropertyBinding Path="Reviews" Target="ProductReviews" />
+          <NavigationPropertyBinding Path="RelatedProduct" Target="Products"/>
+          <NavigationPropertyBinding Path="Reviews" Target="ProductReviews"/>
         </EntitySet>
-        <EntitySet Name="ProductReviews" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductReview" />
+        <EntitySet Name="ProductReviews" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductReview"/>
         <EntitySet Name="Orders" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Order">
-          <NavigationPropertyBinding Path="LoggedInEmployee" Target="Employees" />
-          <NavigationPropertyBinding Path="CustomerForOrder" Target="Customers" />
-          <NavigationPropertyBinding Path="OrderDetails" Target="OrderDetails" />
+          <NavigationPropertyBinding Path="LoggedInEmployee" Target="Employees"/>
+          <NavigationPropertyBinding Path="CustomerForOrder" Target="Customers"/>
+          <NavigationPropertyBinding Path="OrderDetails" Target="OrderDetails"/>
+          <Annotation Term="Core.ChangeTracking">
+            <Record>
+              <PropertyValue Property="Supported" Bool="true"/>
+              <PropertyValue Property="FilterableProperties">
+                <Collection>
+                  <PropertyPath>OrderID</PropertyPath>
+                </Collection>
+              </PropertyValue>
+              <PropertyValue Property="ExpandableProperties">
+                <Collection>
+                  <PropertyPath>OrderDetails</PropertyPath>
+                </Collection>
+              </PropertyValue>
+            </Record>
+          </Annotation>
         </EntitySet>
         <EntitySet Name="OrderDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.OrderDetail">
-          <NavigationPropertyBinding Path="AssociatedOrder" Target="Orders" />
-          <NavigationPropertyBinding Path="ProductOrdered" Target="Products" />
+          <NavigationPropertyBinding Path="AssociatedOrder" Target="Orders"/>
+          <NavigationPropertyBinding Path="ProductOrdered" Target="Products"/>
         </EntitySet>
         <EntitySet Name="Departments" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Department">
-          <NavigationPropertyBinding Path="Company" Target="Company" />
+          <NavigationPropertyBinding Path="Company" Target="Company"/>
         </EntitySet>
         <Singleton Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
-          <NavigationPropertyBinding Path="Employees" Target="Employees" />
-          <NavigationPropertyBinding Path="VipCustomer" Target="VipCustomer" />
-          <NavigationPropertyBinding Path="Departments" Target="Departments" />
-          <NavigationPropertyBinding Path="CoreDepartment" Target="Departments" />
+          <NavigationPropertyBinding Path="Employees" Target="Employees"/>
+          <NavigationPropertyBinding Path="VipCustomer" Target="VipCustomer"/>
+          <NavigationPropertyBinding Path="Departments" Target="Departments"/>
+          <NavigationPropertyBinding Path="CoreDepartment" Target="Departments"/>
         </Singleton>
         <Singleton Name="PublicCompany" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
-          <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PublicCompany/LabourUnion" Target="LabourUnion" />
+          <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PublicCompany/LabourUnion" Target="LabourUnion"/>
         </Singleton>
-        <Singleton Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" />
-        <ActionImport Name="Discount" Action="Microsoft.Test.OData.Services.ODataWCFService.Discount" />
-        <ActionImport Name="ResetBossEmail" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossEmail" />
-        <ActionImport Name="ResetBossAddress" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossAddress" />
-        <FunctionImport Name="GetDefaultColor" Function="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultColor" />
-        <FunctionImport Name="GetPerson" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson" EntitySet="People" />
-        <FunctionImport Name="GetPerson2" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson2" EntitySet="People" />
-        <FunctionImport Name="GetAllProducts" Function="Microsoft.Test.OData.Services.ODataWCFService.GetAllProducts" EntitySet="Products" />
-        <FunctionImport Name="GetBossEmails" Function="Microsoft.Test.OData.Services.ODataWCFService.GetBossEmails" />
-        <FunctionImport Name="GetProductsByAccessLevel" Function="Microsoft.Test.OData.Services.ODataWCFService.GetProductsByAccessLevel" />
+        <Singleton Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion"/>
+        <ActionImport Name="Discount" Action="Microsoft.Test.OData.Services.ODataWCFService.Discount"/>
+        <ActionImport Name="ResetBossEmail" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossEmail"/>
+        <ActionImport Name="ResetBossAddress" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossAddress"/>
+        <ActionImport Name="ResetDataSource" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetDataSource"/>
+        <FunctionImport Name="GetDefaultColor" Function="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultColor" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetPerson" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson" EntitySet="People" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetPerson2" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson2" EntitySet="People" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetAllProducts" Function="Microsoft.Test.OData.Services.ODataWCFService.GetAllProducts" EntitySet="Products" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetBossEmails" Function="Microsoft.Test.OData.Services.ODataWCFService.GetBossEmails" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetProductsByAccessLevel" Function="Microsoft.Test.OData.Services.ODataWCFService.GetProductsByAccessLevel" IncludeInServiceDocument="true"/>
         <EntitySet Name="Accounts" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Account">
-          <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/TheStoredPI" Target="StoredPIs" />
-          <NavigationPropertyBinding Path="AvailableSubscriptionTemplatess" Target="SubscriptionTemplates" />
-          <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/BackupStoredPI" Target="DefaultStoredPI" />
+          <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/TheStoredPI" Target="StoredPIs"/>
+          <NavigationPropertyBinding Path="AvailableSubscriptionTemplatess" Target="SubscriptionTemplates"/>
+          <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/BackupStoredPI" Target="DefaultStoredPI"/>
         </EntitySet>
-        <EntitySet Name="StoredPIs" EntityType="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" />
-        <EntitySet Name="SubscriptionTemplates" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Subscription" />
-        <Singleton Name="DefaultStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" />
+        <EntitySet Name="StoredPIs" EntityType="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
+        <EntitySet Name="SubscriptionTemplates" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Subscription"/>
+        <Singleton Name="DefaultStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
       </EntityContainer>
     </Schema>
   </edmx:DataServices>
-</edmx:Edmx>
-
+</edmx:Edmx>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/main/resources/V40/notFound.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/notFound.json b/fit/src/main/resources/V40/notFound.json
index 2af4618..3f2d311 100644
--- a/fit/src/main/resources/V40/notFound.json
+++ b/fit/src/main/resources/V40/notFound.json
@@ -1,35 +1,23 @@
 {
-
   "error": {
-
     "code": "501",
-
     "message": "Unsupported functionality",
-
     "target": "query",
-
     "details": [
-
       {
-
-       "code": "301",
-
-       "target": "$search",
-
-       "message": "$search query option not supported"
+        "code": "301",
+        "target": "$search",
+        "message": "$search query option not supported"
 
       }
 
     ],
-
     "innererror": {
-
-      "trace": ["callmethod1 etc","callmethod2 etc"],
-
-      "context": {"key1":"for debug deployment only"}
+      "trace": ["callmethod1 etc", "callmethod2 etc"],
+      "context": {
+        "key1": "for debug deployment only"
+      }
 
     }
-
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java
index 7e576f0..a9530cc 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java
@@ -19,11 +19,10 @@
 package org.apache.olingo.fit.v4;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 import java.net.URI;
-import java.util.Dictionary;
-
+import java.util.Map;
 import org.apache.olingo.client.api.communication.ODataClientErrorException;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
 import org.apache.olingo.commons.api.domain.ODataError;
@@ -34,43 +33,33 @@ import org.junit.Test;
 
 public class ErrorResponseTestITCase extends AbstractTestITCase {
 
-	@Test
-	public void jsonError() {
-
-		ODataPubFormat format = ODataPubFormat.JSON;
-		final URI readURI = getClient().getURIBuilder(testStaticServiceRootURL)
-				.appendEntitySetSegment("Customers").appendKeySegment(32)
-				.build();
+  @Test
+  public void jsonError() {
+    final URI readURI = getClient().getURIBuilder(testStaticServiceRootURL).
+            appendEntitySetSegment("Customers").appendKeySegment(32).
+            build();
 
-		final ODataEntityRequest<ODataEntity> req = getClient()
-				.getRetrieveRequestFactory().getEntityRequest(readURI);
-		try {
-			final ODataEntity read = read(format, readURI);
-		} catch (Exception ex) {
-			ODataError err = ((ODataClientErrorException) ex).getODataError();
+    final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(readURI);
+    try {
+      final ODataEntity read = read(ODataPubFormat.JSON, readURI);
 
-			// verify details
-			ODataErrorDetail detail = (ODataErrorDetail) err.getDetails()
-					.get(0);
-			assertEquals("Code should be correct", "301", detail.getCode());
-			assertEquals("Target should be correct", "$search",
-					detail.getTarget());
-			assertEquals("Message should be correct",
-					"$search query option not supported", detail.getMessage());
+      fail("should have got exception");
+    } catch (Exception ex) {
+      final ODataError err = ((ODataClientErrorException) ex).getODataError();
 
-			// verify inner error dictionary
-			Dictionary<String, Object> innerErr = err.getInnerError();
-			assertEquals("innerError dictionary size should be correct", 2,
-					innerErr.size());
-			assertEquals("innerError['context'] should be correct",
-					"{\"key1\":\"for debug deployment only\"}",
-					innerErr.get("context"));
-			assertEquals("innerError['trace'] should be correct",
-					"[\"callmethod1 etc\",\"callmethod2 etc\"]",
-					innerErr.get("trace"));
-			return;
-		}
+      // verify details
+      final ODataErrorDetail detail = (ODataErrorDetail) err.getDetails().get(0);
+      assertEquals("Code should be correct", "301", detail.getCode());
+      assertEquals("Target should be correct", "$search", detail.getTarget());
+      assertEquals("Message should be correct", "$search query option not supported", detail.getMessage());
 
-		assertNotNull("should have got exception", null);
-	}
+      // verify inner error dictionary
+      final Map<String, String> innerErr = err.getInnerError();
+      assertEquals("innerError dictionary size should be correct", 2, innerErr.size());
+      assertEquals("innerError['context'] should be correct",
+              "{\"key1\":\"for debug deployment only\"}", innerErr.get("context"));
+      assertEquals("innerError['trace'] should be correct",
+              "[\"callmethod1 etc\",\"callmethod2 etc\"]", innerErr.get("trace"));
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
index 4a21437..6db1804 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
@@ -20,6 +20,7 @@ package org.apache.olingo.fit.v4;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import org.apache.olingo.commons.api.edm.Edm;
@@ -28,35 +29,56 @@ import org.apache.olingo.commons.api.edm.EdmEntityContainer;
 import org.apache.olingo.commons.api.edm.EdmEntitySet;
 import org.apache.olingo.commons.api.edm.EdmEntityType;
 import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmSchema;
 import org.apache.olingo.commons.api.edm.EdmTerm;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
 import org.apache.olingo.commons.core.edm.primitivetype.EdmBoolean;
 import org.junit.Test;
 
 public class MetadataTestITCase extends AbstractTestITCase {
 
   @Test
-  public void retrieve() {
-    final Edm metadata = client.getRetrieveRequestFactory().
-            getMetadataRequest(testStaticServiceRootURL).execute().getBody();
-    assertNotNull(metadata);
+  public void retrieve() throws EdmPrimitiveTypeException {
+    final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testStaticServiceRootURL).execute().getBody();
+    assertNotNull(edm);
 
-    final EdmEntityType order = metadata.getEntityType(
+    final EdmEntityType order = edm.getEntityType(
             new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order"));
     assertNotNull(order);
 
     final EdmProperty orderDate = order.getStructuralProperty("OrderDate");
     assertNotNull(orderDate);
     assertEquals("Edm.DateTimeOffset", orderDate.getType().getFullQualifiedName().toString());
+
+    final EdmTerm isBoss = edm.getTerm(new FullQualifiedName(edm.getSchemas().get(0).getNamespace(), "IsBoss"));
+    assertNotNull(isBoss);
+    assertEquals(EdmBoolean.getInstance(), isBoss.getType());
+
+    final EdmEntitySet orders = edm.getSchemas().get(0).getEntityContainer().getEntitySet("Orders");
+    assertNotNull(orders);
+    assertFalse(orders.getAnnotations().isEmpty());
+    assertTrue(orders.getAnnotations().get(0).getExpression().isDynamic());
+    assertTrue(orders.getAnnotations().get(0).getExpression().asDynamic().isRecord());
+    final EdmRecord record = orders.getAnnotations().get(0).getExpression().asDynamic().asRecord();
+    assertNotNull(record);
+    assertEquals(3, record.getPropertyValues().size());
+    assertTrue(record.getPropertyValues().get(0).getValue().isConstant());
+    assertTrue(record.getPropertyValues().get(0).getValue().asConstant().getValue().asPrimitive().
+            toCastValue(Boolean.class));
+    assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().isCollection());
+    assertEquals(1, record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().size());
+    assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().get(0).isDynamic());
+    assertEquals("OrderID", record.getPropertyValues().get(1).getValue().asDynamic().asCollection().
+            getItems().get(0).asDynamic().asPropertyPath().getValue());
   }
 
   @Test
   public void include() {
-    final Edm edm = client.getRetrieveRequestFactory().
-            getMetadataRequest(testNorthwindRootURL).execute().getBody();
+    final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testNorthwindRootURL).execute().getBody();
     assertNotNull(edm);
 
     final EdmEntityContainer container = edm.getEntityContainer(

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java
index 4d2df42..64e7f71 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java
@@ -20,6 +20,7 @@ package org.apache.olingo.fit.v4;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.net.URI;
@@ -29,6 +30,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
 import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
 import org.apache.olingo.client.api.uri.v4.URIBuilder;
 import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataValuable;
 import org.apache.olingo.commons.api.domain.v4.Singleton;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -55,12 +57,12 @@ public class SingletonTestITCase extends AbstractTestITCase {
   }
 
   @Test
-  public void readfromAtom() throws EdmPrimitiveTypeException {
+  public void readFromAtom() throws EdmPrimitiveTypeException {
     read(client, ODataPubFormat.ATOM);
   }
 
   @Test
-  public void readfromJSON() throws EdmPrimitiveTypeException {
+  public void readFromJSON() throws EdmPrimitiveTypeException {
     read(edmClient, ODataPubFormat.JSON);
   }
 
@@ -69,6 +71,37 @@ public class SingletonTestITCase extends AbstractTestITCase {
     read(client, ODataPubFormat.JSON_FULL_METADATA);
   }
 
+  private void readWithAnnotations(final ODataClient client, final ODataPubFormat format) 
+          throws EdmPrimitiveTypeException {
+    
+    final URIBuilder builder = client.getURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Boss");    
+    final ODataEntityRequest<Singleton> singleton =
+            client.getRetrieveRequestFactory().getSingletonRequest(builder.build());
+    singleton.setFormat(format);
+    singleton.setPrefer(client.newPreferences().includeAnnotations("*"));
+    final Singleton boss = singleton.execute().getBody();
+    assertNotNull(boss);
+
+    assertFalse(boss.getAnnotations().isEmpty());
+    final ODataAnnotation isBoss = boss.getAnnotations().get(0);
+    assertTrue(isBoss.getPrimitiveValue().toCastValue(Boolean.class));
+  }
+
+  @Test
+  public void readWithAnnotationsFromAtom() throws EdmPrimitiveTypeException {
+    readWithAnnotations(client, ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void readWithAnnotationsFromJSON() throws EdmPrimitiveTypeException {
+    readWithAnnotations(edmClient, ODataPubFormat.JSON);
+  }
+
+  @Test
+  public void readWithAnnotationsFromJSONFull() throws EdmPrimitiveTypeException {
+    readWithAnnotations(client, ODataPubFormat.JSON_FULL_METADATA);
+  }
+
   private void update(final ODataPubFormat format) throws EdmPrimitiveTypeException {
     final Singleton changes = getClient().getObjectFactory().newSingleton(
             new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"));

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/annotation/EdmRecordImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/annotation/EdmRecordImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/annotation/EdmRecordImpl.java
index 270cf87..e01f7b0 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/annotation/EdmRecordImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/annotation/EdmRecordImpl.java
@@ -32,14 +32,16 @@ public class EdmRecordImpl extends AbstractEdmAnnotatableDynamicAnnotationExpres
 
   private final List<EdmPropertyValue> propertyValues;
 
-  private final EdmStructuredType type;
+  private EdmStructuredType type;
 
   public EdmRecordImpl(final Edm edm, final String type, final List<EdmPropertyValue> propertyValues) {
     this.edm = edm;
     this.propertyValues = propertyValues;
 
-    final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(type).build();
-    this.type = typeInfo.getEntityType() == null ? typeInfo.getComplexType() : typeInfo.getEntityType();
+    if (type != null) {
+      final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(type).build();
+      this.type = typeInfo.getEntityType() == null ? typeInfo.getComplexType() : typeInfo.getEntityType();
+    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index a4a38ea..0527951 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -145,6 +145,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
       final Annotation annotation = new AnnotationImpl();
 
       annotation.setTerm(odataAnnotation.getTerm());
+      annotation.setType(odataAnnotation.getValue().getTypeName());
       updateValuable(annotation, odataAnnotation, reference);
 
       annotatable.getAnnotations().add(annotation);
@@ -230,8 +231,16 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
         }
       }
 
+      if (fqn == null && annotation.getType() != null) {
+        final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(annotation.getType()).build();
+        if (typeInfo.isPrimitiveType()) {
+          fqn = typeInfo.getPrimitiveTypeKind().getFullQualifiedName();
+        }
+      }
+      
       final ODataAnnotation odataAnnotation = new ODataAnnotationImpl(annotation.getTerm(),
               (org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(fqn, annotation, null, null));
+      odataAnnotatable.getAnnotations().add(odataAnnotation);
     }
   }
 
@@ -278,7 +287,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
 
     final ODataProperty property = new ODataPropertyImpl(resource.getPayload().getName(),
             getODataValue(typeInfo == null ? null : typeInfo.getFullQualifiedName(),
-            resource.getPayload(), resource.getContextURL(), resource.getMetadataETag()));
+                    resource.getPayload(), resource.getContextURL(), resource.getMetadataETag()));
     odataAnnotations(resource.getPayload(), property);
 
     return property;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/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 a9e0b06..2edab5e 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
@@ -246,8 +246,8 @@ public interface Constants {
   public static final String ERROR_TARGET = "target";
 
   public static final String ERROR_DETAILS = "details";
-  
-  public static final String ERROR_INNERERROR= "innererror";
+
+  public static final String ERROR_INNERERROR = "innererror";
 
   // canonical functions to be applied via dynamic annotation <tt>Apply</tt>
   public static final String CANONICAL_FUNCTION_CONCAT = "odata.concat";

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/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 f899d9a..1d2b83e 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
@@ -18,8 +18,8 @@
  */
 package org.apache.olingo.commons.api.domain;
 
-import java.util.Dictionary;
 import java.util.List;
+import java.util.Map;
 
 /**
  * OData error.
@@ -46,7 +46,6 @@ public interface ODataError {
    * @return error message.
    */
   String getTarget();
-  
 
   /**
    * Gets error details.
@@ -58,7 +57,7 @@ public interface ODataError {
   /**
    * Gets server defined key-value pairs for debug environment only.
    *
-   * @return a Dictionary representing server defined object.
+   * @return a pair representing server defined object.
    */
-  Dictionary<String, Object> getInnerError();
+  Map<String, String> getInnerError();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataErrorDetail.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataErrorDetail.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataErrorDetail.java
index 462e91e..48985e5 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataErrorDetail.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataErrorDetail.java
@@ -19,9 +19,9 @@
 package org.apache.olingo.commons.api.domain;
 
 /**
- * OData details, for example - { "error": {..., "details":[
+ * OData details, for example <tt>{ "error": {..., "details":[
  * {"code": "301","target": "$search" ,"message": "$search query option not supported"}
- * ],...}}
+ * ],...}}</tt>.
  */
 public interface ODataErrorDetail {
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
index 2401a09..bb115cf 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
@@ -209,7 +209,7 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
   }
 
   protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name) throws IOException {
-    if (serverMode && !Constants.VALUE.equals(name)) {
+    if (serverMode && !Constants.VALUE.equals(name) && !(valuable instanceof Annotation)) {
       String type = valuable.getType();
       if (StringUtils.isBlank(type) && valuable.getValue().isPrimitive() || valuable.getValue().isNull()) {
         type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8720a30e/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
index 62cbebf..1e9cf51 100644
--- 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
@@ -18,30 +18,22 @@
  */
 package org.apache.olingo.commons.core.data;
 
-import java.util.Dictionary;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.olingo.commons.api.domain.ODataError;
 import org.apache.olingo.commons.api.domain.ODataErrorDetail;
 
-//  {
-//	  "error": {
-//	    "code": "501",
-//	    "message": "Unsupported functionality",
-//	    "target": "query",
-//	    "details": [
-//	      {
-//	       "code": "301",
-//	       "target": "$search",
-//	       "message": "$search query option not supported"
-//	      }
-//	    ],
-//	    "innererror": {
-//	      "trace": [...],
-//	      "context": {...}
-//	    }
-//	  }
-//	}
+/**
+ * Example:
+ * <tt>
+ * {
+ * "error": { "code": "501", "message": "Unsupported functionality", "target": "query", "details": [ { "code": "301",
+ * "target": "$search", "message": "$search query option not supported" } ], "innererror": { "trace": [...], "context":
+ * {...} } } }
+ * </tt>.
+ */
 public abstract class AbstractODataError implements ODataError {
 
   private String code;
@@ -51,9 +43,9 @@ public abstract class AbstractODataError implements ODataError {
   private String target;
 
   private List<ODataErrorDetail> details;
-  
-  private Dictionary<String,Object> innerError;
-  
+
+  private Map<String, String> innerError = new LinkedHashMap<String, String>();
+
   @Override
   public String getCode() {
     return code;
@@ -91,11 +83,7 @@ public abstract class AbstractODataError implements ODataError {
   }
 
   @Override
-  public Dictionary<String,Object> getInnerError() {
+  public Map<String, String> getInnerError() {
     return innerError;
   }
-
-  public void setInnerError(final Dictionary<String,Object> innerError) {
-    this.innerError = innerError;
-  }
 }