You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/01/13 14:12:03 UTC

[1/7] git commit: [OLINGO-56] - Enhance the Data Model and the mock data for the reference scenario.

Updated Branches:
  refs/heads/OLINGO-88_AnnotationArchetype 595981c09 -> e72d108bb


[OLINGO-56] - Enhance the Data Model and the mock data for the reference
scenario.


Signed-off-by: Chandan V A <ch...@sap.com>

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/2fb8b048
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/2fb8b048
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/2fb8b048

Branch: refs/heads/OLINGO-88_AnnotationArchetype
Commit: 2fb8b0484a3133ea530c50460bc7b853495735d0
Parents: 5d75f6a
Author: Chandan V A <ch...@sap.com>
Authored: Sat Jan 11 20:55:27 2014 +0530
Committer: Chandan V A <ch...@sap.com>
Committed: Sat Jan 11 20:55:27 2014 +0530

----------------------------------------------------------------------
 .../odata2/jpa/processor/ref/model/Address.java | 11 +++
 .../jpa/processor/ref/model/Category.java       | 68 ++++++++++++++++
 .../jpa/processor/ref/model/Customer.java       | 80 ++++++++++++++++++
 .../jpa/processor/ref/model/Material.java       | 22 ++++-
 .../processor/ref/model/SalesOrderHeader.java   | 86 ++++++++------------
 .../src/main/resources/META-INF/persistence.xml |  2 +
 .../extension/SalesOrderHeaderProcessor.java    |  2 +-
 .../extension/_SalesOrderHeaderProcessor.java   |  2 +-
 .../jpa/processor/ref/util/DataGenerator.java   |  4 +-
 .../main/resources/DataDeleteSQLs.properties    | 22 -----
 .../src/main/resources/MaterialSQLs.properties  | 30 -------
 .../src/main/resources/NoteSQLs.properties      | 20 -----
 .../main/resources/SQLInsertConfig.properties   | 22 -----
 .../src/main/resources/SQL_Cleanup.properties   | 22 +++++
 .../resources/SQL_Insert_Category.properties    | 22 +++++
 .../main/resources/SQL_Insert_Config.properties | 22 +++++
 .../resources/SQL_Insert_Customer.properties    | 23 ++++++
 .../resources/SQL_Insert_Material.properties    | 30 +++++++
 .../main/resources/SQL_Insert_Note.properties   | 20 +++++
 .../SQL_Insert_SalesOrderHeader.properties      | 30 +++++++
 .../SQL_Insert_SalesOrderItem.properties        | 30 +++++++
 .../main/resources/SQL_Insert_Store.properties  | 30 +++++++
 .../resources/SalesOrderHeaderSQLs.properties   | 30 -------
 .../resources/SalesOrderItemSQLs.properties     | 30 -------
 .../src/main/resources/StoreSQLs.properties     | 30 -------
 25 files changed, 448 insertions(+), 242 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
