You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/10/08 16:36:35 UTC

[1/3] Enhance Media Resource Handling

Updated Branches:
  refs/heads/master e8a7d7c96 -> 7327a0b41


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/MetadataTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/MetadataTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/MetadataTest.java
index c472ef0..1a8c3b3 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/MetadataTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/MetadataTest.java
@@ -67,60 +67,60 @@ public class MetadataTest extends AbstractRefXmlTest {
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and " +
-        "@m:HasStream='true']/edm:Key/edm:PropertyRef[@Name='EmployeeId']",
+            "@m:HasStream='true']/edm:Key/edm:PropertyRef[@Name='EmployeeId']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and" +
-        " @m:HasStream='true']/edm:Property[@Name='EmployeeId' and @Type='Edm.String' and @Nullable='false']",
+            " @m:HasStream='true']/edm:Property[@Name='EmployeeId' and @Type='Edm.String' and @Nullable='false']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and" +
-        " @m:HasStream='true']/edm:Property[@Name='EmployeeName' and @Type='Edm.String' and " +
-        "@m:FC_TargetPath='SyndicationTitle']",
+            " @m:HasStream='true']/edm:Property[@Name='EmployeeName' and @Type='Edm.String' and " +
+            "@m:FC_TargetPath='SyndicationTitle']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and " +
-        "@m:HasStream='true']/edm:Property[@Name='ManagerId' and @Type='Edm.String']",
+            "@m:HasStream='true']/edm:Property[@Name='ManagerId' and @Type='Edm.String']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and " +
-        "@m:HasStream='true']/edm:Property[@Name='RoomId' and @Type='Edm.String']",
+            "@m:HasStream='true']/edm:Property[@Name='RoomId' and @Type='Edm.String']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and " +
-        "@m:HasStream='true']/edm:Property[@Name='TeamId' and @Type='Edm.String' and @MaxLength='2']",
+            "@m:HasStream='true']/edm:Property[@Name='TeamId' and @Type='Edm.String' and @MaxLength='2']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and" +
-        " @m:HasStream='true']/edm:Property[@Name='Location' and @Type='RefScenario.c_Location']",
+            " @m:HasStream='true']/edm:Property[@Name='Location' and @Type='RefScenario.c_Location']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and " +
-        "@m:HasStream='true']/edm:Property[@Name='Age' and @Type='Edm.Int16']",
+            "@m:HasStream='true']/edm:Property[@Name='Age' and @Type='Edm.Int16']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and " +
-        "@m:HasStream='true']/edm:Property[@Name='EntryDate' and @Type='Edm.DateTime' and " +
-        "@Nullable='true' and @m:FC_TargetPath='SyndicationUpdated']",
+            "@m:HasStream='true']/edm:Property[@Name='EntryDate' and @Type='Edm.DateTime' and " +
+            "@Nullable='true' and @m:FC_TargetPath='SyndicationUpdated']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and " +
-        "@m:HasStream='true']/edm:Property[@Name='ImageUrl' and @Type='Edm.String']",
+            "@m:HasStream='true']/edm:Property[@Name='ImageUrl' and @Type='Edm.String']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and" +
-        " @m:HasStream='true']/edm:NavigationProperty[@Name='ne_Manager' and " +
-        "@Relationship='RefScenario.ManagerEmployees' and @FromRole='r_Employees' and @ToRole='r_Manager']",
+            " @m:HasStream='true']/edm:NavigationProperty[@Name='ne_Manager' and " +
+            "@Relationship='RefScenario.ManagerEmployees' and @FromRole='r_Employees' and @ToRole='r_Manager']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and" +
-        " @m:HasStream='true']/edm:NavigationProperty[@Name='ne_Team' and " +
-        "@Relationship='RefScenario.TeamEmployees' and @FromRole='r_Employees' and @ToRole='r_Team']",
+            " @m:HasStream='true']/edm:NavigationProperty[@Name='ne_Team' and " +
+            "@Relationship='RefScenario.TeamEmployees' and @FromRole='r_Employees' and @ToRole='r_Team']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Employee' and " +
-        "@m:HasStream='true']/edm:NavigationProperty[@Name='ne_Room' and " +
-        "@Relationship='RefScenario.RoomEmployees' and @FromRole='r_Employees' and @ToRole='r_Room']",
+            "@m:HasStream='true']/edm:NavigationProperty[@Name='ne_Room' and " +
+            "@Relationship='RefScenario.RoomEmployees' and @FromRole='r_Employees' and @ToRole='r_Room']",
         payload);
 
     // Team
@@ -128,13 +128,15 @@ public class MetadataTest extends AbstractRefXmlTest {
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Team' and @BaseType='RefScenario.Base']",
         payload);
     assertXpathExists(
-        "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Team' and " +
-        "@BaseType='RefScenario.Base']/edm:Property[@Name='isScrumTeam' and @Type='Edm.Boolean' and @Nullable='true']",
+        "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Team' and "
+            +
+            "@BaseType='RefScenario.Base']/edm:Property[@Name='isScrumTeam' and " +
+            "@Type='Edm.Boolean' and @Nullable='true']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Team' and " +
-        "@BaseType='RefScenario.Base']/edm:NavigationProperty[@Name='nt_Employees' and " +
-        "@Relationship='RefScenario.TeamEmployees' and @FromRole='r_Team' and @ToRole='r_Employees']",
+            "@BaseType='RefScenario.Base']/edm:NavigationProperty[@Name='nt_Employees' and " +
+            "@Relationship='RefScenario.TeamEmployees' and @FromRole='r_Team' and @ToRole='r_Employees']",
         payload);
 
     // Room
@@ -143,33 +145,35 @@ public class MetadataTest extends AbstractRefXmlTest {
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Room' and " +
-        "@BaseType='RefScenario.Base']/edm:Property[@Name='Seats' and @Type='Edm.Int16']",
+            "@BaseType='RefScenario.Base']/edm:Property[@Name='Seats' and @Type='Edm.Int16']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Room' and " +
-        "@BaseType='RefScenario.Base']/edm:Property[@Name='Version' and @Type='Edm.Int16' and " +
-        "@ConcurrencyMode='Fixed']",
+            "@BaseType='RefScenario.Base']/edm:Property[@Name='Version' and @Type='Edm.Int16' and " +
+            "@ConcurrencyMode='Fixed']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Room' and" +
-        " @BaseType='RefScenario.Base']/edm:NavigationProperty[@Name='nr_Employees' and " +
-        "@Relationship='RefScenario.RoomEmployees' and @FromRole='r_Room' and @ToRole='r_Employees']",
+            " @BaseType='RefScenario.Base']/edm:NavigationProperty[@Name='nr_Employees' and " +
+            "@Relationship='RefScenario.RoomEmployees' and @FromRole='r_Room' and @ToRole='r_Employees']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Room' and " +
-        "@BaseType='RefScenario.Base']/edm:NavigationProperty[@Name='nr_Building' and " +
-        "@Relationship='RefScenario.BuildingRooms' and @FromRole='r_Room' and @ToRole='r_Building']",
+            "@BaseType='RefScenario.Base']/edm:NavigationProperty[@Name='nr_Building' and " +
+            "@Relationship='RefScenario.BuildingRooms' and @FromRole='r_Room' and @ToRole='r_Building']",
         payload);
 
     // Manager
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Manager' and " +
-        "@BaseType='RefScenario.Employee' and @m:HasStream='true']",
+            "@BaseType='RefScenario.Employee' and @m:HasStream='true']",
         payload);
     assertXpathExists(
-        "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Manager' and " +
-        "@BaseType='RefScenario.Employee' and @m:HasStream='true']/edm:NavigationProperty[@Name='nm_Employees' and " +
-        "@Relationship='RefScenario.ManagerEmployees' and @FromRole='r_Manager' and @ToRole='r_Employees']",
+        "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Manager' and "
+            +
+            "@BaseType='RefScenario.Employee' and @m:HasStream='true']/edm:NavigationProperty[@Name='nm_Employees' and "
+            +
+            "@Relationship='RefScenario.ManagerEmployees' and @FromRole='r_Manager' and @ToRole='r_Employees']",
         payload);
 
     // Building
@@ -180,20 +184,20 @@ public class MetadataTest extends AbstractRefXmlTest {
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Building']/edm:Property[@Name='Id' and " +
-        "@Type='Edm.String' and @Nullable='false']",
+            "@Type='Edm.String' and @Nullable='false']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Building']/edm:Property[@Name='Name' and " +
-        "@Type='Edm.String' and @m:FC_TargetPath='SyndicationAuthorName']",
+            "@Type='Edm.String' and @m:FC_TargetPath='SyndicationAuthorName']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Building']/edm:Property[@Name='Image' and " +
-        "@Type='Edm.Binary']",
+            "@Type='Edm.Binary']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Building']/edm:NavigationProperty" +
-        "[@Name='nb_Rooms' and @Relationship='RefScenario.BuildingRooms' and @FromRole='r_Building' and " +
-        "@ToRole='r_Room']",
+            "[@Name='nb_Rooms' and @Relationship='RefScenario.BuildingRooms' and @FromRole='r_Building' and " +
+            "@ToRole='r_Room']",
         payload);
 
     // Base
@@ -203,15 +207,15 @@ public class MetadataTest extends AbstractRefXmlTest {
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Base' and @Abstract='true']/edm:Key", payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Base' and @Abstract='true']" +
-        "/edm:Key/edm:PropertyRef[@Name='Id']",
+            "/edm:Key/edm:PropertyRef[@Name='Id']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Base' and @Abstract='true']" +
-        "/edm:Property[@Name='Id' and @Type='Edm.String' and @Nullable='false' and @DefaultValue='1']",
+            "/edm:Property[@Name='Id' and @Type='Edm.String' and @Nullable='false' and @DefaultValue='1']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityType[@Name='Base' and @Abstract='true']" +
-        "/edm:Property[@Name='Name' and @Type='Edm.String' and @m:FC_TargetPath='SyndicationTitle']",
+            "/edm:Property[@Name='Name' and @Type='Edm.String' and @m:FC_TargetPath='SyndicationTitle']",
         payload);
   }
 
@@ -221,22 +225,22 @@ public class MetadataTest extends AbstractRefXmlTest {
     assertXpathExists("/edmx:Edmx/edmx:DataServices/edm:Schema/edm:ComplexType[@Name='c_Location']", payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:ComplexType[@Name='c_Location']/edm:Property[@Name='City' and " +
-        "@Type='RefScenario.c_City']",
+            "@Type='RefScenario.c_City']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:ComplexType[@Name='c_Location']/edm:Property[@Name='Country' " +
-        "and @Type='Edm.String']",
+            "and @Type='Edm.String']",
         payload);
 
     // Location
     assertXpathExists("/edmx:Edmx/edmx:DataServices/edm:Schema/edm:ComplexType[@Name='c_City']", payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:ComplexType[@Name='c_City']/edm:Property[@Name='PostalCode' " +
-        "and @Type='Edm.String']",
+            "and @Type='Edm.String']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:ComplexType[@Name='c_City']/edm:Property[@Name='CityName' " +
-        "and @Type='Edm.String']",
+            "and @Type='Edm.String']",
         payload);
   }
 
@@ -246,44 +250,44 @@ public class MetadataTest extends AbstractRefXmlTest {
     assertXpathExists("/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='ManagerEmployees']", payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='ManagerEmployees']" +
-        "/edm:End[@Type='RefScenario.Employee' and @Multiplicity='*' and @Role='r_Employees']",
+            "/edm:End[@Type='RefScenario.Employee' and @Multiplicity='*' and @Role='r_Employees']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='ManagerEmployees']" +
-        "/edm:End[@Type='RefScenario.Manager' and @Multiplicity='1' and @Role='r_Manager']",
+            "/edm:End[@Type='RefScenario.Manager' and @Multiplicity='1' and @Role='r_Manager']",
         payload);
 
     // TeamEmployees
     assertXpathExists("/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='TeamEmployees']", payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='TeamEmployees']" +
-        "/edm:End[@Type='RefScenario.Employee' and @Multiplicity='*' and @Role='r_Employees']",
+            "/edm:End[@Type='RefScenario.Employee' and @Multiplicity='*' and @Role='r_Employees']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='TeamEmployees']" +
-        "/edm:End[@Type='RefScenario.Team' and @Multiplicity='1' and @Role='r_Team']",
+            "/edm:End[@Type='RefScenario.Team' and @Multiplicity='1' and @Role='r_Team']",
         payload);
 
     // RoomEmployees
     assertXpathExists("/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='RoomEmployees']", payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='RoomEmployees']" +
-        "/edm:End[@Type='RefScenario.Employee' and @Multiplicity='*' and @Role='r_Employees']",
+            "/edm:End[@Type='RefScenario.Employee' and @Multiplicity='*' and @Role='r_Employees']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='RoomEmployees']" +
-        "/edm:End[@Type='RefScenario.Room' and @Multiplicity='1' and @Role='r_Room']",
+            "/edm:End[@Type='RefScenario.Room' and @Multiplicity='1' and @Role='r_Room']",
         payload);
 
     // BuildingRooms
     assertXpathExists("/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='BuildingRooms']", payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='BuildingRooms']" +
-        "/edm:End[@Type='RefScenario.Building' and @Multiplicity='1' and @Role='r_Building']",
+            "/edm:End[@Type='RefScenario.Building' and @Multiplicity='1' and @Role='r_Building']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:Association[@Name='BuildingRooms']" +
-        "/edm:End[@Type='RefScenario.Room' and @Multiplicity='*' and @Role='r_Room']",
+            "/edm:End[@Type='RefScenario.Room' and @Multiplicity='*' and @Role='r_Room']",
         payload);
   }
 