index a0aabcb..ab21848 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
@@ -48,6 +48,17 @@ public class Address {
 
   @Column(name = "COUNTRY")
   private String country;
+  
+  @Column(name = "PINCODE")
+  private String pincode;
+
+  public String getPincode() {
+    return pincode;
+  }
+
+  public void setPincode(String pincode) {
+    this.pincode = pincode;
+  }
 
   public short getHouseNumber() {
     return houseNumber;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
new file mode 100644
index 0000000..34891a7
--- /dev/null
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.ref.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "T_CATEGORY")
+public class Category {
+
+  @Id
+  @Column(name="CODE")
+  private char code[] = new char[2];
+
+  @Column(name="DESC")
+  private String description;
+
+  @OneToMany(mappedBy = "category")
+  private List<Material> materials = new ArrayList<Material>();
+
+  public List<Material> getMaterials() {
+    return materials;
+  }
+
+  public void setMaterials(List<Material> materials) {
+    this.materials = materials;
+  }
+
+  public char[] getCode() {
+    return code;
+  }
+
+  public void setCode(char[] code) {
+    this.code = code;
+  }
+
+  public String getDescription() {
+    return description;
+  }
+
+  public void setDescription(String description) {
+    this.description = description;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
new file mode 100644
index 0000000..c28e37e
--- /dev/null
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.ref.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "T_CUSTOMER")
+public class Customer {
+
+  @Id
+  @Column(name = "ID")
+  private Long id;
+
+  @Column(name = "NAME")
+  private String name;
+
+  @Embedded
+  private Address address;
+
+  @OneToMany(mappedBy = "customer")
+  private List<SalesOrderHeader> orders = new ArrayList<SalesOrderHeader>();
+
+  public Long getId() {
+    return id;
+  }
+
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public List<SalesOrderHeader> getOrders() {
+    return orders;
+  }
+
+  public void setOrders(List<SalesOrderHeader> orders) {
+    this.orders = orders;
+  }
+
+  public Address getAddress() {
+    return address;
+  }
+
+  public void setAddress(final Address address) {
+    this.address = address;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
index 6f08119..7330042 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
@@ -25,7 +25,9 @@ import java.util.List;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
 import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 
 @Entity
@@ -34,7 +36,7 @@ public class Material {
 
   public Material() {}
 
-  public Material(final String materialName, final String typeCode, final double price,
+  public Material(final String materialName, final char[] typeCode, final double price,
       final String measurementUnit) {
     super();
     this.materialName = materialName;
@@ -51,7 +53,7 @@ public class Material {
   private String materialName;
 
   @Column(name = "TYPE_CODE")
-  private String typeCode;
+  private char[] typeCode = new char[2];
 
   @Column(name = "PRICE")
   private double price;
@@ -62,6 +64,10 @@ public class Material {
   @ManyToMany
   private List<Store> stores = new ArrayList<Store>();
 
+  @ManyToOne
+  @JoinColumn(name = "TYPE_CODE", referencedColumnName = "CODE")
+  private Category category;
+
   public long getMaterialId() {
     return materialId;
   }
@@ -70,6 +76,14 @@ public class Material {
     this.materialId = materialId;
   }
 
+  public Category getCategory() {
+    return category;
+  }
+
+  public void setCategory(Category category) {
+    this.category = category;
+  }
+
   public String getMaterialName() {
     return materialName;
   }
@@ -78,11 +92,11 @@ public class Material {
     this.materialName = materialName;
   }
 
-  public String getTypeCode() {
+  public char[] getTypeCode() {
     return typeCode;
   }
 
-  public void setTypeCode(final String typeCode) {
+  public void setTypeCode(final char[] typeCode) {
     this.typeCode = typeCode;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
index 9af23f3..3ed1ee5 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
@@ -26,11 +26,11 @@ import java.util.List;
 import java.util.Set;
 import java.util.TimeZone;
 
-import javax.persistence.CascadeType;
 import javax.persistence.Column;
-import javax.persistence.Embedded;
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
 import javax.persistence.PostPersist;
 import javax.persistence.Table;
@@ -43,14 +43,10 @@ public class SalesOrderHeader {
 
   public SalesOrderHeader() {}
 
-  public SalesOrderHeader(final Calendar creationDate, final int buyerId, final String buyerName,
-      final Address buyerAddress, final String currencyCode, final double netAmount,
+  public SalesOrderHeader(final Calendar creationDate, final String currencyCode, final double netAmount,
       final String deliveryStatus, final char[] shortText, final Character[] longText) {
     super();
     this.creationDate = creationDate;
-    this.buyerId = buyerId;
-    this.buyerName = buyerName;
-    this.buyerAddress = buyerAddress;
     this.currencyCode = currencyCode;
     this.deliveryStatus = deliveryStatus;
     this.shortText = shortText;
@@ -67,29 +63,12 @@ public class SalesOrderHeader {
   @Column
   private Character status;
 
-  public Character getStatus() {
-    return status;
-  }
-
-  public void setStatus(final Character status) {
-    this.status = status;
-  }
-
   @Column(name = "SHORT_TEXT", length = 20)
   private char[] shortText;
 
   @Column(name = "LONG_TEXT", length = 40)
   private Character[] longText;
 
-  @Column(name = "BUYER_ID")
-  private int buyerId;
-
-  @Column(name = "BUYER_NAME", length = 255)
-  private String buyerName;
-
-  @Embedded
-  private Address buyerAddress;
-
   @Column(name = "CURRENCY_CODE", length = 3)
   private String currencyCode;
 
@@ -102,12 +81,43 @@ public class SalesOrderHeader {
   @Column(precision = 8)
   private double netAmount;
 
-  @OneToMany(mappedBy = "salesOrderHeader", cascade = CascadeType.ALL)
+  @Column(name = "CUST_ID")
+  private Long customerId;
+
+  @OneToMany(mappedBy = "salesOrderHeader")
   private Set<SalesOrderItem> salesOrderItem = new HashSet<SalesOrderItem>();
 
-  @OneToMany(mappedBy = "salesOrderHeader", cascade = CascadeType.ALL)
+  @OneToMany(mappedBy = "salesOrderHeader")
   private List<Note> notes = new ArrayList<Note>();
 
+  @ManyToOne
+  @JoinColumn(name = "CUST_ID", referencedColumnName = "ID", insertable = false, updatable = false)
+  private Customer customer;
+
+  public Long getCustomerId() {
+    return customerId;
+  }
+
+  public void setCustomerId(Long customerId) {
+    this.customerId = customerId;
+  }
+
+  public Customer getCustomer() {
+    return customer;
+  }
+
+  public void setCustomer(Customer customer) {
+    this.customer = customer;
+  }
+
+  public Character getStatus() {
+    return status;
+  }
+
+  public void setStatus(final Character status) {
+    this.status = status;
+  }
+
   public long getSoId() {
     return soId;
   }
@@ -138,30 +148,6 @@ public class SalesOrderHeader {
     this.creationDate = newCalendar;
   }
 
-  public int getBuyerId() {
-    return buyerId;
-  }
-
-  public void setBuyerId(final int buyerId) {
-    this.buyerId = buyerId;
-  }
-
-  public String getBuyerName() {
-    return buyerName;
-  }
-
-  public void setBuyerName(final String buyerName) {
-    this.buyerName = buyerName;
-  }
-
-  public Address getBuyerAddress() {
-    return buyerAddress;
-  }
-
-  public void setBuyerAddress(final Address buyerAddress) {
-    this.buyerAddress = buyerAddress;
-  }
-
   public String getCurrencyCode() {
     return currencyCode;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
index e71d834..b5ff286 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
+++ b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
@@ -20,6 +20,8 @@
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Note</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Material</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Store</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Category</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Customer</class>
 		<properties>
 			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
 			<property name="javax.persistence.jdbc.url"

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java
index 57549ee..5dc9017 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java
@@ -106,7 +106,7 @@ public class SalesOrderHeaderProcessor {
     List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q
         .getResultList();
     if (!soList.isEmpty()) {
-      return soList.get(0).getBuyerAddress();
+      return soList.get(0).getCustomer().getAddress();
     } else {
       return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java
index 4bc0a29..bfe0e89 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java
@@ -108,7 +108,7 @@ public class _SalesOrderHeaderProcessor {
     List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q
         .getResultList();
     if (!soList.isEmpty()) {
-      return soList.get(0).getBuyerAddress();
+      return soList.get(0).getCustomer().getAddress();
     } else {
       return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java
index 55eb876..e840119 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java
@@ -45,14 +45,14 @@ public class DataGenerator {
   /**
    * This is configuration property to hold comma separated names of Insert Files
    */
-  private static final String SQL_INSERT_CONFIG = "SQLInsertConfig";
+  private static final String SQL_INSERT_CONFIG = "SQL_Insert_Config";
 
   /**
    * This is key which will be used to fetch file names from SQL Insert Config File.
    */
   private static final String SQL_INSERT_FILE_NAMES_KEY = "insert_file_names";
 
-  private static final String SQL_DELETE_CONFIG = "DataDeleteSQLs";
+  private static final String SQL_DELETE_CONFIG = "SQL_Cleanup";
   private static final String SQL_DELETE_STATEMENTS_KEY = "delete_queries";
 
   public DataGenerator(final EntityManager entityManager) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/DataDeleteSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/DataDeleteSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/DataDeleteSQLs.properties
deleted file mode 100644
index 19f859d..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/DataDeleteSQLs.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-#        or more contributor license agreements.  See the NOTICE file
-#        distributed with this work for additional information
-#        regarding copyright ownership.  The ASF licenses this file
-#        to you under the Apache License, Version 2.0 (the
-#        "License"); you may not use this file except in compliance
-#        with the License.  You may obtain a copy of the License at
-# 
-#          http://www.apache.org/licenses/LICENSE-2.0
-# 
-#        Unless required by applicable law or agreed to in writing,
-#        software distributed under the License is distributed on an
-#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#        KIND, either express or implied.  See the License for the
-#        specific language governing permissions and limitations
-#        under the License.
-#-------------------------------------------------------------------------------
-
-#Config file for deleting the entities. They are deleted in the order provided in the below comma-separated string. 
-#It is mandatory due to referential constaints.
-delete_queries = DELETE FROM T_NOTE,DELETE FROM T_SALESORDERITEM,DELETE FROM T_MATERIAL_T_STORE,DELETE FROM T_MATERIAL,DELETE FROM T_STORE,DELETE FROM T_SALESORDERHEADER
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/MaterialSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/MaterialSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/MaterialSQLs.properties
deleted file mode 100644
index 0faf9ce..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/MaterialSQLs.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-#        or more contributor license agreements.  See the NOTICE file
-#        distributed with this work for additional information
-#        regarding copyright ownership.  The ASF licenses this file
-#        to you under the Apache License, Version 2.0 (the
-#        "License"); you may not use this file except in compliance
-#        with the License.  You may obtain a copy of the License at
-# 
-#          http://www.apache.org/licenses/LICENSE-2.0
-# 
-#        Unless required by applicable law or agreed to in writing,
-#        software distributed under the License is distributed on an
-#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#        KIND, either express or implied.  See the License for the
-#        specific language governing permissions and limitations
-#        under the License.
-#-------------------------------------------------------------------------------
-
-material_query_1 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(111, 'Test_Material_Name_1', 'Test_Type_Code_1', 111.1, 'Dollar');
-material_query_2 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(112, 'Test_Material_Name_2', 'Test_Type_Code_2', 112.1, 'Pound');
-material_query_3 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(113, 'Test_Material_Name_3', 'Test_Type_Code_3', 113.1, 'Yen');
-material_query_4 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(114, 'Test_Material_Name_4', 'Test_Type_Code_4', 114.1, 'Rupee');
-material_query_5 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(115, 'Test_Material_Name_5', 'Test_Type_Code_5', 115.1, 'Dollar');
-material_query_6 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(116, 'Test_Material_Name_6', 'Test_Type_Code_6', 116.1, 'Dollar');
-material_query_7 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(117, 'Test_Material_Name_7', 'Test_Type_Code_7', 117.1, 'Dollar');
-material_query_8 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(118, 'Test_Material_Name_8', 'Test_Type_Code_8', 118.1, 'Dollar');
-material_query_9 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(119, 'Test_Material_Name_9', 'Test_Type_Code_9', 119.1, 'Dollar');
-material_query_10 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(120, 'Test_Material_Name_10', 'Test_Type_Code_10', 120.1, 'Dollar');
-material_query_11 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(121, 'Test_Material_Name_11', 'Test_Type_Code_11', 121.1, 'Dollar');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/NoteSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/NoteSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/NoteSQLs.properties
deleted file mode 100644
index 347c37a..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/NoteSQLs.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-#        or more contributor license agreements.  See the NOTICE file
-#        distributed with this work for additional information
-#        regarding copyright ownership.  The ASF licenses this file
-#        to you under the Apache License, Version 2.0 (the
-#        "License"); you may not use this file except in compliance
-#        with the License.  You may obtain a copy of the License at
-# 
-#          http://www.apache.org/licenses/LICENSE-2.0
-# 
-#        Unless required by applicable law or agreed to in writing,
-#        software distributed under the License is distributed on an
-#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#        KIND, either express or implied.  See the License for the
-#        specific language governing permissions and limitations
-#        under the License.
-#-------------------------------------------------------------------------------
-
-note_query_1 = insert into T_NOTE (SO_ID , text, createdBy, creationDate,creationTime) values(2, 'Test_Note_1', 'CreatedBy_1','2013-01-01 00:00:00','00:00:23');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQLInsertConfig.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQLInsertConfig.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQLInsertConfig.properties
deleted file mode 100644
index 915a8e8..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/SQLInsertConfig.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-#        or more contributor license agreements.  See the NOTICE file
-#        distributed with this work for additional information
-#        regarding copyright ownership.  The ASF licenses this file
-#        to you under the Apache License, Version 2.0 (the
-#        "License"); you may not use this file except in compliance
-#        with the License.  You may obtain a copy of the License at
-# 
-#          http://www.apache.org/licenses/LICENSE-2.0
-# 
-#        Unless required by applicable law or agreed to in writing,
-#        software distributed under the License is distributed on an
-#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#        KIND, either express or implied.  See the License for the
-#        specific language governing permissions and limitations
-#        under the License.
-#-------------------------------------------------------------------------------
-
-#This file contains names of file which will contain the SQL statements to be executed by Data generator. Add a file name here and it will be picked up by Generator
-#You need to put the file names in order you want to get them called. First Entry will be inserted first.
-insert_file_names = SalesOrderHeaderSQLs,StoreSQLs,MaterialSQLs,SalesOrderItemSQLs,NoteSQLs
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties
new file mode 100644
index 0000000..19f859d
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties
@@ -0,0 +1,22 @@
+#-------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+#        or more contributor license agreements.  See the NOTICE file
+#        distributed with this work for additional information
+#        regarding copyright ownership.  The ASF licenses this file
+#        to you under the Apache License, Version 2.0 (the
+#        "License"); you may not use this file except in compliance
+#        with the License.  You may obtain a copy of the License at
+# 
+#          http://www.apache.org/licenses/LICENSE-2.0
+# 
+#        Unless required by applicable law or agreed to in writing,
+#        software distributed under the License is distributed on an
+#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#        KIND, either express or implied.  See the License for the
+#        specific language governing permissions and limitations
+#        under the License.
+#-------------------------------------------------------------------------------
+
+#Config file for deleting the entities. They are deleted in the order provided in the below comma-separated string. 
+#It is mandatory due to referential constaints.
+delete_queries = DELETE FROM T_NOTE,DELETE FROM T_SALESORDERITEM,DELETE FROM T_MATERIAL_T_STORE,DELETE FROM T_MATERIAL,DELETE FROM T_STORE,DELETE FROM T_SALESORDERHEADER
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties
new file mode 100644
index 0000000..86d4a13
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties
@@ -0,0 +1,22 @@
+#-------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+#        or more contributor license agreements.  See the NOTICE file
+#        distributed with this work for additional information
+#        regarding copyright ownership.  The ASF licenses this file
+#        to you under the Apache License, Version 2.0 (the
+#        "License"); you may not use this file except in compliance
+#        with the License.  You may obtain a copy of the License at
+# 
+#          http://www.apache.org/licenses/LICENSE-2.0
+# 
+#        Unless required by applicable law or agreed to in writing,
+#        software distributed under the License is distributed on an
+#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#        KIND, either express or implied.  See the License for the
+#        specific language governing permissions and limitations
+#        under the License.
+#-------------------------------------------------------------------------------
+query_1 = INSERT INTO T_CATEGORY (CODE,DESC) VALUES('P1','Pen');
+query_2 = INSERT INTO T_CATEGORY (CODE,DESC) VALUES('P2','Pencil');
+query_3 = INSERT INTO T_CATEGORY (CODE,DESC) VALUES('S1','Sharpner');
+query_4 = INSERT INTO T_CATEGORY (CODE,DESC) VALUES('E1','Eraser');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties
new file mode 100644
index 0000000..5910123
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties
@@ -0,0 +1,22 @@
+#-------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+#        or more contributor license agreements.  See the NOTICE file
+#        distributed with this work for additional information
+#        regarding copyright ownership.  The ASF licenses this file
+#        to you under the Apache License, Version 2.0 (the
+#        "License"); you may not use this file except in compliance
+#        with the License.  You may obtain a copy of the License at
+# 
+#          http://www.apache.org/licenses/LICENSE-2.0
+# 
+#        Unless required by applicable law or agreed to in writing,
+#        software distributed under the License is distributed on an
+#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#        KIND, either express or implied.  See the License for the
+#        specific language governing permissions and limitations
+#        under the License.
+#-------------------------------------------------------------------------------
+
+#This file contains names of file which will contain the SQL statements to be executed by Data generator. Add a file name here and it will be picked up by Generator
+#You need to put the file names in order you want to get them called. First Entry will be inserted first.
+insert_file_names = SQL_Insert_Customer,SQL_Insert_Category,SQL_Insert_SalesOrderHeader,SQL_Insert_Store,SQL_Insert_Material,SQL_Insert_SalesOrderItem,SQL_Insert_Note
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties
new file mode 100644
index 0000000..e718a01
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties
@@ -0,0 +1,23 @@
+#-------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+#        or more contributor license agreements.  See the NOTICE file
+#        distributed with this work for additional information
+#        regarding copyright ownership.  The ASF licenses this file
+#        to you under the Apache License, Version 2.0 (the
+#        "License"); you may not use this file except in compliance
+#        with the License.  You may obtain a copy of the License at
+# 
+#          http://www.apache.org/licenses/LICENSE-2.0
+# 
+#        Unless required by applicable law or agreed to in writing,
+#        software distributed under the License is distributed on an
+#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#        KIND, either express or implied.  See the License for the
+#        specific language governing permissions and limitations
+#        under the License.
+#-------------------------------------------------------------------------------
+query_1 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(100,'Bob Bryan',7,'5 cross Street', 'London', 'UK',  'E7');
+query_2 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(200,'Mike Bryan',7,'8 cross Street', 'New York', 'USA',  '10011');
+query_3 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(201,'Steve Roger',7,'9 cross Street', 'Mumbai', 'India', '200101');
+query_4 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(101,'Pac Man',7,'25 cross Street', 'Frankfurt', 'Germany',  '60001');
+query_5 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(202,'Bolt Man',7,'25 cross Street', 'Toronto', 'Canada',  'NE');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties
new file mode 100644
index 0000000..7ea5ade
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties
@@ -0,0 +1,30 @@
+#-------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+#        or more contributor license agreements.  See the NOTICE file
+#        distributed with this work for additional information
+#        regarding copyright ownership.  The ASF licenses this file
+#        to you under the Apache License, Version 2.0 (the
+#        "License"); you may not use this file except in compliance
+#        with the License.  You may obtain a copy of the License at
+# 
+#          http://www.apache.org/licenses/LICENSE-2.0
+# 
+#        Unless required by applicable law or agreed to in writing,
+#        software distributed under the License is distributed on an
+#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#        KIND, either express or implied.  See the License for the
+#        specific language governing permissions and limitations
+#        under the License.
+#-------------------------------------------------------------------------------
+
+material_query_1 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(111, 'My Pen', 'P1', 111.1, 'Piece');
+material_query_2 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(112, 'My Great Pen', 'P1', 112.1, 'Piece');
+material_query_3 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(113, 'Super Pen', 'P1', 113.1, 'Piece');
+material_query_4 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(114, 'Marvel Pen', 'P1', 114.1, 'Piece');
+material_query_5 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(115, 'Smooth', 'P2', 115.1, 'Piece');
+material_query_6 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(116, 'Silver Line', 'P2', 116.1, 'Piece');
+material_query_7 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(117, 'Dark Line', 'P2', 117.1, 'Piece');
+material_query_8 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(118, 'Sharp', 'S1', 118.1, 'Piece');
+material_query_9 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(119, 'Cut Sharp', 'S1', 119.1, 'Piece');
+material_query_10 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(120, 'Thin line', 'S1', 120.1, 'Piece');
+material_query_11 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(121, 'Clean', 'E1', 121.1, 'Piece');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Note.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Note.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Note.properties
new file mode 100644
index 0000000..347c37a
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Note.properties
@@ -0,0 +1,20 @@
+#-------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+#        or more contributor license agreements.  See the NOTICE file
+#        distributed with this work for additional information
+#        regarding copyright ownership.  The ASF licenses this file
+#        to you under the Apache License, Version 2.0 (the
+#        "License"); you may not use this file except in compliance
+#        with the License.  You may obtain a copy of the License at
+# 
+#          http://www.apache.org/licenses/LICENSE-2.0
+# 
+#        Unless required by applicable law or agreed to in writing,
+#        software distributed under the License is distributed on an
+#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#        KIND, either express or implied.  See the License for the
+#        specific language governing permissions and limitations
+#        under the License.
+#-------------------------------------------------------------------------------
+
+note_query_1 = insert into T_NOTE (SO_ID , text, createdBy, creationDate,creationTime) values(2, 'Test_Note_1', 'CreatedBy_1','2013-01-01 00:00:00','00:00:23');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties
new file mode 100644
index 0000000..b5ebf24
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties
@@ -0,0 +1,30 @@
+#-------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+#        or more contributor license agreements.  See the NOTICE file
+#        distributed with this work for additional information
+#        regarding copyright ownership.  The ASF licenses this file
+#        to you under the Apache License, Version 2.0 (the
+#        "License"); you may not use this file except in compliance
+#        with the License.  You may obtain a copy of the License at
+# 
+#          http://www.apache.org/licenses/LICENSE-2.0
+# 
+#        Unless required by applicable law or agreed to in writing,
+#        software distributed under the License is distributed on an
+#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#        KIND, either express or implied.  See the License for the
+#        specific language governing permissions and limitations
+#        under the License.
+#-------------------------------------------------------------------------------
+
+query1 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(1, 100, 'INR', '01', '2012-11-01 00:01:00');
+query2 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(2, 100, 'USD', '01', '2013-01-02 00:00:00');
+query3 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(3, 100, 'USD', '02', '2013-01-01 14:00:00');
+query4 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(4, 200, 'INR', '01', '2013-01-02 00:00:00');
+query5 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(5, 201, 'INR', '02', '2013-01-01 14:14:14');
+query6 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(6, 101, 'EUR', '01', '2013-01-02 00:00:00');
+query7 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(7, 201, 'EUR', '02', '2013-01-01 14:14:00');
+query8 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(8, 201, 'GBR', '01', '2013-01-02 00:00:00');
+query9 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(9, 101, 'GBR', '02', '2013-01-01 00:00:00');
+query10 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(10, 100, 'AUD', '01', '2013-01-01 00:00:00');
+query11 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(11, 202, 'AUD', '02', '2013-01-02 00:00:00');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties
new file mode 100644
index 0000000..ed93834
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties
@@ -0,0 +1,30 @@
+#-------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+#        or more contributor license agreements.  See the NOTICE file
+#        distributed with this work for additional information
+#        regarding copyright ownership.  The ASF licenses this file
+#        to you under the Apache License, Version 2.0 (the
+#        "License"); you may not use this file except in compliance
+#        with the License.  You may obtain a copy of the License at
+# 
+#          http://www.apache.org/licenses/LICENSE-2.0
+# 
+#        Unless required by applicable law or agreed to in writing,
+#        software distributed under the License is distributed on an
+#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#        KIND, either express or implied.  See the License for the
+#        specific language governing permissions and limitations
+#        under the License.
+#-------------------------------------------------------------------------------
+
+line_item_query1 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(111, 1, 10.1, 1.11, 3, 11);
+line_item_query2 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(112, 1, 111.1, 1.12, 2, 10);
+line_item_query3 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(113, 1, 211.1, 1.13, 3, 9);
+line_item_query4 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(114, 1, 221.1, 1.14, 4, 8);
+line_item_query5 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(115, 1, 651.1, 1.15, 5, 7);
+line_item_query6 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(116, 1, 653.21, 1.16, 6, 6);
+line_item_query7 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(117, 1, 57.11, 1.17, 7, 5);
+line_item_query8 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(118, 1, 52.98, 1.18, 8, 4);
+line_item_query9 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(119, 1, 78.99, 1.19, 9, 3);
+line_item_query10 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(120, 1,69.23, 1.20, 10, 2);
+line_item_query11 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(121, 1, 356.65, 1.21, 3, 1);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties
new file mode 100644
index 0000000..20860f2
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties
@@ -0,0 +1,30 @@
+#-------------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+#        or more contributor license agreements.  See the NOTICE file
+#        distributed with this work for additional information
+#        regarding copyright ownership.  The ASF licenses this file
+#        to you under the Apache License, Version 2.0 (the
+#        "License"); you may not use this file except in compliance
+#        with the License.  You may obtain a copy of the License at
+# 
+#          http://www.apache.org/licenses/LICENSE-2.0
+# 
+#        Unless required by applicable law or agreed to in writing,
+#        software distributed under the License is distributed on an
+#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#        KIND, either express or implied.  See the License for the
+#        specific language governing permissions and limitations
+#        under the License.
+#-------------------------------------------------------------------------------
+
+store_query_1 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(131, 'Store New York', 11, 'New York Street', 'New York', 'USA','10001');
+store_query_2 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(132, 'Store Bengaluru', 21, 'Whitefield', 'Bengaluru', 'India','560037');
+store_query_3 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(133, 'Store Toronto', 31, 'Toronto Street', 'Toronto', 'Canada','M4J');
+store_query_4 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(134, 'Store Chicago', 41, 'Chicago Street', 'Chicago', 'USA','60625');
+store_query_5 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(135, 'Store Chennai', 51, 'Park Street', 'Chennai', 'India','600021');
+store_query_6 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(136, 'Store Frankfurt', 61, 'Frankfurt Street', 'Frankfurt', 'Germany','60001');
+store_query_7 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(137, 'Store Berlin', 71, 'Berlin Street', 'Berlin', 'Germany','10115');
+store_query_8 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(138, 'Store Hamburg', 81, 'Hamburg Street', 'Hamburg', 'Germany','20001');
+store_query_9 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(139, 'Store New Delhi', 91, 'New Delhi Street', 'New Delhi', 'India','110001');
+store_query_10 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(140, 'Store Ottawa', 100, 'Ottawa Street', 'Ottawa', 'Canada','K0A');
+store_query_11 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(141, 'Store Kolkata', 101, 'Kolkata Street', 'Kolkata', 'India','310001');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderHeaderSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderHeaderSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderHeaderSQLs.properties
deleted file mode 100644
index bc3e5a3..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderHeaderSQLs.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-#        or more contributor license agreements.  See the NOTICE file
-#        distributed with this work for additional information
-#        regarding copyright ownership.  The ASF licenses this file
-#        to you under the Apache License, Version 2.0 (the
-#        "License"); you may not use this file except in compliance
-#        with the License.  You may obtain a copy of the License at
-# 
-#          http://www.apache.org/licenses/LICENSE-2.0
-# 
-#        Unless required by applicable law or agreed to in writing,
-#        software distributed under the License is distributed on an
-#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#        KIND, either express or implied.  See the License for the
-#        specific language governing permissions and limitations
-#        under the License.
-#-------------------------------------------------------------------------------
-
-query1 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(20130320170725, 1, 'buyerName_1', 'INR', '01', '2012-11-01 00:01:00', 1, 'Test_Street_Name_1', 'Test_City_1', 'Test_Country_1');
-query2 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(2, 2, 'buyerName_2', 'USD', '01', '2013-01-02 00:00:00', 2, 'Test_Street_Name_2', 'Test_City_2', 'Test_Country_2');
-query3 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(3, 3, 'buyerName_3', 'USD', '02', '2013-01-01 14:00:00', 3, 'Test_Street_Name_3', 'Test_City_3', 'Test_Country_3');
-query4 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(4, 4, 'buyerName_4', 'INR', '01', '2013-01-02 00:00:00', 4, 'Test_Street_Name_4', 'Test_City_4', 'Test_Country_4');
-query5 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(5, 5, 'buyerName_5', 'INR', '02', '2013-01-01 14:14:14', 5, 'Test_Street_Name_5', 'Test_City_5', 'Test_Country_5');
-query6 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(6, 6, 'buyerName_6', 'EUR', '01', '2013-01-02 00:00:00', 6, 'Test_Street_Name_6', 'Test_City_6', 'Test_Country_6');
-query7 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(7, 7, 'buyerName_7', 'EUR', '02', '2013-01-01 14:14:00', 7, 'Test_Street_Name_7', 'Test_City_7', 'Test_Country_7');
-query8 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(8, 8, 'buyerName_8', 'GBR', '01', '2013-01-02 00:00:00', 8, 'Test_Street_Name_8', 'Test_City_8', 'Test_Country_8');
-query9 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(9, 9, 'buyerName_9', 'GBR', '02', '2013-01-01 00:00:00', 9, 'Test_Street_Name_9', 'Test_City_9', 'Test_Country_9');
-query10 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(10, 10, 'buyerName_10', 'AUD', '01', '2013-01-01 00:00:00', 10, 'Test_Street_Name_10', 'Test_City_10', 'Test_Country_10');
-query11 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(11, 11, 'buyerName_11', 'AUD', '02', '2013-01-02 00:00:00', 7, 'Test_Street_Name_11', 'Test_City_11', 'Test_Country_3');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderItemSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderItemSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderItemSQLs.properties
deleted file mode 100644
index ed93834..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderItemSQLs.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-#        or more contributor license agreements.  See the NOTICE file
-#        distributed with this work for additional information
-#        regarding copyright ownership.  The ASF licenses this file
-#        to you under the Apache License, Version 2.0 (the
-#        "License"); you may not use this file except in compliance
-#        with the License.  You may obtain a copy of the License at
-# 
-#          http://www.apache.org/licenses/LICENSE-2.0
-# 
-#        Unless required by applicable law or agreed to in writing,
-#        software distributed under the License is distributed on an
-#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#        KIND, either express or implied.  See the License for the
-#        specific language governing permissions and limitations
-#        under the License.
-#-------------------------------------------------------------------------------
-
-line_item_query1 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(111, 1, 10.1, 1.11, 3, 11);
-line_item_query2 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(112, 1, 111.1, 1.12, 2, 10);
-line_item_query3 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(113, 1, 211.1, 1.13, 3, 9);
-line_item_query4 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(114, 1, 221.1, 1.14, 4, 8);
-line_item_query5 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(115, 1, 651.1, 1.15, 5, 7);
-line_item_query6 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(116, 1, 653.21, 1.16, 6, 6);
-line_item_query7 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(117, 1, 57.11, 1.17, 7, 5);
-line_item_query8 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(118, 1, 52.98, 1.18, 8, 4);
-line_item_query9 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(119, 1, 78.99, 1.19, 9, 3);
-line_item_query10 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(120, 1,69.23, 1.20, 10, 2);
-line_item_query11 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(121, 1, 356.65, 1.21, 3, 1);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2fb8b048/odata2-jpa-processor/jpa-web/src/main/resources/StoreSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/StoreSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/StoreSQLs.properties
deleted file mode 100644
index 69af954..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/StoreSQLs.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-#        or more contributor license agreements.  See the NOTICE file
-#        distributed with this work for additional information
-#        regarding copyright ownership.  The ASF licenses this file
-#        to you under the Apache License, Version 2.0 (the
-#        "License"); you may not use this file except in compliance
-#        with the License.  You may obtain a copy of the License at
-# 
-#          http://www.apache.org/licenses/LICENSE-2.0
-# 
-#        Unless required by applicable law or agreed to in writing,
-#        software distributed under the License is distributed on an
-#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#        KIND, either express or implied.  See the License for the
-#        specific language governing permissions and limitations
-#        under the License.
-#-------------------------------------------------------------------------------
-
-store_query_1 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(131, 'Test_Store_1', 1, 'Test_Street_Name_1', 'Test_City_1', 'Test_Country_1');
-store_query_2 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(132, 'Test_Store_2', 1, 'Test_Street_Name_2', 'Test_City_2', 'Test_Country_2');
-store_query_3 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(133, 'Test_Store_3', 1, 'Test_Street_Name_3', 'Test_City_3', 'Test_Country_3');
-store_query_4 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(134, 'Test_Store_4', 1, 'Test_Street_Name_4', 'Test_City_4', 'Test_Country_4');
-store_query_5 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(135, 'Test_Store_5', 1, 'Test_Street_Name_5', 'Test_City_5', 'Test_Country_5');
-store_query_6 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(136, 'Test_Store_6', 1, 'Test_Street_Name_6', 'Test_City_6', 'Test_Country_6');
-store_query_7 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(137, 'Test_Store_7', 1, 'Test_Street_Name_7', 'Test_City_7', 'Test_Country_7');
-store_query_8 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(138, 'Test_Store_8', 1, 'Test_Street_Name_8', 'Test_City_8', 'Test_Country_8');
-store_query_9 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(139, 'Test_Store_9', 1, 'Test_Street_Name_9', 'Test_City_9', 'Test_Country_9');
-store_query_10 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(140, 'Test_Store_10', 1, 'Test_Street_Name_10', 'Test_City_10', 'Test_Country_10');
-store_query_11 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(141, 'Test_Store_11', 1, 'Test_Street_Name_11', 'Test_City_11', 'Test_Country_11');
\ No newline at end of file


[3/7] git commit: [OLINGO-49], [OLINGO-51] Support for A) Linking entities using tag within an OData Entry B) Updating links C) Deleting links D) Code Cleanup

Posted by mi...@apache.org.
[OLINGO-49],[OLINGO-51]
Support for 
A) Linking entities using <link> tag within an OData Entry
B) Updating links
C) Deleting links
D) Code Cleanup

Signed-off-by: Chandan V A <ch...@sap.com>

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/886d283d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/886d283d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/886d283d

Branch: refs/heads/OLINGO-88_AnnotationArchetype
Commit: 886d283dad40aa98d27a6d47b145063ea9626316
Parents: 2fb8b04
Author: Chandan V A <ch...@sap.com>
Authored: Sun Jan 12 23:09:04 2014 +0530
Committer: Chandan V A <ch...@sap.com>
Committed: Sun Jan 12 23:09:04 2014 +0530

----------------------------------------------------------------------
 .../jpa/processor/api/ODataJPAProcessor.java    |   2 +-
 .../api/factory/JPQLBuilderFactory.java         |   2 +-
 .../api/model/JPAEdmComplexTypeView.java        |   4 +-
 .../processor/api/model/JPAEdmPropertyView.java |   9 +
 .../jpa/processor/core/ODataEntityParser.java   | 127 ++++----
 .../core/ODataJPAProcessorDefault.java          |   8 +
 .../processor/core/access/data/JPAEntity.java   |  28 +-
 .../jpa/processor/core/access/data/JPALink.java | 318 ++++++++++++-------
 .../core/access/data/JPAProcessorImpl.java      |  18 +-
 .../access/model/JPAEdmMappingModelService.java |   2 +-
 .../core/access/model/JPAEdmNameBuilder.java    |   9 +-
 .../processor/core/model/JPAEdmMappingImpl.java |   1 -
 .../processor/core/model/JPAEdmProperty.java    |  81 +++--
 .../core/model/JPAEdmReferentialConstraint.java |   2 +-
 .../model/JPAEdmReferentialConstraintRole.java  |   2 +-
 .../processor/core/ODataEntityParserTest.java   | 226 +++++++++++++
 .../core/ODataExpressionParserTest.java         |   1 -
 .../processor/core/ODataJPAContextImplTest.java |   1 -
 .../core/ODataJPAProcessorDefaultTest.java      |   2 +-
 .../core/access/data/JPAEntityParserTest.java   |   1 -
 .../JPAEntityParserTestForStaticMethods.java    |   1 -
 .../core/access/data/JPAEntityTest.java         |   3 +-
 .../core/access/data/JPAExpandCallBackTest.java |   1 -
 .../access/data/JPAFunctionContextTest.java     |   1 -
 .../processor/core/access/data/JPALinkTest.java |   5 +
 .../core/access/data/JPAProcessorImplTest.java  |   2 +-
 .../model/JPAEdmMappingModelServiceTest.java    |   1 -
 .../access/model/JPAEdmNameBuilderTest.java     |   2 -
 .../core/access/model/JPATypeConvertorTest.java |   1 -
 .../edm/ODataJPAEdmProviderNegativeTest.java    |   1 -
 .../core/edm/ODataJPAEdmProviderTest.java       |   1 -
 .../core/jpql/JPQLBuilderFactoryTest.java       |   6 +-
 .../core/jpql/JPQLJoinContextTest.java          |   1 -
 .../jpql/JPQLJoinSelectSingleContextTest.java   |   1 -
 ...PQLJoinSelectSingleStatementBuilderTest.java |   1 -
 .../core/jpql/JPQLJoinStatementBuilderTest.java |   1 -
 .../core/jpql/JPQLSelectContextImplTest.java    |   1 -
 .../jpql/JPQLSelectSingleContextImplTest.java   |   1 -
 .../JPQLSelectSingleStatementBuilderTest.java   |   4 +-
 .../jpql/JPQLSelectStatementBuilderTest.java    |   4 +-
 .../processor/core/mock/ODataContextMock.java   |  48 +++
 .../core/mock/ODataJPAContextMock.java          |  15 +
 .../processor/core/mock/ODataServiceMock.java   | 106 +++++++
 .../jpa/processor/core/mock/PathInfoMock.java   |  51 +++
 .../processor/core/mock/PathSegmentMock.java    |  44 +++
 .../processor/core/mock/data/EdmMockUtilV2.java |  27 +-
 .../core/model/JPAEdmAssociationEndTest.java    |   1 -
 .../core/model/JPAEdmAssociationSetTest.java    |   1 -
 .../core/model/JPAEdmAssociationTest.java       |   5 +-
 .../core/model/JPAEdmBaseViewImplTest.java      |   1 -
 .../core/model/JPAEdmComplexTypeTest.java       |   2 -
 .../core/model/JPAEdmEntityContainerTest.java   |   1 -
 .../core/model/JPAEdmEntitySetTest.java         |   1 -
 .../core/model/JPAEdmEntityTypeTest.java        |   1 -
 .../core/model/JPAEdmFunctionImportTest.java    |   1 -
 .../jpa/processor/core/model/JPAEdmKeyTest.java |   1 -
 .../processor/core/model/JPAEdmModelTest.java   |   1 -
 .../model/JPAEdmNavigationPropertyTest.java     |   1 -
 .../core/model/JPAEdmPropertyTest.java          |   5 +-
 .../JPAEdmReferentialConstraintRoleTest.java    |   2 -
 .../model/JPAEdmReferentialConstraintTest.java  |   1 -
 .../processor/core/model/JPAEdmSchemaTest.java  |   1 -
 .../core/model/JPAEdmTestModelView.java         |  10 +-
 .../core/model/_JPAEdmFunctionImportTest.java   |   1 -
 .../odata2/jpa/processor/ref/model/Address.java |   4 +-
 .../jpa/processor/ref/model/Category.java       |  10 +-
 .../jpa/processor/ref/model/Customer.java       |   6 +-
 .../jpa/processor/ref/model/Material.java       |  14 +-
 .../processor/ref/model/SalesOrderHeader.java   |   4 +-
 .../src/main/resources/META-INF/persistence.xml |   4 +-
 .../jpa/processor/ref/extension/OrderValue.java |   4 +-
 .../SalesOrderProcessingExtension.java          |  12 +-
 72 files changed, 959 insertions(+), 310 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java
index d08eee9..127c79a 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java
@@ -28,7 +28,7 @@ import org.apache.olingo.odata2.jpa.processor.api.factory.ODataJPAFactory;
  * behavior of OData JPA Processor library has to be overwritten.
  * 
  * The class encapsulates a default processor for handling OData requests and
- * a default builder to build an OData response. 
+ * a default builder to build an OData response.
  * 
  */
 public abstract class ODataJPAProcessor extends ODataSingleProcessor {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java
index 4880257..08aea25 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java
@@ -19,9 +19,9 @@
 package org.apache.olingo.odata2.jpa.processor.api.factory;
 
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAMethodContext.JPAMethodContextBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextView;
-import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLStatement.JPQLStatementBuilder;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java
index 8b087c8..3b5a884 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java
@@ -126,11 +126,11 @@ public interface JPAEdmComplexTypeView extends JPAEdmBaseView {
    * 
    */
   public boolean isReferencedInKey(String complexTypeName);
-  
+
   /**
    * The method sets the given EDM complex type as referenced in an Entity as a key property
    * @param complexTypeName
-   *  EDM complex Type name
+   * EDM complex Type name
    */
   public void setReferencedInKey(String complexTypeName);
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java
index c363844..ce06f68 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java
@@ -80,6 +80,15 @@ public interface JPAEdmPropertyView extends JPAEdmBaseView {
   Attribute<?, ?> getJPAAttribute();
 
   /**
+   * The method returns a JPA Attribute referenced by a JPA Attribute in the {@link javax.persistence.JoinColumn}
+   * annotation for the given JPA entity type .
+   * 
+   * @return an instance of type {@link javax.persistence.metamodel.Attribute
+   * <?, ?>}
+   */
+  Attribute<?, ?> getJPAReferencedAttribute();
+
+  /**
    * The method returns a JPA EDM navigation property view.
    * 
    * @return an instance of type {@link org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmNavigationPropertyView}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
index 3823e2c..dccfc6c 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
@@ -43,6 +43,7 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 public final class ODataEntityParser {
 
   private ODataJPAContext context;
+  private Edm edm;
 
   public ODataEntityParser(final ODataJPAContext context) {
     this.context = context;
@@ -63,21 +64,37 @@ public final class ODataEntityParser {
 
   }
 
-  public final UriInfo parseLinkURI() throws ODataJPARuntimeException {
+  public final UriInfo parseURISegmentWithCustomOptions(final int segmentFromIndex, final int segmentToIndex,
+      final Map<String, String> options) throws ODataJPARuntimeException {
     UriInfo uriInfo = null;
-
-    Edm edm;
+    if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) {
+      return uriInfo;
+    }
     try {
-      edm = context.getODataContext().getService().getEntityDataModel();
-
+      edm = getEdm();
       List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments();
-      List<PathSegment> subPathSegments = pathSegments.subList(0, pathSegments.size() - 2);
+      List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex);
+      uriInfo = UriParser.parse(edm, subPathSegments, options);
+    } catch (ODataException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    }
+    return uriInfo;
+  }
 
+  public final UriInfo parseURISegment(final int segmentFromIndex, final int segmentToIndex)
+      throws ODataJPARuntimeException {
+    UriInfo uriInfo = null;
+    if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) {
+      return uriInfo;
+    }
+    try {
+      edm = getEdm();
+      List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments();
+      List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex);
       uriInfo = UriParser.parse(edm, subPathSegments, Collections.<String, String> emptyMap());
     } catch (ODataException e) {
       throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
-
     return uriInfo;
   }
 
@@ -86,78 +103,70 @@ public final class ODataEntityParser {
 
     String uriString = null;
     UriInfo uri = null;
-
     try {
       uriString = EntityProvider.readLink(contentType, entitySet, content);
       ODataContext odataContext = context.getODataContext();
       final String serviceRoot = odataContext.getPathInfo().getServiceRoot().toString();
-
       final String path =
           uriString.startsWith(serviceRoot.toString()) ? uriString.substring(serviceRoot.length()) : uriString;
-
-      final PathSegment pathSegment = new PathSegment() {
-        @Override
-        public String getPath() {
-          return path;
-        }
-
-        @Override
-        public Map<String, List<String>> getMatrixParameters() {
-          return null;
-        }
-      };
-
-      final Edm edm = odataContext.getService().getEntityDataModel();
-
+      final PathSegment pathSegment = getPathSegment(path);
+      edm = getEdm();
       uri = UriParser.parse(edm, Arrays.asList(pathSegment), Collections.<String, String> emptyMap());
-
     } catch (ODataException e) {
       throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
-
     return uri;
-
   }
 
-  public List<UriInfo> parseLinks(final EdmEntitySet entitySet, final InputStream content, final String contentType)
+  public UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options)
       throws ODataJPARuntimeException {
-
-    List<String> uriList = new ArrayList<String>();
-    List<UriInfo> uriInfoList = new ArrayList<UriInfo>();
-
+    List<PathSegment> pathSegments = new ArrayList<PathSegment>();
+    for (String link : linkSegments) {
+      PathSegment pathSegment = getPathSegment(link);
+      pathSegments.add(pathSegment);
+    }
+    UriInfo uriInfo = null;
     try {
+      edm = getEdm();
+      uriInfo = UriParser.parse(edm, pathSegments, options);
+    } catch (ODataException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    }
+    return uriInfo;
+  }
 
-      uriList = EntityProvider.readLinks(contentType, entitySet, content);
-      ODataContext odataContext = context.getODataContext();
-      final String serviceRoot = odataContext.getPathInfo().getServiceRoot().toString();
-      final int length = serviceRoot.length();
-      final Edm edm = odataContext.getService().getEntityDataModel();
-
-      for (String uriString : uriList) {
-        final String path = uriString.startsWith(serviceRoot) ? uriString.substring(length) : uriString;
-
-        final PathSegment pathSegment = new PathSegment() {
-          @Override
-          public String getPath() {
-            return path;
-          }
-
-          @Override
-          public Map<String, List<String>> getMatrixParameters() {
-            return null;
-          }
-        };
-
-        UriInfo uriInfo = UriParser.parse(edm, Arrays.asList(pathSegment), Collections.<String, String> emptyMap());
-        uriInfoList.add(uriInfo);
-      }
-    } catch (EntityProviderException e) {
-      return null;
+  public UriInfo parseBindingLink(final String link, final Map<String, String> options) throws ODataJPARuntimeException {
+    final PathSegment pathSegment = getPathSegment(link);
+    UriInfo uriInfo = null;
+    try {
+      edm = getEdm();
+      uriInfo = UriParser.parse(edm, Arrays.asList(pathSegment), options);
     } catch (ODataException e) {
       throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
+    return uriInfo;
+  }
 
-    return uriInfoList;
+  private Edm getEdm() throws ODataException {
+    if (edm == null) {
+      edm = context.getODataContext().getService().getEntityDataModel();
+    }
+    return edm;
   }
 
+  private PathSegment getPathSegment(final String path) {
+    final PathSegment pathSegment = new PathSegment() {
+
+      @Override
+      public String getPath() {
+        return path;
+      }
+
+      @Override
+      public Map<String, List<String>> getMatrixParameters() {
+        return null;
+      }
+    };
+    return pathSegment;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java
index 96782b8..f59edf9 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java
@@ -191,4 +191,12 @@ public class ODataJPAProcessorDefault extends ODataJPAProcessor {
     return ODataResponse.newBuilder().build();
   }
 
+  @Override
+  public ODataResponse deleteEntityLink(final DeleteUriInfo uriParserResultView, final String contentType)
+      throws ODataException {
+
+    jpaProcessor.process(uriParserResultView, contentType);
+    return ODataResponse.newBuilder().build();
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
index 6a3ab60..64b6f92 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
@@ -100,11 +100,20 @@ public class JPAEntity {
           jpaEntityParser.getJPAEmbeddableKeyMap(jpaEntity.getClass().getName());
       Set<String> propertyNames = null;
       if (embeddableKeys != null) {
-        setEmbeddableKeyProperty(embeddableKeys, oDataEntityType.getKeyProperties(), oDataEntryProperties, jpaEntity);
+        List<String> processedKeys =
+            setEmbeddableKeyProperty(embeddableKeys, oDataEntityType.getKeyProperties(), oDataEntryProperties,
+                jpaEntity);
+
         propertyNames = new HashSet<String>();
         propertyNames.addAll(oDataEntryProperties.keySet());
-        for (String propertyName : oDataEntityType.getKeyPropertyNames()) {
-          propertyNames.remove(propertyName);
+        if (processedKeys.isEmpty()) {
+          for (String key : embeddableKeys.keySet()) {
+            propertyNames.remove(key);
+          }
+        } else {
+          for (String propertyName : processedKeys) {
+            propertyNames.remove(propertyName);
+          }
         }
       } else {
         propertyNames = oDataEntryProperties.keySet();
@@ -212,7 +221,7 @@ public class JPAEntity {
           .throwException(ODataJPARuntimeException.GENERAL, null);
     }
     Map<String, Object> oDataEntryProperties = oDataEntry.getProperties();
-    if(oDataEntry.containsInlineEntry()){
+    if (oDataEntry.containsInlineEntry()) {
       normalizeInlineEntries(oDataEntryProperties);
     }
     write(oDataEntryProperties, false);
@@ -279,7 +288,7 @@ public class JPAEntity {
     }
   }
 
-  protected void setEmbeddableKeyProperty(final HashMap<String, String> embeddableKeys,
+  protected List<String> setEmbeddableKeyProperty(final HashMap<String, String> embeddableKeys,
       final List<EdmProperty> oDataEntryKeyProperties,
       final Map<String, Object> oDataEntryProperties, final Object entity)
       throws ODataJPARuntimeException, EdmException, IllegalAccessException, IllegalArgumentException,
@@ -288,6 +297,7 @@ public class JPAEntity {
     HashMap<String, Object> embeddableObjMap = new HashMap<String, Object>();
     List<EdmProperty> leftODataEntryKeyProperties = new ArrayList<EdmProperty>();
     HashMap<String, String> leftEmbeddableKeys = new HashMap<String, String>();
+    List<String> processedKeys = new ArrayList<String>();
 
     for (EdmProperty edmProperty : oDataEntryKeyProperties) {
       if (oDataEntryProperties.containsKey(edmProperty.getName()) == false) {
@@ -296,6 +306,9 @@ public class JPAEntity {
 
       String edmPropertyName = edmProperty.getName();
       String embeddableKeyNameComposite = embeddableKeys.get(edmPropertyName);
+      if (embeddableKeyNameComposite == null) {
+        continue;
+      }
       String embeddableKeyNameSplit[] = embeddableKeyNameComposite.split("\\.");
       String methodPartName = null;
       Method method = null;
@@ -320,10 +333,13 @@ public class JPAEntity {
         leftODataEntryKeyProperties.add(edmProperty);
         leftEmbeddableKeys
             .put(edmPropertyName, embeddableKeyNameComposite.split(embeddableKeyNameSplit[0] + ".", 2)[1]);
-        setEmbeddableKeyProperty(leftEmbeddableKeys, leftODataEntryKeyProperties, oDataEntryProperties, embeddableObj);
+        processedKeys.addAll(setEmbeddableKeyProperty(leftEmbeddableKeys, leftODataEntryKeyProperties,
+            oDataEntryProperties, embeddableObj));
       }
+      processedKeys.add(edmPropertyName);
 
     }
+    return processedKeys;
   }
 
   protected Object instantiateJPAEntity() throws InstantiationException, IllegalAccessException {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
index 40e0792..f3b821b 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
@@ -22,6 +22,8 @@ import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 
 import javax.persistence.EntityManager;
@@ -30,7 +32,14 @@ import javax.persistence.EntityTransaction;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmException;
 import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.edm.EdmSimpleType;
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
 import org.apache.olingo.odata2.api.uri.UriInfo;
+import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
 import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
 import org.apache.olingo.odata2.api.uri.info.PostUriInfo;
 import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
@@ -43,6 +52,11 @@ import org.apache.olingo.odata2.jpa.processor.core.ODataEntityParser;
 
 public class JPALink {
 
+  private static final String SPACE = " ";
+  private static final String ODATA_COMMAND_FILTER = "$filter";
+  private static final String ODATA_OPERATOR_AND = "and";
+  private static final String ODATA_OPERATOR_NE = "ne";
+
   private ODataJPAContext context;
   private JPAProcessor jpaProcessor;
   private ODataEntityParser parser;
@@ -59,80 +73,106 @@ public class JPALink {
     sourceJPAEntity = jpaEntity;
   }
 
-  public void create(final PostUriInfo uriInfo, final InputStream content, final String requestContentType,
-      final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
+  public void setTargetJPAEntity(final Object jpaEntity) {
+    targetJPAEntity = jpaEntity;
+  }
 
-    EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
-    String targerEntitySetName;
-    EdmNavigationProperty navigationProperty = null;
-    try {
-      targerEntitySetName = targetEntitySet.getName();
-    } catch (EdmException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    }
+  public Object getTargetJPAEntity() {
+    return targetJPAEntity;
+  }
+
+  public Object getSourceJPAEntity() {
+    return sourceJPAEntity;
+  }
 
-    List<UriInfo> uriInfoList = new ArrayList<UriInfo>();
+  public void create(final PostUriInfo uriInfo, final InputStream content, final String requestContentType,
+      final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
+    modifyLink((UriInfo) uriInfo, content, requestContentType, contentType);
+  }
 
-    if (((UriInfo) uriInfo).isLinks()) {
-      UriInfo getUriInfo = parser.parseLink(targetEntitySet, content, requestContentType);
-      uriInfoList = new ArrayList<UriInfo>();
-      uriInfoList.add(getUriInfo);
-      navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty();
-    } else {
-      uriInfoList = parser.parseLinks(targetEntitySet, content, contentType);
-    }
+  public void update(final PutMergePatchUriInfo putUriInfo, final InputStream content, final String requestContentType,
+      final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
+    modifyLink((UriInfo) putUriInfo, content, requestContentType, contentType);
+  }
 
-    if (uriInfoList == null) {
-      return;
-    }
+  public void delete(final DeleteUriInfo uriInfo) throws ODataJPARuntimeException {
     try {
-      for (UriInfo getUriInfo : uriInfoList) {
 
-        if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName)) {
-          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
-        }
-        if (!((UriInfo) uriInfo).isLinks()) {
-          navigationProperty = getUriInfo.getNavigationSegments().get(0).getNavigationProperty();
+      int index = context.getODataContext().getPathInfo().getODataSegments().size() - 2;
+
+      List<String> linkSegments = new ArrayList<String>();
+      String customLinkSegment = context.getODataContext().getPathInfo().getODataSegments().get(0).getPath();
+      linkSegments.add(customLinkSegment);
+      customLinkSegment = uriInfo.getNavigationSegments().get(0).getNavigationProperty().getName();
+      linkSegments.add(customLinkSegment);
+
+      HashMap<String, String> options = new HashMap<String, String>();
+      List<KeyPredicate> keyPredicates = uriInfo.getNavigationSegments().get(0).getKeyPredicates();
+      StringBuffer condition = new StringBuffer();
+      String literal = null;
+      KeyPredicate keyPredicate = null;
+      int size = keyPredicates.size();
+      for (int i = 0; i < size; i++) {
+        keyPredicate = keyPredicates.get(i);
+
+        literal = ((EdmSimpleType) keyPredicate.getProperty().getType()).toUriLiteral(keyPredicate.getLiteral());
+        condition.append(keyPredicate.getProperty().getName()).append(SPACE);
+        condition.append(ODATA_OPERATOR_NE).append(SPACE);
+        condition.append(literal).append(SPACE);
+        if (i != size - 1) {
+          condition.append(ODATA_OPERATOR_AND).append(SPACE);
         }
+      }
+      options.put(ODATA_COMMAND_FILTER, condition.toString());
 
-        targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
-        if (targetJPAEntity != null && ((UriInfo) uriInfo).isLinks()) {
-          getUriInfo = parser.parseLinkURI();
-          sourceJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
-          if (sourceJPAEntity == null) {
-            throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
-                .addContent(getUriInfo.getTargetEntitySet().getName()), null);
-          }
+      UriInfo parsedUriInfo = parser.parseLinkSegments(linkSegments, options);
+      List<Object> relatedEntities = jpaProcessor.process((GetEntitySetUriInfo) parsedUriInfo);
+
+      parsedUriInfo = parser.parseURISegment(0, index);
+      if (parsedUriInfo != null) {
+        targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) parsedUriInfo);
+        if (targetJPAEntity == null) {
+          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
+              .addContent(parsedUriInfo.getTargetEntitySet().getName()), null);
         }
+        NavigationSegment navigationSegment = uriInfo.getNavigationSegments().get(0);
+        EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty();
+        delinkJPAEntities(targetJPAEntity, relatedEntities, navigationProperty);
+      }
 
-        JPAEntityParser entityParser = new JPAEntityParser();
-        Method setMethod =
-            entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
+    } catch (EdmException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    } catch (ODataException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    }
+  }
 
-        Method getMethod =
-            entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
+  private void delinkJPAEntities(final Object targetJPAEntity,
+      final List<Object> relatedJPAEntities,
+      final EdmNavigationProperty targetNavigationProperty)
+      throws ODataJPARuntimeException {
 
-        if (getMethod.getReturnType().getTypeParameters() != null) {
-          @SuppressWarnings("unchecked")
-          List<Object> relatedEntities = (List<Object>) getMethod.invoke(sourceJPAEntity);
-          relatedEntities.add(targetJPAEntity);
-          setMethod.invoke(sourceJPAEntity, relatedEntities);
-        } else {
-          setMethod.invoke(sourceJPAEntity, targetJPAEntity);
-        }
+    try {
+      JPAEntityParser entityParser = new JPAEntityParser();
+      Method setMethod = entityParser.getAccessModifier(targetJPAEntity,
+          targetNavigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
+
+      Method getMethod = entityParser.getAccessModifier(targetJPAEntity,
+          targetNavigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
+
+      if (getMethod.getReturnType().getTypeParameters() != null
+          && getMethod.getReturnType().getTypeParameters().length != 0) {
+        setMethod.invoke(targetJPAEntity, relatedJPAEntities);
+      } else {
+        setMethod.invoke(targetJPAEntity, (Object) null);
       }
     } catch (IllegalAccessException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    } catch (IllegalArgumentException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (InvocationTargetException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    } catch (EdmException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     }
-  }
 
-  public void delete() {}
+  }
 
   public void save() {
     EntityManager em = context.getEntityManager();
@@ -140,86 +180,128 @@ public class JPALink {
 
     if (!tx.isActive()) {
       em.getTransaction().begin();
-      em.persist(sourceJPAEntity);
+      if (sourceJPAEntity != null) {
+        em.persist(sourceJPAEntity);
+      }
+      if (targetJPAEntity != null) {
+        em.persist(targetJPAEntity);
+        em.flush();
+      }
       em.getTransaction().commit();
     }
 
   }
 
-  public void update(final PutMergePatchUriInfo putUriInfo, final InputStream content, final String requestContentType,
-      final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
-    UriInfo uriInfo = (UriInfo) putUriInfo;
-
-    EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
-    String targerEntitySetName;
-    EdmNavigationProperty navigationProperty = null;
+  public void create(final PostUriInfo uriInfo, final ODataEntry oDataEntry) throws ODataJPARuntimeException,
+      ODataJPAModelException {
     try {
-      targerEntitySetName = targetEntitySet.getName();
-    } catch (EdmException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    }
+      EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
+      int index = context.getODataContext().getPathInfo().getODataSegments().size() - 2;
+      UriInfo parsedUriInfo = parser.parseURISegment(index, index + 1);
+      Object targetJPAEntity = null;
+
+      if (parsedUriInfo != null) {
+        targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) parsedUriInfo);
+        if (targetJPAEntity == null) {
+          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
+              .addContent(parsedUriInfo.getTargetEntitySet().getName()), null);
+        }
+        linkJPAEntities(sourceJPAEntity, targetJPAEntity, uriInfo.getNavigationSegments().get(0)
+            .getNavigationProperty());
+      }
 
-    List<UriInfo> uriInfoList = new ArrayList<UriInfo>();
+      List<String> navPropertyNames;
+      navPropertyNames = targetEntitySet.getEntityType().getNavigationPropertyNames();
 
-    if (((UriInfo) uriInfo).isLinks()) {
-      UriInfo getUriInfo = parser.parseLink(targetEntitySet, content, requestContentType);
-      uriInfoList = new ArrayList<UriInfo>();
-      uriInfoList.add(getUriInfo);
-      navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty();
-    } else {
-      uriInfoList = parser.parseLinks(targetEntitySet, content, contentType);
-    }
+      for (String navPropertyName : navPropertyNames) {
+        List<String> links = oDataEntry.getMetadata().getAssociationUris(navPropertyName);
+        if (links != null && links.isEmpty() == false) {
+          for (String link : links) {
+            UriInfo bindingUriInfo = parser.parseBindingLink(link, new HashMap<String, String>());
+            targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) bindingUriInfo);
 
-    if (uriInfoList == null) {
-      return;
+            linkJPAEntities(targetJPAEntity, sourceJPAEntity, (EdmNavigationProperty) targetEntitySet.getEntityType()
+                .getProperty(
+                    navPropertyName));
+          }
+        }
+      }
+    } catch (EdmException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    } catch (ODataException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
-    try {
-      for (UriInfo getUriInfo : uriInfoList) {
+  }
 
-        if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName)) {
-          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
-        }
-        if (!((UriInfo) uriInfo).isLinks()) {
-          navigationProperty = getUriInfo.getNavigationSegments().get(0).getNavigationProperty();
-        }
+  private void modifyLink(final UriInfo uriInfo, final InputStream content, final String requestContentType,
+      final String contentType)
+      throws ODataJPARuntimeException, ODataJPAModelException {
+    try {
+      EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
+      String targerEntitySetName = targetEntitySet.getName();
+      EdmNavigationProperty navigationProperty = null;
+      UriInfo getUriInfo = null;
+
+      if (uriInfo.isLinks()) {
+        getUriInfo = parser.parseLink(targetEntitySet, content, requestContentType);
+        navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty();
+      } else {
+        return;
+      }
 
-        targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
-        if (targetJPAEntity != null && ((UriInfo) uriInfo).isLinks()) {
-          getUriInfo = parser.parseLinkURI();
-          sourceJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
-          if (sourceJPAEntity == null) {
-            throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
-                .addContent(getUriInfo.getTargetEntitySet().getName()), null);
-          }
-        }
+      if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName))
+      {
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
+      }
 
-        JPAEntityParser entityParser = new JPAEntityParser();
-        Method setMethod =
-            entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
-
-        Method getMethod =
-            entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
-
-        if (getMethod.getReturnType().getTypeParameters() != null
-            && getMethod.getReturnType().getTypeParameters().length != 0) {
-          @SuppressWarnings("unchecked")
-          List<Object> relatedEntities = (List<Object>) getMethod.invoke(sourceJPAEntity);
-          relatedEntities.add(targetJPAEntity);
-          setMethod.invoke(sourceJPAEntity, relatedEntities);
-        } else {
-          setMethod.invoke(sourceJPAEntity, targetJPAEntity);
+      targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
+      if (targetJPAEntity != null && sourceJPAEntity == null) {
+        int index = context.getODataContext().getPathInfo().getODataSegments().size() - 2;
+        getUriInfo = parser.parseURISegment(0, index);
+        sourceJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
+        if (sourceJPAEntity == null) {
+          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
+              .addContent(getUriInfo.getTargetEntitySet().getName()), null);
         }
       }
-    } catch (IllegalAccessException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+      if (targetJPAEntity != null && sourceJPAEntity != null) {
+        linkJPAEntities(targetJPAEntity, sourceJPAEntity, navigationProperty);
+      }
+
     } catch (IllegalArgumentException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    } catch (InvocationTargetException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (EdmException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    } catch (ODataException e) {
       throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
-
   }
 
+  private void
+      linkJPAEntities(final Object targetJPAEntity, final Object sourceJPAEntity,
+          final EdmNavigationProperty navigationProperty)
+          throws ODataJPARuntimeException {
+    try {
+      JPAEntityParser entityParser = new JPAEntityParser();
+      Method setMethod = entityParser.getAccessModifier(sourceJPAEntity,
+          navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
+
+      Method getMethod = entityParser.getAccessModifier(sourceJPAEntity,
+          navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
+
+      if (getMethod.getReturnType().getTypeParameters() != null
+          && getMethod.getReturnType().getTypeParameters().length != 0) {
+        @SuppressWarnings("unchecked")
+        Collection<Object> relatedEntities = (Collection<Object>) getMethod.invoke(sourceJPAEntity);
+        relatedEntities.add(targetJPAEntity);
+        setMethod.invoke(sourceJPAEntity, relatedEntities);
+      } else {
+        setMethod.invoke(sourceJPAEntity, targetJPAEntity);
+      }
+    } catch (IllegalAccessException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    } catch (InvocationTargetException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
index 6ca98e6..9a5b101 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
@@ -33,6 +33,7 @@ import org.apache.olingo.odata2.api.edm.EdmEntityType;
 import org.apache.olingo.odata2.api.edm.EdmException;
 import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.uri.UriInfo;
 import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
 import org.apache.olingo.odata2.api.uri.info.GetEntityCountUriInfo;
 import org.apache.olingo.odata2.api.uri.info.GetEntityLinkUriInfo;
@@ -314,8 +315,8 @@ public class JPAProcessorImpl implements JPAProcessor {
             oDataEntityParser.parseEntry(oDataEntitySet, content, requestedContentType, false);
         virtualJPAEntity.create(oDataEntry);
         JPALink link = new JPALink(oDataJPAContext);
-        link.setSourceJPAEntity(jpaEntity);
-        link.create(createView, content, requestedContentType, requestedContentType);
+        link.setSourceJPAEntity(virtualJPAEntity.getJPAEntity());
+        link.create(createView, oDataEntry);
       } else if (properties != null) {
         virtualJPAEntity.create(properties);
       } else {
@@ -396,6 +397,9 @@ public class JPAProcessorImpl implements JPAProcessor {
     JPQLContextType contextType = null;
     try {
       if (uriParserResultView instanceof DeleteUriInfo) {
+        if (((UriInfo) uriParserResultView).isLinks()) {
+          return deleteLink(uriParserResultView);
+        }
         uriParserResultView = ((DeleteUriInfo) uriParserResultView);
         if (!((DeleteUriInfo) uriParserResultView).getStartEntitySet().getName()
             .equals(((DeleteUriInfo) uriParserResultView).getTargetEntitySet().getName())) {
@@ -409,15 +413,14 @@ public class JPAProcessorImpl implements JPAProcessor {
           ODataJPARuntimeException.GENERAL, e);
     }
 
-    // First read the entity with read operation.
     Object selectedObject = readEntity(uriParserResultView, contextType);
-    // Read operation done. This object would be passed on to entity manager for delete
     if (selectedObject != null) {
       try {
         em.getTransaction().begin();
         em.remove(selectedObject);
         em.flush();
         em.getTransaction().commit();
+
       } catch (Exception e) {
         throw ODataJPARuntimeException.throwException(
             ODataJPARuntimeException.ERROR_JPQL_DELETE_REQUEST, e);
@@ -426,6 +429,13 @@ public class JPAProcessorImpl implements JPAProcessor {
     return selectedObject;
   }
 
+  private Object deleteLink(final DeleteUriInfo uriParserResultView) throws ODataJPARuntimeException {
+    JPALink link = new JPALink(oDataJPAContext);
+    link.delete(uriParserResultView);
+    link.save();
+    return link.getTargetJPAEntity();
+  }
+
   /* Process Get Entity Link Request */
   @Override
   public Object process(final GetEntityLinkUriInfo uriParserResultView)

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
index 97e438e..dd453ac 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
@@ -27,11 +27,11 @@ import javax.xml.bind.Unmarshaller;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmMappingModelAccess;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAAttributeMapType.JPAAttribute;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAEdmMappingModel;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAEmbeddableTypeMapType;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAEntityTypeMapType;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAPersistenceUnitMapType;
-import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAAttributeMapType.JPAAttribute;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPARelationshipMapType.JPARelationship;
 
 public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
index 5c8c999..9c22364 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
@@ -22,6 +22,7 @@ import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Field;
 
 import javax.persistence.Column;
+import javax.persistence.JoinColumn;
 import javax.persistence.metamodel.Attribute;
 import javax.persistence.metamodel.ManagedType;
 import javax.persistence.metamodel.PluralAttribute;
@@ -149,7 +150,6 @@ public class JPAEdmNameBuilder {
     view.getEdmSimpleProperty().setName(propertyName);
 
     JPAEdmMapping mapping = new JPAEdmMappingImpl();
-    ((Mapping) mapping).setInternalName(jpaAttributeName);
     mapping.setJPAType(jpaAttribute.getJavaType());
 
     AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
@@ -157,6 +157,12 @@ public class JPAEdmNameBuilder {
       Column column = annotatedElement.getAnnotation(Column.class);
       if (column != null) {
         mapping.setJPAColumnName(column.name());
+      } else {
+        JoinColumn joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
+        if (joinColumn != null) {
+          mapping.setJPAColumnName(joinColumn.name());
+          jpaAttributeName += "." + view.getJPAReferencedAttribute().getName();
+        }
       }
     } else {
       ManagedType<?> managedType = jpaAttribute.getDeclaringType();
@@ -176,6 +182,7 @@ public class JPAEdmNameBuilder {
       }
 
     }
+    ((Mapping) mapping).setInternalName(jpaAttributeName);
     view.getEdmSimpleProperty().setMapping((Mapping) mapping);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java
index f930d20..fc9f3fd 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java
@@ -47,5 +47,4 @@ public class JPAEdmMappingImpl extends Mapping implements JPAEdmMapping {
   public Class<?> getJPAType() {
     return type;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
index 0923176..e23f3b1 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
@@ -18,6 +18,7 @@
  ******************************************************************************/
 package org.apache.olingo.odata2.jpa.processor.core.model;
 
+import java.lang.reflect.AnnotatedElement;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -25,8 +26,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.persistence.Column;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
 import javax.persistence.metamodel.Attribute;
 import javax.persistence.metamodel.Attribute.PersistentAttributeType;
+import javax.persistence.metamodel.EntityType;
 import javax.persistence.metamodel.PluralAttribute;
 import javax.persistence.metamodel.SingularAttribute;
 
@@ -66,6 +71,7 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
   private SimpleProperty currentSimpleProperty = null;
   private ComplexProperty currentComplexProperty = null;
   private Attribute<?, ?> currentAttribute;
+  private Attribute<?, ?> currentRefAttribute;
   private boolean isBuildModeComplexType;
   private Map<String, Integer> associationCount;
 
@@ -118,6 +124,11 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
   }
 
   @Override
+  public Attribute<?, ?> getJPAReferencedAttribute() {
+    return currentRefAttribute;
+  }
+
+  @Override
   public ComplexProperty getEdmComplexProperty() {
     return currentComplexProperty;
   }
@@ -167,9 +178,7 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
      */
     @Override
     public void build() throws ODataJPAModelException, ODataJPARuntimeException {
-
       JPAEdmBuilder keyViewBuilder = null;
-
       properties = new ArrayList<Property>();
 
       List<Attribute<?, ?>> jpaAttributes = null;
@@ -200,29 +209,15 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
 
         switch (attributeType) {
         case BASIC:
-
           currentSimpleProperty = new SimpleProperty();
-          JPAEdmNameBuilder
-              .build((JPAEdmPropertyView) JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming);
-
-          EdmSimpleTypeKind simpleTypeKind = JPATypeConvertor
-              .convertToEdmSimpleType(currentAttribute
-                  .getJavaType(), currentAttribute);
-
-          currentSimpleProperty.setType(simpleTypeKind);
-          JPAEdmFacets.setFacets(currentAttribute, currentSimpleProperty);
-
-          properties.add(currentSimpleProperty);
-
+          properties.add(buildSimpleProperty(currentAttribute, currentSimpleProperty));
           if (((SingularAttribute<?, ?>) currentAttribute).isId()) {
             if (keyView == null) {
               keyView = new JPAEdmKey(JPAEdmProperty.this);
               keyViewBuilder = keyView.getBuilder();
             }
-
             keyViewBuilder.build();
           }
-
           break;
         case EMBEDDED:
           ComplexType complexType = complexTypeView
@@ -234,7 +229,6 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
             complexTypeViewLocal.getBuilder().build();
             complexType = complexTypeViewLocal.getEdmComplexType();
             complexTypeView.addJPAEdmCompleTypeView(complexTypeViewLocal);
-
           }
 
           if (isBuildModeComplexType == false
@@ -276,6 +270,8 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
         case ONE_TO_ONE:
         case MANY_TO_ONE:
 
+          addForeignKey(currentAttribute);
+
           JPAEdmAssociationEndView associationEndView = new JPAEdmAssociationEnd(entityTypeView, JPAEdmProperty.this);
           associationEndView.getBuilder().build();
           JPAEdmAssociationView associationView = schemaView.getJPAEdmAssociationView();
@@ -325,6 +321,54 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
 
     }
 
+    private SimpleProperty buildSimpleProperty(final Attribute<?, ?> jpaAttribute, final SimpleProperty simpleProperty)
+        throws ODataJPAModelException,
+        ODataJPARuntimeException {
+
+      JPAEdmNameBuilder
+          .build((JPAEdmPropertyView) JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming);
+      EdmSimpleTypeKind simpleTypeKind = JPATypeConvertor
+          .convertToEdmSimpleType(jpaAttribute
+              .getJavaType(), jpaAttribute);
+      simpleProperty.setType(simpleTypeKind);
+      JPAEdmFacets.setFacets(jpaAttribute, simpleProperty);
+
+      return simpleProperty;
+
+    }
+
+    private void addForeignKey(final Attribute<?, ?> jpaAttribute) throws ODataJPAModelException,
+        ODataJPARuntimeException {
+
+      AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
+      if (annotatedElement == null) {
+        return;
+      }
+      JoinColumn joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
+      if (joinColumn == null) {
+        JoinColumns joinColumns = annotatedElement.getAnnotation(JoinColumns.class);
+        if (joinColumns != null) {
+          return;
+        }
+      } else {
+        if (joinColumn.insertable() && joinColumn.updatable()) {
+          EntityType<?> referencedEntityType = metaModel.entity(jpaAttribute.getJavaType());
+          for (Attribute<?, ?> referencedAttribute : referencedEntityType.getAttributes()) {
+            AnnotatedElement annotatedElement2 = (AnnotatedElement) referencedAttribute.getJavaMember();
+            if (annotatedElement2 != null) {
+              Column referencedColumn = annotatedElement2.getAnnotation(Column.class);
+              if (referencedColumn != null && referencedColumn.name().equals((joinColumn.referencedColumnName()))) {
+                currentRefAttribute = referencedAttribute;
+                currentSimpleProperty = new SimpleProperty();
+                properties.add(buildSimpleProperty(currentRefAttribute, currentSimpleProperty));
+                break;
+              }
+            }
+          }
+        }
+      }
+    }
+
     @SuppressWarnings("rawtypes")
     private List<Attribute<?, ?>> sortInAscendingOrder(final Set<?> jpaAttributes) {
       List<Attribute<?, ?>> jpaAttributeList = new ArrayList<Attribute<?, ?>>();
@@ -374,4 +418,5 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
     }
     return isExcluded;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java
index cd80e70..07b4480 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java
@@ -26,8 +26,8 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmAssociationView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityTypeView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmPropertyView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintRoleView;
-import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintRoleView.RoleType;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintView;
 
 public class JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements JPAEdmReferentialConstraintView {
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java
index 6358774..2a2426b 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java
@@ -168,7 +168,7 @@ public class JPAEdmReferentialConstraintRole extends JPAEdmBaseViewImpl implemen
 
         if (roleType == RoleType.PRINCIPAL) {
           jpaAttributeType = jpaAttribute.getJavaType().getSimpleName();
-          if (jpaAttributeType.equals("List")) {
+          if (jpaAttribute.isCollection()) {
             Type type =
                 ((ParameterizedType) jpaAttribute.getJavaMember().getDeclaringClass().getDeclaredField(
                     jpaAttribute.getName()).getGenericType()).getActualTypeArguments()[0];

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
new file mode 100644
index 0000000..93587a8
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
@@ -0,0 +1,226 @@
+package org.apache.olingo.odata2.jpa.processor.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.uri.PathSegment;
+import org.apache.olingo.odata2.api.uri.UriInfo;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.mock.ODataContextMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.ODataServiceMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.PathInfoMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.PathSegmentMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtilV2;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock;
+import org.junit.Test;
+
+public class ODataEntityParserTest {
+
+  private ODataEntityParser parser;
+
+  private ODataJPAContext mock(final String path) {
+    ODataServiceMock serviceMock = new ODataServiceMock();
+    ODataContextMock contextMock = new ODataContextMock();
+    PathInfoMock pathInfoMock = new PathInfoMock();
+    PathSegmentMock pathSegmentMock = new PathSegmentMock();
+    ODataJPAContext odataJPAContext = null;
+
+    try {
+
+      pathSegmentMock.setPath(path);
+
+      List<PathSegment> pathSegments = new ArrayList<PathSegment>();
+      pathSegments.add(pathSegmentMock);
+      pathInfoMock.setPathSegments(pathSegments);
+      pathInfoMock.setServiceRootURI(ODataServiceMock.SERVICE_ROOT);
+
+      contextMock.setPathInfo(pathInfoMock.mock());
+      contextMock.setODataService(serviceMock.mock());
+
+      odataJPAContext = ODataJPAContextMock.mockODataJPAContext(contextMock.mock());
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (URISyntaxException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+    return odataJPAContext;
+  }
+
+  @Test
+  public void testParseURISegment() {
+
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseURISegment(0, 1);
+      assertNotNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseURISegmentInvalidIndex00() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseURISegment(0, 0);
+      assertNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseURISegmentInvalidIndex01() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseURISegment(-1, -1);
+      assertNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseURISegmentInvalidIndex02() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseURISegment(3, -1);
+      assertNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseURISegmentInvalidEntityType() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMockInvalid(2)"));
+      parser.parseURISegment(0, 1);
+      fail("Exception Expected");
+    } catch (ODataJPARuntimeException e) {
+      assertEquals(true, true);
+    }
+  }
+
+  @Test
+  public void testParseBindingLink() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseBindingLink("JPATypeMock(2)", new HashMap<String, String>());
+      assertNotNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+  }
+
+  @Test
+  public void testParseBindingLinkNegative() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      parser.parseBindingLink("JPATypeMockInvalid(2)", new HashMap<String, String>());
+      fail("Exception Expected");
+    } catch (ODataJPARuntimeException e) {
+      assertEquals(true, true);
+    }
+  }
+
+  @Test
+  public void testParseLink() {
+    parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+    try {
+      UriInfo uriInfo =
+          parser.parseLink(EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false), mockURIContent(0),
+              "application/json");
+      assertNotNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseLinkWithoutServiceRoot() {
+    parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+    try {
+      UriInfo uriInfo =
+          parser.parseLink(EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false), mockURIContent(1),
+              "application/json");
+      assertNotNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseLinkNegative() {
+    parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+    try {
+      parser.parseLink(EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false), mockURIContent(2),
+          "application/json");
+      fail("Exception Expected");
+    } catch (ODataJPARuntimeException e) {
+      assertEquals(true, true);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  private InputStream mockURIContent(final int variant) {
+    String uri = null;
+    InputStream is = null;
+    switch (variant) {
+    case 0:
+      uri = "{ \"uri\": \"" + ODataServiceMock.SERVICE_ROOT + "JPATypeMock(2)\" }";
+      break;
+    case 1:
+      uri = "{ \"uri\": \"JPATypeMock(2)\" }";
+      break;
+    case 2:
+      uri = "{ \"uri\": \"" + ODataServiceMock.SERVICE_ROOT + "JPATypeMockInvalid(2)\" }";
+    }
+
+    try {
+      is = new ByteArrayInputStream(uri.getBytes("utf-8"));
+    } catch (UnsupportedEncodingException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    return is;
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java
index c0d364c..422b5ab 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java
@@ -48,7 +48,6 @@ import org.apache.olingo.odata2.api.uri.expression.PropertyExpression;
 import org.apache.olingo.odata2.api.uri.expression.UnaryExpression;
 import org.apache.olingo.odata2.api.uri.expression.UnaryOperator;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.ODataExpressionParser;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.easymock.EasyMock;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java
index fe981fc..7550c00 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java
@@ -31,7 +31,6 @@ import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
 import org.apache.olingo.odata2.api.processor.ODataContext;
 import org.apache.olingo.odata2.api.processor.ODataProcessor;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
-import org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl;
 import org.apache.olingo.odata2.jpa.processor.core.edm.ODataJPAEdmProvider;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java
index ced012e..6317a4b 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java
@@ -69,7 +69,6 @@ import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.ODataJPAProcessorDefault;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmTestModelView;
 import org.easymock.EasyMock;
@@ -227,6 +226,7 @@ public class ODataJPAProcessorDefaultTest extends JPAEdmTestModelView {
     EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
     EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
     EasyMock.expect(objUriInfo.getKeyPredicates()).andStubReturn(getKeyPredicates());
+    EasyMock.expect(objUriInfo.isLinks()).andStubReturn(false);
     EasyMock.replay(objUriInfo);
     return objUriInfo;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
index 213b51b..e1c7c35 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
@@ -38,7 +38,6 @@ import org.apache.olingo.odata2.api.edm.EdmStructuralType;
 import org.apache.olingo.odata2.api.edm.EdmType;
 import org.apache.olingo.odata2.api.edm.EdmTypeKind;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntityParser;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.easymock.EasyMock;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
index d87d2c1..e75b060 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
@@ -26,7 +26,6 @@ import static org.junit.Assert.fail;
 import java.lang.reflect.Method;
 
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntityParser;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
index a93c4e0..6b81805 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
@@ -27,14 +27,13 @@ import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmEntityType;
 import org.apache.olingo.odata2.api.edm.EdmException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntity;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtilV2;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock;
-import org.apache.olingo.odata2.jpa.processor.core.mock.data.ODataEntryMockUtil;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPARelatedTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPATypeEmbeddableMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPATypeEmbeddableMock2;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.ODataEntryMockUtil;
 import org.junit.Test;
 
 public class JPAEntityTest {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
index d6f9153..efa230c 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
@@ -40,7 +40,6 @@ import org.apache.olingo.odata2.api.ep.callback.WriteFeedCallbackContext;
 import org.apache.olingo.odata2.api.ep.callback.WriteFeedCallbackResult;
 import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
 import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAExpandCallBack;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtil;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java
index 359ddfa..f9d0999 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java
@@ -37,7 +37,6 @@ import org.apache.olingo.odata2.jpa.processor.api.access.JPAMethodContext;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAFunctionContext;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmMappingImpl;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
new file mode 100644
index 0000000..db0f6fb
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
@@ -0,0 +1,5 @@
+package org.apache.olingo.odata2.jpa.processor.core.access.data;
+
+public class JPALinkTest {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java
index 915a7d3..bafef01 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java
@@ -59,7 +59,6 @@ import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAProcessorImpl;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.easymock.EasyMock;
 import org.junit.Before;
@@ -154,6 +153,7 @@ public class JPAProcessorImplTest {
     EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
     EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
     EasyMock.expect(objUriInfo.getKeyPredicates()).andStubReturn(getKeyPredicates());
+    EasyMock.expect(objUriInfo.isLinks()).andStubReturn(false);
     EasyMock.replay(objUriInfo);
     return objUriInfo;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java
index 073cd1f..bb0c1d3 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java
@@ -26,7 +26,6 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.InputStream;
 
-import org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmMappingModelService;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.junit.BeforeClass;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java
index 73af3e9..542d37f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java
@@ -26,8 +26,6 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmComplexPropertyVie
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityTypeView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmPropertyView;
 import org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl;
-import org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmMappingModelService;
-import org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmNameBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
index cdcf3b1..29462c9 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
@@ -26,7 +26,6 @@ import java.util.UUID;
 
 import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
-import org.apache.olingo.odata2.jpa.processor.core.access.model.JPATypeConvertor;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.junit.Test;
 


[6/7] git commit: [OLINGO-116] Added fix

Posted by mi...@apache.org.
[OLINGO-116] Added fix


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/01b50185
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/01b50185
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/01b50185

Branch: refs/heads/OLINGO-88_AnnotationArchetype
Commit: 01b501851da6809b2500064ec62a305a2eccc16f
Parents: 6575254
Author: Michael Bolz <mi...@apache.org>
Authored: Mon Jan 13 13:48:54 2014 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Mon Jan 13 14:06:32 2014 +0100

----------------------------------------------------------------------
 .../processor/core/util/ClassHelper.java        | 60 +++++++++++++-------
 1 file changed, 38 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/01b50185/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
index 006adb4..27f9cdb 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
@@ -39,9 +39,9 @@ import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
  */
 public class ClassHelper {
 
-  private static final String JAR_FILE_ENDING = "jar!";
+  private static final String JAR_FILE_ENDING = "jar";
   private static final String JAR_RESOURCE_SEPARATOR = "!";
-  private static final char PATH_SEPARATOR = '/';
+  private static final char RESOURCE_SEPARATOR = '/';
   private static final char PACKAGE_SEPARATOR = '.';
   private static final File[] EMPTY_FILE_ARRAY = new File[0];
   private static final String CLASSFILE_ENDING = ".class";
@@ -67,18 +67,20 @@ public class ClassHelper {
   public static final List<Class<?>> loadClasses(final String packageToScan, final FilenameFilter ff,
       final ClassValidator cv) {
     final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-    String folderToScan = packageToScan.replace(PACKAGE_SEPARATOR, PATH_SEPARATOR);
+    String folderToScan = packageToScan.replace(PACKAGE_SEPARATOR, RESOURCE_SEPARATOR);
     URL url = classLoader.getResource(folderToScan);
     if (url == null) {
       throw new IllegalArgumentException("No folder to scan found for package '" + packageToScan + "'.");
     }
 
     final Collection<String> fqnForClasses;
-    if (url.getFile().contains(JAR_FILE_ENDING)) {
-      fqnForClasses = getClassFqnFromJar(url.getFile().substring(5));
-    } else {
-      File folder = new File(url.getFile());
+    File folder = new File(url.getFile());
+    if (folder.isDirectory()) {
       fqnForClasses = getClassFqnFromDir(ff, folder, packageToScan);
+    } else if (isJarFile(url)) {
+      fqnForClasses = getClassFqnFromJar(url.getFile().substring(5), packageToScan);
+    } else {
+      fqnForClasses = null;
     }
 
     if (fqnForClasses == null || fqnForClasses.isEmpty()) {
@@ -94,6 +96,7 @@ public class ClassHelper {
         }
       } catch (ClassNotFoundException ex) {
         throw new IllegalArgumentException("Exception during class loading of class '" + fqn +
+            " from resource '" + url.getFile() + "'" +
             "' with message '" + ex.getMessage() + "'.");
       }
     }
@@ -101,6 +104,16 @@ public class ClassHelper {
     return annotatedClasses;
   }
 
+  private static boolean isJarFile(URL url) {
+    String filename = url.getFile();
+    int index = filename.indexOf(JAR_RESOURCE_SEPARATOR);
+    if (index > JAR_FILE_ENDING.length()) {
+      String fileEnding = filename.substring(index - JAR_FILE_ENDING.length(), index);
+      return JAR_FILE_ENDING.equalsIgnoreCase(fileEnding);
+    }
+    return false;
+  }
+
   private static Collection<String> getClassFqnFromDir(final FilenameFilter ff, File folder, String packageToScan) {
     List<String> classFiles = new ArrayList<String>();
     String[] classFilesForFolder = folder.list(ff);
@@ -117,33 +130,28 @@ public class ClassHelper {
     return classFiles;
   }
 
-  private static Collection<String> getClassFqnFromJar(String filepath) {
+  private static Collection<String> getClassFqnFromJar(String filepath, String packageToScan) {
+    JarFile jarFile = null;
+
+    final String jarFilePath;
     String[] split = filepath.split(JAR_RESOURCE_SEPARATOR);
     if (split.length == 2) {
-      return getClassFilesFromJar(split[0], split[1]);
+      jarFilePath = split[0];
+    } else {
+      throw new IllegalArgumentException("Illegal jar file path '" + filepath + "'.");
     }
-    throw new IllegalArgumentException("Illegal jar file path '" + filepath + "'.");
-  }
 
-  private static Collection<String> getClassFilesFromJar(String jarFilePath, String folderToScan) {
     try {
-      final String prefix;
-      if (folderToScan.startsWith(File.separator)) {
-        prefix = folderToScan.substring(1);
-      } else {
-        prefix = folderToScan;
-      }
-
-      JarFile jarFile = new JarFile(jarFilePath);
+      jarFile = new JarFile(jarFilePath);
       List<String> classFileNames = new ArrayList<String>();
       Enumeration<JarEntry> entries = jarFile.entries();
 
       while (entries.hasMoreElements()) {
         JarEntry je = entries.nextElement();
         String name = je.getName();
-        if (!je.isDirectory() && name.endsWith(CLASSFILE_ENDING) && name.startsWith(prefix)) {
+        if (!je.isDirectory() && name.matches(".*" + packageToScan + ".*" + CLASSFILE_ENDING)) {
           String className = name.substring(0, name.length() - CLASSFILE_ENDING.length());
-          classFileNames.add(className.replace(PATH_SEPARATOR, PACKAGE_SEPARATOR));
+          classFileNames.add(className.replace(RESOURCE_SEPARATOR, PACKAGE_SEPARATOR));
         }
       }
 
@@ -151,6 +159,14 @@ public class ClassHelper {
     } catch (IOException e) {
       throw new IllegalArgumentException("Exception during class loading from path '" + jarFilePath +
           "' with message '" + e.getMessage() + "'.");
+    } finally {
+      if (jarFile != null) {
+        try {
+          jarFile.close();
+        } catch (IOException e) {
+          throw new RuntimeException("Error during close of jar file: " + jarFile.getName() + "", e);
+        }
+      }
     }
   }
 


[2/7] [OLINGO-49], [OLINGO-51] Support for A) Linking entities using tag within an OData Entry B) Updating links C) Deleting links D) Code Cleanup

Posted by mi...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java
index 3e680f2..f4789c6 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java
@@ -33,7 +33,6 @@ import org.apache.olingo.odata2.api.edm.provider.EntityContainerInfo;
 import org.apache.olingo.odata2.api.edm.provider.Schema;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.jpa.processor.core.edm.ODataJPAEdmProvider;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmModel;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java
index 44d0448..75d849b 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java
@@ -38,7 +38,6 @@ import org.apache.olingo.odata2.api.edm.provider.Schema;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.jpa.processor.core.edm.ODataJPAEdmProvider;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.EdmSchemaMock;
 import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmModel;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java
index a127e60..dd56f91 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java
@@ -51,17 +51,13 @@ import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.factory.JPAAccessFactory;
 import org.apache.olingo.odata2.jpa.processor.api.factory.ODataJPAAccessFactory;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
-import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLStatement.JPQLStatementBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl;
 import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAProcessorImplTest;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.factory.ODataJPAFactoryImpl;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectSingleStatementBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinStatementBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleStatementBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectStatementBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext.JPQLSelectContextBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleContext.JPQLSelectSingleContextBuilder;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java
index 33e44e2..c94160c 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java
@@ -42,7 +42,6 @@ import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectContext;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectContext.JPQLJoinContextBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java
index de5532c..117d21f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java
@@ -42,7 +42,6 @@ import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectSingleContext;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectSingleContext.JPQLJoinSelectSingleContextBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
index 13f1ca5..b5412a8 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
@@ -35,7 +35,6 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLJoinSelectSingleContextView;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLStatement;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectSingleStatementBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.AfterClass;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
index e1637d1..2a0d4f7 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
@@ -31,7 +31,6 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLJoinContextView;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLStatement;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinStatementBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.AfterClass;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java
index 03eb651..e793817 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java
@@ -46,7 +46,6 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext.JPQLSelectContextBuilder;
 import org.easymock.EasyMock;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java
index 69952fd..0394e54 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java
@@ -38,7 +38,6 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelExcepti
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleContext;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleContext.JPQLSelectSingleContextBuilder;
 import org.easymock.EasyMock;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java
index c65aee4..25fd5ae 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java
@@ -36,10 +36,8 @@ import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
-import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleContext;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleStatementBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
index 7a14f6c..617365b 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
@@ -37,10 +37,8 @@ import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
-import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectStatementBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataContextMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataContextMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataContextMock.java
new file mode 100644
index 0000000..d4a691e
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataContextMock.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.mock;
+
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataContext;
+import org.apache.olingo.odata2.api.uri.PathInfo;
+import org.easymock.EasyMock;
+
+public class ODataContextMock {
+
+  private ODataService odataService;
+  private PathInfo pathInfo;
+
+  public void setODataService(final ODataService service) {
+    odataService = service;
+  }
+
+  public void setPathInfo(final PathInfo pathInfo) {
+    this.pathInfo = pathInfo;
+  }
+
+  public ODataContext mock() throws ODataException {
+    ODataContext context = EasyMock.createMock(ODataContext.class);
+    EasyMock.expect(context.getService()).andReturn(odataService).anyTimes();
+    EasyMock.expect(context.getPathInfo()).andReturn(pathInfo).anyTimes();
+    EasyMock.replay(context);
+    return context;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
index 83ae7c0..4d00503 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
@@ -21,6 +21,7 @@ package org.apache.olingo.odata2.jpa.processor.core.mock;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.metamodel.Metamodel;
 
+import org.apache.olingo.odata2.api.processor.ODataContext;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
 import org.easymock.EasyMock;
 
@@ -37,6 +38,20 @@ public abstract class ODataJPAContextMock {
     EasyMock.expect(odataJPAContext.getJPAEdmMappingModel()).andReturn(MAPPING_MODEL);
     EasyMock.expect(odataJPAContext.getJPAEdmExtension()).andReturn(null);
     EasyMock.expect(odataJPAContext.getDefaultNaming()).andReturn(true);
+
+    EasyMock.replay(odataJPAContext);
+    return odataJPAContext;
+  }
+
+  public static ODataJPAContext mockODataJPAContext(final ODataContext context) {
+    ODataJPAContext odataJPAContext = EasyMock.createMock(ODataJPAContext.class);
+    EasyMock.expect(odataJPAContext.getPersistenceUnitName()).andStubReturn(NAMESPACE);
+    EasyMock.expect(odataJPAContext.getEntityManagerFactory()).andReturn(mockEntityManagerFactory());
+    EasyMock.expect(odataJPAContext.getJPAEdmMappingModel()).andReturn(MAPPING_MODEL);
+    EasyMock.expect(odataJPAContext.getJPAEdmExtension()).andReturn(null);
+    EasyMock.expect(odataJPAContext.getDefaultNaming()).andReturn(true);
+    EasyMock.expect(odataJPAContext.getODataContext()).andReturn(context).anyTimes();
+
     EasyMock.replay(odataJPAContext);
     return odataJPAContext;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataServiceMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataServiceMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataServiceMock.java
new file mode 100644
index 0000000..c5478db
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataServiceMock.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.mock;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmAssociation;
+import org.apache.olingo.odata2.api.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmServiceMetadata;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtilV2;
+import org.easymock.EasyMock;
+
+public class ODataServiceMock {
+
+  private Edm edmMock = null;
+  public static final String SERVICE_ROOT = "http://apache.odata.org/OData.svc/";
+
+  public ODataService mock() throws ODataException {
+    ODataService odataService = EasyMock.createMock(ODataService.class);
+    EasyMock.expect(odataService.getEntityDataModel()).andReturn(mockEdm());
+    EasyMock.replay(odataService);
+    return odataService;
+
+  }
+
+  private Edm mockEdm() {
+    if (edmMock == null) {
+      edmMock = new EdmMock();
+    }
+    return edmMock;
+  }
+
+  public static class EdmMock implements Edm {
+
+    @Override
+    public EdmEntityContainer getEntityContainer(final String name) throws EdmException {
+      return EdmMockUtilV2.mockEdmEntityContainer(name);
+    }
+
+    @Override
+    public EdmEntityType getEntityType(final String namespace, final String name) throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public EdmComplexType getComplexType(final String namespace, final String name) throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public EdmAssociation getAssociation(final String namespace, final String name) throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public EdmServiceMetadata getServiceMetadata() {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public EdmEntityContainer getDefaultEntityContainer() throws EdmException {
+      return EdmMockUtilV2.mockEdmEntityContainer(null);
+    }
+
+    @Override
+    public List<EdmEntitySet> getEntitySets() throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public List<EdmFunctionImport> getFunctionImports() throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathInfoMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathInfoMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathInfoMock.java
new file mode 100644
index 0000000..96a920c
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathInfoMock.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.mock;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.uri.PathInfo;
+import org.apache.olingo.odata2.api.uri.PathSegment;
+import org.easymock.EasyMock;
+
+public class PathInfoMock {
+
+  private List<PathSegment> pathSegments;
+  private URI uri;
+
+  public void setPathSegments(final List<PathSegment> pathSegments) {
+    this.pathSegments = pathSegments;
+  }
+
+  public void setServiceRootURI(final String uriString) throws URISyntaxException {
+    uri = new URI(uriString);
+  }
+
+  public PathInfo mock() {
+    PathInfo pathInfo = EasyMock.createMock(PathInfo.class);
+    EasyMock.expect(pathInfo.getODataSegments()).andReturn(pathSegments);
+    EasyMock.expect(pathInfo.getServiceRoot()).andReturn(uri);
+
+    EasyMock.replay(pathInfo);
+    return pathInfo;
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathSegmentMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathSegmentMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathSegmentMock.java
new file mode 100644
index 0000000..77d1fbd
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathSegmentMock.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.mock;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.uri.PathSegment;
+
+public class PathSegmentMock implements PathSegment {
+
+  private String path;
+
+  public void setPath(final String path) {
+    this.path = path;
+  }
+
+  @Override
+  public String getPath() {
+    return path;
+  }
+
+  @Override
+  public Map<String, List<String>> getMatrixParameters() {
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
index 2189219..2ecf5dd 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
@@ -26,6 +26,7 @@ import java.util.UUID;
 import org.apache.olingo.odata2.api.edm.EdmAssociation;
 import org.apache.olingo.odata2.api.edm.EdmAssociationEnd;
 import org.apache.olingo.odata2.api.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmEntityType;
 import org.apache.olingo.odata2.api.edm.EdmException;
@@ -33,7 +34,7 @@ import org.apache.olingo.odata2.api.edm.EdmMapping;
 import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
 import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
 import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.edm.EdmSimpleType;
 import org.apache.olingo.odata2.api.edm.EdmTypeKind;
 import org.apache.olingo.odata2.api.edm.provider.Mapping;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping;
@@ -49,6 +50,19 @@ public class EdmMockUtilV2 {
 
   }
 
+  public static EdmEntityContainer mockEdmEntityContainer(final String entityName) throws EdmException {
+    EdmEntityContainer entityContainer = EasyMock.createMock(EdmEntityContainer.class);
+    entityContainer = EasyMock.createMock(EdmEntityContainer.class);
+    EasyMock.expect(entityContainer.getEntitySet(JPATypeMock.ENTITY_NAME)).andReturn(
+        mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false));
+    EasyMock.expect(entityContainer.getFunctionImport(JPATypeMock.ENTITY_NAME)).andReturn(null);
+    EasyMock.expect(entityContainer.getEntitySet("JPATypeMockInvalid")).andReturn(null);
+    EasyMock.expect(entityContainer.getFunctionImport("JPATypeMockInvalid")).andReturn(null);
+    EasyMock.replay(entityContainer);
+
+    return entityContainer;
+  }
+
   public static EdmEntityType mockEdmEntityType(final String entityName, final boolean withComplexType)
       throws EdmException {
 
@@ -64,6 +78,7 @@ public class EdmMockUtilV2 {
     EasyMock.expect(entityType.getNavigationPropertyNames()).andReturn(mockNavigationPropertyNames(entityName));
     EasyMock.expect(entityType.getKind()).andReturn(EdmTypeKind.ENTITY);
     EasyMock.expect(entityType.getMapping()).andReturn((EdmMapping) mockEdmMapping(entityName, null, null));
+    EasyMock.expect(entityType.getKeyProperties()).andReturn(mockKeyProperties(entityName)).anyTimes();
     if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
       EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MINT)).andReturn(
           mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MINT)).anyTimes();
@@ -89,6 +104,13 @@ public class EdmMockUtilV2 {
     return entityType;
   }
 
+  public static List<EdmProperty> mockKeyProperties(final String entityName) throws EdmException {
+    List<EdmProperty> edmProperties = new ArrayList<EdmProperty>();
+    edmProperties.add(mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MINT));
+
+    return edmProperties;
+  }
+
   public static List<String> mockNavigationPropertyNames(final String entityName) {
     List<String> propertyNames = new ArrayList<String>();
     propertyNames.add(JPATypeMock.NAVIGATION_PROPERTY_X);
@@ -211,9 +233,10 @@ public class EdmMockUtilV2 {
         propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE) ||
         propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)) {
 
-      EdmType edmType = EasyMock.createMock(EdmType.class);
+      EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
       EasyMock.expect(edmProperty.getType()).andReturn(edmType).anyTimes();
       EasyMock.expect(edmType.getKind()).andReturn(EdmTypeKind.SIMPLE).anyTimes();
+      EasyMock.expect(edmType.isCompatible(EasyMock.isA(EdmSimpleType.class))).andReturn(true).anyTimes();
       EasyMock.replay(edmType);
       EasyMock.expect(edmProperty.getName()).andReturn(propertyName).anyTimes();
       EasyMock.expect(edmProperty.getMapping()).andReturn((EdmMapping) mockEdmMapping(entityName, propertyName, null))

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
index b756f91..a066972 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
@@ -37,7 +37,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType.SimpleTypeA;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociationEnd;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
index cb7d252..2cf50ca 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
@@ -40,7 +40,6 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmAssociationView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityContainerView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntitySetView;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociationSet;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
index 3923dd8..8c3b119 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
-
+ * 
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
@@ -48,9 +48,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType.SimpleTypeA;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociation;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociationEnd;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmReferentialConstraint;
 import org.easymock.EasyMock;
 import org.junit.BeforeClass;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
index 237a6a3..4f4a479 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
@@ -26,7 +26,6 @@ import javax.persistence.metamodel.Metamodel;
 
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmBaseViewImpl;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
index 9ab7872..ae1c5f1 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
@@ -46,8 +46,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEmbeddableMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmComplexType;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmMappingImpl;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java
index 0d6a2c1..f94fa6f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java
@@ -43,7 +43,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmEntityContainer;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java
index f8f5321..6994dd9 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java
@@ -43,7 +43,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmEntitySet;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java
index ad1a5c0..8c79ece 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java
@@ -40,7 +40,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmEntityType;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java
index 5992418..db23397 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java
@@ -47,7 +47,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPACustomProcessorMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model._JPACustomProcessorNegativeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmFunctionImport;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java
index 533e4e8..459a2c4 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java
@@ -42,7 +42,6 @@ import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.ComplexType.ComplexTypeA;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmKey;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java
index 354f910..120b209 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java
@@ -34,7 +34,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEmbeddableMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmModel;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java
index 8c7aea6..354fecc 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java
@@ -37,7 +37,6 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityTypeView;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAPluralAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmNavigationProperty;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
index 877d883..c204d1f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
@@ -47,14 +47,13 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityContainerVie
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntitySetView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityTypeView;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.ComplexType;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEmbeddableTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAPluralAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.ComplexType;
-import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmProperty;
 import org.junit.Test;
 
 public class JPAEdmPropertyTest extends JPAEdmTestModelView {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java
index a453984..5737c41 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java
@@ -47,8 +47,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAJavaMemberMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAManagedTypeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmMappingImpl;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmReferentialConstraintRole;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java
index 885ff86..6e7f6b3 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java
@@ -40,7 +40,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAJavaMemberMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAManagedTypeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmReferentialConstraint;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java
index b366191..8408c9f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java
@@ -28,7 +28,6 @@ import javax.persistence.metamodel.Metamodel;
 
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmSchema;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java
index d145239..7a6f90f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java
@@ -386,15 +386,21 @@ public class JPAEdmTestModelView implements JPAEdmAssociationEndView, JPAEdmAsso
   }
 
   @Override
-  public boolean isReferencedInKey(String complexTypeName) {
+  public boolean isReferencedInKey(final String complexTypeName) {
     // TODO Auto-generated method stub
     return false;
   }
 
   @Override
-  public void setReferencedInKey(String complexTypeName) {
+  public void setReferencedInKey(final String complexTypeName) {
     // TODO Auto-generated method stub
 
   }
 
+  @Override
+  public Attribute<?, ?> getJPAReferencedAttribute() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java
index 02b6c9f..e8f3e7b 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java
@@ -48,7 +48,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model._JPACustomProcessorMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model._JPACustomProcessorNegativeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmFunctionImport;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
index ab21848..0ae4adf 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
@@ -48,7 +48,7 @@ public class Address {
 
   @Column(name = "COUNTRY")
   private String country;
-  
+
   @Column(name = "PINCODE")
   private String pincode;
 
@@ -56,7 +56,7 @@ public class Address {
     return pincode;
   }
 
-  public void setPincode(String pincode) {
+  public void setPincode(final String pincode) {
     this.pincode = pincode;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
index 34891a7..22e2966 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
@@ -32,10 +32,10 @@ import javax.persistence.Table;
 public class Category {
 
   @Id
-  @Column(name="CODE")
+  @Column(name = "CODE")
   private char code[] = new char[2];
 
-  @Column(name="DESC")
+  @Column(name = "DESC")
   private String description;
 
   @OneToMany(mappedBy = "category")
@@ -45,7 +45,7 @@ public class Category {
     return materials;
   }
 
-  public void setMaterials(List<Material> materials) {
+  public void setMaterials(final List<Material> materials) {
     this.materials = materials;
   }
 
@@ -53,7 +53,7 @@ public class Category {
     return code;
   }
 
-  public void setCode(char[] code) {
+  public void setCode(final char[] code) {
     this.code = code;
   }
 
@@ -61,7 +61,7 @@ public class Category {
     return description;
   }
 
-  public void setDescription(String description) {
+  public void setDescription(final String description) {
     this.description = description;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
index c28e37e..18f24b4 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
@@ -49,7 +49,7 @@ public class Customer {
     return id;
   }
 
-  public void setId(Long id) {
+  public void setId(final Long id) {
     this.id = id;
   }
 
@@ -57,7 +57,7 @@ public class Customer {
     return name;
   }
 
-  public void setName(String name) {
+  public void setName(final String name) {
     this.name = name;
   }
 
@@ -65,7 +65,7 @@ public class Customer {
     return orders;
   }
 
-  public void setOrders(List<SalesOrderHeader> orders) {
+  public void setOrders(final List<SalesOrderHeader> orders) {
     this.orders = orders;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
index 7330042..c4ca423 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
@@ -40,7 +40,6 @@ public class Material {
       final String measurementUnit) {
     super();
     this.materialName = materialName;
-    this.typeCode = typeCode;
     this.price = price;
     this.measurementUnit = measurementUnit;
   }
@@ -52,9 +51,6 @@ public class Material {
   @Column(name = "MATERIAL_NAME")
   private String materialName;
 
-  @Column(name = "TYPE_CODE")
-  private char[] typeCode = new char[2];
-
   @Column(name = "PRICE")
   private double price;
 
@@ -80,7 +76,7 @@ public class Material {
     return category;
   }
 
-  public void setCategory(Category category) {
+  public void setCategory(final Category category) {
     this.category = category;
   }
 
@@ -92,14 +88,6 @@ public class Material {
     this.materialName = materialName;
   }
 
-  public char[] getTypeCode() {
-    return typeCode;
-  }
-
-  public void setTypeCode(final char[] typeCode) {
-    this.typeCode = typeCode;
-  }
-
   public double getPrice() {
     return price;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
index 3ed1ee5..c6a28c5 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
@@ -98,7 +98,7 @@ public class SalesOrderHeader {
     return customerId;
   }
 
-  public void setCustomerId(Long customerId) {
+  public void setCustomerId(final Long customerId) {
     this.customerId = customerId;
   }
 
@@ -106,7 +106,7 @@ public class SalesOrderHeader {
     return customer;
   }
 
-  public void setCustomer(Customer customer) {
+  public void setCustomer(final Customer customer) {
     this.customer = customer;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
index b5ff286..29e5007 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
+++ b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
@@ -18,10 +18,10 @@
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderHeader</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderItem</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Note</class>
-		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Material</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Store</class>
-		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Category</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Customer</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Category</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Material</class>
 		<properties>
 			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
 			<property name="javax.persistence.jdbc.url"

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java
index 9dde58f..7b056e0 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java
@@ -27,7 +27,7 @@ public class OrderValue {
     return amount;
   }
 
-  public void setAmount(double amount) {
+  public void setAmount(final double amount) {
     this.amount = amount;
   }
 
@@ -35,7 +35,7 @@ public class OrderValue {
     return currency;
   }
 
-  public void setCurrency(String currency) {
+  public void setCurrency(final String currency) {
     this.currency = currency;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/886d283d/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java
index 94aad4f..3133944 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java
@@ -39,24 +39,24 @@ public class SalesOrderProcessingExtension implements JPAEdmExtension {
 
   private ComplexType getComplexType() {
     ComplexType complexType = new ComplexType();
-    
+
     List<Property> properties = new ArrayList<Property>();
     SimpleProperty property = new SimpleProperty();
-    
+
     property.setName("Amount");
     property.setType(EdmSimpleTypeKind.Double);
     properties.add(property);
-    
+
     property = new SimpleProperty();
     property.setName("Currency");
     property.setType(EdmSimpleTypeKind.String);
     properties.add(property);
-    
+
     complexType.setName("OrderValue");
     complexType.setProperties(properties);
-    
+
     return complexType;
-    
+
   }
 
   @Override


[5/7] git commit: [OLINGO-115] Junit test verified that it works

Posted by mi...@apache.org.
[OLINGO-115] Junit test verified that it works


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/6575254a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/6575254a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/6575254a

Branch: refs/heads/OLINGO-88_AnnotationArchetype
Commit: 6575254a16039d83e12c6adb2c2e0d81a9d94843
Parents: 6a517c9
Author: Christian Amend <ch...@apache.org>
Authored: Mon Jan 13 10:44:10 2014 +0100
Committer: Christian Amend <ch...@apache.org>
Committed: Mon Jan 13 10:52:49 2014 +0100

----------------------------------------------------------------------
 .../jpa/processor/core/ODataEntityParser.java   |  3 +-
 .../ep/ProducerConsumerIntegrationTest.java     | 83 ++++++++++++++++++++
 2 files changed, 85 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6575254a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
index dccfc6c..0da3bcd 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
@@ -135,7 +135,8 @@ public final class ODataEntityParser {
     return uriInfo;
   }
 
-  public UriInfo parseBindingLink(final String link, final Map<String, String> options) throws ODataJPARuntimeException {
+  public UriInfo parseBindingLink(final String link, final Map<String, String> options) 
+      throws ODataJPARuntimeException {
     final PathSegment pathSegment = getPathSegment(link);
     UriInfo uriInfo = null;
     try {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6575254a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProducerConsumerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProducerConsumerIntegrationTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProducerConsumerIntegrationTest.java
new file mode 100644
index 0000000..e7aec79
--- /dev/null
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProducerConsumerIntegrationTest.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.core.ep;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.ep.EntityProvider;
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
+import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.testutil.mock.MockFacade;
+import org.junit.Test;
+
+public class ProducerConsumerIntegrationTest {
+  protected static final URI BASE_URI;
+
+  static {
+    try {
+      BASE_URI = new URI("http://host:80/service/");
+    } catch (URISyntaxException e) {
+      throw new RuntimeException(e);
+    }
+  }
+  private static final EntityProviderReadProperties DEFAULT_READ_PROPERTIES = EntityProviderReadProperties.init()
+      .build();
+  private static final EntityProviderWriteProperties DEFAULT_WRITE_PROPERTIES = EntityProviderWriteProperties
+      .serviceRoot(
+          BASE_URI).build();
+  private static final String XML = "application/xml";
+  private static final String JSON = "application/json";
+
+  @Test
+  public void produceRoomAndThenConsumeIt() throws Exception {
+    EdmEntitySet roomSet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+    Map<String, Object> localRoomData = new HashMap<String, Object>();
+    localRoomData.put("Id", "1");
+    localRoomData.put("Name", "Neu \n Schwanstein蝴蝶");
+
+    Map<String, Object> properties = execute(localRoomData, roomSet, XML);
+    assertEquals("1", properties.get("Id"));
+    assertEquals("Neu \n Schwanstein蝴蝶", properties.get("Name"));
+
+    Map<String, Object> properties2 = execute(localRoomData, roomSet, JSON);
+    assertEquals("1", properties2.get("Id"));
+    assertEquals("Neu \n Schwanstein蝴蝶", properties2.get("Name"));
+  }
+
+  private Map<String, Object> execute(Map<String, Object> localRoomData, EdmEntitySet roomSet, String contentType)
+      throws EntityProviderException {
+    ODataResponse response = EntityProvider.writeEntry(contentType, roomSet, localRoomData, DEFAULT_WRITE_PROPERTIES);
+    InputStream content = (InputStream) response.getEntity();
+
+    ODataEntry entry = EntityProvider.readEntry(contentType, roomSet, content, DEFAULT_READ_PROPERTIES);
+    Map<String, Object> properties = entry.getProperties();
+    return properties;
+  }
+
+}


[7/7] git commit: Merge branch 'master' into OLINGO-88_AnnotationArchetype

Posted by mi...@apache.org.
Merge branch 'master' into OLINGO-88_AnnotationArchetype


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/e72d108b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/e72d108b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/e72d108b

Branch: refs/heads/OLINGO-88_AnnotationArchetype
Commit: e72d108bbaa7e175ba8083825d959ca1ef7a0ced
Parents: 595981c 01b5018
Author: Michael Bolz <mi...@apache.org>
Authored: Mon Jan 13 14:08:49 2014 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Mon Jan 13 14:08:49 2014 +0100

----------------------------------------------------------------------
 .../processor/core/util/ClassHelper.java        |  60 ++--
 .../jpa/processor/api/ODataJPAProcessor.java    |   2 +-
 .../api/factory/JPQLBuilderFactory.java         |   2 +-
 .../api/model/JPAEdmComplexTypeView.java        |   4 +-
 .../processor/api/model/JPAEdmPropertyView.java |   9 +
 .../jpa/processor/core/ODataEntityParser.java   | 128 ++++----
 .../core/ODataJPAProcessorDefault.java          |   8 +
 .../processor/core/access/data/JPAEntity.java   |  28 +-
 .../jpa/processor/core/access/data/JPALink.java | 318 ++++++++++++-------
 .../core/access/data/JPAProcessorImpl.java      |  18 +-
 .../access/model/JPAEdmMappingModelService.java |   2 +-
 .../core/access/model/JPAEdmNameBuilder.java    |   9 +-
 .../processor/core/model/JPAEdmMappingImpl.java |   1 -
 .../processor/core/model/JPAEdmProperty.java    |  81 +++--
 .../core/model/JPAEdmReferentialConstraint.java |   2 +-
 .../model/JPAEdmReferentialConstraintRole.java  |   2 +-
 .../processor/core/ODataEntityParserTest.java   | 244 ++++++++++++++
 .../core/ODataExpressionParserTest.java         |   1 -
 .../processor/core/ODataJPAContextImplTest.java |   1 -
 .../core/ODataJPAProcessorDefaultTest.java      |   2 +-
 .../core/access/data/JPAEntityParserTest.java   |   1 -
 .../JPAEntityParserTestForStaticMethods.java    |   1 -
 .../core/access/data/JPAEntityTest.java         |   3 +-
 .../core/access/data/JPAExpandCallBackTest.java |   1 -
 .../access/data/JPAFunctionContextTest.java     |   1 -
 .../processor/core/access/data/JPALinkTest.java |  23 ++
 .../core/access/data/JPAProcessorImplTest.java  |   2 +-
 .../model/JPAEdmMappingModelServiceTest.java    |   1 -
 .../access/model/JPAEdmNameBuilderTest.java     |   2 -
 .../core/access/model/JPATypeConvertorTest.java |   1 -
 .../edm/ODataJPAEdmProviderNegativeTest.java    |   1 -
 .../core/edm/ODataJPAEdmProviderTest.java       |   1 -
 .../core/jpql/JPQLBuilderFactoryTest.java       |   6 +-
 .../core/jpql/JPQLJoinContextTest.java          |   1 -
 .../jpql/JPQLJoinSelectSingleContextTest.java   |   1 -
 ...PQLJoinSelectSingleStatementBuilderTest.java |   1 -
 .../core/jpql/JPQLJoinStatementBuilderTest.java |   1 -
 .../core/jpql/JPQLSelectContextImplTest.java    |   1 -
 .../jpql/JPQLSelectSingleContextImplTest.java   |   1 -
 .../JPQLSelectSingleStatementBuilderTest.java   |   4 +-
 .../jpql/JPQLSelectStatementBuilderTest.java    |   4 +-
 .../processor/core/mock/ODataContextMock.java   |  48 +++
 .../core/mock/ODataJPAContextMock.java          |  15 +
 .../processor/core/mock/ODataServiceMock.java   | 106 +++++++
 .../jpa/processor/core/mock/PathInfoMock.java   |  51 +++
 .../processor/core/mock/PathSegmentMock.java    |  44 +++
 .../processor/core/mock/data/EdmMockUtilV2.java |  27 +-
 .../core/model/JPAEdmAssociationEndTest.java    |   1 -
 .../core/model/JPAEdmAssociationSetTest.java    |   1 -
 .../core/model/JPAEdmAssociationTest.java       |   5 +-
 .../core/model/JPAEdmBaseViewImplTest.java      |   1 -
 .../core/model/JPAEdmComplexTypeTest.java       |   2 -
 .../core/model/JPAEdmEntityContainerTest.java   |   1 -
 .../core/model/JPAEdmEntitySetTest.java         |   1 -
 .../core/model/JPAEdmEntityTypeTest.java        |   1 -
 .../core/model/JPAEdmFunctionImportTest.java    |   1 -
 .../jpa/processor/core/model/JPAEdmKeyTest.java |   1 -
 .../processor/core/model/JPAEdmModelTest.java   |   1 -
 .../model/JPAEdmNavigationPropertyTest.java     |   1 -
 .../core/model/JPAEdmPropertyTest.java          |   5 +-
 .../JPAEdmReferentialConstraintRoleTest.java    |   2 -
 .../model/JPAEdmReferentialConstraintTest.java  |   1 -
 .../processor/core/model/JPAEdmSchemaTest.java  |   1 -
 .../core/model/JPAEdmTestModelView.java         |  10 +-
 .../core/model/_JPAEdmFunctionImportTest.java   |   1 -
 .../odata2/jpa/processor/ref/model/Address.java |  11 +
 .../jpa/processor/ref/model/Category.java       |  68 ++++
 .../jpa/processor/ref/model/Customer.java       |  80 +++++
 .../jpa/processor/ref/model/Material.java       |  28 +-
 .../processor/ref/model/SalesOrderHeader.java   |  86 +++--
 .../src/main/resources/META-INF/persistence.xml |   4 +-
 .../jpa/processor/ref/extension/OrderValue.java |   4 +-
 .../extension/SalesOrderHeaderProcessor.java    |   2 +-
 .../SalesOrderProcessingExtension.java          |  12 +-
 .../extension/_SalesOrderHeaderProcessor.java   |   2 +-
 .../jpa/processor/ref/util/DataGenerator.java   |   4 +-
 .../main/resources/DataDeleteSQLs.properties    |  22 --
 .../src/main/resources/MaterialSQLs.properties  |  30 --
 .../src/main/resources/NoteSQLs.properties      |  20 --
 .../main/resources/SQLInsertConfig.properties   |  22 --
 .../src/main/resources/SQL_Cleanup.properties   |  22 ++
 .../resources/SQL_Insert_Category.properties    |  22 ++
 .../main/resources/SQL_Insert_Config.properties |  22 ++
 .../resources/SQL_Insert_Customer.properties    |  23 ++
 .../resources/SQL_Insert_Material.properties    |  30 ++
 .../main/resources/SQL_Insert_Note.properties   |  20 ++
 .../SQL_Insert_SalesOrderHeader.properties      |  30 ++
 .../SQL_Insert_SalesOrderItem.properties        |  30 ++
 .../main/resources/SQL_Insert_Store.properties  |  30 ++
 .../resources/SalesOrderHeaderSQLs.properties   |  30 --
 .../resources/SalesOrderItemSQLs.properties     |  30 --
 .../src/main/resources/StoreSQLs.properties     |  30 --
 .../ep/ProducerConsumerIntegrationTest.java     |  83 +++++
 93 files changed, 1548 insertions(+), 557 deletions(-)
----------------------------------------------------------------------



[4/7] git commit: Added missing licence header

Posted by mi...@apache.org.
Added missing licence header


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/6a517c94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/6a517c94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/6a517c94

Branch: refs/heads/OLINGO-88_AnnotationArchetype
Commit: 6a517c94d6cae1d9892ef45a959ba241a8d7c541
Parents: 886d283
Author: Michael Bolz <mi...@apache.org>
Authored: Mon Jan 13 07:50:43 2014 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Mon Jan 13 07:50:43 2014 +0100

----------------------------------------------------------------------
 .../jpa/processor/core/ODataEntityParserTest.java | 18 ++++++++++++++++++
 .../processor/core/access/data/JPALinkTest.java   | 18 ++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6a517c94/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
index 93587a8..adf7b80 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
 package org.apache.olingo.odata2.jpa.processor.core;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6a517c94/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
index db0f6fb..7a0b754 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
 package org.apache.olingo.odata2.jpa.processor.core.access.data;
 
 public class JPALinkTest {