@@ -291,143 +295,147 @@ public class MetadataTest extends AbstractRefXmlTest {
   public void testEntityContainer() throws Exception {
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']",
+            "@m:IsDefaultEntityContainer='true']",
         payload);
 
     // EntitySets
     assertXpathExists(
-        "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Employees' and @EntityType='RefScenario.Employee']",
+        "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and "
+            +
+            "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Employees' and " +
+            "@EntityType='RefScenario.Employee']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Teams' and @EntityType='RefScenario.Team']",
+            "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Teams' and @EntityType='RefScenario.Team']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Rooms' and @EntityType='RefScenario.Room']",
+            "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Rooms' and @EntityType='RefScenario.Room']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Managers' and @EntityType='RefScenario.Manager']",
+            "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Managers' and @EntityType='RefScenario.Manager']",
         payload);
     assertXpathExists(
-        "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Buildings' and @EntityType='RefScenario.Building']",
+        "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and "
+            +
+            "@m:IsDefaultEntityContainer='true']/edm:EntitySet[@Name='Buildings' and " +
+            "@EntityType='RefScenario.Building']",
         payload);
 
     // AssociationSets
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='ManagerEmployees' and " +
-        "@Association='RefScenario.ManagerEmployees']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='ManagerEmployees' and " +
+            "@Association='RefScenario.ManagerEmployees']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='ManagerEmployees' and " +
-        "@Association='RefScenario.ManagerEmployees']/edm:End[@EntitySet='Managers' and @Role='r_Manager']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='ManagerEmployees' and " +
+            "@Association='RefScenario.ManagerEmployees']/edm:End[@EntitySet='Managers' and @Role='r_Manager']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='ManagerEmployees' and " +
-        "@Association='RefScenario.ManagerEmployees']/edm:End[@EntitySet='Employees' and @Role='r_Employees']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='ManagerEmployees' and " +
+            "@Association='RefScenario.ManagerEmployees']/edm:End[@EntitySet='Employees' and @Role='r_Employees']",
         payload);
 
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='TeamEmployees' and " +
-        "@Association='RefScenario.TeamEmployees']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='TeamEmployees' and " +
+            "@Association='RefScenario.TeamEmployees']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='TeamEmployees' and " +
-        "@Association='RefScenario.TeamEmployees']/edm:End[@EntitySet='Teams' and @Role='r_Team']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='TeamEmployees' and " +
+            "@Association='RefScenario.TeamEmployees']/edm:End[@EntitySet='Teams' and @Role='r_Team']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='TeamEmployees' and " +
-        "@Association='RefScenario.TeamEmployees']/edm:End[@EntitySet='Employees' and @Role='r_Employees']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='TeamEmployees' and " +
+            "@Association='RefScenario.TeamEmployees']/edm:End[@EntitySet='Employees' and @Role='r_Employees']",
         payload);
 
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='RoomEmployees' and " +
-        "@Association='RefScenario.RoomEmployees']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='RoomEmployees' and " +
+            "@Association='RefScenario.RoomEmployees']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='RoomEmployees' and " +
-        "@Association='RefScenario.RoomEmployees']/edm:End[@EntitySet='Rooms' and @Role='r_Room']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='RoomEmployees' and " +
+            "@Association='RefScenario.RoomEmployees']/edm:End[@EntitySet='Rooms' and @Role='r_Room']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='RoomEmployees' and " +
-        "@Association='RefScenario.RoomEmployees']/edm:End[@EntitySet='Employees' and @Role='r_Employees']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='RoomEmployees' and " +
+            "@Association='RefScenario.RoomEmployees']/edm:End[@EntitySet='Employees' and @Role='r_Employees']",
         payload);
 
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='BuildingRooms' and " +
-        "@Association='RefScenario.BuildingRooms']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='BuildingRooms' and " +
+            "@Association='RefScenario.BuildingRooms']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='BuildingRooms' and " +
-        "@Association='RefScenario.BuildingRooms']/edm:End[@EntitySet='Buildings' and @Role='r_Building']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='BuildingRooms' and " +
+            "@Association='RefScenario.BuildingRooms']/edm:End[@EntitySet='Buildings' and @Role='r_Building']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='BuildingRooms' and " +
-        "@Association='RefScenario.BuildingRooms']/edm:End[@EntitySet='Rooms' and @Role='r_Room']",
+            "@m:IsDefaultEntityContainer='true']/edm:AssociationSet[@Name='BuildingRooms' and " +
+            "@Association='RefScenario.BuildingRooms']/edm:End[@EntitySet='Rooms' and @Role='r_Room']",
         payload);
 
     // FunctionImports
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='EmployeeSearch' and " +
-        "@ReturnType='Collection(RefScenario.Employee)' and @m:HttpMethod='GET' and @EntitySet='Employees']",
+            "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='EmployeeSearch' and " +
+            "@ReturnType='Collection(RefScenario.Employee)' and @m:HttpMethod='GET' and @EntitySet='Employees']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='EmployeeSearch' and " +
-        "@ReturnType='Collection(RefScenario.Employee)' and @m:HttpMethod='GET' and " +
-        "@EntitySet='Employees']/edm:Parameter[@Name='q' and @Type='Edm.String' and @Nullable='true']",
+            "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='EmployeeSearch' and " +
+            "@ReturnType='Collection(RefScenario.Employee)' and @m:HttpMethod='GET' and " +
+            "@EntitySet='Employees']/edm:Parameter[@Name='q' and @Type='Edm.String' and @Nullable='true']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='AllLocations' and " +
-        "@ReturnType='Collection(RefScenario.c_Location)' and @m:HttpMethod='GET']",
+            "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='AllLocations' and " +
+            "@ReturnType='Collection(RefScenario.c_Location)' and @m:HttpMethod='GET']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='AllUsedRoomIds' and " +
-        "@ReturnType='Collection(Edm.String)' and @m:HttpMethod='GET']",
+            "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='AllUsedRoomIds' and " +
+            "@ReturnType='Collection(Edm.String)' and @m:HttpMethod='GET']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='MaximalAge' and " +
-        "@ReturnType='Edm.Int16' and @m:HttpMethod='GET']",
+            "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='MaximalAge' and " +
+            "@ReturnType='Edm.Int16' and @m:HttpMethod='GET']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='MostCommonLocation' " +
-        "and @ReturnType='RefScenario.c_Location' and @m:HttpMethod='GET']",
+            "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='MostCommonLocation' " +
+            "and @ReturnType='RefScenario.c_Location' and @m:HttpMethod='GET']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='ManagerPhoto' and " +
-        "@ReturnType='Edm.Binary' and @m:HttpMethod='GET']",
+            "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='ManagerPhoto' and " +
+            "@ReturnType='Edm.Binary' and @m:HttpMethod='GET']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='ManagerPhoto' and " +
-        "@ReturnType='Edm.Binary' and @m:HttpMethod='GET']/edm:Parameter[@Name='Id' and @Type='Edm.String' and " +
-        "@Nullable='false']",
+            "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='ManagerPhoto' and " +
+            "@ReturnType='Edm.Binary' and @m:HttpMethod='GET']/edm:Parameter[@Name='Id' and @Type='Edm.String' and " +
+            "@Nullable='false']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema/edm:EntityContainer[@Name='Container1' and " +
-        "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='OldestEmployee' and " +
-        "@ReturnType='RefScenario.Employee' and @m:HttpMethod='GET' and @EntitySet='Employees']",
+            "@m:IsDefaultEntityContainer='true']/edm:FunctionImport[@Name='OldestEmployee' and " +
+            "@ReturnType='RefScenario.Employee' and @m:HttpMethod='GET' and @EntitySet='Employees']",
         payload);
   }
 
@@ -437,53 +445,57 @@ public class MetadataTest extends AbstractRefXmlTest {
     // EntityType
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']" +
-        "/edm:EntityType[@Name='Photo' and @m:HasStream='true']",
+            "/edm:EntityType[@Name='Photo' and @m:HasStream='true']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']" +
-        "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Key",
+            "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Key",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']" +
-        "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Key/edm:PropertyRef[@Name='Id']",
+            "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Key/edm:PropertyRef[@Name='Id']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']" +
-        "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Key/edm:PropertyRef[@Name='Type']",
+            "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Key/edm:PropertyRef[@Name='Type']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']" +
-        "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Property[@Name='Id' and @Type='Edm.Int32' and " +
-        "@Nullable='false' and @ConcurrencyMode='Fixed']",
+            "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Property[@Name='Id' and @Type='Edm.Int32' and "
+            +
+            "@Nullable='false' and @ConcurrencyMode='Fixed']",
         payload);
     assertXpathExists(
-        "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']" +
-        "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Property[@Name='Name' and @Type='Edm.String' and " +
-        "@m:FC_TargetPath='SyndicationTitle']",
+        "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']"
+            +
+            "/edm:EntityType[@Name='Photo' and @m:HasStream='true']/edm:Property" +
+            "[@Name='Name' and @Type='Edm.String' and "
+            +
+            "@m:FC_TargetPath='SyndicationTitle']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']/edm:EntityType[@Name='Photo' and " +
-        "@m:HasStream='true']/edm:Property[@Name='Type' and @Type='Edm.String' and @Nullable='false']",
+            "@m:HasStream='true']/edm:Property[@Name='Type' and @Type='Edm.String' and @Nullable='false']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']/edm:EntityType[@Name='Photo' and " +
-        "@m:HasStream='true']/edm:Property[@Name='ImageUrl' and @Type='Edm.String' and " +
-        "@m:FC_TargetPath='SyndicationAuthorUri']",
+            "@m:HasStream='true']/edm:Property[@Name='ImageUrl' and @Type='Edm.String' and " +
+            "@m:FC_TargetPath='SyndicationAuthorUri']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']/edm:EntityType[@Name='Photo' and " +
-        "@m:HasStream='true']/edm:Property[@Name='Image' and @Type='Edm.Binary']",
+            "@m:HasStream='true']/edm:Property[@Name='Image' and @Type='Edm.Binary']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']/edm:EntityType[@Name='Photo' and " +
-        "@m:HasStream='true']/edm:Property[@Name='BinaryData' and @Type='Edm.Binary' and @Nullable='true' and " +
-        "@m:MimeType='image/jpeg']",
+            "@m:HasStream='true']/edm:Property[@Name='BinaryData' and @Type='Edm.Binary' and @Nullable='true' and " +
+            "@m:MimeType='image/jpeg']",
         payload);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']/edm:EntityType[@Name='Photo' and " +
-        "@m:HasStream='true']/edm:Property[@Name='Содержание' and @Type='Edm.String' and @Nullable='true' and " +
-        "@m:FC_KeepInContent='false' and @m:FC_NsPrefix='ру' and @m:FC_NsUri='http://localhost' and " +
-        "@m:FC_TargetPath='Содержание']",
+            "@m:HasStream='true']/edm:Property[@Name='Содержание' and @Type='Edm.String' and @Nullable='true' and " +
+            "@m:FC_KeepInContent='false' and @m:FC_NsPrefix='ру' and @m:FC_NsUri='http://localhost' and " +
+            "@m:FC_TargetPath='Содержание']",
         payload);
 
     // EntityContainer
@@ -491,8 +503,10 @@ public class MetadataTest extends AbstractRefXmlTest {
         "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']/edm:EntityContainer[@Name='Container2']",
         payload);
     assertXpathExists(
-        "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']" +
-        "/edm:EntityContainer[@Name='Container2']/edm:EntitySet[@Name='Photos' and @EntityType='RefScenario2.Photo']",
+        "/edmx:Edmx/edmx:DataServices/edm:Schema[@Namespace='RefScenario2']"
+            +
+            "/edm:EntityContainer[@Name='Container2']/edm:EntitySet[@Name='Photos' and " +
+            "@EntityType='RefScenario2.Photo']",
         payload);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
index 686f63e..371d0f2 100644
--- a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
+++ b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
@@ -196,6 +196,7 @@ public class ListsProcessor extends ODataSingleProcessor {
       values.add(getStructuralTypeValueMap(entryData, entityType));
     }
 
+    String mediaTypeKey = entityType.getMapping() == null ? null : entityType.getMapping().getMimeType();
     final EntityProviderWriteProperties feedProperties = EntityProviderWriteProperties
         .serviceRoot(context.getPathInfo().getServiceRoot())
         .inlineCountType(inlineCountType)
@@ -203,6 +204,7 @@ public class ListsProcessor extends ODataSingleProcessor {
         .expandSelectTree(UriParser.createExpandSelectTree(uriInfo.getSelect(), uriInfo.getExpand()))
         .callbacks(getCallbacks(data, entityType))
         .nextLink(nextLink)
+        .mediaResourceTypeKey(mediaTypeKey)
         .build();
 
     final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "writeFeed");
@@ -828,8 +830,14 @@ public class ListsProcessor extends ODataSingleProcessor {
     }
 
     ODataContext context = getContext();
+    String mediaTypeKey = null;
+    if (type instanceof EdmStructuralType) {
+      EdmStructuralType structType = (EdmStructuralType) type;
+      mediaTypeKey = structType.getMapping() == null ? null : structType.getMapping().getMimeType();
+
+    }
     final EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties
-        .serviceRoot(context.getPathInfo().getServiceRoot()).build();
+        .serviceRoot(context.getPathInfo().getServiceRoot()).mediaResourceTypeKey(mediaTypeKey).build();
 
     final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "writeFunctionImport");
 
@@ -938,7 +946,7 @@ public class ListsProcessor extends ODataSingleProcessor {
     return eTag == null ? null : "W/\"" + eTag + "\"";
   }
 
-  private <T> Map<String, ODataCallback> getCallbacks(final T data, final EdmEntityType entityType) 
+  private <T> Map<String, ODataCallback> getCallbacks(final T data, final EdmEntityType entityType)
       throws EdmException {
     final List<String> navigationPropertyNames = entityType.getNavigationPropertyNames();
     if (navigationPropertyNames.isEmpty()) {
@@ -978,10 +986,12 @@ public class ListsProcessor extends ODataSingleProcessor {
         }
         WriteFeedCallbackResult result = new WriteFeedCallbackResult();
         result.setFeedData(values);
+        String mimeTypeKey =
+            entityType.getMapping() == null ? null : entityType.getMapping().getMimeType();
         EntityProviderWriteProperties inlineProperties =
             EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).callbacks(
                 getCallbacks(relatedData, entityType)).expandSelectTree(context.getCurrentExpandSelectTreeNode())
-                .selfLink(context.getSelfLink()).build();
+                .selfLink(context.getSelfLink()).mediaResourceTypeKey(mimeTypeKey).build();
         result.setInlineProperties(inlineProperties);
         return result;
       } catch (final ODataException e) {
@@ -1003,9 +1013,12 @@ public class ListsProcessor extends ODataSingleProcessor {
           relatedData = null;
         }
         result.setEntryData(getStructuralTypeValueMap(relatedData, entityType));
+        String mimeTypeKey =
+            entityType.getMapping() == null ? null : entityType.getMapping().getMimeType();
         EntityProviderWriteProperties inlineProperties =
             EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).callbacks(
                 getCallbacks(relatedData, entityType)).expandSelectTree(context.getCurrentExpandSelectTreeNode())
+                .mediaResourceTypeKey(mimeTypeKey)
                 .build();
         result.setInlineProperties(inlineProperties);
         return result;
@@ -1048,10 +1061,13 @@ public class ListsProcessor extends ODataSingleProcessor {
     final Map<String, Object> values = getStructuralTypeValueMap(data, entityType);
 
     ODataContext context = getContext();
+    String mimeTypeKey =
+        entitySet.getEntityType().getMapping() == null ? null : entitySet.getEntityType().getMapping().getMimeType();
     EntityProviderWriteProperties writeProperties = EntityProviderWriteProperties
         .serviceRoot(context.getPathInfo().getServiceRoot())
         .expandSelectTree(expandSelectTree)
         .callbacks(getCallbacks(data, entityType))
+        .mediaResourceTypeKey(mimeTypeKey)
         .build();
 
     final int timingHandle = context.startRuntimeMeasurement("EntityProvider", "writeEntry");


[3/3] git commit: Enhance Media Resource Handling

Posted by ch...@apache.org.
Enhance Media Resource Handling

Made it possible to specifiy external resources as well as mime types per
enitity


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/7327a0b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/7327a0b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/7327a0b4

Branch: refs/heads/master
Commit: 7327a0b41acb2c230296697e108b64e819883d10
Parents: e8a7d7c
Author: Christian Amend <ch...@apache.org>
Authored: Tue Oct 8 16:32:31 2013 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Tue Oct 8 16:32:31 2013 +0200

----------------------------------------------------------------------
 .../api/ep/EntityProviderWriteProperties.java   |  36 ++-
 .../olingo/odata2/core/ODataRequestHandler.java |   4 +-
 .../odata2/core/ep/AtomEntityProvider.java      |   2 +-
 .../odata2/core/ep/JsonEntityProvider.java      |   2 +-
 .../ep/aggregator/EntityInfoAggregator.java     |   2 +-
 .../consumer/AtomServiceDocumentConsumer.java   |  16 +-
 .../core/ep/consumer/XmlEntryConsumer.java      |   4 +-
 .../core/ep/consumer/XmlMetadataConsumer.java   |   4 +-
 .../odata2/core/ep/entry/ODataEntryImpl.java    |   2 +-
 .../ep/producer/AtomEntryEntityProducer.java    |  74 ++++--
 .../ep/producer/JsonEntryEntityProducer.java    | 239 ++++++++++-------
 .../ep/producer/JsonPropertyEntityProducer.java |   2 +-
 .../core/ep/producer/XmlMetadataProducer.java   |   4 +-
 .../olingo/odata2/core/ep/util/JsonUtils.java   |   2 +-
 .../core/uri/ExpandSelectTreeCreator.java       |   2 +-
 .../core/uri/expression/FilterParserImpl.java   |   4 +-
 .../odata2/core/uri/expression/JsonVisitor.java |   2 +-
 .../odata2/core/uri/expression/Tokenizer.java   |   2 +-
 .../odata2/core/edm/EdmSimpleTypeTest.java      |  45 ++--
 .../edm/provider/EdmEntityTypeImplProvTest.java |   2 +
 .../EdmServiceMetadataImplProvTest.java         |  14 +-
 .../odata2/core/ep/AbstractProviderTest.java    |   6 +-
 .../odata2/core/ep/BasicProviderTest.java       |  14 +-
 .../core/ep/consumer/JsonFeedConsumerTest.java  |  10 +-
 .../ep/consumer/JsonPropertyConsumerTest.java   |  16 +-
 .../core/ep/consumer/XmlEntityConsumerTest.java |   4 +-
 .../core/ep/producer/AtomEntryProducerTest.java |  92 +++++++
 .../producer/JsonEntryEntityProducerTest.java   | 237 +++++++++++++----
 .../ep/producer/JsonFunctionImportTest.java     |   2 +-
 .../core/exception/MessageServiceTest.java      |   4 +-
 .../exception/ODataMessageTextVerifierTest.java |   4 +-
 .../uri/ExpandSelectTreeCreatorImplTest.java    |  50 ++--
 .../uri/expression/TestAbapCompatibility.java   |   4 +-
 .../uri/expression/TestParserExceptions.java    |  42 +--
 .../odata2/core/uri/expression/VisitorTool.java |   2 +-
 .../odata2/fit/basic/AcceptHeaderTypeTest.java  |   2 +-
 .../olingo/odata2/fit/basic/BasicBatchTest.java |   2 +-
 .../odata2/fit/basic/ServiceResolutionTest.java |   4 +-
 .../olingo/odata2/fit/mapping/MapProcessor.java |   2 +-
 .../olingo/odata2/fit/ref/AbstractRefTest.java  |   2 +-
 .../odata2/fit/ref/EntryJsonReadOnlyTest.java   |   4 +-
 .../odata2/fit/ref/EntryXmlReadOnlyTest.java    |  18 +-
 .../odata2/fit/ref/FeedJsonReadOnlyTest.java    |   2 +-
 .../odata2/fit/ref/FeedXmlReadOnlyTest.java     |   8 +-
 .../olingo/odata2/fit/ref/MetadataTest.java     | 264 ++++++++++---------
 .../odata2/ref/processor/ListsProcessor.java    |  22 +-
 46 files changed, 826 insertions(+), 455 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java
index 1b5a25c..99f9bc1 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderWriteProperties.java
@@ -41,6 +41,8 @@ public class EntityProviderWriteProperties {
   private ExpandSelectTreeNode expandSelectTree;
   private Map<String, ODataCallback> callbacks = Collections.emptyMap();
   private URI selfLink;
+  private String mediaResourceSourceKey;
+  private String mediaResourceTypeKey;
 
   private EntityProviderWriteProperties() {}
 
@@ -104,6 +106,22 @@ public class EntityProviderWriteProperties {
   public final String getNextLink() {
     return nextLink;
   }
+  
+  /**
+   * Gets the key under which the resource source value can be found in the data map.
+   * @return the key of the media resource source
+   */
+  public final String getMediaResourceSourceKey() {
+    return mediaResourceSourceKey;
+  }
+  
+  /**
+   * Gets the key under which the resource mime type can be found in the data map.
+   * @return the key of the media resource type
+   */
+  public final String getMediaResourceTypeKey() {
+    return mediaResourceTypeKey;
+  }
 
   public static ODataEntityProviderPropertiesBuilder serviceRoot(final URI serviceRoot) {
     return new ODataEntityProviderPropertiesBuilder().serviceRoot(serviceRoot);
@@ -111,6 +129,7 @@ public class EntityProviderWriteProperties {
 
   public static class ODataEntityProviderPropertiesBuilder {
     private final EntityProviderWriteProperties properties = new EntityProviderWriteProperties();
+    
 
     /**
      * @param mediaResourceMimeType the mediaResourceMimeType to set
@@ -119,6 +138,22 @@ public class EntityProviderWriteProperties {
       properties.mediaResourceMimeType = mediaResourceMimeType;
       return this;
     }
+    
+    /**
+     * @param mediaResourceSourceKey the mediaResourceSourceKey to set
+     */
+    public final ODataEntityProviderPropertiesBuilder mediaResourceSourceKey(final String mediaResourceSourceKey) {
+      properties.mediaResourceSourceKey = mediaResourceSourceKey;
+      return this;
+    }
+    
+    /**
+     * @param mediaResourceTypeKey the mediaResourceTypeKey to set
+     */
+    public ODataEntityProviderPropertiesBuilder mediaResourceTypeKey(String mediaResourceTypeKey) {
+      properties.mediaResourceTypeKey = mediaResourceTypeKey;
+      return this;
+    }
 
     /**
      * @param inlineCountType the inlineCountType to set
@@ -192,7 +227,6 @@ public class EntityProviderWriteProperties {
       this.properties.selfLink = properties.getSelfLink();
       return this;
     }
-
   }
 
   public static ODataEntityProviderPropertiesBuilder fromProperties(final EntityProviderWriteProperties properties) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java
index d9dc33a..2c5c32d 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ODataRequestHandler.java
@@ -69,7 +69,7 @@ public class ODataRequestHandler {
   private final ODataService service;
   private final ODataContext context;
 
-  public ODataRequestHandler(final ODataServiceFactory factory, final ODataService service, 
+  public ODataRequestHandler(final ODataServiceFactory factory, final ODataService service,
       final ODataContext context) {
     serviceFactory = factory;
     this.service = service;
@@ -413,7 +413,7 @@ public class ODataRequestHandler {
 
     // Adjust processor feature.
     if (processorFeature == EntitySetProcessor.class) {
-      processorFeature = uriInfo.getTargetEntitySet().getEntityType().hasStream() ? EntityMediaProcessor.class : 
+      processorFeature = uriInfo.getTargetEntitySet().getEntityType().hasStream() ? EntityMediaProcessor.class :
           EntityProcessor.class; // The request must contain a single entity!
     } else if (processorFeature == EntityLinksProcessor.class) {
       processorFeature = EntityLinkProcessor.class; // The request must contain a single link!

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
index a8b24fb..9fc9945 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
@@ -383,7 +383,7 @@ public class AtomEntityProvider implements ContentTypeBasedEntityProvider {
   }
 
   @Override
-  public List<String> readLinks(final EdmEntitySet entitySet, final InputStream content) 
+  public List<String> readLinks(final EdmEntitySet entitySet, final InputStream content)
       throws EntityProviderException {
     XmlEntityConsumer xec = new XmlEntityConsumer();
     return xec.readLinks(entitySet, content);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
index 1937c7f..c008e2f 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
@@ -324,7 +324,7 @@ public class JsonEntityProvider implements ContentTypeBasedEntityProvider {
   }
 
   @Override
-  public List<String> readLinks(final EdmEntitySet entitySet, final InputStream content) 
+  public List<String> readLinks(final EdmEntitySet entitySet, final InputStream content)
       throws EntityProviderException {
     return new JsonEntityConsumer().readLinks(entitySet, content);
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java
index 9345c7e..9fd0d94 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java
@@ -163,7 +163,7 @@ public class EntityInfoAggregator {
    * if create of {@link EntityPropertyInfo} something goes wrong (e.g. exceptions during
    * access of {@link EntityPropertyInfo}).
    */
-  public static Map<String, EntityPropertyInfo> create(final EdmComplexType complexType) 
+  public static Map<String, EntityPropertyInfo> create(final EdmComplexType complexType)
       throws EntityProviderException {
     try {
       EntityInfoAggregator entityInfo = new EntityInfoAggregator();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java
index fb0a41c..5ea81a5 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java
@@ -105,7 +105,7 @@ public class AtomServiceDocumentConsumer {
           && Edm.PREFIX_XML.equals(reader.getAttributePrefix(i))
           || (FormatXml.XML_LANG.equals(reader.getAttributeLocalName(i)) && Edm.PREFIX_XML.equals(reader
               .getAttributePrefix(i)))
-          || ("local".equals(reader.getAttributeNamespace(i)) || DEFAULT_PREFIX.equals(reader.getAttributePrefix(i))))) 
+          || ("local".equals(reader.getAttributeNamespace(i)) || DEFAULT_PREFIX.equals(reader.getAttributePrefix(i)))))
       {
         extAttributes.add(new ExtensionAttributeImpl()
             .setName(reader.getAttributeLocalName(i))
@@ -118,7 +118,7 @@ public class AtomServiceDocumentConsumer {
     return attribute.setAttributes(extAttributes);
   }
 
-  private WorkspaceImpl parseWorkspace(final XMLStreamReader reader) 
+  private WorkspaceImpl parseWorkspace(final XMLStreamReader reader)
       throws XMLStreamException, EntityProviderException {
     reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_APP_2007, FormatXml.APP_WORKSPACE);
 
@@ -162,8 +162,8 @@ public class AtomServiceDocumentConsumer {
       throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent("href"));
     }
     while (reader.hasNext()
-        && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) 
-            && FormatXml.APP_COLLECTION.equals(reader.getLocalName()))) {
+        && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI())
+        && FormatXml.APP_COLLECTION.equals(reader.getLocalName()))) {
       reader.next();
       if (reader.isStartElement()) {
         currentHandledStartTagName = reader.getLocalName();
@@ -230,8 +230,8 @@ public class AtomServiceDocumentConsumer {
       }
       List<Category> categoriesList = new ArrayList<Category>();
       while (reader.hasNext()
-          && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) 
-              && FormatXml.APP_CATEGORIES.equals(reader.getLocalName()))) {
+          && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI())
+          && FormatXml.APP_CATEGORIES.equals(reader.getLocalName()))) {
         reader.next();
         if (reader.isStartElement()) {
           currentHandledStartTagName = reader.getLocalName();
@@ -264,8 +264,8 @@ public class AtomServiceDocumentConsumer {
       EntityProviderException {
     ExtensionElementImpl extElement = new ExtensionElementImpl();
     if (!(Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI())
-    || (FormatXml.ATOM_TITLE.equals(reader.getLocalName()) 
-        && Edm.NAMESPACE_ATOM_2005.equals(reader.getNamespaceURI())))) {
+    || (FormatXml.ATOM_TITLE.equals(reader.getLocalName())
+    && Edm.NAMESPACE_ATOM_2005.equals(reader.getNamespaceURI())))) {
       extElement = parseElement(reader);
     }
     return extElement;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
index 47d4eef..62b822c 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
@@ -542,8 +542,8 @@ public class XmlEntryConsumer {
       reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_CONTENT);
     } else {
       throw new EntityProviderException(EntityProviderException.INVALID_STATE
-          .addContent("Expected closing 'content' or starting 'properties' but found '" 
-      + reader.getLocalName() + "'."));
+          .addContent("Expected closing 'content' or starting 'properties' but found '"
+              + reader.getLocalName() + "'."));
     }
 
     mediaMetadata.setContentType(contentType);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java
index 8ecd4d4..32af48b 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlMetadataConsumer.java
@@ -324,8 +324,8 @@ public class XmlMetadataConsumer {
     }
     associationSet.setAnnotationAttributes(readAnnotationAttribute(reader));
     while (reader.hasNext()
-        && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) 
-            && XmlMetadataConstants.EDM_ASSOCIATION_SET.equals(reader.getLocalName()))) {
+        && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI())
+        && XmlMetadataConstants.EDM_ASSOCIATION_SET.equals(reader.getLocalName()))) {
       reader.next();
       if (reader.isStartElement()) {
         extractNamespaces(reader);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/ODataEntryImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/ODataEntryImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/ODataEntryImpl.java
index 96ecf75..89ae144 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/ODataEntryImpl.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/ODataEntryImpl.java
@@ -43,7 +43,7 @@ public class ODataEntryImpl implements ODataEntry {
   }
 
   public ODataEntryImpl(final Map<String, Object> data, final MediaMetadata mediaMetadata,
-      final EntryMetadata entryMetadata, final ExpandSelectTreeNode expandSelectTree, 
+      final EntryMetadata entryMetadata, final ExpandSelectTreeNode expandSelectTree,
       final boolean containsInlineEntry) {
     this.data = data;
     this.entryMetadata = entryMetadata;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryEntityProducer.java
index d85e577..4da4ab1 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryEntityProducer.java
@@ -95,21 +95,23 @@ public class AtomEntryEntityProducer {
       }
 
       // write all atom infos (mandatory and optional)
-      appendAtomMandatoryParts(writer, eia, data);
+      String selfLink = createSelfLink(eia, data, null);
+      appendAtomMandatoryParts(writer, eia, data, selfLink);
       appendAtomOptionalParts(writer, eia, data);
 
       if (eia.getEntityType().hasStream()) {
         // write all links
-        appendAtomEditLink(writer, eia, data);
-        appendAtomContentLink(writer, eia, data, properties.getMediaResourceMimeType());
+        appendAtomEditLink(writer, eia, data, selfLink);
+        // TODO: fix
+        appendAtomContentLink(writer, eia, data, selfLink);
         appendAtomNavigationLinks(writer, eia, data);
         // write properties/content
         appendCustomProperties(writer, eia, data);
-        appendAtomContentPart(writer, eia, data, properties.getMediaResourceMimeType());
+        appendAtomContentPart(writer, eia, data, selfLink);
         appendProperties(writer, eia, data);
       } else {
         // write all links
-        appendAtomEditLink(writer, eia, data);
+        appendAtomEditLink(writer, eia, data, selfLink);
         appendAtomNavigationLinks(writer, eia, data);
         // write properties/content
         appendCustomProperties(writer, eia, data);
@@ -295,12 +297,10 @@ public class AtomEntryEntityProducer {
   }
 
   private void appendAtomEditLink(final XMLStreamWriter writer, final EntityInfoAggregator eia,
-      final Map<String, Object> data) throws EntityProviderException {
+      final Map<String, Object> data, final String selfLink) throws EntityProviderException {
     try {
-      String self = createSelfLink(eia, data, null);
-
       writer.writeStartElement(FormatXml.ATOM_LINK);
-      writer.writeAttribute(FormatXml.ATOM_HREF, self);
+      writer.writeAttribute(FormatXml.ATOM_HREF, selfLink);
       writer.writeAttribute(FormatXml.ATOM_REL, Edm.LINK_REL_EDIT);
       writer.writeAttribute(FormatXml.ATOM_TITLE, eia.getEntityType().getName());
       writer.writeEndElement();
@@ -312,16 +312,21 @@ public class AtomEntryEntityProducer {
   }
 
   private void appendAtomContentLink(final XMLStreamWriter writer, final EntityInfoAggregator eia,
-      final Map<String, Object> data, String mediaResourceMimeType) throws EntityProviderException {
+      final Map<String, Object> data, final String selfLink) throws EntityProviderException {
     try {
-      String self = createSelfLink(eia, data, "$value");
-
+      String mediaResourceMimeType = properties.getMediaResourceMimeType();
       if (mediaResourceMimeType == null) {
-        mediaResourceMimeType = ContentType.APPLICATION_OCTET_STREAM.toString();
+        String mediaResourceMimeTypeKey = properties.getMediaResourceTypeKey();
+        if (mediaResourceMimeTypeKey != null) {
+          mediaResourceMimeType = extractKey(data, mediaResourceMimeTypeKey);
+        }
+        if (mediaResourceMimeType == null) {
+          mediaResourceMimeType = ContentType.APPLICATION_OCTET_STREAM.toString();
+        }
       }
 
       writer.writeStartElement(FormatXml.ATOM_LINK);
-      writer.writeAttribute(FormatXml.ATOM_HREF, self);
+      writer.writeAttribute(FormatXml.ATOM_HREF, selfLink + "/$value");
       writer.writeAttribute(FormatXml.ATOM_REL, Edm.LINK_REL_EDIT_MEDIA);
       writer.writeAttribute(FormatXml.ATOM_TYPE, mediaResourceMimeType);
       writer.writeEndElement();
@@ -331,12 +336,28 @@ public class AtomEntryEntityProducer {
   }
 
   private void appendAtomContentPart(final XMLStreamWriter writer, final EntityInfoAggregator eia,
-      final Map<String, Object> data, String mediaResourceMimeType) throws EntityProviderException {
+      final Map<String, Object> data, final String selfLink) throws EntityProviderException {
     try {
-      String self = createSelfLink(eia, data, "$value");
+
+      String mediaResourceSourceKey = properties.getMediaResourceSourceKey();
+      String mediaResourceMimeType = properties.getMediaResourceMimeType();
+
+      String self = null;
+      if (mediaResourceSourceKey != null) {
+        self = extractKey(data, mediaResourceSourceKey);
+      }
+      if (self == null) {
+        self = selfLink + "/$value";
+      }
 
       if (mediaResourceMimeType == null) {
-        mediaResourceMimeType = ContentType.APPLICATION_OCTET_STREAM.toString();
+        String mediaResourceMimeTypeKey = properties.getMediaResourceTypeKey();
+        if (mediaResourceMimeTypeKey != null) {
+          mediaResourceMimeType = extractKey(data, mediaResourceMimeTypeKey);
+        }
+        if (mediaResourceMimeType == null) {
+          mediaResourceMimeType = ContentType.APPLICATION_OCTET_STREAM.toString();
+        }
       }
 
       writer.writeStartElement(FormatXml.ATOM_CONTENT);
@@ -348,11 +369,22 @@ public class AtomEntryEntityProducer {
     }
   }
 
+  private String extractKey(final Map<String, Object> data, final String mediaResourceMimeTypeKey)
+      throws EntityProviderException {
+    Object key = data.get(mediaResourceMimeTypeKey);
+    if (key == null || key instanceof String) {
+      return (String) key;
+    } else {
+      throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT
+          .addContent("Key must be of type String"));
+    }
+  }
+
   private void appendAtomMandatoryParts(final XMLStreamWriter writer, final EntityInfoAggregator eia,
-      final Map<String, Object> data) throws EntityProviderException {
+      final Map<String, Object> data, final String selfLink) throws EntityProviderException {
     try {
       writer.writeStartElement(FormatXml.ATOM_ID);
-      location = properties.getServiceRoot().toASCIIString() + createSelfLink(eia, data, null);
+      location = properties.getServiceRoot().toASCIIString() + selfLink;
       writer.writeCharacters(location);
       writer.writeEndElement();
 
@@ -383,7 +415,7 @@ public class AtomEntryEntityProducer {
     }
   }
 
-  String getUpdatedString(final EntityInfoAggregator eia, final Map<String, Object> data) 
+  String getUpdatedString(final EntityInfoAggregator eia, final Map<String, Object> data)
       throws EdmSimpleTypeException {
     Object updateDate = null;
     EdmFacets updateFacets = null;
@@ -507,7 +539,7 @@ public class AtomEntryEntityProducer {
 
       final EdmSimpleType type = (EdmSimpleType) keyPropertyInfo.getType();
       try {
-        keys.append(Encoder.encode(type.valueToString(data.get(name), EdmLiteralKind.URI, 
+        keys.append(Encoder.encode(type.valueToString(data.get(name), EdmLiteralKind.URI,
             keyPropertyInfo.getFacets())));
       } catch (final EdmSimpleTypeException e) {
         throw new EntityProviderException(EntityProviderException.COMMON, e);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducer.java
index 3d2d98f..0659ad8 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducer.java
@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.olingo.odata2.api.ODataCallback;
-import org.apache.olingo.odata2.api.commons.HttpContentType;
 import org.apache.olingo.odata2.api.edm.Edm;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmEntityType;
@@ -42,6 +41,7 @@ import org.apache.olingo.odata2.api.ep.callback.WriteEntryCallbackResult;
 import org.apache.olingo.odata2.api.ep.callback.WriteFeedCallbackContext;
 import org.apache.olingo.odata2.api.ep.callback.WriteFeedCallbackResult;
 import org.apache.olingo.odata2.api.exception.ODataApplicationException;
+import org.apache.olingo.odata2.core.commons.ContentType;
 import org.apache.olingo.odata2.core.commons.Encoder;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
 import org.apache.olingo.odata2.core.ep.util.FormatJson;
@@ -75,105 +75,11 @@ public class JsonEntryEntityProducer {
 
       jsonStreamWriter.beginObject();
 
-      jsonStreamWriter.name(FormatJson.METADATA)
-          .beginObject();
-      final String self = AtomEntryEntityProducer.createSelfLink(entityInfo, data, null);
-      location = (properties.getServiceRoot() == null ? "" : properties.getServiceRoot().toASCIIString()) + self;
-      jsonStreamWriter.namedStringValue(FormatJson.ID, location).separator()
-          .namedStringValue(FormatJson.URI, location).separator()
-          .namedStringValueRaw(FormatJson.TYPE,
-              type.getNamespace() + Edm.DELIMITER + type.getName());
-      eTag = AtomEntryEntityProducer.createETag(entityInfo, data);
-      if (eTag != null) {
-        jsonStreamWriter.separator()
-            .namedStringValue(FormatJson.ETAG, eTag);
-      }
-      if (type.hasStream()) {
-        jsonStreamWriter.separator()
-            .namedStringValueRaw(
-                FormatJson.CONTENT_TYPE,
-                properties.getMediaResourceMimeType() == null ?
-                    type.getMapping() == null || type.getMapping().getMimeType() == null
-                        || data.get(type.getMapping().getMimeType()) == null ?
-                        HttpContentType.APPLICATION_OCTET_STREAM : data.get(type.getMapping().getMimeType()).toString()
-                    :
-                    properties.getMediaResourceMimeType())
-            .separator()
-            .namedStringValue(FormatJson.MEDIA_SRC, self + "/$value").separator()
-            .namedStringValue(FormatJson.EDIT_MEDIA, location + "/$value");
-      }
-      jsonStreamWriter.endObject();
+      writeMetadata(entityInfo, data, type);
 
-      for (final String propertyName : type.getPropertyNames()) {
-        if (entityInfo.getSelectedPropertyNames().contains(propertyName)) {
-          jsonStreamWriter.separator()
-              .name(propertyName);
-          JsonPropertyEntityProducer.appendPropertyValue(jsonStreamWriter, entityInfo.getPropertyInfo(propertyName),
-              data.get(propertyName));
-        }
-      }
+      writeProperties(entityInfo, data, type);
 
-      for (final String navigationPropertyName : type.getNavigationPropertyNames()) {
-        if (entityInfo.getSelectedNavigationPropertyNames().contains(navigationPropertyName)) {
-          jsonStreamWriter.separator()
-              .name(navigationPropertyName);
-          if (entityInfo.getExpandedNavigationPropertyNames().contains(navigationPropertyName)) {
-            if (properties.getCallbacks() != null && properties.getCallbacks().containsKey(navigationPropertyName)) {
-              final EdmNavigationProperty navigationProperty =
-                  (EdmNavigationProperty) type.getProperty(navigationPropertyName);
-              final boolean isFeed = navigationProperty.getMultiplicity() == EdmMultiplicity.MANY;
-              final EdmEntitySet entitySet = entityInfo.getEntitySet();
-              final EdmEntitySet inlineEntitySet = entitySet.getRelatedEntitySet(navigationProperty);
-
-              WriteCallbackContext context = isFeed ? new WriteFeedCallbackContext() : new WriteEntryCallbackContext();
-              context.setSourceEntitySet(entitySet);
-              context.setNavigationProperty(navigationProperty);
-              context.setEntryData(data);
-              context.setCurrentExpandSelectTreeNode(properties.getExpandSelectTree().getLinks().get(
-                  navigationPropertyName));
-
-              ODataCallback callback = properties.getCallbacks().get(navigationPropertyName);
-              if (callback == null) {
-                throw new EntityProviderException(EntityProviderException.EXPANDNOTSUPPORTED);
-              }
-              try {
-                if (isFeed) {
-                  final WriteFeedCallbackResult result =
-                      ((OnWriteFeedContent) callback).retrieveFeedResult((WriteFeedCallbackContext) context);
-                  List<Map<String, Object>> inlineData = result.getFeedData();
-                  if (inlineData == null) {
-                    inlineData = new ArrayList<Map<String, Object>>();
-                  }
-                  final EntityProviderWriteProperties inlineProperties = result.getInlineProperties();
-                  final EntityInfoAggregator inlineEntityInfo =
-                      EntityInfoAggregator.create(inlineEntitySet, inlineProperties.getExpandSelectTree());
-                  new JsonFeedEntityProducer(inlineProperties).append(writer, inlineEntityInfo, inlineData, false);
-
-                } else {
-                  final WriteEntryCallbackResult result =
-                      ((OnWriteEntryContent) callback).retrieveEntryResult((WriteEntryCallbackContext) context);
-                  Map<String, Object> inlineData = result.getEntryData();
-                  if (inlineData != null && !inlineData.isEmpty()) {
-                    final EntityProviderWriteProperties inlineProperties = result.getInlineProperties();
-                    final EntityInfoAggregator inlineEntityInfo =
-                        EntityInfoAggregator.create(inlineEntitySet, inlineProperties.getExpandSelectTree());
-                    new JsonEntryEntityProducer(inlineProperties).append(writer, inlineEntityInfo, inlineData, false);
-                  } else {
-                    jsonStreamWriter.unquotedValue("null");
-                  }
-                }
-              } catch (final ODataApplicationException e) {
-                throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
-                    .getSimpleName()), e);
-              }
-            } else {
-              writeDeferredUri(navigationPropertyName);
-            }
-          } else {
-            writeDeferredUri(navigationPropertyName);
-          }
-        }
-      }
+      writeNavigationProperties(writer, entityInfo, data, type);
 
       jsonStreamWriter.endObject();
 
@@ -192,6 +98,132 @@ public class JsonEntryEntityProducer {
     }
   }
 
+  private void writeNavigationProperties(final Writer writer, final EntityInfoAggregator entityInfo,
+      final Map<String, Object> data,
+      final EdmEntityType type) throws EdmException, EntityProviderException, IOException {
+    for (final String navigationPropertyName : type.getNavigationPropertyNames()) {
+      if (entityInfo.getSelectedNavigationPropertyNames().contains(navigationPropertyName)) {
+        jsonStreamWriter.separator();
+        jsonStreamWriter.name(navigationPropertyName);
+        if (entityInfo.getExpandedNavigationPropertyNames().contains(navigationPropertyName)) {
+          if (properties.getCallbacks() != null && properties.getCallbacks().containsKey(navigationPropertyName)) {
+            writeExpandedNavigationProperty(writer, entityInfo, data, type, navigationPropertyName);
+          } else {
+            writeDeferredUri(navigationPropertyName);
+          }
+        } else {
+          writeDeferredUri(navigationPropertyName);
+        }
+      }
+    }
+  }
+
+  private void writeExpandedNavigationProperty(final Writer writer, final EntityInfoAggregator entityInfo,
+      final Map<String, Object> data,
+      final EdmEntityType type, final String navigationPropertyName) throws EdmException, EntityProviderException,
+      IOException {
+    final EdmNavigationProperty navigationProperty = (EdmNavigationProperty) type.getProperty(navigationPropertyName);
+    final boolean isFeed = navigationProperty.getMultiplicity() == EdmMultiplicity.MANY;
+    final EdmEntitySet entitySet = entityInfo.getEntitySet();
+    final EdmEntitySet inlineEntitySet = entitySet.getRelatedEntitySet(navigationProperty);
+
+    WriteCallbackContext context = isFeed ? new WriteFeedCallbackContext() : new WriteEntryCallbackContext();
+    context.setSourceEntitySet(entitySet);
+    context.setNavigationProperty(navigationProperty);
+    context.setEntryData(data);
+    context.setCurrentExpandSelectTreeNode(properties.getExpandSelectTree().getLinks().get(
+        navigationPropertyName));
+
+    ODataCallback callback = properties.getCallbacks().get(navigationPropertyName);
+    if (callback == null) {
+      throw new EntityProviderException(EntityProviderException.EXPANDNOTSUPPORTED);
+    }
+    try {
+      if (isFeed) {
+        final WriteFeedCallbackResult result =
+            ((OnWriteFeedContent) callback).retrieveFeedResult((WriteFeedCallbackContext) context);
+        List<Map<String, Object>> inlineData = result.getFeedData();
+        if (inlineData == null) {
+          inlineData = new ArrayList<Map<String, Object>>();
+        }
+        final EntityProviderWriteProperties inlineProperties = result.getInlineProperties();
+        final EntityInfoAggregator inlineEntityInfo =
+            EntityInfoAggregator.create(inlineEntitySet, inlineProperties.getExpandSelectTree());
+        new JsonFeedEntityProducer(inlineProperties).append(writer, inlineEntityInfo, inlineData, false);
+
+      } else {
+        final WriteEntryCallbackResult result =
+            ((OnWriteEntryContent) callback).retrieveEntryResult((WriteEntryCallbackContext) context);
+        Map<String, Object> inlineData = result.getEntryData();
+        if (inlineData != null && !inlineData.isEmpty()) {
+          final EntityProviderWriteProperties inlineProperties = result.getInlineProperties();
+          final EntityInfoAggregator inlineEntityInfo =
+              EntityInfoAggregator.create(inlineEntitySet, inlineProperties.getExpandSelectTree());
+          new JsonEntryEntityProducer(inlineProperties).append(writer, inlineEntityInfo, inlineData, false);
+        } else {
+          jsonStreamWriter.unquotedValue("null");
+        }
+      }
+    } catch (final ODataApplicationException e) {
+      throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+          .getSimpleName()), e);
+    }
+  }
+
+  private void writeProperties(final EntityInfoAggregator entityInfo, final Map<String, Object> data,
+      final EdmEntityType type) throws EdmException, EntityProviderException, IOException {
+    for (final String propertyName : type.getPropertyNames()) {
+      if (entityInfo.getSelectedPropertyNames().contains(propertyName)) {
+        jsonStreamWriter.separator();
+        jsonStreamWriter.name(propertyName);
+        JsonPropertyEntityProducer.appendPropertyValue(jsonStreamWriter, entityInfo.getPropertyInfo(propertyName),
+            data.get(propertyName));
+      }
+    }
+  }
+
+  private void writeMetadata(final EntityInfoAggregator entityInfo, final Map<String, Object> data,
+      final EdmEntityType type) throws IOException, EntityProviderException, EdmException {
+    jsonStreamWriter.name(FormatJson.METADATA);
+    jsonStreamWriter.beginObject();
+    final String self = AtomEntryEntityProducer.createSelfLink(entityInfo, data, null);
+    location = (properties.getServiceRoot() == null ? "" : properties.getServiceRoot().toASCIIString()) + self;
+    jsonStreamWriter.namedStringValue(FormatJson.ID, location);
+    jsonStreamWriter.separator();
+    jsonStreamWriter.namedStringValue(FormatJson.URI, location);
+    jsonStreamWriter.separator();
+    jsonStreamWriter.namedStringValueRaw(FormatJson.TYPE, type.getNamespace() + Edm.DELIMITER + type.getName());
+    eTag = AtomEntryEntityProducer.createETag(entityInfo, data);
+    if (eTag != null) {
+      jsonStreamWriter.separator();
+      jsonStreamWriter.namedStringValue(FormatJson.ETAG, eTag);
+    }
+    if (type.hasStream()) {
+      jsonStreamWriter.separator();
+      String mediaResourceMimeType = properties.getMediaResourceMimeType();
+      if (mediaResourceMimeType == null) {
+        String mediaResourceMimeTypeKey = properties.getMediaResourceTypeKey();
+        if (mediaResourceMimeTypeKey != null) {
+          mediaResourceMimeType = extractKey(data, mediaResourceMimeTypeKey);
+        }
+        if (mediaResourceMimeType == null) {
+          mediaResourceMimeType = ContentType.APPLICATION_OCTET_STREAM.toString();
+        }
+      }
+      jsonStreamWriter.namedStringValueRaw(FormatJson.CONTENT_TYPE, mediaResourceMimeType);
+      jsonStreamWriter.separator();
+
+      String mediaSrc = self + "/$value";
+      if (properties.getMediaResourceSourceKey() != null) {
+        mediaSrc = (String) data.get(properties.getMediaResourceSourceKey());
+      }
+      jsonStreamWriter.namedStringValue(FormatJson.MEDIA_SRC, mediaSrc);
+      jsonStreamWriter.separator();
+      jsonStreamWriter.namedStringValue(FormatJson.EDIT_MEDIA, location + "/$value");
+    }
+    jsonStreamWriter.endObject();
+  }
+
   private void writeDeferredUri(final String navigationPropertyName) throws IOException {
     jsonStreamWriter.beginObject()
         .name(FormatJson.DEFERRED);
@@ -206,4 +238,15 @@ public class JsonEntryEntityProducer {
   public String getLocation() {
     return location;
   }
+
+  private String extractKey(final Map<String, Object> data, final String mediaResourceMimeTypeKey)
+      throws EntityProviderException {
+    Object key = data.get(mediaResourceMimeTypeKey);
+    if (key == null || key instanceof String) {
+      return (String) key;
+    } else {
+      throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT
+          .addContent("Key must be of type String"));
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonPropertyEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonPropertyEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonPropertyEntityProducer.java
index 659e4b9..ad222ba 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonPropertyEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonPropertyEntityProducer.java
@@ -77,7 +77,7 @@ public class JsonPropertyEntityProducer {
           jsonStreamWriter.separator();
           final String name = childPropertyInfo.getName();
           jsonStreamWriter.name(name);
-          appendPropertyValue(jsonStreamWriter, childPropertyInfo, 
+          appendPropertyValue(jsonStreamWriter, childPropertyInfo,
               value == null ? null : ((Map<?, ?>) value).get(name));
         }
         jsonStreamWriter.endObject();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/XmlMetadataProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/XmlMetadataProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/XmlMetadataProducer.java
index 51a09b4..4ad3e3e 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/XmlMetadataProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/XmlMetadataProducer.java
@@ -339,7 +339,7 @@ public class XmlMetadataProducer {
                   writeAssociationSetEnd(associationSet.getEnd1(), predefinedNamespaces, xmlStreamWriter);
                   writeAssociationSetEnd(associationSet.getEnd2(), predefinedNamespaces, xmlStreamWriter);
 
-                  writeAnnotationElements(associationSet.getAnnotationElements(), predefinedNamespaces, 
+                  writeAnnotationElements(associationSet.getAnnotationElements(), predefinedNamespaces,
                       xmlStreamWriter);
 
                   xmlStreamWriter.writeEndElement();
@@ -395,7 +395,7 @@ public class XmlMetadataProducer {
                     }
                   }
 
-                  writeAnnotationElements(functionImport.getAnnotationElements(), predefinedNamespaces, 
+                  writeAnnotationElements(functionImport.getAnnotationElements(), predefinedNamespaces,
                       xmlStreamWriter);
 
                   xmlStreamWriter.writeEndElement();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java
index 786c24e..41c2eac 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java
@@ -42,7 +42,7 @@ public class JsonUtils {
           String name = reader.nextName();
           if (!("d".equals(name) ^ "results".equals(name))) {
             // TODO I18N
-            throw new EntityProviderException(EntityProviderException.COMMON, name + 
+            throw new EntityProviderException(EntityProviderException.COMMON, name +
                 " not expected, only d or results");
           }
         }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreator.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreator.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreator.java
index 24c879d..8deb357 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreator.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreator.java
@@ -40,7 +40,7 @@ public class ExpandSelectTreeCreator {
   private List<SelectItem> initialSelect;
   private List<ArrayList<NavigationPropertySegment>> initialExpand;
 
-  public ExpandSelectTreeCreator(final List<SelectItem> select, 
+  public ExpandSelectTreeCreator(final List<SelectItem> select,
       final List<ArrayList<NavigationPropertySegment>> expand) {
     if (select != null) {
       initialSelect = select;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
index eb5ecb1..e9f37b5 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserImpl.java
@@ -464,7 +464,7 @@ public class FilterParserImpl implements FilterParser {
       validateEdmPropertyOfStructuredType(resourceEntityType, property, propertyToken);
       return;
     } else {
-      if ((leftExpression.getKind() != ExpressionKind.PROPERTY) && 
+      if ((leftExpression.getKind() != ExpressionKind.PROPERTY) &&
           (leftExpression.getKind() != ExpressionKind.MEMBER)) {
         if (actBinOp != null) {
           // Tested with TestParserExceptions.TestPMvalidateEdmProperty CASE 6
@@ -568,7 +568,7 @@ public class FilterParserImpl implements FilterParser {
    * }
    */
 
-  protected void validateUnaryOperatorTypes(final UnaryExpression unaryExpression) 
+  protected void validateUnaryOperatorTypes(final UnaryExpression unaryExpression)
       throws ExpressionParserInternalError {
     InfoUnaryOperator unOpt = availableUnaryOperators.get(unaryExpression.getOperator().toUriLiteral());
     EdmType operandType = unaryExpression.getOperand().getEdmType();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java
index d1f4b98..9c26463 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/JsonVisitor.java
@@ -98,7 +98,7 @@ public class JsonVisitor implements ExpressionVisitor {
   }
 
   @Override
-  public Object visitOrder(final OrderExpression orderExpression, final Object filterResult, 
+  public Object visitOrder(final OrderExpression orderExpression, final Object filterResult,
       final SortOrder sortOrder) {
     try {
       StringWriter writer = new StringWriter();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java
index 519f493..e21b453 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/Tokenizer.java
@@ -39,7 +39,7 @@ public class Tokenizer {
   private static final Pattern FUNK =
       Pattern
           .compile("^(startswith|endswith|substring|substring|substringof|indexof|replace|tolower|toupper" +
-          		"|trim|concat|length|year|mounth|day|hour|minute|second|round|ceiling|floor)( *)\\(");
+              "|trim|concat|length|year|mounth|day|hour|minute|second|round|ceiling|floor)( *)\\(");
   private static final Pattern AND_SUB1 = Pattern.compile("^(add|sub|mul|div|mod|not) ");
   private static final Pattern AND_SUB = Pattern.compile("^(and|or|eq|ne|lt|gt|le|ge) ");
   private static final Pattern prefix = Pattern.compile("^(X|binary|guid|datetime|datetimeoffset|time)'");

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/EdmSimpleTypeTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/EdmSimpleTypeTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/EdmSimpleTypeTest.java
index 72401a6..d504232 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/EdmSimpleTypeTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/EdmSimpleTypeTest.java
@@ -506,7 +506,7 @@ public class EdmSimpleTypeTest extends BaseTest {
     assertEquals("32", instance.valueToString(Integer.valueOf(32), EdmLiteralKind.DEFAULT, null));
     assertEquals("255", instance.valueToString(255L, EdmLiteralKind.DEFAULT, null));
 
-    expectErrorInValueToString(instance, -1, EdmLiteralKind.DEFAULT, null, 
+    expectErrorInValueToString(instance, -1, EdmLiteralKind.DEFAULT, null,
         EdmSimpleTypeException.VALUE_ILLEGAL_CONTENT);
     expectErrorInValueToString(instance, 256, EdmLiteralKind.DEFAULT, null,
         EdmSimpleTypeException.VALUE_ILLEGAL_CONTENT);
@@ -573,7 +573,7 @@ public class EdmSimpleTypeTest extends BaseTest {
         EdmSimpleTypeException.VALUE_TYPE_NOT_SUPPORTED);
     expectErrorInValueToString(instance, dateTime, null, null, EdmSimpleTypeException.LITERAL_KIND_MISSING);
   }
-  
+
   /**
    * Extended test for combination of precision with dates before 1970 (and for regression after 1970)
    */
@@ -584,14 +584,14 @@ public class EdmSimpleTypeTest extends BaseTest {
       final EdmSimpleType instance = EdmSimpleTypeKind.DateTime.getEdmSimpleTypeInstance();
       final EdmFacets facets = getPrecisionScaleFacets(precision, null);
       final Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
-      date.set(Calendar.MILLISECOND, 10 * precision+1);
+      date.set(Calendar.MILLISECOND, 10 * precision + 1);
 
       date.set(1954, 7, 4);
-      expectErrorInValueToString(instance, date, EdmLiteralKind.DEFAULT, facets, 
+      expectErrorInValueToString(instance, date, EdmLiteralKind.DEFAULT, facets,
           EdmSimpleTypeException.VALUE_FACETS_NOT_MATCHED);
 
       date.set(1999, 7, 4);
-      expectErrorInValueToString(instance, date, EdmLiteralKind.DEFAULT, facets, 
+      expectErrorInValueToString(instance, date, EdmLiteralKind.DEFAULT, facets,
           EdmSimpleTypeException.VALUE_FACETS_NOT_MATCHED);
     }
 
@@ -601,21 +601,22 @@ public class EdmSimpleTypeTest extends BaseTest {
     }
   }
 
-  private void assertValueToStringDateTimeSpecial(int year, int month, int day, int precision) throws Exception {
+  private void assertValueToStringDateTimeSpecial(final int year, final int month, final int day, final int precision)
+      throws Exception {
     final EdmSimpleType instance = EdmSimpleTypeKind.DateTime.getEdmSimpleTypeInstance();
     final StringBuilder regExToMatch = new StringBuilder();// = new StringBuilder("1954-08-04T\\d\\d:\\d\\d:\\d\\d");
     regExToMatch.append(year).append("-");
-    if(month < 9) {
+    if (month < 9) {
       regExToMatch.append("0");
     }
     // add '1' to the month because java calendar month begin with '0'
-    regExToMatch.append(month+1).append("-");
-    if(day < 10) {
+    regExToMatch.append(month + 1).append("-");
+    if (day < 10) {
       regExToMatch.append("0");
     }
     regExToMatch.append(day).append("T\\d\\d:\\d\\d:\\d\\d");
 
-    if(precision > 0) {
+    if (precision > 0) {
       regExToMatch.append("\\.");
     }
     for (int i = 0; i < precision; i++) {
@@ -623,8 +624,8 @@ public class EdmSimpleTypeTest extends BaseTest {
     }
     Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
     date.set(year, month, day);
-    date.set(Calendar.MILLISECOND, 10*precision+1);
-    
+    date.set(Calendar.MILLISECOND, 10 * precision + 1);
+
     //
     String formated = instance.valueToString(date, EdmLiteralKind.DEFAULT, getPrecisionScaleFacets(precision, null));
     assertTrue("Formated date '" + formated + "' is wrong for precision '" + precision +
@@ -1061,7 +1062,7 @@ public class EdmSimpleTypeTest extends BaseTest {
 
     expectErrorInValueOfString(instance, "@", EdmLiteralKind.DEFAULT, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
-    expectErrorInValueOfString(instance, "@", EdmLiteralKind.JSON, null, 
+    expectErrorInValueOfString(instance, "@", EdmLiteralKind.JSON, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "binary'ZZ'", EdmLiteralKind.URI, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
@@ -1212,7 +1213,7 @@ public class EdmSimpleTypeTest extends BaseTest {
     dateTime.clear();
     dateTime.setTimeZone(TimeZone.getTimeZone("GMT"));
     dateTime.set(2012, 1, 29, 1, 2, 3);
-    assertEquals(dateTime, instance.valueOfString("2012-02-29T01:02:03Z", 
+    assertEquals(dateTime, instance.valueOfString("2012-02-29T01:02:03Z",
         EdmLiteralKind.DEFAULT, null, Calendar.class));
     assertEquals(Long.valueOf(dateTime.getTimeInMillis()), instance.valueOfString("2012-02-29T01:02:03+00:00",
         EdmLiteralKind.DEFAULT, null, Long.class));
@@ -1327,9 +1328,9 @@ public class EdmSimpleTypeTest extends BaseTest {
     expectErrorInValueOfString(instance, "1M", EdmLiteralKind.JSON, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "0", EdmLiteralKind.URI, null, EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
-    expectErrorInValueOfString(instance, "1.0D", EdmLiteralKind.URI, null, 
+    expectErrorInValueOfString(instance, "1.0D", EdmLiteralKind.URI, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
-    expectErrorInValueOfString(instance, "0F", EdmLiteralKind.URI, null, 
+    expectErrorInValueOfString(instance, "0F", EdmLiteralKind.URI, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "0x42", EdmLiteralKind.DEFAULT, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
@@ -1378,7 +1379,7 @@ public class EdmSimpleTypeTest extends BaseTest {
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "42F", EdmLiteralKind.DEFAULT, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
-    expectErrorInValueOfString(instance, "42", EdmLiteralKind.URI, null, 
+    expectErrorInValueOfString(instance, "42", EdmLiteralKind.URI, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "0x42P42", EdmLiteralKind.DEFAULT, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
@@ -1429,7 +1430,7 @@ public class EdmSimpleTypeTest extends BaseTest {
 
     assertEquals(Byte.valueOf((byte) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Byte.class));
     assertEquals(Short.valueOf((short) 2), instance.valueOfString("2", EdmLiteralKind.JSON, null, Short.class));
-    assertEquals(Short.valueOf((short) -32768), instance.valueOfString("-32768", 
+    assertEquals(Short.valueOf((short) -32768), instance.valueOfString("-32768",
         EdmLiteralKind.URI, null, Short.class));
     assertEquals(Short.valueOf((short) 32767), instance.valueOfString("32767", EdmLiteralKind.URI, null, Short.class));
     assertEquals(Integer.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Integer.class));
@@ -1485,7 +1486,7 @@ public class EdmSimpleTypeTest extends BaseTest {
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "1.0L", EdmLiteralKind.URI, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
-    expectErrorInValueOfString(instance, "0M", EdmLiteralKind.URI, null, 
+    expectErrorInValueOfString(instance, "0M", EdmLiteralKind.URI, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "0x42", EdmLiteralKind.DEFAULT, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
@@ -1552,7 +1553,7 @@ public class EdmSimpleTypeTest extends BaseTest {
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "42D", EdmLiteralKind.DEFAULT, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
-    expectErrorInValueOfString(instance, "42", EdmLiteralKind.URI, null, 
+    expectErrorInValueOfString(instance, "42", EdmLiteralKind.URI, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "0x42P4", EdmLiteralKind.DEFAULT, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
@@ -1590,14 +1591,14 @@ public class EdmSimpleTypeTest extends BaseTest {
     assertEquals("text", instance.valueOfString("text", EdmLiteralKind.DEFAULT, getMaxLengthFacets(4), String.class));
     assertEquals("text", instance.valueOfString("text", EdmLiteralKind.DEFAULT, getMaxLengthFacets(Integer.MAX_VALUE),
         String.class));
-    assertEquals("text", instance.valueOfString("text", EdmLiteralKind.DEFAULT, getMaxLengthFacets(null), 
+    assertEquals("text", instance.valueOfString("text", EdmLiteralKind.DEFAULT, getMaxLengthFacets(null),
         String.class));
 
     expectErrorInValueOfString(instance, "schräg", EdmLiteralKind.DEFAULT, getUnicodeFacets(false),
         EdmSimpleTypeException.LITERAL_FACETS_NOT_MATCHED);
     expectErrorInValueOfString(instance, "text", EdmLiteralKind.DEFAULT, getMaxLengthFacets(3),
         EdmSimpleTypeException.LITERAL_FACETS_NOT_MATCHED);
-    expectErrorInValueOfString(instance, "'", EdmLiteralKind.URI, null, 
+    expectErrorInValueOfString(instance, "'", EdmLiteralKind.URI, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
     expectErrorInValueOfString(instance, "'text", EdmLiteralKind.URI, null,
         EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityTypeImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityTypeImplProvTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityTypeImplProvTest.java
index b264296..0ef0a8d 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityTypeImplProvTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityTypeImplProvTest.java
@@ -93,6 +93,8 @@ public class EdmEntityTypeImplProvTest extends BaseTest {
     List<Property> keyPropertysBarBase = new ArrayList<Property>();
     Property keyPropBarBase = new SimpleProperty().setName("Id").setType(EdmSimpleTypeKind.String);
     keyPropertysBarBase.add(keyPropBarBase);
+    keyPropBarBase = new SimpleProperty().setName("NotrmalProp").setType(EdmSimpleTypeKind.String);
+    keyPropertysBarBase.add(keyPropBarBase);
     barBase.setProperties(keyPropertysBarBase);
 
     PropertyRef refToKeyBarBase = new PropertyRef().setName("Id");

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmServiceMetadataImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmServiceMetadataImplProvTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmServiceMetadataImplProvTest.java
index d11da1a..2a6786e 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmServiceMetadataImplProvTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmServiceMetadataImplProvTest.java
@@ -245,11 +245,11 @@ public class EdmServiceMetadataImplProvTest extends BaseTest {
     assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name and @Type]", metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name and @Type and @Nullable and" +
-        " @m:FC_TargetPath]",
+            " @m:FC_TargetPath]",
         metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:NavigationProperty[@Name and " +
-        "@Relationship and @FromRole and @ToRole]",
+            "@Relationship and @FromRole and @ToRole]",
         metadata);
   }
 
@@ -257,11 +257,11 @@ public class EdmServiceMetadataImplProvTest extends BaseTest {
   public void testAnnotations() throws Exception {
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name and @Type and @Nullable and " +
-        "@annoPrefix:annoName]",
+            "@annoPrefix:annoName]",
         metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name and @Type and @m:FC_TargetPath and " +
-        "@annoPrefix:annoName]",
+            "@annoPrefix:annoName]",
         metadata);
   }
 
@@ -283,7 +283,7 @@ public class EdmServiceMetadataImplProvTest extends BaseTest {
         metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityContainer/a:FunctionImport[@Name and @ReturnType and " +
-        "@EntitySet and @m:HttpMethod]",
+            "@EntitySet and @m:HttpMethod]",
         metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityContainer/a:FunctionImport/a:Parameter[@Name and @Type]",
@@ -299,13 +299,13 @@ public class EdmServiceMetadataImplProvTest extends BaseTest {
         metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:Association/a:ReferentialConstraint/a:" +
-        "Principal[@Role]/a:PropertyRef[@Name]",
+            "Principal[@Role]/a:PropertyRef[@Name]",
         metadata);
     assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/a:Association/a:ReferentialConstraint/a:Dependent[@Role]",
         metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:Association/a:ReferentialConstraint/a:Dependent" +
-        "[@Role]/a:PropertyRef[@Name]",
+            "[@Role]/a:PropertyRef[@Name]",
         metadata);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/AbstractProviderTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/AbstractProviderTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/AbstractProviderTest.java
index 2fd5afa..3845675 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/AbstractProviderTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/AbstractProviderTest.java
@@ -136,7 +136,7 @@ public abstract class AbstractProviderTest extends AbstractXmlProducerTestHelper
         .put(
             "ImageUrl",
             "http://www.mopo.de/image/view/2012/6/4/16548086,13385561,medRes,maxh,234,maxw,234," +
-            "Parodia_Mona_Lisa_Lego_Hamburger_Morgenpost.jpg");
+                "Parodia_Mona_Lisa_Lego_Hamburger_Morgenpost.jpg");
     Map<String, Object> imageData = new HashMap<String, Object>();
     imageData.put("Image", new byte[] { 1, 2, 3, 4 });
     imageData.put("getImageType", "image/png");
@@ -189,8 +189,8 @@ public abstract class AbstractProviderTest extends AbstractXmlProducerTestHelper
     return ctx;
   }
 
-  protected EntityProviderInterface createEntityProvider() throws ODataException, EdmException, 
-  EntityProviderException {
+  protected EntityProviderInterface createEntityProvider() throws ODataException, EdmException,
+      EntityProviderException {
     return new ProviderFacadeImpl();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/BasicProviderTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/BasicProviderTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/BasicProviderTest.java
index 590ea47..ecefecd 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/BasicProviderTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/BasicProviderTest.java
@@ -106,11 +106,11 @@ public class BasicProviderTest extends AbstractProviderTest {
     setNamespaces();
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name and @Type and @Nullable and " +
-        "@annoPrefix:annoName]",
+            "@annoPrefix:annoName]",
         metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name and @Type and @m:FC_TargetPath and " +
-        "@annoPrefix:annoName]",
+            "@annoPrefix:annoName]",
         metadata);
     assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name=\"EmployeeName\"]",
         metadata);
@@ -126,7 +126,7 @@ public class BasicProviderTest extends AbstractProviderTest {
     assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/a:schemaElementTest1/prefix:schemaElementTest3", metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:schemaElementTest1/a:schemaElementTest4[@rel=\"self\" and " +
-        "@pre:href=\"http://foo\"]",
+            "@pre:href=\"http://foo\"]",
         metadata);
   }
 
@@ -143,13 +143,13 @@ public class BasicProviderTest extends AbstractProviderTest {
     setNamespaces();
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name and @Type and @Nullable and " +
-        "@annoPrefix:annoName]",
+            "@annoPrefix:annoName]",
         metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name and @Type and @m:FC_TargetPath and " +
-        "@annoPrefix:annoName]",
+            "@annoPrefix:annoName]",
         metadata);
-    assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name=\"EmployeeName\"]", 
+    assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name=\"EmployeeName\"]",
         metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType/a:Property[@Name=\"EmployeeName\"]/a:propertyAnnoElement",
@@ -163,7 +163,7 @@ public class BasicProviderTest extends AbstractProviderTest {
     assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/a:schemaElementTest1/prefix:schemaElementTest3", metadata);
     assertXpathExists(
         "/edmx:Edmx/edmx:DataServices/a:Schema/a:schemaElementTest1/a:schemaElementTest4[@rel=\"self\" and " +
-        "@pre:href=\"http://foo\"]",
+            "@pre:href=\"http://foo\"]",
         metadata);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java
index ed25f21..1e8999f 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java
@@ -304,11 +304,11 @@ public class JsonFeedConsumerTest extends AbstractConsumerTest {
     EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
     String content =
         "{\"d\":{\"__count\":\"3\",\"results\":[{" +
-        "\"__metadata\":{\"id\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\"," +
-        "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\",\"type\":\"RefScenario.Team\"}," +
-        "\"Id\":\"1\",\"Name\":\"Team 1\",\"isScrumTeam\":false,\"nt_Employees\":{\"__deferred\":{" +
-        "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')/nt_Employees\"}}}]," +
-        "\"__next\":\"Rooms?$skiptoken=98&$inlinecount=allpages\",\"__delta\":\"deltalink\"}}";
+            "\"__metadata\":{\"id\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\"," +
+            "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\",\"type\":\"RefScenario.Team\"}," +
+            "\"Id\":\"1\",\"Name\":\"Team 1\",\"isScrumTeam\":false,\"nt_Employees\":{\"__deferred\":{" +
+            "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')/nt_Employees\"}}}]," +
+            "\"__next\":\"Rooms?$skiptoken=98&$inlinecount=allpages\",\"__delta\":\"deltalink\"}}";
     assertNotNull(content);
     InputStream contentBody = createContentAsStream(content);
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java
index 8c00076..b52df8b 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumerTest.java
@@ -339,7 +339,7 @@ public class JsonPropertyConsumerTest extends BaseTest {
   public void complexPropertyWithStringToStringMappingStandalone() throws Exception {
     final String complexPropertyJson =
         "{\"d\":{\"City\":{\"__metadata\":{\"type\":\"RefScenario.c_City\"}," +
-        "\"PostalCode\":\"69124\",\"CityName\":\"Heidelberg\"}}}";
+            "\"PostalCode\":\"69124\",\"CityName\":\"Heidelberg\"}}}";
     JsonReader reader = prepareReader(complexPropertyJson);
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getComplexType("RefScenario", "c_Location").getProperty("City");
@@ -363,8 +363,8 @@ public class JsonPropertyConsumerTest extends BaseTest {
   public void deepComplexPropertyWithStringToStringMappingStandalone() throws Exception {
     final String complexPropertyJson =
         "{\"d\":{\"Location\":{\"__metadata\":{\"type\":\"RefScenario.c_Location\"}," +
-        "\"City\":{\"__metadata\":{\"type\":\"RefScenario.c_City\"},\"PostalCode\":\"69124\"," +
-        "\"CityName\":\"Heidelberg\"},\"Country\":\"Germany\"}}}";
+            "\"City\":{\"__metadata\":{\"type\":\"RefScenario.c_City\"},\"PostalCode\":\"69124\"," +
+            "\"CityName\":\"Heidelberg\"},\"Country\":\"Germany\"}}}";
     JsonReader reader = prepareReader(complexPropertyJson);
     EdmProperty edmProperty =
         (EdmProperty) MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees").getEntityType()
@@ -433,8 +433,8 @@ public class JsonPropertyConsumerTest extends BaseTest {
   public void deepComplexPropertyOnOpenReader() throws Exception {
     final String complexPropertyJson =
         "{\"__metadata\":{\"type\":\"RefScenario.c_Location\"}," +
-        "\"City\":{\"__metadata\":{\"type\":\"RefScenario.c_City\"},\"PostalCode\":\"69124\"," +
-        "\"CityName\":\"Heidelberg\"},\"Country\":\"Germany\"}";
+            "\"City\":{\"__metadata\":{\"type\":\"RefScenario.c_City\"},\"PostalCode\":\"69124\"," +
+            "\"CityName\":\"Heidelberg\"},\"Country\":\"Germany\"}";
     JsonReader reader = prepareReader(complexPropertyJson);
     EdmProperty edmProperty =
         (EdmProperty) MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees").getEntityType()
@@ -470,7 +470,7 @@ public class JsonPropertyConsumerTest extends BaseTest {
   public void complexPropertyStandalone() throws Exception {
     final String complexPropertyJson =
         "{\"d\":{\"City\":{\"__metadata\":{\"type\":\"RefScenario.c_City\"}," +
-        "\"PostalCode\":\"69124\",\"CityName\":\"Heidelberg\"}}}";
+            "\"PostalCode\":\"69124\",\"CityName\":\"Heidelberg\"}}}";
     JsonReader reader = prepareReader(complexPropertyJson);
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getComplexType("RefScenario", "c_Location").getProperty("City");
@@ -488,8 +488,8 @@ public class JsonPropertyConsumerTest extends BaseTest {
   public void deepComplexPropertyStandalone() throws Exception {
     final String complexPropertyJson =
         "{\"d\":{\"Location\":{\"__metadata\":{\"type\":\"RefScenario.c_Location\"}," +
-        "\"City\":{\"__metadata\":{\"type\":\"RefScenario.c_City\"},\"PostalCode\":\"69124\"," +
-        "\"CityName\":\"Heidelberg\"},\"Country\":\"Germany\"}}}";
+            "\"City\":{\"__metadata\":{\"type\":\"RefScenario.c_City\"},\"PostalCode\":\"69124\"," +
+            "\"CityName\":\"Heidelberg\"},\"Country\":\"Germany\"}}}";
     JsonReader reader = prepareReader(complexPropertyJson);
     EdmProperty edmProperty =
         (EdmProperty) MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees").getEntityType()

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java
index 6e84b1d..8459f12 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumerTest.java
@@ -938,7 +938,7 @@ public class XmlEntityConsumerTest extends AbstractConsumerTest {
     InputStream reqContent = createContentAsStream(content);
 
     // execute
-    readAndExpectException(entitySet, reqContent, 
+    readAndExpectException(entitySet, reqContent,
         EntityProviderException.INVALID_INLINE_CONTENT.addContent("xml data"));
   }
 
@@ -959,7 +959,7 @@ public class XmlEntityConsumerTest extends AbstractConsumerTest {
     InputStream reqContent = createContentAsStream(content);
 
     // execute
-    readAndExpectException(entitySet, reqContent, 
+    readAndExpectException(entitySet, reqContent,
         EntityProviderException.INVALID_INLINE_CONTENT.addContent("xml data"));
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java
index b6e1f8f..9cc296e 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/AtomEntryProducerTest.java
@@ -701,6 +701,98 @@ public class AtomEntryProducerTest extends AbstractProviderTest {
     assertXpathExists("/a:entry/a:link[@title='ne_Manager']", xmlString);
   }
 
+  @Test
+  public void serializeWithCustomSrcAttributeOnEmployee() throws Exception {
+    AtomEntityProvider ser = createAtomEntityProvider();
+    Map<String, Object> localEmployeeData = new HashMap<String, Object>(employeeData);
+    String mediaResourceSourceKey = "~src";
+    localEmployeeData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+    EntityProviderWriteProperties localProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+            ).build();
+    ODataResponse response =
+        ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"),
+            localEmployeeData,
+            localProperties);
+    String xmlString = verifyResponse(response);
+
+    assertXpathExists(
+        "/a:entry/a:link[@href=\"Employees('1')/$value\" and" +
+            " @rel=\"edit-media\" and @type=\"application/octet-stream\"]", xmlString);
+    assertXpathExists("/a:entry/a:content[@type=\"application/octet-stream\"]", xmlString);
+    assertXpathExists("/a:entry/a:content[@src=\"http://localhost:8080/images/image1\"]", xmlString);
+  }
+
+  @Test
+  public void serializeWithCustomSrcAndTypeAttributeOnEmployee() throws Exception {
+    AtomEntityProvider ser = createAtomEntityProvider();
+    Map<String, Object> localEmployeeData = new HashMap<String, Object>(employeeData);
+    String mediaResourceSourceKey = "~src";
+    localEmployeeData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+    String mediaResourceTypeKey = "~type";
+    localEmployeeData.put(mediaResourceTypeKey, "image/jpeg");
+    EntityProviderWriteProperties localProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+            ).mediaResourceTypeKey(mediaResourceTypeKey).build();
+    ODataResponse response =
+        ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"),
+            localEmployeeData,
+            localProperties);
+    String xmlString = verifyResponse(response);
+
+    assertXpathExists(
+        "/a:entry/a:link[@href=\"Employees('1')/$value\" and" +
+            " @rel=\"edit-media\" and @type=\"image/jpeg\"]", xmlString);
+    assertXpathExists("/a:entry/a:content[@type=\"image/jpeg\"]", xmlString);
+    assertXpathExists("/a:entry/a:content[@src=\"http://localhost:8080/images/image1\"]", xmlString);
+  }
+
+  @Test
+  public void serializeWithCustomSrcAttributeOnRoom() throws Exception {
+    AtomEntityProvider ser = createAtomEntityProvider();
+    Map<String, Object> localRoomData = new HashMap<String, Object>(roomData);
+    String mediaResourceSourceKey = "~src";
+    localRoomData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+    EntityProviderWriteProperties localProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+            ).build();
+    ODataResponse response =
+        ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"),
+            localRoomData,
+            localProperties);
+    String xmlString = verifyResponse(response);
+
+    assertXpathNotExists(
+        "/a:entry/a:link[@href=\"Rooms('1')/$value\" and" +
+            " @rel=\"edit-media\" and @type=\"application/octet-stream\"]", xmlString);
+    assertXpathNotExists("/a:entry/a:content[@type=\"application/octet-stream\"]", xmlString);
+    assertXpathNotExists("/a:entry/a:content[@src=\"http://localhost:8080/images/image1\"]", xmlString);
+  }
+
+  @Test
+  public void serializeWithCustomSrcAndTypeAttributeOnRoom() throws Exception {
+    AtomEntityProvider ser = createAtomEntityProvider();
+    Map<String, Object> localRoomData = new HashMap<String, Object>(roomData);
+    String mediaResourceSourceKey = "~src";
+    localRoomData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+    String mediaResourceTypeKey = "~type";
+    localRoomData.put(mediaResourceTypeKey, "image/jpeg");
+    EntityProviderWriteProperties localProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+            ).mediaResourceTypeKey(mediaResourceTypeKey).build();
+    ODataResponse response =
+        ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"),
+            localRoomData,
+            localProperties);
+    String xmlString = verifyResponse(response);
+
+    assertXpathNotExists(
+        "/a:entry/a:link[@href=\"Rooms('1')/$value\" and" +
+            " @rel=\"edit-media\" and @type=\"image/jpeg\"]", xmlString);
+    assertXpathNotExists("/a:entry/a:content[@type=\"image/jpeg\"]", xmlString);
+    assertXpathNotExists("/a:entry/a:content[@src=\"http://localhost:8080/images/image1\"]", xmlString);
+  }
+
   private void verifyTagOrdering(final String xmlString, final String... toCheckTags) {
     XMLUnitHelper.verifyTagOrdering(xmlString, toCheckTags);
   }


[2/3] Enhance Media Resource Handling

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
index b10c68e..0ce9980 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonEntryEntityProducerTest.java
@@ -23,14 +23,17 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Calendar;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.TimeZone;
 
 import org.apache.olingo.odata2.api.ODataCallback;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
@@ -54,6 +57,7 @@ import org.junit.Test;
 import org.mockito.Mockito;
 
 import com.google.gson.Gson;
+import com.google.gson.internal.StringMap;
 
 /**
  *  
@@ -71,12 +75,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
     teamData.put("isScrumTeam", true);
 
     final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, teamData, DEFAULT_PROPERTIES);
-    assertNotNull(response);
-    assertNotNull(response.getEntity());
-    assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
-    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
-    assertNotNull(json);
+    final String json = verifyResponse(response);
     assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Teams('1')\","
         + "\"uri\":\"" + BASE_URI + "Teams('1')\",\"type\":\"RefScenario.Team\"},"
         + "\"Id\":\"1\",\"Name\":null,\"isScrumTeam\":true,"
@@ -111,12 +110,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
 
     final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, buildingData,
         EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node).build());
-    assertNotNull(response);
-    assertNotNull(response.getEntity());
-    assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
-    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
-    assertNotNull(json);
+    final String json = verifyResponse(response);
     assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Buildings('1')\","
         + "\"uri\":\"" + BASE_URI + "Buildings('1')\",\"type\":\"RefScenario.Building\"},"
         + "\"nb_Rooms\":{\"__deferred\":{\"uri\":\"" + BASE_URI + "Buildings('1')/nb_Rooms\"}}}}",
@@ -130,15 +124,12 @@ public class JsonEntryEntityProducerTest extends BaseTest {
     photoData.put("Id", 1);
     photoData.put("Type", "image/png");
     photoData.put("BinaryData", new byte[] { -1, 0, 1, 2 });
-    photoData.put("getType", "image/png");
 
-    final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, photoData, DEFAULT_PROPERTIES);
-    assertNotNull(response);
-    assertNotNull(response.getEntity());
-    assertNull("EntitypProvider must not set content header", response.getContentHeader());
+    EntityProviderWriteProperties writeProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceTypeKey("Type").build();
 
-    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
-    assertNotNull(json);
+    final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, photoData, writeProperties);
+    final String json = verifyResponse(response);
     assertEquals("{\"d\":{\"__metadata\":{"
         + "\"id\":\"" + BASE_URI + "Container2.Photos(Id=1,Type='image%2Fpng')\","
         + "\"uri\":\"" + BASE_URI + "Container2.Photos(Id=1,Type='image%2Fpng')\","
@@ -162,14 +153,13 @@ public class JsonEntryEntityProducerTest extends BaseTest {
     ExpandSelectTreeNode node = Mockito.mock(ExpandSelectTreeNode.class);
     Mockito.when(node.getProperties()).thenReturn(Arrays.asList(property));
 
-    final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, employeeData,
-        EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node).build());
-    assertNotNull(response);
-    assertNotNull(response.getEntity());
-    assertNull("EntitypProvider must not set content header", response.getContentHeader());
+    EntityProviderWriteProperties writeProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceTypeKey("getImageType")
+            .serviceRoot(URI.create(BASE_URI)).expandSelectTree(node).build();
 
-    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
-    assertNotNull(json);
+    final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, employeeData,
+        writeProperties);
+    final String json = verifyResponse(response);
     assertEquals("{\"d\":{\"__metadata\":{"
         + "\"id\":\"" + BASE_URI + "Employees('1')\","
         + "\"uri\":\"" + BASE_URI + "Employees('1')\","
@@ -303,12 +293,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
         new JsonEntityProvider().writeEntry(entitySet, roomData,
             EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
                 .callbacks(callbacks).build());
-    assertNotNull(response);
-    assertNotNull(response.getEntity());
-    assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
-    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
-    assertNotNull(json);
+    final String json = verifyResponse(response);
     assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Rooms('1')\","
         + "\"uri\":\"" + BASE_URI + "Rooms('1')\",\"type\":\"RefScenario.Room\",\"etag\":\"W/\\\"1\\\"\"},"
         + "\"nr_Building\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Buildings('1')\","
@@ -333,12 +318,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
 
     final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, roomData,
         EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).build());
-    assertNotNull(response);
-    assertNotNull(response.getEntity());
-    assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
-    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
-    assertNotNull(json);
+    final String json = verifyResponse(response);
     assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Rooms('1')\","
         + "\"uri\":\"" + BASE_URI + "Rooms('1')\",\"type\":\"RefScenario.Room\",\"etag\":\"W/\\\"1\\\"\"},"
         + "\"nr_Building\":{\"__deferred\":{\"uri\":\"" + BASE_URI + "Rooms('1')/nr_Building\"}}}}",
@@ -402,12 +382,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
         new JsonEntityProvider().writeEntry(entitySet, buildingData,
             EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1)
                 .callbacks(callbacks).build());
-    assertNotNull(response);
-    assertNotNull(response.getEntity());
-    assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
-    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
-    assertNotNull(json);
+    final String json = verifyResponse(response);
     assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Buildings('1')\","
         + "\"uri\":\"" + BASE_URI + "Buildings('1')\",\"type\":\"RefScenario.Building\"},"
         + "\"nb_Rooms\":{\"results\":[{\"__metadata\":{\"id\":\"" + BASE_URI + "Rooms('1')\","
@@ -526,12 +501,7 @@ public class JsonEntryEntityProducerTest extends BaseTest {
 
     final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, buildingData,
         EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).build());
-    assertNotNull(response);
-    assertNotNull(response.getEntity());
-    assertNull("EntitypProvider must not set content header", response.getContentHeader());
-
-    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
-    assertNotNull(json);
+    final String json = verifyResponse(response);
     assertEquals("{\"d\":{\"__metadata\":{\"id\":\"" + BASE_URI + "Buildings('1')\","
         + "\"uri\":\"" + BASE_URI + "Buildings('1')\",\"type\":\"RefScenario.Building\"},"
         + "\"nb_Rooms\":{\"__deferred\":{\"uri\":\"" + BASE_URI + "Buildings('1')/nb_Rooms\"}}}}",
@@ -556,6 +526,173 @@ public class JsonEntryEntityProducerTest extends BaseTest {
     new JsonEntityProvider().writeEntry(entitySet, buildingData,
         EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).expandSelectTree(node1).callbacks(callbacks)
             .build());
+  }
+
+  @SuppressWarnings("unchecked")
+  @Test
+  public void serializeWithCustomSrcAttributeOnEmployee() throws Exception {
+    Map<String, Object> employeeData = new HashMap<String, Object>();
+
+    Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+    date.clear();
+    date.set(1999, 0, 1);
+
+    employeeData.put("EmployeeId", "1");
+    employeeData.put("ImmageUrl", null);
+    employeeData.put("ManagerId", "1");
+    employeeData.put("Age", new Integer(52));
+    employeeData.put("RoomId", "1");
+    employeeData.put("EntryDate", date);
+    employeeData.put("TeamId", "42");
+    employeeData.put("EmployeeName", "Walter Winter");
+
+    Map<String, Object> locationData = new HashMap<String, Object>();
+    Map<String, Object> cityData = new HashMap<String, Object>();
+    cityData.put("PostalCode", "33470");
+    cityData.put("CityName", "Duckburg");
+    locationData.put("City", cityData);
+    locationData.put("Country", "Calisota");
+
+    employeeData.put("Location", locationData);
+
+    String mediaResourceSourceKey = "~src";
+    employeeData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+    EntityProviderWriteProperties localProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+            ).build();
+    ODataResponse response =
+        new JsonEntityProvider().writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet(
+            "Employees"),
+            employeeData,
+            localProperties);
+    String jsonString = verifyResponse(response);
+    Gson gson = new Gson();
+    StringMap<Object> jsonMap = gson.fromJson(jsonString, StringMap.class);
+    jsonMap = (StringMap<Object>) jsonMap.get("d");
+    jsonMap = (StringMap<Object>) jsonMap.get("__metadata");
+
+    assertEquals("http://localhost:8080/images/image1", jsonMap.get("media_src"));
+    assertEquals("application/octet-stream", jsonMap.get("content_type"));
+    assertEquals("http://host:80/service/Employees('1')/$value", jsonMap.get("edit_media"));
+  }
+
+  @SuppressWarnings("unchecked")
+  @Test
+  public void serializeWithCustomSrcAndTypeAttributeOnEmployee() throws Exception {
+    Map<String, Object> employeeData = new HashMap<String, Object>();
+
+    Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+    date.clear();
+    date.set(1999, 0, 1);
+
+    employeeData.put("EmployeeId", "1");
+    employeeData.put("ImmageUrl", null);
+    employeeData.put("ManagerId", "1");
+    employeeData.put("Age", new Integer(52));
+    employeeData.put("RoomId", "1");
+    employeeData.put("EntryDate", date);
+    employeeData.put("TeamId", "42");
+    employeeData.put("EmployeeName", "Walter Winter");
+
+    Map<String, Object> locationData = new HashMap<String, Object>();
+    Map<String, Object> cityData = new HashMap<String, Object>();
+    cityData.put("PostalCode", "33470");
+    cityData.put("CityName", "Duckburg");
+    locationData.put("City", cityData);
+    locationData.put("Country", "Calisota");
+
+    employeeData.put("Location", locationData);
+    String mediaResourceSourceKey = "~src";
+    employeeData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+    String mediaResourceTypeKey = "~type";
+    employeeData.put(mediaResourceTypeKey, "image/jpeg");
+    EntityProviderWriteProperties localProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+            ).mediaResourceTypeKey(mediaResourceTypeKey).build();
+    ODataResponse response =
+        new JsonEntityProvider().writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet(
+            "Employees"),
+            employeeData,
+            localProperties);
+    String jsonString = verifyResponse(response);
+
+    Gson gson = new Gson();
+    StringMap<Object> jsonMap = gson.fromJson(jsonString, StringMap.class);
+    jsonMap = (StringMap<Object>) jsonMap.get("d");
+    jsonMap = (StringMap<Object>) jsonMap.get("__metadata");
+
+    assertEquals("http://localhost:8080/images/image1", jsonMap.get("media_src"));
+    assertEquals("image/jpeg", jsonMap.get("content_type"));
+    assertEquals("http://host:80/service/Employees('1')/$value", jsonMap.get("edit_media"));
+  }
+
+  @SuppressWarnings("unchecked")
+  @Test
+  public void serializeWithCustomSrcAttributeOnRoom() throws Exception {
+    Map<String, Object> roomData = new HashMap<String, Object>();
+    roomData.put("Id", "1");
+    roomData.put("Name", "Neu Schwanstein");
+    roomData.put("Seats", new Integer(20));
+    roomData.put("Version", new Integer(3));
+
+    String mediaResourceSourceKey = "~src";
+    roomData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+    EntityProviderWriteProperties localProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+            ).build();
+    ODataResponse response =
+        new JsonEntityProvider().writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"),
+            roomData,
+            localProperties);
+    String jsonString = verifyResponse(response);
+    Gson gson = new Gson();
+    StringMap<Object> jsonMap = gson.fromJson(jsonString, StringMap.class);
+    jsonMap = (StringMap<Object>) jsonMap.get("d");
+    jsonMap = (StringMap<Object>) jsonMap.get("__metadata");
+
+    assertNull(jsonMap.get("media_src"));
+    assertNull(jsonMap.get("content_type"));
+    assertNull(jsonMap.get("edit_media"));
+  }
+
+  @SuppressWarnings("unchecked")
+  @Test
+  public void serializeWithCustomSrcAndTypeAttributeOnRoom() throws Exception {
+    Map<String, Object> roomData = new HashMap<String, Object>();
+    roomData.put("Id", "1");
+    roomData.put("Name", "Neu Schwanstein");
+    roomData.put("Seats", new Integer(20));
+    roomData.put("Version", new Integer(3));
+
+    String mediaResourceSourceKey = "~src";
+    roomData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
+    String mediaResourceTypeKey = "~type";
+    roomData.put(mediaResourceTypeKey, "image/jpeg");
+    EntityProviderWriteProperties localProperties =
+        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).mediaResourceSourceKey(mediaResourceSourceKey
+            ).mediaResourceTypeKey(mediaResourceTypeKey).build();
+    ODataResponse response =
+        new JsonEntityProvider().writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"),
+            roomData,
+            localProperties);
+    String jsonString = verifyResponse(response);
+    Gson gson = new Gson();
+    StringMap<Object> jsonMap = gson.fromJson(jsonString, StringMap.class);
+    jsonMap = (StringMap<Object>) jsonMap.get("d");
+    jsonMap = (StringMap<Object>) jsonMap.get("__metadata");
+
+    assertNull(jsonMap.get("media_src"));
+    assertNull(jsonMap.get("content_type"));
+    assertNull(jsonMap.get("edit_media"));
+  }
 
+  private String verifyResponse(final ODataResponse response) throws IOException {
+    assertNotNull(response);
+    assertNotNull(response.getEntity());
+    assertNull("EntitypProvider must not set content header", response.getContentHeader());
+
+    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
+    assertNotNull(json);
+    return json;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java
index 001e7f1..97314fd 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFunctionImportTest.java
@@ -131,7 +131,7 @@ public class JsonFunctionImportTest extends BaseTest {
         MockFacade.getMockEdm().getDefaultEntityContainer().getFunctionImport("OldestEmployee");
     final String uri = "http://host:80/service/";
     final EntityProviderWriteProperties properties =
-        EntityProviderWriteProperties.serviceRoot(URI.create(uri)).build();
+        EntityProviderWriteProperties.serviceRoot(URI.create(uri)).mediaResourceTypeKey("getImageType").build();
     Map<String, Object> employeeData = new HashMap<String, Object>();
     employeeData.put("EmployeeId", "1");
     employeeData.put("getImageType", "image/jpeg");

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java
index 553857f..6c0f7ab 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/MessageServiceTest.java
@@ -42,7 +42,7 @@ public class MessageServiceTest extends BaseTest {
 
     assertEquals(
         "MessageService could not be created because of exception 'IllegalArgumentException with message " +
-        "'Parameter locale MUST NOT be NULL.'.",
+            "'Parameter locale MUST NOT be NULL.'.",
         ms.getText());
   }
 
@@ -71,7 +71,7 @@ public class MessageServiceTest extends BaseTest {
 
     assertEquals(
         "Missing replacement for place holder in value 'First was [%1$s] and second was [%2$s]!' " +
-        "for following arguments '[first]'!",
+            "for following arguments '[first]'!",
         ms.getText());
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java
index 28d5c97..9c63ef2 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/exception/ODataMessageTextVerifierTest.java
@@ -48,14 +48,14 @@ public class ODataMessageTextVerifierTest extends BaseTest {
     assertEquals(
         "Error",
         "Error-->Messagetext for key:\"org.apache.olingo.odata2.testutil.mock.SampleClassForInvalidMessageReferences." +
-        "DOES_NOT_EXIST\" missing",
+            "DOES_NOT_EXIST\" missing",
         ec.get(0).getMessage());
 
     assertNotNull("!!!Error in testtool", ec.get(1));
     assertEquals(
         "Error",
         "Error-->Messagetext for key:\"org.apache.olingo.odata2.testutil.mock.SampleClassForInvalidMessageReferences." +
-        "EXITS_BUT_EMPTY\" empty",
+            "EXITS_BUT_EMPTY\" empty",
         ec.get(1).getMessage());
 
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
index 5c97db2..0e6c50e 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreatorImplTest.java
@@ -164,10 +164,10 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
   @Test
   public void deepLinkInSelectAndExpand() throws Exception {
     // {"all":false,"properties":[],"links":[{"ne_Room":{"all":false,"properties":[],
-    //"links":[{"nr_Employees":{"all":true,"properties":[],"links":[]}}]}}]}
+    // "links":[{"nr_Employees":{"all":true,"properties":[],"links":[]}}]}}]}
     String expected =
         "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Room\":{\"all\":false," +
-        "\"properties\":[],\"links\":[{\"nr_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
+            "\"properties\":[],\"links\":[{\"nr_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
 
     // $select=ne_Room/nr_Employees&$expand=ne_Room,ne_Manager,ne_Room/nr_Employees,ne_Room/nr_Building
     String actual =
@@ -200,8 +200,8 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
   @Test
   public void complexSelectExpand() throws Exception {
     // {"all":false,"properties":["Age"],"links":[{"ne_Room":{"all":false,"properties":["Seats"],
-    //"links":[]}},{"ne_Team":null},{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Team":{"all":true,
-    //"properties":[],"links":[{"nt_Employees":{"all":true,"properties":[],"links":[]}}]}}]}}]}
+    // "links":[]}},{"ne_Team":null},{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Team":{"all":true,
+    // "properties":[],"links":[{"nt_Employees":{"all":true,"properties":[],"links":[]}}]}}]}}]}
 
     String select = "Age,ne_Room/Seats,ne_Team/Name,ne_Manager/*,ne_Manager/ne_Team,ne_Team";
     String expand = "ne_Room/nr_Building,ne_Manager/ne_Team/nt_Employees,ne_Manager/ne_Room";
@@ -225,7 +225,7 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
         ExpandSelectTreeNodeImpl managerNode = (ExpandSelectTreeNodeImpl) links.get(navPropertyName);
         String expected =
             "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Team\":{\"all\":true,\"properties\":[]," +
-            "\"links\":[{\"nt_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
+                "\"links\":[{\"nt_Employees\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
         String actualString = managerNode.toJsonString();
         assertEquals(expected, actualString);
       } else {
@@ -317,10 +317,10 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
   @Test
   public void multiExpandLinkWithoutSelect() throws Exception {
     // {"all":true,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],
-    //"links":[{"ne_Manager":{"all":true,"properties":[],"links":[]}}]}}]}
+    // "links":[{"ne_Manager":{"all":true,"properties":[],"links":[]}}]}}]}
     String expected =
         "{\"all\":true,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[]," +
-        "\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
+            "\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
 
     // $expand=ne_Manager/ne_Manager,ne_Manager
     String actual = getExpandSelectTree(null, "ne_Manager/ne_Manager,ne_Manager").toJsonString();
@@ -344,11 +344,11 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
   @Test
   public void oneSelectDeepExpand() throws Exception {
     // {"all":false,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[{
-    //"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}}]}}]}
+    // "ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}}]}}]}
     String expected =
         "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[]," +
-        "\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true," +
-        "\"properties\":[],\"links\":[]}}]}}]}}]}";
+            "\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true," +
+            "\"properties\":[],\"links\":[]}}]}}]}}]}";
 
     // $select=ne_Manager $expand=ne_Manager/ne_Room/nr_Building
     String actual = getExpandSelectTree("ne_Manager", "ne_Manager/ne_Room/nr_Building").toJsonString();
@@ -373,7 +373,7 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
     // {"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
     String expected =
         "{\"all\":false,\"properties\":[\"EmployeeId\"],\"links\":[{\"ne_Room\":{\"all\":true," +
-        "\"properties\":[],\"links\":[]}}]}";
+            "\"properties\":[],\"links\":[]}}]}";
 
     // $select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
     String actual = getExpandSelectTree("EmployeeId,ne_Room/*", "ne_Room/nr_Building").toJsonString();
@@ -390,7 +390,7 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
     // {"all":false,"properties":["EmployeeId"],"links":[{"ne_Room":{"all":true,"properties":[],"links":[]}}]}
     String expected =
         "{\"all\":false,\"properties\":[\"EmployeeId\"],\"links\":[{\"ne_Room\":{\"all\":false," +
-        "\"properties\":[\"Id\"],\"links\":[]}}]}";
+            "\"properties\":[\"Id\"],\"links\":[]}}]}";
 
     // $select=EmployeeId,ne_Room/* $expand=ne_Room/nr_Building
     String actual = getExpandSelectTree("EmployeeId,ne_Room/Id", "ne_Room/nr_Building").toJsonString();
@@ -421,12 +421,12 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
   public void twoExpandsTwoSelects() throws Exception {
 
     // {"all":false,"properties":[],"links":[{"ne_Manager":{"all":false,"properties":["EmployeeId"],
-    //"links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],
-    //"links":[]}}]}}]}}]}
+    // "links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],
+    // "links":[]}}]}}]}}]}
     String expected =
         "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":false,\"properties\":[\"EmployeeId\"]," +
-        "\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true," +
-        "\"properties\":[],\"links\":[]}}]}}]}}]}";
+            "\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true," +
+            "\"properties\":[],\"links\":[]}}]}}]}}]}";
 
     // $select=ne_Manager/EmployeeId,ne_Manager/ne_Room $expand=ne_Manager/ne_Room/nr_Building
     String actual =
@@ -445,16 +445,16 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
   public void twoExpandsTest() throws Exception {
 
     // {"all":false,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],
-    //"links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],
-    //"links":[]}}]}},{"ne_Team":{"all":true,"properties":[],"links":[]}}]}}]}
+    // "links":[{"ne_Room":{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],
+    // "links":[]}}]}},{"ne_Team":{"all":true,"properties":[],"links":[]}}]}}]}
     String expected1 =
         "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[]," +
-        "\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true," +
-        "\"properties\":[],\"links\":[]}}]}},{\"ne_Team\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
+            "\"links\":[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true," +
+            "\"properties\":[],\"links\":[]}}]}},{\"ne_Team\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}";
     String expected2 =
         "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[]," +
-        "\"links\":[{\"ne_Team\":{\"all\":true,\"properties\":[],\"links\":[]}},{\"ne_Room\":{\"all\":true," +
-        "\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}}]}";
+            "\"links\":[{\"ne_Team\":{\"all\":true,\"properties\":[],\"links\":[]}},{\"ne_Room\":{\"all\":true," +
+            "\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":[],\"links\":[]}}]}}]}}]}";
 
     // $select=ne_Manager $expand=ne_Manager/ne_Room/nr_Building,ne_Manager/ne_Team
     String actual =
@@ -490,11 +490,11 @@ public class ExpandSelectTreeCreatorImplTest extends BaseTest {
   public void oneExpandsFourSelects() throws Exception {
 
     // {"all":false,"properties":[],"links":[{"ne_Manager":{"all":true,"properties":[],"links":[{"ne_Room":
-    //{"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}}]}}]}
+    // {"all":true,"properties":[],"links":[{"nr_Building":{"all":true,"properties":[],"links":[]}}]}}]}}]}
     String expected =
         "{\"all\":false,\"properties\":[],\"links\":[{\"ne_Manager\":{\"all\":true,\"properties\":[],\"links\":" +
-        "[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":" +
-        "[],\"links\":[]}}]}}]}}]}";
+            "[{\"ne_Room\":{\"all\":true,\"properties\":[],\"links\":[{\"nr_Building\":{\"all\":true,\"properties\":" +
+            "[],\"links\":[]}}]}}]}}]}";
 
     // $select=ne_Manager/EmployeeId,ne_Manager/ne_Room/Id,ne_Manager/ne_Room/nr_Building/Id,ne_Manager
     // $expand=ne_Manager/ne_Room/nr_Building

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java
index 7fdab60..4952a32 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestAbapCompatibility.java
@@ -392,7 +392,7 @@ public class TestAbapCompatibility extends TestBase {
     GetPTF("concat('125')")
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"concat('125')\" with the " +
-            "specified arguments. Method \"concat\" requires 2 or more arguments.");
+                "specified arguments. Method \"concat\" requires 2 or more arguments.");
 
     // lcl_helper=>veri_expression_ex(
     // iv_expression = `indexof('a','b','c')`
@@ -401,7 +401,7 @@ public class TestAbapCompatibility extends TestBase {
     GetPTF("indexof('a','b','c')")
         .aExMsgText(
             "No applicable method found for \"indexof\" at position 1 in \"indexof('a','b','c')\" with " +
-            "the specified arguments. Method \"indexof\" requires exact 2 argument(s).");
+                "the specified arguments. Method \"indexof\" requires exact 2 argument(s).");
 
     // lcl_helper=>veri_expression_ex(
     // iv_expression = `replace('aBa','B','CCC')`

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
index 933bbb1..7cde803 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
@@ -94,19 +94,19 @@ public class TestParserExceptions extends TestBase {
     GetPTF(edmEtAllTypes, "'text' eq NotAProperty")
         .aExMsgText(
             "No property \"NotAProperty\" exists in type \"TecRefScenario.EtAllTypes\" at" +
-            " position 11 in \"'text' eq NotAProperty\".");
+                " position 11 in \"'text' eq NotAProperty\".");
 
     // CASE 3
     GetPTF(edmEtAllTypes, "Complex/NotAProperty")
         .aExMsgText(
             "No property \"NotAProperty\" exists in type \"TecRefScenario.CtAllTypes\" at" +
-            " position 9 in \"Complex/NotAProperty\".");
+                " position 9 in \"Complex/NotAProperty\".");
 
     // CASE 4
     GetPTF(edmEtAllTypes, "'text' eq Complex/NotAProperty")
         .aExMsgText(
             "No property \"NotAProperty\" exists in type \"TecRefScenario.CtAllTypes\" at " +
-            "position 19 in \"'text' eq Complex/NotAProperty\".");
+                "position 19 in \"'text' eq Complex/NotAProperty\".");
 
     // CASE 5
     GetPTF(edmEtAllTypes, "String/NotAProperty").aExMsgText(
@@ -146,7 +146,7 @@ public class TestParserExceptions extends TestBase {
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"startswith\" at position 1 in \"startswith()\" with the specified " +
-            "arguments. Method \"startswith\" requires exact 2 argument(s).");
+                "arguments. Method \"startswith\" requires exact 2 argument(s).");
 
     // CASE 13
     // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A')
@@ -156,7 +156,7 @@ public class TestParserExceptions extends TestBase {
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"startswith\" at position 1 in \"startswith('A')\" with the specified " +
-            "arguments. Method \"startswith\" requires exact 2 argument(s).");
+                "arguments. Method \"startswith\" requires exact 2 argument(s).");
 
     // CASE 14
     // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A','B')
@@ -171,18 +171,18 @@ public class TestParserExceptions extends TestBase {
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"startswith\" at position 1 in \"startswith('A','B','C')\" with the" +
-            " specified arguments. Method \"startswith\" requires exact 2 argument(s).");
+                " specified arguments. Method \"startswith\" requires exact 2 argument(s).");
 
     // CASE 16
     GetPTF("concat()")
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"concat()\" with the specified arguments." +
-            " Method \"concat\" requires 2 or more arguments.");
+                " Method \"concat\" requires 2 or more arguments.");
     // CASE 17
     GetPTF("concat('A')")
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"concat('A')\" with the specified " +
-            "arguments. Method \"concat\" requires 2 or more arguments.");
+                "arguments. Method \"concat\" requires 2 or more arguments.");
     // CASE 18
     GetPTF("concat('A','B')").aSerialized("{concat('A','B')}");
     // CASE 19
@@ -192,7 +192,7 @@ public class TestParserExceptions extends TestBase {
     GetPTF("'A' and concat('A')")
         .aExMsgText(
             "No applicable method found for \"concat\" at position 9 in \"'A' and concat('A')\" with the specified " +
-            "arguments. Method \"concat\" requires 2 or more arguments.");
+                "arguments. Method \"concat\" requires 2 or more arguments.");
 
     // CASE 1
     // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(
@@ -239,12 +239,12 @@ public class TestParserExceptions extends TestBase {
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX3()\" with the specified " +
-            "arguments. Method \"concat\" requires 2 or more arguments.");
+                "arguments. Method \"concat\" requires 2 or more arguments.");
     GetPTF("testingMINMAX3('A')")
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX3('A')\" with the specified " +
-            "arguments. Method \"concat\" requires 2 or more arguments.");
+                "arguments. Method \"concat\" requires 2 or more arguments.");
     GetPTF("testingMINMAX3('A','B')").aSerialized("{concat('A','B')}");
     GetPTF("testingMINMAX3('A','B','C')").aSerialized("{concat('A','B','C')}");
 
@@ -255,17 +255,17 @@ public class TestParserExceptions extends TestBase {
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A')\" with the specified " +
-            "arguments. Method \"concat\" requires maximal 0 arguments.");
+                "arguments. Method \"concat\" requires maximal 0 arguments.");
     GetPTF("testingMINMAX4('A','B')")
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A','B')\" with the " +
-            "specified arguments. Method \"concat\" requires maximal 0 arguments.");
+                "specified arguments. Method \"concat\" requires maximal 0 arguments.");
     GetPTF("testingMINMAX4('A','B','C')")
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A','B','C')\" with the " +
-            "specified arguments. Method \"concat\" requires maximal 0 arguments.");
+                "specified arguments. Method \"concat\" requires maximal 0 arguments.");
 
     // CASE 9
     // min =-1, max = 2,
@@ -276,7 +276,7 @@ public class TestParserExceptions extends TestBase {
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX5('A','B','C')\" with the " +
-            "specified arguments. Method \"concat\" requires maximal 2 arguments.");
+                "specified arguments. Method \"concat\" requires maximal 2 arguments.");
 
     // CASE 10
     // min =1, max = 2,
@@ -284,14 +284,14 @@ public class TestParserExceptions extends TestBase {
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX6()\" with the specified " +
-            "arguments. Method \"concat\" requires between 1 and 2 arguments.");
+                "arguments. Method \"concat\" requires between 1 and 2 arguments.");
     GetPTF("testingMINMAX6('A')").aSerialized("{concat('A')}");
     GetPTF("testingMINMAX6('A','B')").aSerialized("{concat('A','B')}");
     GetPTF("testingMINMAX6('A','B','C')")
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX6('A','B','C')\" with the " +
-            "specified arguments. Method \"concat\" requires between 1 and 2 arguments.");
+                "specified arguments. Method \"concat\" requires between 1 and 2 arguments.");
 
     // CASE 11
     // min =1, max = 2,
@@ -299,18 +299,18 @@ public class TestParserExceptions extends TestBase {
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX7()\" with the specified " +
-            "arguments. Method \"concat\" requires exact 1 argument(s).");
+                "arguments. Method \"concat\" requires exact 1 argument(s).");
     GetPTF("testingMINMAX7('A')").aSerialized("{concat('A')}");
     GetPTF("testingMINMAX7('A','B')")
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX7('A','B')\" with the " +
-            "specified arguments. Method \"concat\" requires exact 1 argument(s).");
+                "specified arguments. Method \"concat\" requires exact 1 argument(s).");
     GetPTF("testingMINMAX7('A','B','C')")
         .aExType(ExpressionParserException.class)
         .aExMsgText(
             "No applicable method found for \"concat\" at position 1 in \"testingMINMAX7('A','B','C')\" with " +
-            "the specified arguments. Method \"concat\" requires exact 1 argument(s).");
+                "the specified arguments. Method \"concat\" requires exact 1 argument(s).");
 
     // CASE 12
     // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat('a' 'b')
@@ -342,7 +342,7 @@ public class TestParserExceptions extends TestBase {
         .aExKey(ExpressionParserException.INVALID_TYPES_FOR_BINARY_OPERATOR)
         .aExMsgText(
             "Operator \"add\" incompatible with operand types \"System.Uint7\" and \"Edm.String\" at " +
-            "position 5 in \"123 add 'abc'\".");
+                "position 5 in \"123 add 'abc'\".");
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
index c2b3ced..66af755 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
@@ -112,7 +112,7 @@ public class VisitorTool implements ExpressionVisitor {
   }
 
   @Override
-  public Object visitOrder(final OrderExpression orderExpression, final Object filterResult, 
+  public Object visitOrder(final OrderExpression orderExpression, final Object filterResult,
       final SortOrder sortOrder) {
     return "{o(" + filterResult + ", " + sortOrder.toString() + ")}";
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java
index 33b2e82..ac77a6b 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/AcceptHeaderTypeTest.java
@@ -163,7 +163,7 @@ public class AcceptHeaderTypeTest extends AbstractBasicTest {
 
   @Test
   public void illegalLwsInAcceptHeaderParameter() throws Exception {
-    testGetRequest("Employees('1')", "application/xml; param=\talskdf;", HttpStatusCodes.BAD_REQUEST, 
+    testGetRequest("Employees('1')", "application/xml; param=\talskdf;", HttpStatusCodes.BAD_REQUEST,
         "application/xml");
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java
index 761a3b5..f11d93a 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/BasicBatchTest.java
@@ -68,7 +68,7 @@ public class BasicBatchTest extends AbstractBasicTest {
   private static final String LF = "\n";
   private static final String REG_EX_BOUNDARY =
       "(([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\(\\),/:=\\?]" +
-      "{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\")";
+          "{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\")";
   private static final String REG_EX = "multipart/mixed;\\s*boundary=" + REG_EX_BOUNDARY + "\\s*";
 
   private static final String REQUEST_PAYLOAD =

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
index f357602..f378715 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/basic/ServiceResolutionTest.java
@@ -254,8 +254,8 @@ public class ServiceResolutionTest extends BaseTest {
   }
 
   @Test
-  public void testBaseUriWithEncoding() throws ClientProtocolException, IOException, ODataException, 
-  URISyntaxException {
+  public void testBaseUriWithEncoding() throws ClientProtocolException, IOException, ODataException,
+      URISyntaxException {
     server.setPathSplit(3);
     startServer();
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java
index ded1086..26c7f58 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/mapping/MapProcessor.java
@@ -61,7 +61,7 @@ public class MapProcessor extends ODataSingleProcessor {
   }
 
   @Override
-  public ODataResponse readEntitySet(final GetEntitySetUriInfo uriInfo, final String contentType) 
+  public ODataResponse readEntitySet(final GetEntitySetUriInfo uriInfo, final String contentType)
       throws ODataException {
     final EntityProviderWriteProperties properties =
         EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).build();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
index e802b06..2404a25 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/AbstractRefTest.java
@@ -157,7 +157,7 @@ public class AbstractRefTest extends AbstractFitTest {
     assertNotNull(getBody(response));
   }
 
-  protected void deleteUri(final String uri, final HttpStatusCodes expectedStatusCode) 
+  protected void deleteUri(final String uri, final HttpStatusCodes expectedStatusCode)
       throws Exception, AssertionError {
     final HttpResponse response = callUri(ODataHttpMethod.DELETE, uri, null, null, null, null, expectedStatusCode);
     if (expectedStatusCode != HttpStatusCodes.NO_CONTENT) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
index e2bc613..55d9379 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryJsonReadOnlyTest.java
@@ -115,7 +115,7 @@ public class EntryJsonReadOnlyTest extends AbstractRefTest {
   public void entryWithTwoLevelInline() throws Exception {
     HttpResponse response =
         callUri("Employees('5')?$expand=ne_Room/nr_Building&$select=Age,ne_Room/Seats," +
-        		"ne_Room/nr_Building/Name&$format=json");
+            "ne_Room/nr_Building/Name&$format=json");
     checkMediaType(response, HttpContentType.APPLICATION_JSON);
     assertEquals("{\"d\":{\"__metadata\":{"
         + "\"id\":\"" + getEndpoint() + "Employees('5')\","
@@ -135,7 +135,7 @@ public class EntryJsonReadOnlyTest extends AbstractRefTest {
 
     response =
         callUri("Employees('1')?$expand=ne_Room/nr_Building&$select=EntryDate,ne_Manager,ne_Room/*," +
-        		"ne_Room/nr_Building/Name&$format=json");
+            "ne_Room/nr_Building/Name&$format=json");
     checkMediaType(response, HttpContentType.APPLICATION_JSON);
     assertEquals("{\"d\":{\"__metadata\":{"
         + "\"id\":\"" + getEndpoint() + "Employees('1')\","

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
index 3bb834c..50a9b47 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/EntryXmlReadOnlyTest.java
@@ -71,7 +71,7 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
     assertXpathEvaluatesTo(
         EMPLOYEE_1_NAME,
         "/atom:entry/atom:link[@href=\"Rooms('1')/nr_Employees\"]" +
-        "/m:inline/atom:feed/atom:entry/m:properties/d:EmployeeName",
+            "/m:inline/atom:feed/atom:entry/m:properties/d:EmployeeName",
         getBody(response));
 
     response = callUri("Container2.Photos(Id=1,Type='image%2Fpng')");
@@ -137,13 +137,13 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
     assertXpathEvaluatesTo(
         EMPLOYEE_5_NAME,
         "/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]" +
-        "/m:inline/atom:feed/atom:entry/m:properties/d:EmployeeName",
+            "/m:inline/atom:feed/atom:entry/m:properties/d:EmployeeName",
         body);
     assertXpathEvaluatesTo(
         EMPLOYEE_3_NAME,
         "/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]" +
-        "/m:inline/atom:feed/atom:entry/atom:link[@href=\"Employees('5')/ne_Manager\"]" +
-        "/m:inline/atom:entry/m:properties/d:EmployeeName",
+            "/m:inline/atom:feed/atom:entry/atom:link[@href=\"Employees('5')/ne_Manager\"]" +
+            "/m:inline/atom:entry/m:properties/d:EmployeeName",
         body);
 
     notFound("Employees('3')?$expand=noNavProp");
@@ -173,7 +173,7 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
     assertEquals(entry, getBody(callUri("Employees('6')?$select=*,ne_Room")));
 
     checkUri("Container2.Photos(Id=4,Type='foo')?$select=%D0%A1%D0%BE%D0%B4%D0%B5%D1%80%D0%B6" +
-    		"%D0%B0%D0%BD%D0%B8%D0%B5,Id");
+        "%D0%B0%D0%BD%D0%B8%D0%B5,Id");
 
     response = callUri("Employees('6')?$expand=ne_Room&$select=ne_Room/Version");
     checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=entry");
@@ -181,12 +181,12 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
     assertXpathEvaluatesTo(
         "2",
         "/atom:entry/atom:link[@href=\"Employees('6')/ne_Room\"]/m:inline/atom:entry/atom:content" +
-        "[@type=\"application/xml\"]/m:properties/d:Version",
+            "[@type=\"application/xml\"]/m:properties/d:Version",
         body);
     assertXpathNotExists("/atom:entry/m:properties/d:Location", body);
     assertXpathNotExists(
         "/atom:entry/atom:link[@href=\"Employees('6')/ne_Room\"]/m:inline/atom:entry/atom:content" +
-        "[@type=\"application/xml\"]/m:properties/d:Seats",
+            "[@type=\"application/xml\"]/m:properties/d:Seats",
         body);
 
     response = callUri("Rooms('3')?$expand=nr_Employees/ne_Team&$select=nr_Employees/ne_Team/Name");
@@ -195,14 +195,14 @@ public class EntryXmlReadOnlyTest extends AbstractRefXmlTest {
     assertXpathEvaluatesTo(
         "Team 2",
         "/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]/m:inline/atom:feed/atom:entry" +
-        "/atom:link[@href=\"Employees('5')/ne_Team\"]/m:inline/atom:entry/atom:content/m:properties/d:Name",
+            "/atom:link[@href=\"Employees('5')/ne_Team\"]/m:inline/atom:entry/atom:content/m:properties/d:Name",
         body);
     assertXpathNotExists("/atom:entry/atom:content/m:properties", body);
     assertXpathNotExists(
         "/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]/m:inline/atom:feed/atom:entry/m:properties", body);
     assertXpathNotExists(
         "/atom:entry/atom:link[@href=\"Rooms('3')/nr_Employees\"]/m:inline/atom:feed/atom:entry" +
-        "/atom:link[@href=\"Employees('5')/ne_Team\"]/m:inline/atom:entry/atom:content/m:properties/d:Id",
+            "/atom:link[@href=\"Employees('5')/ne_Team\"]/m:inline/atom:entry/atom:content/m:properties/d:Id",
         body);
 
     notFound("Teams('3')?$select=noProp");

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java
index 1d78e42..0658210 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedJsonReadOnlyTest.java
@@ -123,7 +123,7 @@ public class FeedJsonReadOnlyTest extends AbstractRefTest {
   public void feedWithTwoLevelInline() throws Exception {
     final HttpResponse response =
         callUri("Employees()?$expand=ne_Room/nr_Building&$select=Age,ne_Room/Seats,ne_Room/nr_Building/Name&" +
-        		"$top=2&$format=json");
+            "$top=2&$format=json");
     checkMediaType(response, HttpContentType.APPLICATION_JSON);
     assertEquals("{\"d\":{\"results\":[{\"__metadata\":{"
         + "\"id\":\"" + getEndpoint() + "Employees('1')\","

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7327a0b4/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java
index 93a30ca..ca1cb84 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/ref/FeedXmlReadOnlyTest.java
@@ -174,7 +174,7 @@ public class FeedXmlReadOnlyTest extends AbstractRefXmlTest {
 
     response =
         callUri("Employees?$filter=indexof(ImageUrl,EmployeeId)%20mod%20(Age%20sub%2028)%20eq%20month" +
-        		"(EntryDate)%20mul%203%20div%2027%20sub%201");
+            "(EntryDate)%20mul%203%20div%2027%20sub%201");
     checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=feed");
     body = getBody(response);
     assertXpathEvaluatesTo("1", "count(/atom:feed/atom:entry)", body);
@@ -210,7 +210,7 @@ public class FeedXmlReadOnlyTest extends AbstractRefXmlTest {
 
     checkUri("Employees('1')/ne_Room/nr_Employees('1')?$filter=EmployeeId%20eq%20'1'");
     checkUri("Container2.Photos(Id=4,Type='foo')?$filter=%D0%A1%D0%BE%D0%B4%D0%B5%D1%80%D0%B6%D0%B0%D0%BD%" +
-    		"D0%B8%D0%B5%20eq%20'%D0%9F%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82'");
+        "D0%B8%D0%B5%20eq%20'%D0%9F%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82'");
 
     notFound("Employees('4')?$filter=Age%20eq%2099");
     notFound("Rooms('1')/nr_Employees('1')?$filter=Age%20eq%2099");
@@ -249,12 +249,12 @@ public class FeedXmlReadOnlyTest extends AbstractRefXmlTest {
   public void nextLinkQueryOptions() throws Exception {
     final HttpResponse response =
         callUri("Rooms?$format=atom&$filter=true&$inlinecount=none&$orderby=Name&$skiptoken=1&$skip=0&$top=200" +
-        		"&$expand=nr_Building&$select=Seats");
+            "&$expand=nr_Building&$select=Seats");
     checkMediaType(response, HttpContentType.APPLICATION_ATOM_XML_UTF8 + ";type=feed");
     final String body = getBody(response);
     assertXpathEvaluatesTo(
         "Rooms?$format=atom&$filter=true&$inlinecount=none&$orderby=Name&$top=200&$expand=nr_Building" +
-        "&$select=Seats&$skiptoken=97",
+            "&$select=Seats&$skiptoken=97",
         "/atom:feed/atom:link[@rel='next']/@href", body);
   }