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

[1/9] line ending issue again

Repository: olingo-odata2
Updated Branches:
  refs/heads/olingo436BatchRefactoring f0dc0f745 -> 8dfd515e8


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-web/.gitignore
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/.gitignore b/odata2-jpa-processor/jpa-web/.gitignore
index fe5d89b..a7ffe90 100644
--- a/odata2-jpa-processor/jpa-web/.gitignore
+++ b/odata2-jpa-processor/jpa-web/.gitignore
@@ -1,8 +1,8 @@
-.project
-.classpath
-.settings
-target
-bin
-*.bak
-classes
+.project
+.classpath
+.settings
+target
+bin
+*.bak
+classes
 .DS_Store
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java
index 678b62a..f93a977 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OnDBWriteContent.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * 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.extension;
-
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.SQLException;
-
-import javax.sql.rowset.serial.SerialException;
-
-import org.apache.olingo.odata2.jpa.processor.api.OnJPAWriteContent;
-import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.hsqldb.jdbc.JDBCBlob;
-import org.hsqldb.jdbc.JDBCClob;
-
-public class OnDBWriteContent implements OnJPAWriteContent {
-
-  @Override
-  public Blob getJPABlob(final byte[] binaryData) throws ODataJPARuntimeException {
-    try {
-      return new JDBCBlob(binaryData);
-    } catch (SerialException e) {
-      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
-    } catch (SQLException e) {
-      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
-    }
-    return null;
-  }
-
-  @Override
-  public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException {
-    try {
-      return new JDBCClob(new String(characterData));
-    } catch (SQLException e) {
-      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
-    }
-    return null;
-  }
-}
+/*******************************************************************************
+ * 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.extension;
+
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.SQLException;
+
+import javax.sql.rowset.serial.SerialException;
+
+import org.apache.olingo.odata2.jpa.processor.api.OnJPAWriteContent;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.hsqldb.jdbc.JDBCBlob;
+import org.hsqldb.jdbc.JDBCClob;
+
+public class OnDBWriteContent implements OnJPAWriteContent {
+
+  @Override
+  public Blob getJPABlob(final byte[] binaryData) throws ODataJPARuntimeException {
+    try {
+      return new JDBCBlob(binaryData);
+    } catch (SerialException e) {
+      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    } catch (SQLException e) {
+      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    }
+    return null;
+  }
+
+  @Override
+  public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException {
+    try {
+      return new JDBCClob(new String(characterData));
+    } catch (SQLException e) {
+      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    }
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 7b056e0..e65221d 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
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * 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.extension;
-
-public class OrderValue {
-
-  private double amount;
-  private String currency;
-
-  public double getAmount() {
-    return amount;
-  }
-
-  public void setAmount(final double amount) {
-    this.amount = amount;
-  }
-
-  public String getCurrency() {
-    return currency;
-  }
-
-  public void setCurrency(final String currency) {
-    this.currency = currency;
-  }
-
-}
+/*******************************************************************************
+ * 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.extension;
+
+public class OrderValue {
+
+  private double amount;
+  private String currency;
+
+  public double getAmount() {
+    return amount;
+  }
+
+  public void setAmount(final double amount) {
+    this.amount = amount;
+  }
+
+  public String getCurrency() {
+    return currency;
+  }
+
+  public void setCurrency(final String currency) {
+    this.currency = currency;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 e840119..e8c74dd 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
@@ -1,158 +1,158 @@
-/*******************************************************************************
- * 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.util;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.olingo.odata2.jpa.processor.ref.model.Material;
-import org.apache.olingo.odata2.jpa.processor.ref.model.Store;
-import org.eclipse.persistence.internal.jpa.EntityManagerImpl;
-import org.eclipse.persistence.queries.DataModifyQuery;
-import org.eclipse.persistence.queries.SQLCall;
-import org.eclipse.persistence.sessions.Session;
-
-/**
- * This is a utility class for generating and cleaning data. The generated data would be used by the application.
- * 
- * 
- */
-public class DataGenerator {
-
-  private EntityManager entityManager;
-
-  /**
-   * This is configuration property to hold comma separated names of Insert Files
-   */
-  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 = "SQL_Cleanup";
-  private static final String SQL_DELETE_STATEMENTS_KEY = "delete_queries";
-
-  public DataGenerator(final EntityManager entityManager) {
-    this.entityManager = entityManager;
-  }
-
-  /**
-   * This method generates data to be used in the application. It does so by
-   * reading properties file. Currently it iterates through comma separated
-   * file names in file SQLInsertConfig and gets the insert statements from
-   * those files in the order provided in the file.
-   */
-  public void generate() {
-    String[] resourceSQLPropFileNames = getSQLInsertFileNames();
-    if (resourceSQLPropFileNames.length > 0) { // If configuration is proper with at least one file
-      Session session = ((EntityManagerImpl) entityManager).getActiveSession();
-      ResourceBundle[] resourceBundleArr = new ResourceBundle[resourceSQLPropFileNames.length];
-      entityManager.getTransaction().begin();
-
-      for (int i = 0; i < resourceSQLPropFileNames.length; i++) { // For each Entity SQL property file,
-        System.out.println("Reading from File - " + resourceSQLPropFileNames[i]);
-        resourceBundleArr[i] = ResourceBundle.getBundle(resourceSQLPropFileNames[i]);// Get SQL statements as properties
-
-        Set<String> keySet = resourceBundleArr[i].keySet();
-
-        for (String string : keySet) {
-          String currentSQL = (String) string;
-          String sqlQuery = resourceBundleArr[i].getString(currentSQL);
-          System.out.println("Executing Query - " + sqlQuery);
-          SQLCall sqlCall = new SQLCall(sqlQuery);
-
-          DataModifyQuery query = new DataModifyQuery();
-          query.setCall(sqlCall);
-          session.executeQuery(query);
-        }
-      }
-      setMaterialInStore();
-      entityManager.flush();
-      entityManager.getTransaction().commit();
-    }
-
-  }
-
-  @SuppressWarnings("unchecked")
-  private void setMaterialInStore() {
-    Query query = entityManager.createQuery("SELECT e FROM Material e");
-    List<Material> materials = (List<Material>) query.getResultList();
-
-    query = entityManager.createQuery("SELECT e FROM Store e");
-    List<Store> stores = (List<Store>) query.getResultList();
-
-    int storeSize = stores.size();
-    int i = 0;
-    for (Material material : materials) {
-      List<Store> storesA = Arrays.asList(stores.get(i), stores.get(i + 1));
-      material.setStores(storesA);
-      i++;
-      if (i > storeSize - 2) {
-        i = 0;
-      }
-      entityManager.persist(material);
-    }
-    entityManager.flush();
-  }
-
-  private String[] getSQLInsertFileNames() {
-    ResourceBundle resourceBundle = ResourceBundle.getBundle(SQL_INSERT_CONFIG);// File names from properties
-    String namesStr = resourceBundle.getString(SQL_INSERT_FILE_NAMES_KEY);
-    return namesStr.split(",");
-  }
-
-  private String[] getSQLDeleteStatements() {
-    ResourceBundle resourceBundle = ResourceBundle.getBundle(SQL_DELETE_CONFIG);// File names from properties
-    String deleteStatements = resourceBundle.getString(SQL_DELETE_STATEMENTS_KEY);
-    return deleteStatements.split(",");
-  }
-
-  /**
-   * This method deletes data from JPA tables created. This method reads comma
-   * separated SQL delete statements from DataDeleteSQLs properties files and
-   * executes them in order.
-   */
-  public void clean() {
-    // Delete using SQLs
-    String[] deleteStatements = getSQLDeleteStatements();
-    if (deleteStatements.length > 0) { // If configuration is proper with at least one delete Statements
-      Session session = ((EntityManagerImpl) entityManager).getActiveSession();
-      entityManager.getTransaction().begin();
-      for (String deleteStatement : deleteStatements) {
-        System.out.println("Cleaning - " + deleteStatement);
-        SQLCall sqlCall = new SQLCall(deleteStatement);
-
-        DataModifyQuery query = new DataModifyQuery();
-        query.setCall(sqlCall);
-        session.executeQuery(query);
-      }
-      entityManager.getTransaction().commit();
-    } else {
-      System.err.println("Delete configuration file doesn't have any delete statements.");
-    }
-  }
-
-}
+/*******************************************************************************
+ * 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.util;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.olingo.odata2.jpa.processor.ref.model.Material;
+import org.apache.olingo.odata2.jpa.processor.ref.model.Store;
+import org.eclipse.persistence.internal.jpa.EntityManagerImpl;
+import org.eclipse.persistence.queries.DataModifyQuery;
+import org.eclipse.persistence.queries.SQLCall;
+import org.eclipse.persistence.sessions.Session;
+
+/**
+ * This is a utility class for generating and cleaning data. The generated data would be used by the application.
+ * 
+ * 
+ */
+public class DataGenerator {
+
+  private EntityManager entityManager;
+
+  /**
+   * This is configuration property to hold comma separated names of Insert Files
+   */
+  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 = "SQL_Cleanup";
+  private static final String SQL_DELETE_STATEMENTS_KEY = "delete_queries";
+
+  public DataGenerator(final EntityManager entityManager) {
+    this.entityManager = entityManager;
+  }
+
+  /**
+   * This method generates data to be used in the application. It does so by
+   * reading properties file. Currently it iterates through comma separated
+   * file names in file SQLInsertConfig and gets the insert statements from
+   * those files in the order provided in the file.
+   */
+  public void generate() {
+    String[] resourceSQLPropFileNames = getSQLInsertFileNames();
+    if (resourceSQLPropFileNames.length > 0) { // If configuration is proper with at least one file
+      Session session = ((EntityManagerImpl) entityManager).getActiveSession();
+      ResourceBundle[] resourceBundleArr = new ResourceBundle[resourceSQLPropFileNames.length];
+      entityManager.getTransaction().begin();
+
+      for (int i = 0; i < resourceSQLPropFileNames.length; i++) { // For each Entity SQL property file,
+        System.out.println("Reading from File - " + resourceSQLPropFileNames[i]);
+        resourceBundleArr[i] = ResourceBundle.getBundle(resourceSQLPropFileNames[i]);// Get SQL statements as properties
+
+        Set<String> keySet = resourceBundleArr[i].keySet();
+
+        for (String string : keySet) {
+          String currentSQL = (String) string;
+          String sqlQuery = resourceBundleArr[i].getString(currentSQL);
+          System.out.println("Executing Query - " + sqlQuery);
+          SQLCall sqlCall = new SQLCall(sqlQuery);
+
+          DataModifyQuery query = new DataModifyQuery();
+          query.setCall(sqlCall);
+          session.executeQuery(query);
+        }
+      }
+      setMaterialInStore();
+      entityManager.flush();
+      entityManager.getTransaction().commit();
+    }
+
+  }
+
+  @SuppressWarnings("unchecked")
+  private void setMaterialInStore() {
+    Query query = entityManager.createQuery("SELECT e FROM Material e");
+    List<Material> materials = (List<Material>) query.getResultList();
+
+    query = entityManager.createQuery("SELECT e FROM Store e");
+    List<Store> stores = (List<Store>) query.getResultList();
+
+    int storeSize = stores.size();
+    int i = 0;
+    for (Material material : materials) {
+      List<Store> storesA = Arrays.asList(stores.get(i), stores.get(i + 1));
+      material.setStores(storesA);
+      i++;
+      if (i > storeSize - 2) {
+        i = 0;
+      }
+      entityManager.persist(material);
+    }
+    entityManager.flush();
+  }
+
+  private String[] getSQLInsertFileNames() {
+    ResourceBundle resourceBundle = ResourceBundle.getBundle(SQL_INSERT_CONFIG);// File names from properties
+    String namesStr = resourceBundle.getString(SQL_INSERT_FILE_NAMES_KEY);
+    return namesStr.split(",");
+  }
+
+  private String[] getSQLDeleteStatements() {
+    ResourceBundle resourceBundle = ResourceBundle.getBundle(SQL_DELETE_CONFIG);// File names from properties
+    String deleteStatements = resourceBundle.getString(SQL_DELETE_STATEMENTS_KEY);
+    return deleteStatements.split(",");
+  }
+
+  /**
+   * This method deletes data from JPA tables created. This method reads comma
+   * separated SQL delete statements from DataDeleteSQLs properties files and
+   * executes them in order.
+   */
+  public void clean() {
+    // Delete using SQLs
+    String[] deleteStatements = getSQLDeleteStatements();
+    if (deleteStatements.length > 0) { // If configuration is proper with at least one delete Statements
+      Session session = ((EntityManagerImpl) entityManager).getActiveSession();
+      entityManager.getTransaction().begin();
+      for (String deleteStatement : deleteStatements) {
+        System.out.println("Cleaning - " + deleteStatement);
+        SQLCall sqlCall = new SQLCall(deleteStatement);
+
+        DataModifyQuery query = new DataModifyQuery();
+        query.setCall(sqlCall);
+        session.executeQuery(query);
+      }
+      entityManager.getTransaction().commit();
+    } else {
+      System.err.println("Delete configuration file doesn't have any delete statements.");
+    }
+  }
+
+}


[5/9] line ending issue again

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 adf7b80..3f133c1 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,244 +1,244 @@
-/*******************************************************************************
- * 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;
-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;
-
-  }
-}
+/*******************************************************************************
+ * 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;
+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/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserForStaticMethodTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserForStaticMethodTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserForStaticMethodTest.java
index 7d09a18..e7d4c5f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserForStaticMethodTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserForStaticMethodTest.java
@@ -1,330 +1,330 @@
-/*******************************************************************************
- * 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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.SQLException;
-
-import javax.sql.rowset.serial.SerialBlob;
-import javax.sql.rowset.serial.SerialClob;
-import javax.sql.rowset.serial.SerialException;
-
-import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.junit.Test;
-
-public class JPAEntityParserForStaticMethodTest {
-
-  @Test
-  public void testToStringDefault() {
-
-    Character[] input = new Character[] { 'A', 'B' };
-    assertEquals("AB", JPAEntityParser.toString(input));
-
-  }
-
-  @Test
-  public void testToStringNull() {
-    Character[] input = null;
-    assertNull(JPAEntityParser.toString(input));
-  }
-
-  @Test
-  public void testToStringPartialNull() {
-    Character[] input = new Character[] { 'A', null };
-    assertEquals("A", JPAEntityParser.toString(input));
-  }
-
-  @Test
-  public void testToCharacterArrayDefault() {
-    String input = new String("AB");
-    Character[] ch = JPAEntityParser.toCharacterArray(input);
-
-    assertEquals(2, ch.length);
-    assertTrue(ch[0].equals('A'));
-    assertTrue(ch[1].equals('B'));
-  }
-
-  @Test
-  public void testToCharacterArrayNull() {
-    String input = null;
-    Character[] ch = JPAEntityParser.toCharacterArray(input);
-
-    assertNull(ch);
-  }
-
-  @Test
-  public void testGetPropertyCharacter() {
-    try {
-      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharacter", (Class<?>[]) null);
-      String output = (String) JPAEntityParser.getPropertyValue(method, this);
-      assertEquals("A", output);
-
-    } catch (NoSuchMethodException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SecurityException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetPropertyCharacterNull() {
-    try {
-      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharacterNull", (Class<?>[]) null);
-      String output = (String) JPAEntityParser.getPropertyValue(method, this);
-      assertNull(output);
-
-    } catch (NoSuchMethodException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SecurityException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetPropertyCharacterArray() {
-    try {
-      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharacterArray", (Class<?>[]) null);
-      String output = (String) JPAEntityParser.getPropertyValue(method, this);
-      assertEquals("AB", output);
-
-    } catch (NoSuchMethodException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SecurityException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetPropertyCharacterArrayNull() {
-    try {
-      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharacterArrayNull", (Class<?>[]) null);
-      String output = (String) JPAEntityParser.getPropertyValue(method, this);
-      assertNull(output);
-
-    } catch (NoSuchMethodException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SecurityException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetPropertyChar() {
-    try {
-      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getChar", (Class<?>[]) null);
-      String output = (String) JPAEntityParser.getPropertyValue(method, this);
-      assertEquals("A", output);
-
-    } catch (NoSuchMethodException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SecurityException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetPropertyCharNull() {
-    try {
-      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharNull", (Class<?>[]) null);
-      String output = (String) JPAEntityParser.getPropertyValue(method, this);
-      assertNull(output);
-
-    } catch (NoSuchMethodException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SecurityException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetPropertyCharArray() {
-    try {
-      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharArray", (Class<?>[]) null);
-      String output = (String) JPAEntityParser.getPropertyValue(method, this);
-      assertEquals("AB", output);
-
-    } catch (NoSuchMethodException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SecurityException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetPropertyCharArrayNull() {
-    try {
-      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharArrayNull", (Class<?>[]) null);
-      String output = (String) JPAEntityParser.getPropertyValue(method, this);
-      assertNull(output);
-
-    } catch (NoSuchMethodException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SecurityException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetPropertyCharArrayValueNull() {
-    try {
-      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharArrayValueNull", (Class<?>[]) null);
-      String output = (String) JPAEntityParser.getPropertyValue(method, this);
-      assertEquals("A\u0000", output);
-
-    } catch (NoSuchMethodException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SecurityException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetString() {
-    char[] expectedChar = new char[] { 'a', 'b', 'c' };
-    try {
-      Clob clob = new SerialClob(expectedChar);
-      String actualString = JPAEntityParser.getString(clob);
-
-      assertEquals(new String(expectedChar), actualString);
-
-    } catch (SerialException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SQLException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testGetBytes() {
-    final String fileName = "SalesOrderProcessingMappingModels.xml";
-
-    try {
-      FileInputStream fis = getFileStream(fileName);
-
-      ByteArrayOutputStream baos = new ByteArrayOutputStream();
-      int content = fis.read();
-      while (content != -1) {
-        baos.write(content);
-        content = fis.read();
-      }
-      Blob blob = new SerialBlob(baos.toByteArray());
-      byte[] actualBytes = (byte[]) JPAEntityParser.getBytes(blob);
-      byte[] expectedBytes = baos.toByteArray();
-
-      assertEquals(expectedBytes.length, actualBytes.length);
-      int size = actualBytes.length;
-      int index = 0;
-      while (index < size) {
-        assertEquals(expectedBytes[index], actualBytes[index]);
-        index++;
-      }
-
-    } catch (FileNotFoundException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SerialException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (SQLException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (IOException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  private FileInputStream getFileStream(final String name) throws SerialException, FileNotFoundException {
-    final String fileName = "SalesOrderProcessingMappingModels.xml";
-    FileInputStream fis;
-
-    URL fileURL = JPAEntityParserForStaticMethodTest.class.getClassLoader().getResource(fileName);
-    fis = new FileInputStream(fileURL.getPath());
-
-    return fis;
-
-  }
-
-  public Character getCharacter() {
-    return new Character('A');
-  }
-
-  public Character getCharacterNull() {
-    return null;
-  }
-
-  public Character[] getCharacterArray() {
-    return new Character[] { 'A', 'B' };
-  }
-
-  public Character[] getCharacterArrayNull() {
-    return null;
-  }
-
-  public char getChar() {
-    return 'A';
-  }
-
-  public char getCharNull() {
-    return '\u0000';
-  }
-
-  public char[] getCharArray() {
-    return new char[] { 'A', 'B' };
-  }
-
-  public char[] getCharArrayNull() {
-    return null;
-  }
-
-  public char[] getCharArrayValueNull() {
-    return new char[] { 'A', '\u0000' };
-  }
-}
+/*******************************************************************************
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.SQLException;
+
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialClob;
+import javax.sql.rowset.serial.SerialException;
+
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.junit.Test;
+
+public class JPAEntityParserForStaticMethodTest {
+
+  @Test
+  public void testToStringDefault() {
+
+    Character[] input = new Character[] { 'A', 'B' };
+    assertEquals("AB", JPAEntityParser.toString(input));
+
+  }
+
+  @Test
+  public void testToStringNull() {
+    Character[] input = null;
+    assertNull(JPAEntityParser.toString(input));
+  }
+
+  @Test
+  public void testToStringPartialNull() {
+    Character[] input = new Character[] { 'A', null };
+    assertEquals("A", JPAEntityParser.toString(input));
+  }
+
+  @Test
+  public void testToCharacterArrayDefault() {
+    String input = new String("AB");
+    Character[] ch = JPAEntityParser.toCharacterArray(input);
+
+    assertEquals(2, ch.length);
+    assertTrue(ch[0].equals('A'));
+    assertTrue(ch[1].equals('B'));
+  }
+
+  @Test
+  public void testToCharacterArrayNull() {
+    String input = null;
+    Character[] ch = JPAEntityParser.toCharacterArray(input);
+
+    assertNull(ch);
+  }
+
+  @Test
+  public void testGetPropertyCharacter() {
+    try {
+      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharacter", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getPropertyValue(method, this);
+      assertEquals("A", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharacterNull() {
+    try {
+      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharacterNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getPropertyValue(method, this);
+      assertNull(output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharacterArray() {
+    try {
+      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharacterArray", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getPropertyValue(method, this);
+      assertEquals("AB", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharacterArrayNull() {
+    try {
+      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharacterArrayNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getPropertyValue(method, this);
+      assertNull(output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyChar() {
+    try {
+      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getChar", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getPropertyValue(method, this);
+      assertEquals("A", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharNull() {
+    try {
+      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getPropertyValue(method, this);
+      assertNull(output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharArray() {
+    try {
+      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharArray", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getPropertyValue(method, this);
+      assertEquals("AB", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharArrayNull() {
+    try {
+      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharArrayNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getPropertyValue(method, this);
+      assertNull(output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharArrayValueNull() {
+    try {
+      Method method = JPAEntityParserForStaticMethodTest.class.getMethod("getCharArrayValueNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getPropertyValue(method, this);
+      assertEquals("A\u0000", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetString() {
+    char[] expectedChar = new char[] { 'a', 'b', 'c' };
+    try {
+      Clob clob = new SerialClob(expectedChar);
+      String actualString = JPAEntityParser.getString(clob);
+
+      assertEquals(new String(expectedChar), actualString);
+
+    } catch (SerialException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SQLException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetBytes() {
+    final String fileName = "SalesOrderProcessingMappingModels.xml";
+
+    try {
+      FileInputStream fis = getFileStream(fileName);
+
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+      int content = fis.read();
+      while (content != -1) {
+        baos.write(content);
+        content = fis.read();
+      }
+      Blob blob = new SerialBlob(baos.toByteArray());
+      byte[] actualBytes = (byte[]) JPAEntityParser.getBytes(blob);
+      byte[] expectedBytes = baos.toByteArray();
+
+      assertEquals(expectedBytes.length, actualBytes.length);
+      int size = actualBytes.length;
+      int index = 0;
+      while (index < size) {
+        assertEquals(expectedBytes[index], actualBytes[index]);
+        index++;
+      }
+
+    } catch (FileNotFoundException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SerialException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SQLException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IOException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  private FileInputStream getFileStream(final String name) throws SerialException, FileNotFoundException {
+    final String fileName = "SalesOrderProcessingMappingModels.xml";
+    FileInputStream fis;
+
+    URL fileURL = JPAEntityParserForStaticMethodTest.class.getClassLoader().getResource(fileName);
+    fis = new FileInputStream(fileURL.getPath());
+
+    return fis;
+
+  }
+
+  public Character getCharacter() {
+    return new Character('A');
+  }
+
+  public Character getCharacterNull() {
+    return null;
+  }
+
+  public Character[] getCharacterArray() {
+    return new Character[] { 'A', 'B' };
+  }
+
+  public Character[] getCharacterArrayNull() {
+    return null;
+  }
+
+  public char getChar() {
+    return 'A';
+  }
+
+  public char getCharNull() {
+    return '\u0000';
+  }
+
+  public char[] getCharArray() {
+    return new char[] { 'A', 'B' };
+  }
+
+  public char[] getCharArrayNull() {
+    return null;
+  }
+
+  public char[] getCharArrayValueNull() {
+    return new char[] { 'A', '\u0000' };
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 3bfac96..e601bd8 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
@@ -1,246 +1,246 @@
-/*******************************************************************************
- * 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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-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.exception.ODataException;
-import org.apache.olingo.odata2.api.processor.ODataContext;
-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.data.EdmMockUtilV2;
-import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock;
-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 {
-
-  private JPAEntity jpaEntity = null;
-
-  @Test
-  public void testCreateODataEntryWithComplexType() {
-    try {
-      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, true);
-      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
-
-      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
-      jpaEntity.create(ODataEntryMockUtil.mockODataEntryWithComplexType(JPATypeMock.ENTITY_NAME));
-    } 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);
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
-          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
-    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
-    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
-    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
-    JPATypeEmbeddableMock jpaEmbeddableMock = jpaTypeMock.getComplexType();
-    assertNotNull(jpaEmbeddableMock);
-
-    assertEquals(jpaEmbeddableMock.getMShort(), ODataEntryMockUtil.VALUE_SHORT);
-    JPATypeEmbeddableMock2 jpaEmbeddableMock2 = jpaEmbeddableMock.getMEmbeddable();
-    assertNotNull(jpaEmbeddableMock2);
-    assertEquals(jpaEmbeddableMock2.getMFloat(), ODataEntryMockUtil.VALUE_MFLOAT, 1);
-    assertEquals(jpaEmbeddableMock2.getMUUID(), ODataEntryMockUtil.VALUE_UUID);
-  }
-
-  @Test
-  public void testCreateODataEntry() {
-    try {
-      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
-      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
-
-      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
-      jpaEntity.create(ODataEntryMockUtil.mockODataEntry(JPATypeMock.ENTITY_NAME));
-    } 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);
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
-          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
-    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
-    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
-    assertEquals(ODataEntryMockUtil.VALUE_C.charAt(0), jpaTypeMock.getMC());
-    assertEquals(ODataEntryMockUtil.VALUE_CARRAY, new String(jpaTypeMock.getMCArray()));
-    assertEquals(ODataEntryMockUtil.VALUE_CHAR, jpaTypeMock.getMChar().toString());
-    assertEquals(ODataEntryMockUtil.VALUE_CHARARRAY, JPAEntityParser.toString(jpaTypeMock.getMCharArray()));
-    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
-  }
-
-  @Test
-  public void testCreateODataEntryWithInline() {
-    try {
-      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
-      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
-
-      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
-      jpaEntity.create(ODataEntryMockUtil.mockODataEntryWithInline(JPATypeMock.ENTITY_NAME));
-    } 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);
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
-          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
-    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
-    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
-    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
-
-    JPARelatedTypeMock relatedType = jpaTypeMock.getMRelatedEntity();
-    assertEquals(relatedType.getMByte(), ODataEntryMockUtil.VALUE_MBYTE);
-    assertEquals(relatedType.getMByteArray(), ODataEntryMockUtil.VALUE_MBYTEARRAY);
-    assertEquals(relatedType.getMDouble(), ODataEntryMockUtil.VALUE_MDOUBLE, 0.0);
-    assertEquals(relatedType.getMLong(), ODataEntryMockUtil.VALUE_MLONG);
-  }
-
-  @Test
-  public void testCreateODataEntryProperty() {
-    try {
-      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
-      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
-
-      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
-      jpaEntity.create(ODataEntryMockUtil.mockODataEntryProperties(JPATypeMock.ENTITY_NAME));
-    } 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);
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
-          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
-    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
-    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
-    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
-  }
-
-  @Test
-  public void testCreateODataEntryPropertyWithOutCallBack() {
-    try {
-      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
-      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
-
-      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContextWithoutCallBack());
-      jpaEntity.create(ODataEntryMockUtil.mockODataEntryProperties(JPATypeMock.ENTITY_NAME));
-    } catch (ODataJPARuntimeException e) {
-      assertEquals(ODataJPARuntimeException.ERROR_JPA_BLOB_NULL.getKey(), e.getMessageReference().getKey());
-      return;
-    } catch (EdmException 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);
-    }
-    fail(ODataJPATestConstants.EXCEPTION_EXPECTED);
-  }
-
-  @Test
-  public void testUpdateODataEntry() {
-    try {
-      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
-      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
-
-      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
-      JPATypeMock jpaTypeMock = new JPATypeMock();
-      jpaEntity.setJPAEntity(jpaTypeMock);
-      jpaEntity.update(ODataEntryMockUtil.mockODataEntry(JPATypeMock.ENTITY_NAME));
-    } 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);
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
-          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
-    assertEquals(jpaTypeMock.getMInt(), 0);// Key should not be changed
-    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
-    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
-  }
-
-  @Test
-  public void testUpdateODataEntryProperty() {
-    try {
-      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
-      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
-
-      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
-      JPATypeMock jpaTypeMock = new JPATypeMock();
-      jpaEntity.setJPAEntity(jpaTypeMock);
-      jpaEntity.update(ODataEntryMockUtil.mockODataEntryProperties(JPATypeMock.ENTITY_NAME));
-    } 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);
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
-          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
-    assertEquals(jpaTypeMock.getMInt(), 0);// Key should not be changed
-    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
-    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
-  }
-
-  private ODataJPAContext mockODataJPAContext() throws ODataException {
-    ODataContext context = new ODataContextMock().mock();
-    ODataJPAContext jpaContext = ODataJPAContextMock.mockODataJPAContext(context);
-    return jpaContext;
-  }
-
-  private ODataJPAContext mockODataJPAContextWithoutCallBack() throws ODataException {
-    ODataContext context = new ODataContextMock().mockWithoutOnJPAWriteContent();
-    ODataJPAContext jpaContext = ODataJPAContextMock.mockODataJPAContext(context);
-    return jpaContext;
-  }
-}
+/*******************************************************************************
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+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.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataContext;
+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.data.EdmMockUtilV2;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock;
+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 {
+
+  private JPAEntity jpaEntity = null;
+
+  @Test
+  public void testCreateODataEntryWithComplexType() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, true);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
+      jpaEntity.create(ODataEntryMockUtil.mockODataEntryWithComplexType(JPATypeMock.ENTITY_NAME));
+    } 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);
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+    JPATypeEmbeddableMock jpaEmbeddableMock = jpaTypeMock.getComplexType();
+    assertNotNull(jpaEmbeddableMock);
+
+    assertEquals(jpaEmbeddableMock.getMShort(), ODataEntryMockUtil.VALUE_SHORT);
+    JPATypeEmbeddableMock2 jpaEmbeddableMock2 = jpaEmbeddableMock.getMEmbeddable();
+    assertNotNull(jpaEmbeddableMock2);
+    assertEquals(jpaEmbeddableMock2.getMFloat(), ODataEntryMockUtil.VALUE_MFLOAT, 1);
+    assertEquals(jpaEmbeddableMock2.getMUUID(), ODataEntryMockUtil.VALUE_UUID);
+  }
+
+  @Test
+  public void testCreateODataEntry() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
+      jpaEntity.create(ODataEntryMockUtil.mockODataEntry(JPATypeMock.ENTITY_NAME));
+    } 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);
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertEquals(ODataEntryMockUtil.VALUE_C.charAt(0), jpaTypeMock.getMC());
+    assertEquals(ODataEntryMockUtil.VALUE_CARRAY, new String(jpaTypeMock.getMCArray()));
+    assertEquals(ODataEntryMockUtil.VALUE_CHAR, jpaTypeMock.getMChar().toString());
+    assertEquals(ODataEntryMockUtil.VALUE_CHARARRAY, JPAEntityParser.toString(jpaTypeMock.getMCharArray()));
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+  }
+
+  @Test
+  public void testCreateODataEntryWithInline() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
+      jpaEntity.create(ODataEntryMockUtil.mockODataEntryWithInline(JPATypeMock.ENTITY_NAME));
+    } 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);
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+
+    JPARelatedTypeMock relatedType = jpaTypeMock.getMRelatedEntity();
+    assertEquals(relatedType.getMByte(), ODataEntryMockUtil.VALUE_MBYTE);
+    assertEquals(relatedType.getMByteArray(), ODataEntryMockUtil.VALUE_MBYTEARRAY);
+    assertEquals(relatedType.getMDouble(), ODataEntryMockUtil.VALUE_MDOUBLE, 0.0);
+    assertEquals(relatedType.getMLong(), ODataEntryMockUtil.VALUE_MLONG);
+  }
+
+  @Test
+  public void testCreateODataEntryProperty() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
+      jpaEntity.create(ODataEntryMockUtil.mockODataEntryProperties(JPATypeMock.ENTITY_NAME));
+    } 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);
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+  }
+
+  @Test
+  public void testCreateODataEntryPropertyWithOutCallBack() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContextWithoutCallBack());
+      jpaEntity.create(ODataEntryMockUtil.mockODataEntryProperties(JPATypeMock.ENTITY_NAME));
+    } catch (ODataJPARuntimeException e) {
+      assertEquals(ODataJPARuntimeException.ERROR_JPA_BLOB_NULL.getKey(), e.getMessageReference().getKey());
+      return;
+    } catch (EdmException 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);
+    }
+    fail(ODataJPATestConstants.EXCEPTION_EXPECTED);
+  }
+
+  @Test
+  public void testUpdateODataEntry() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
+      JPATypeMock jpaTypeMock = new JPATypeMock();
+      jpaEntity.setJPAEntity(jpaTypeMock);
+      jpaEntity.update(ODataEntryMockUtil.mockODataEntry(JPATypeMock.ENTITY_NAME));
+    } 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);
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), 0);// Key should not be changed
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+  }
+
+  @Test
+  public void testUpdateODataEntryProperty() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet, mockODataJPAContext());
+      JPATypeMock jpaTypeMock = new JPATypeMock();
+      jpaEntity.setJPAEntity(jpaTypeMock);
+      jpaEntity.update(ODataEntryMockUtil.mockODataEntryProperties(JPATypeMock.ENTITY_NAME));
+    } 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);
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), 0);// Key should not be changed
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+  }
+
+  private ODataJPAContext mockODataJPAContext() throws ODataException {
+    ODataContext context = new ODataContextMock().mock();
+    ODataJPAContext jpaContext = ODataJPAContextMock.mockODataJPAContext(context);
+    return jpaContext;
+  }
+
+  private ODataJPAContext mockODataJPAContextWithoutCallBack() throws ODataException {
+    ODataContext context = new ODataContextMock().mockWithoutOnJPAWriteContent();
+    ODataJPAContext jpaContext = ODataJPAContextMock.mockODataJPAContext(context);
+    return jpaContext;
+  }
+}

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


[7/9] git commit: Performance Refactoring

Posted by ch...@apache.org.
Performance Refactoring

Signed-off-by: Christian Amend <ch...@apache.org>


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

Branch: refs/heads/olingo436BatchRefactoring
Commit: 1f76b2103d75fe8cd5077538bb84ad1b0bba28e3
Parents: b155bda
Author: Christian Holzer <c....@sap.com>
Authored: Tue Oct 7 14:42:41 2014 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Thu Oct 9 16:45:26 2014 +0200

----------------------------------------------------------------------
 .../olingo/odata2/core/batch/AcceptParser.java  | 143 ++++++-------------
 .../odata2/core/batch/v2/BatchParser.java       |  24 ++--
 .../odata2/core/batch/v2/BatchParserCommon.java |  74 +++++++++-
 .../v2/BufferedReaderIncludingLineEndings.java  |  10 +-
 .../olingo/odata2/core/batch/v2/Header.java     |   2 +-
 .../core/batch/BatchRequestParserTest.java      |  37 +++--
 6 files changed, 158 insertions(+), 132 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/1f76b210/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/AcceptParser.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/AcceptParser.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/AcceptParser.java
index 48bfb1b..5c8811c 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/AcceptParser.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/AcceptParser.java
@@ -19,23 +19,19 @@
 package org.apache.olingo.odata2.core.batch;
 
 import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
-import java.util.Scanner;
 import java.util.TreeSet;
-import java.util.regex.MatchResult;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.apache.olingo.odata2.api.batch.BatchException;
+import org.apache.olingo.odata2.api.exception.MessageReference;
 
 /**
  *
  */
 public class AcceptParser {
 
-  private static final String COMMA = ",";
   private static final String BAD_REQUEST = "400";
   private static final String ALL = "*";
   private static final String REG_EX_QUALITY_FACTOR = "q=((?:1\\.0{0,3})|(?:0\\.[0-9]{0,2}[1-9]))";
@@ -54,42 +50,53 @@ public class AcceptParser {
   private List<String> acceptLanguageHeaderValues = new ArrayList<String>();
 
   public List<String> parseAcceptHeaders() throws BatchException {
-    final String headerValue = concatenateHeaderLines(acceptHeaderValues);
-    final TreeSet<Accept> acceptTree = getAcceptTree();
+    return parseQualifiedHeader(acceptHeaderValues,
+        REG_EX_ACCEPT_WITH_Q_FACTOR,
+        BatchException.INVALID_ACCEPT_HEADER);
+  }
+
+  public List<String> parseAcceptableLanguages() throws BatchException {
+    return parseQualifiedHeader(acceptLanguageHeaderValues,
+        REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR,
+        BatchException.INVALID_ACCEPT_LANGUAGE_HEADER);
+  }
+
+  private List<String> parseQualifiedHeader(List<String> headerValues, Pattern regEx, MessageReference exectionMessage)
+      throws BatchException {
+    final TreeSet<Accept> acceptTree = new TreeSet<AcceptParser.Accept>();
     final List<String> acceptHeaders = new ArrayList<String>();
-    final Scanner acceptHeaderScanner = new Scanner(headerValue);
-
-    acceptHeaderScanner.useDelimiter(",\\s?");
-    while (acceptHeaderScanner.hasNext()) {
-      if (acceptHeaderScanner.hasNext(REG_EX_ACCEPT_WITH_Q_FACTOR)) {
-        acceptHeaderScanner.next(REG_EX_ACCEPT_WITH_Q_FACTOR);
-        MatchResult result = acceptHeaderScanner.match();
-        if (result.groupCount() == 2) {
-          String acceptHeaderValue = result.group(1);
-          double qualityFactor = result.group(2) != null ? Double.parseDouble(result.group(2)) : 1d;
-          qualityFactor = getQualityFactor(acceptHeaderValue, qualityFactor);
-          Accept acceptHeader = new Accept().setQuality(qualityFactor).setValue(acceptHeaderValue);
+
+    for (final String headerValue : headerValues) {
+      final String[] acceptParts = headerValue.split(",");
+
+      for (final String part : acceptParts) {
+        final Matcher matcher = regEx.matcher(part.trim());
+
+        if (matcher.matches() && matcher.groupCount() == 2) {
+          final Accept acceptHeader = getQualifiedHeader(matcher);
           acceptTree.add(acceptHeader);
         } else {
-          String header = acceptHeaderScanner.next();
-          acceptHeaderScanner.close();
-          throw new BatchException(BatchException.INVALID_ACCEPT_HEADER.addContent(header), BAD_REQUEST);
+          throw new BatchException(exectionMessage.addContent(part), BAD_REQUEST);
         }
-      } else {
-        String header = acceptHeaderScanner.next();
-        acceptHeaderScanner.close();
-        throw new BatchException(BatchException.INVALID_ACCEPT_HEADER.addContent(header), BAD_REQUEST);
       }
     }
+
     for (Accept accept : acceptTree) {
       if (!acceptHeaders.contains(accept.getValue())) {
         acceptHeaders.add(accept.getValue());
       }
     }
-    acceptHeaderScanner.close();
     return acceptHeaders;
   }
 
+  private Accept getQualifiedHeader(final Matcher matcher) {
+    final String acceptHeaderValue = matcher.group(1);
+    double qualityFactor = matcher.group(2) != null ? Double.parseDouble(matcher.group(2)) : 1d;
+    qualityFactor = getQualityFactor(acceptHeaderValue, qualityFactor);
+
+    return new Accept().setQuality(qualityFactor).setValue(acceptHeaderValue);
+  }
+  
   private double getQualityFactor(final String acceptHeaderValue, double qualityFactor) {
     int paramNumber = 0;
     double typeFactor = 0.0;
@@ -115,57 +122,7 @@ public class AcceptParser {
     qualityFactor = qualityFactor + paramNumber * QUALITY_PARAM_FACTOR + typeFactor + subtypeFactor;
     return qualityFactor;
   }
-
-  public List<String> parseAcceptableLanguages() throws BatchException {
-    final String headerValue = concatenateHeaderLines(acceptLanguageHeaderValues);
-    final List<String> acceptLanguages = new LinkedList<String>();
-    final TreeSet<Accept> acceptTree = getAcceptTree();
-    Scanner acceptLanguageScanner = new Scanner(headerValue);
-    acceptLanguageScanner.useDelimiter(",\\s?");
-
-    while (acceptLanguageScanner.hasNext()) {
-      if (acceptLanguageScanner.hasNext(REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR)) {
-        acceptLanguageScanner.next(REG_EX_ACCEPT_LANGUAGES_WITH_Q_FACTOR);
-        MatchResult result = acceptLanguageScanner.match();
-        if (result.groupCount() == 2) {
-          String languagerange = result.group(1);
-          double qualityFactor = result.group(2) != null ? Double.parseDouble(result.group(2)) : 1d;
-          acceptTree.add(new Accept().setQuality(qualityFactor).setValue(languagerange));
-        } else {
-          String acceptLanguage = acceptLanguageScanner.next();
-          acceptLanguageScanner.close();
-          throw new BatchException(BatchException.INVALID_ACCEPT_LANGUAGE_HEADER.addContent(acceptLanguage),
-              BAD_REQUEST);
-        }
-      } else {
-        String acceptLanguage = acceptLanguageScanner.next();
-        acceptLanguageScanner.close();
-        throw new BatchException(BatchException.INVALID_ACCEPT_LANGUAGE_HEADER.addContent(acceptLanguage), BAD_REQUEST);
-      }
-    }
-    for (Accept accept : acceptTree) {
-      if (!acceptLanguages.contains(accept.getValue())) {
-        acceptLanguages.add(accept.getValue());
-      }
-    }
-    acceptLanguageScanner.close();
-    return acceptLanguages;
-  }
-
-  private String concatenateHeaderLines(final List<String> headerValues) {
-    final StringBuilder builder = new StringBuilder();
-    final Iterator<String> iter = headerValues.iterator();
-
-    while (iter.hasNext()) {
-      builder.append(iter.next());
-      if (iter.hasNext()) {
-        builder.append(COMMA);
-      }
-    }
-
-    return builder.toString();
-  }
-
+  
   public void addAcceptHeaderValue(final String headerValue) {
     acceptHeaderValues.add(headerValue);
   }
@@ -174,21 +131,7 @@ public class AcceptParser {
     acceptLanguageHeaderValues.add(headerValue);
   }
 
-  private TreeSet<Accept> getAcceptTree() {
-    TreeSet<Accept> treeSet = new TreeSet<Accept>(new Comparator<Accept>() {
-      @Override
-      public int compare(final Accept o1, final Accept o2) {
-        if (o1.getQuality() <= o2.getQuality()) {
-          return 1;
-        } else {
-          return -1;
-        }
-      }
-    });
-    return treeSet;
-  }
-
-  private static class Accept {
+  private static class Accept implements Comparable<Accept> {
     private double quality;
     private String value;
 
@@ -201,14 +144,18 @@ public class AcceptParser {
       return this;
     }
 
-    public double getQuality() {
-      return quality;
-    }
-
     public Accept setQuality(final double quality) {
       this.quality = quality;
       return this;
     }
 
+    @Override
+    public int compareTo(Accept o) {
+      if (quality <= o.quality) {
+        return 1;
+      } else {
+        return -1;
+      }
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/1f76b210/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
index 00a1f2a..76b5215 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
@@ -20,7 +20,6 @@ package org.apache.olingo.odata2.core.batch.v2;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -81,7 +80,7 @@ public class BatchParser {
     final String baseUri = getBaseUri();
     final String boundary = BatchParserCommon.getBoundary(contentTypeMime, 1);
     final List<BatchParserResult> resultList = new LinkedList<BatchParserResult>();
-    final List<List<Line>> bodyPartStrings = splitBodyParts(in, boundary);
+    final List<List<Line>> bodyPartStrings = BatchParserCommon.splitRequestByBoundary(in, boundary);
 
     for (List<Line> bodyPartString : bodyPartStrings) {
       BatchBodyPart bodyPart = new BatchBodyPart(bodyPartString, boundary, isStrict).parse();
@@ -90,16 +89,17 @@ public class BatchParser {
 
     return resultList;
   }
-
-  private List<List<Line>> splitBodyParts(final InputStream in, final String boundary)
-      throws IOException, BatchException {
-
-    final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
-    final List<Line> message = reader.toList();
-    reader.close();
-
-    return BatchParserCommon.splitMessageByBoundary(message, boundary);
-  }
+  
+  //TODO remove
+//  private List<List<Line>> splitBodyParts(final InputStream in, final String boundary)
+//      throws IOException, BatchException {
+//
+//    final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
+//    final List<Line> message = reader.toList();
+//    reader.close();
+//
+//    return BatchParserCommon.splitMessageByBoundary(message, boundary);
+//  }
 
   private String getBaseUri() throws BatchException {
     String baseUri = "";

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/1f76b210/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
index b028759..3592688 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
@@ -19,7 +19,9 @@
 package org.apache.olingo.odata2.core.batch.v2;
 
 import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
@@ -44,6 +46,9 @@ import org.apache.olingo.odata2.core.batch.v2.BufferedReaderIncludingLineEndings
 import org.apache.olingo.odata2.core.commons.Decoder;
 
 public class BatchParserCommon {
+
+  private static final Pattern PATTERN_LAST_CRLF = Pattern.compile("(.*)(\r\n){1}( *)", Pattern.DOTALL);
+
   private static final String REG_EX_BOUNDARY =
       "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\" +
           "(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\""; // See RFC 2046
@@ -55,6 +60,7 @@ public class BatchParserCommon {
   public static final Pattern PATTERN_HEADER_LINE = Pattern.compile("([a-zA-Z\\-]+):\\s?(.*)\\s*");
   public static final Pattern PATTERN_CONTENT_TYPE_APPLICATION_HTTP = Pattern.compile(REG_EX_APPLICATION_HTTP,
       Pattern.CASE_INSENSITIVE);
+  private static final Pattern PATTERN_RELATIVE_URI = Pattern.compile("([^/][^?]*)(\\?.*)?");
 
   public static String trimLineListToLength(final List<Line> list, final int length) {
     final String message = stringListToString(list);
@@ -86,19 +92,77 @@ public class BatchParserCommon {
 
     return new ByteArrayInputStream(message.getBytes());
   }
+  
+  static List<List<Line>> splitRequestByBoundary(final InputStream in, final String boundary)
+      throws BatchException, IOException {
+    final List<List<Line>> messageParts = new LinkedList<List<Line>>();
+    List<Line> currentPart = new ArrayList<Line>();
+    boolean isEndReached = false;
+    //32ms
+    final String quotedBoundary = Pattern.quote(boundary);
+    final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary +  "--[\\s ]*");
+    final Pattern boundaryPattern = Pattern.compile("--" + quotedBoundary + "[\\s ]*");
+    
+    final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
+    String currentLine;
+    int lineNumber = 1;
+    
+    while((currentLine = reader.readLine()) != null) {
+      if (boundaryDelimiterPattern.matcher(currentLine.toString()).matches()) {
+        removeEndingCRLFFromList(currentPart);
+        messageParts.add(currentPart);
+        isEndReached = true;
+      } else if (boundaryPattern.matcher(currentLine.toString()).matches()) {
+        removeEndingCRLFFromList(currentPart);
+        messageParts.add(currentPart);
+        currentPart = new LinkedList<Line>();
+      } else {
+        currentPart.add(new Line(currentLine, lineNumber));
+      }
 
+      if (isEndReached) {
+        break;
+      }
+
+      lineNumber++;
+    }
+    reader.close();
+
+    // Remove preamble
+    if (messageParts.size() > 0) {
+      messageParts.remove(0);
+    } else {
+
+      throw new BatchException(BatchException.MISSING_BOUNDARY_DELIMITER.addContent(1));
+    }
+
+    if (!isEndReached) {
+      throw new BatchException(BatchException.MISSING_CLOSE_DELIMITER.addContent(1));
+    }
+
+    if (messageParts.size() == 0) {
+      throw new BatchException(BatchException.NO_MATCH_WITH_BOUNDARY_STRING.addContent(boundary).addContent(0));
+    }
+
+    return messageParts;
+  }
+  
   static List<List<Line>> splitMessageByBoundary(final List<Line> message, final String boundary)
       throws BatchException {
     final List<List<Line>> messageParts = new LinkedList<List<Line>>();
     List<Line> currentPart = new ArrayList<Line>();
     boolean isEndReached = false;
-
+    
+    final String quotedBoundary = Pattern.quote(boundary);
+    final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary +  "--[\\s ]*");
+    final Pattern boundaryPattern = Pattern.compile("--" + quotedBoundary + "[\\s ]*");
+    
     for (Line currentLine : message) {
-      if (currentLine.toString().contains("--" + boundary + "--")) {
+      if (boundaryDelimiterPattern.matcher(currentLine.toString()).matches()) {
         removeEndingCRLFFromList(currentPart);
         messageParts.add(currentPart);
         isEndReached = true;
-      } else if (currentLine.toString().contains("--" + boundary)) {
+      } else if (boundaryPattern.matcher(currentLine.toString()).matches()) {
         removeEndingCRLFFromList(currentPart);
         messageParts.add(currentPart);
         currentPart = new LinkedList<Line>();
@@ -139,7 +203,7 @@ public class BatchParserCommon {
   }
 
   public static Line removeEndingCRLF(final Line line) {
-    Pattern pattern = Pattern.compile("(.*)(\r\n){1}( *)", Pattern.DOTALL);
+    Pattern pattern = PATTERN_LAST_CRLF;
     Matcher matcher = pattern.matcher(line.toString());
 
     if (matcher.matches()) {
@@ -268,7 +332,7 @@ public class BatchParserCommon {
         if (uriObject.isAbsolute()) {
           regexRequestUri = Pattern.compile(baseUri + "/([^/][^?]*)(\\?.*)?");
         } else {
-          regexRequestUri = Pattern.compile("([^/][^?]*)(\\?.*)?");
+          regexRequestUri = PATTERN_RELATIVE_URI;
 
         }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/1f76b210/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java
index 295f4c6..7b81dc8 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java
@@ -27,7 +27,7 @@ public class BufferedReaderIncludingLineEndings extends Reader {
   private static final char CR = '\r';
   private static final char LF = '\n';
   private static final int EOF = -1;
-  private static final int BUFFER_SIZE = 1024;
+  private static final int BUFFER_SIZE = 8192;
   private Reader reader;
   private char[] buffer;
   private int offset = 0;
@@ -105,7 +105,7 @@ public class BufferedReaderIncludingLineEndings extends Reader {
   }
 
   public String readLine() throws IOException {
-    if (isEOF()) {
+    if (limit == EOF) {
       return null;
     }
 
@@ -113,7 +113,7 @@ public class BufferedReaderIncludingLineEndings extends Reader {
     boolean foundLineEnd = false; // EOF will be considered as line ending
 
     while (!foundLineEnd) {
-      if (isBufferReloadRequired()) {
+      if (limit == offset) {
         if (fillBuffer() == EOF) {
           foundLineEnd = true;
         }
@@ -129,12 +129,12 @@ public class BufferedReaderIncludingLineEndings extends Reader {
           foundLineEnd = true;
 
           // Check next char. Consume \n if available
-          if (isBufferReloadRequired()) {
+          if (limit == offset) {
             fillBuffer();
           }
 
           // Check if there is at least one character
-          if (!isEOF() && buffer[offset] == LF) {
+          if (limit != EOF && buffer[offset] == LF) {
             stringBuffer.append(LF);
             offset++;
           }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/1f76b210/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java
index c9daa6a..6c90e02 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java
@@ -87,7 +87,7 @@ public class Header implements Cloneable {
 
   public Map<String, List<String>> toMultiMap() {
     final Map<String, List<String>> singleMap = new HashMap<String, List<String>>();
-
+    
     for (final String key : headers.keySet()) {
       HeaderField field = headers.get(key);
       singleMap.put(field.getFieldName(), field.getValues());

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/1f76b210/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java
index 142d355..f9287b5 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java
@@ -29,6 +29,7 @@ import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.List;
+import java.util.Random;
 
 import org.apache.olingo.odata2.api.batch.BatchException;
 import org.apache.olingo.odata2.api.batch.BatchRequestPart;
@@ -895,7 +896,7 @@ public class BatchRequestParserTest {
         + "This is a preamble and must be ignored" + CRLF
         + CRLF
         + CRLF
-        + "----1242"
+        + "----1242" + CRLF
         + "--batch_8194-cf13-1f56" + CRLF
         + MIME_HEADERS
         + CRLF
@@ -909,7 +910,7 @@ public class BatchRequestParserTest {
         + "This is a preamble and must be ignored" + CRLF
         + CRLF
         + CRLF
-        + "----1242"
+        + "----1242" + CRLF
         + "--changeset_f980-1cb6-94dd" + CRLF
         + MIME_HEADERS
         + "Content-Id: " + CONTENT_ID_REFERENCE + CRLF
@@ -1071,20 +1072,34 @@ public class BatchRequestParserTest {
     assertEquals("{\"EmployeeName\":\"Peter Fall\"}",
         inputStreamToString(changeSetPart.getRequests().get(1).getBody()));
   }
-  
+
   @Test
   public void testLargeBatch() throws BatchException, IOException {
-    String fileName = "/batchLarge.batch";
-    InputStream in = ClassLoader.class.getResourceAsStream(fileName);
-    if (in == null) {
-      throw new IOException("Requested file '" + fileName + "' was not found.");
+    for (int j = 0; j < 200; j++) {
+      String fileName = "/batchLarge.batch";
+      InputStream in = ClassLoader.class.getResourceAsStream(fileName);
+      if (in == null) {
+        throw new IOException("Requested file '" + fileName + "' was not found.");
+      }
+
+      StringBuilder builder = new StringBuilder();
+      Random rnd = new Random();
+      for (int i = 0; i < 300; i++) {
+        builder.append((char) ('A' + rnd.nextInt('Z' - 'A')));
+      }
+
+      // String request = builder.toString() + CRLF + inputStreamToString(in);
+      String request = inputStreamToString(in).replace("Walldorf", builder.toString());
+      in.close();
+      InputStream requestStream = new ByteArrayInputStream(request.getBytes());
+
+      long start = System.currentTimeMillis();
+      BatchParser parser = new BatchParser(contentType, batchProperties, true);
+      parser.parseBatchRequest(requestStream);
+      System.out.println(System.currentTimeMillis() - start);
     }
-    
-    BatchParser parser = new BatchParser(contentType, batchProperties, true);
-    parser.parseBatchRequest(in);
   }
 
-  
   private List<BatchRequestPart> parse(final String batch) throws BatchException {
     InputStream in = new ByteArrayInputStream(batch.getBytes());
     BatchParser parser = new BatchParser(contentType, batchProperties, true);


[2/9] line ending issue again

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java
index e950d69..16835fe 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/converter/BlobToByteConverter.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * 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.converter;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.Blob;
-import java.sql.SQLException;
-
-import javax.persistence.AttributeConverter;
-import javax.persistence.Converter;
-
-import org.hsqldb.jdbc.JDBCBlob;
-
-@Converter(autoApply = true)
-public class BlobToByteConverter implements AttributeConverter<Blob, byte[]> {
-
-  @Override
-  public byte[] convertToDatabaseColumn(final Blob arg0) {
-    if (arg0 == null) {
-      return null;
-    }
-    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-    InputStream is;
-    try {
-      is = arg0.getBinaryStream();
-      int b;
-      b = is.read();
-      while (b != -1) {
-        buffer.write(b);
-        b = is.read();
-      }
-    } catch (SQLException e) {
-      e.printStackTrace();
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-    return buffer.toByteArray();
-  }
-
-  @Override
-  public Blob convertToEntityAttribute(final byte[] arg0) {
-    try {
-      if (arg0 == null) {
-        return null;
-      }
-      return new JDBCBlob(arg0);
-    } catch (SQLException e) {
-      e.printStackTrace();
-    }
-    return null;
-  }
-}
+/*******************************************************************************
+ * 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.converter;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Blob;
+import java.sql.SQLException;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+
+import org.hsqldb.jdbc.JDBCBlob;
+
+@Converter(autoApply = true)
+public class BlobToByteConverter implements AttributeConverter<Blob, byte[]> {
+
+  @Override
+  public byte[] convertToDatabaseColumn(final Blob arg0) {
+    if (arg0 == null) {
+      return null;
+    }
+    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+    InputStream is;
+    try {
+      is = arg0.getBinaryStream();
+      int b;
+      b = is.read();
+      while (b != -1) {
+        buffer.write(b);
+        b = is.read();
+      }
+    } catch (SQLException e) {
+      e.printStackTrace();
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+    return buffer.toByteArray();
+  }
+
+  @Override
+  public Blob convertToEntityAttribute(final byte[] arg0) {
+    try {
+      if (arg0 == null) {
+        return null;
+      }
+      return new JDBCBlob(arg0);
+    } catch (SQLException e) {
+      e.printStackTrace();
+    }
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/factory/JPAEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/factory/JPAEntityManagerFactory.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/factory/JPAEntityManagerFactory.java
index 1f4a7a8..9e53eb3 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/factory/JPAEntityManagerFactory.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/factory/JPAEntityManagerFactory.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * 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.factory;
-
-import java.util.HashMap;
-
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-
-public class JPAEntityManagerFactory {
-  private static HashMap<String, EntityManagerFactory> emfMap;
-
-  public static EntityManagerFactory getEntityManagerFactory(final String pUnit) {
-    if (pUnit == null) {
-      return null;
-    }
-    if (emfMap == null) {
-      emfMap = new HashMap<String, EntityManagerFactory>();
-    }
-
-    if (emfMap.containsKey(pUnit)) {
-      return emfMap.get(pUnit);
-    } else {
-      EntityManagerFactory emf = Persistence.createEntityManagerFactory(pUnit);
-      emfMap.put(pUnit, emf);
-      return emf;
-    }
-
-  }
-}
+/*******************************************************************************
+ * 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.factory;
+
+import java.util.HashMap;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+public class JPAEntityManagerFactory {
+  private static HashMap<String, EntityManagerFactory> emfMap;
+
+  public static EntityManagerFactory getEntityManagerFactory(final String pUnit) {
+    if (pUnit == null) {
+      return null;
+    }
+    if (emfMap == null) {
+      emfMap = new HashMap<String, EntityManagerFactory>();
+    }
+
+    if (emfMap.containsKey(pUnit)) {
+      return emfMap.get(pUnit);
+    } else {
+      EntityManagerFactory emf = Persistence.createEntityManagerFactory(pUnit);
+      emfMap.put(pUnit, emf);
+      return emf;
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderItemTombstoneListener.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderItemTombstoneListener.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderItemTombstoneListener.java
index 05de214..26c5b81 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderItemTombstoneListener.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderItemTombstoneListener.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * 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.listeners;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
-import org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneContext;
-import org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneEntityListener;
-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.JPQLStatement;
-
-public class SalesOrderItemTombstoneListener extends ODataJPATombstoneEntityListener {
-
-  @Override
-  public Query getQuery(final GetEntitySetUriInfo resultsView, final EntityManager em) {
-    JPQLContextType contextType = null;
-
-    try {
-      if (!resultsView.getStartEntitySet().getName().equals(resultsView.getTargetEntitySet().getName())) {
-        contextType = JPQLContextType.JOIN;
-      } else {
-        contextType = JPQLContextType.SELECT;
-      }
-
-      JPQLContext jpqlContext = JPQLContext.createBuilder(contextType, resultsView).build();
-      JPQLStatement jpqlStatement = JPQLStatement.createBuilder(jpqlContext).build();
-      String deltaToken = ODataJPATombstoneContext.getDeltaToken();
-
-      Query query = null;
-      if (deltaToken != null) {
-        String statement = jpqlStatement.toString();
-        String[] statementParts = statement.split(JPQLStatement.KEYWORD.WHERE);
-        String deltaCondition = jpqlContext.getJPAEntityAlias() + ".creationDate >= {ts '" + deltaToken + "'}";
-        if (statementParts.length > 1) {
-          statement =
-              statementParts[0] + JPQLStatement.DELIMITER.SPACE + JPQLStatement.KEYWORD.WHERE
-                  + JPQLStatement.DELIMITER.SPACE + deltaCondition + JPQLStatement.DELIMITER.SPACE
-                  + JPQLStatement.Operator.AND + statementParts[1];
-        } else {
-          statement =
-              statementParts[0] + JPQLStatement.DELIMITER.SPACE + JPQLStatement.KEYWORD.WHERE
-                  + JPQLStatement.DELIMITER.SPACE + deltaCondition;
-        }
-
-        query = em.createQuery(statement);
-      } else {
-        query = em.createQuery(jpqlStatement.toString());
-      }
-
-      return query;
-    } catch (EdmException e) {
-      return null;
-    } catch (ODataJPAModelException e) {
-      return null;
-    } catch (ODataJPARuntimeException e) {
-      return null;
-    }
-  }
-
-  @Override
-  public String generateDeltaToken(final List<Object> deltas, final Query query) {
-    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.000");
-
-    Date date = new Date(System.currentTimeMillis());
-    return dateFormat.format(date);
-  }
-}
+/*******************************************************************************
+ * 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.listeners;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneContext;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneEntityListener;
+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.JPQLStatement;
+
+public class SalesOrderItemTombstoneListener extends ODataJPATombstoneEntityListener {
+
+  @Override
+  public Query getQuery(final GetEntitySetUriInfo resultsView, final EntityManager em) {
+    JPQLContextType contextType = null;
+
+    try {
+      if (!resultsView.getStartEntitySet().getName().equals(resultsView.getTargetEntitySet().getName())) {
+        contextType = JPQLContextType.JOIN;
+      } else {
+        contextType = JPQLContextType.SELECT;
+      }
+
+      JPQLContext jpqlContext = JPQLContext.createBuilder(contextType, resultsView).build();
+      JPQLStatement jpqlStatement = JPQLStatement.createBuilder(jpqlContext).build();
+      String deltaToken = ODataJPATombstoneContext.getDeltaToken();
+
+      Query query = null;
+      if (deltaToken != null) {
+        String statement = jpqlStatement.toString();
+        String[] statementParts = statement.split(JPQLStatement.KEYWORD.WHERE);
+        String deltaCondition = jpqlContext.getJPAEntityAlias() + ".creationDate >= {ts '" + deltaToken + "'}";
+        if (statementParts.length > 1) {
+          statement =
+              statementParts[0] + JPQLStatement.DELIMITER.SPACE + JPQLStatement.KEYWORD.WHERE
+                  + JPQLStatement.DELIMITER.SPACE + deltaCondition + JPQLStatement.DELIMITER.SPACE
+                  + JPQLStatement.Operator.AND + statementParts[1];
+        } else {
+          statement =
+              statementParts[0] + JPQLStatement.DELIMITER.SPACE + JPQLStatement.KEYWORD.WHERE
+                  + JPQLStatement.DELIMITER.SPACE + deltaCondition;
+        }
+
+        query = em.createQuery(statement);
+      } else {
+        query = em.createQuery(jpqlStatement.toString());
+      }
+
+      return query;
+    } catch (EdmException e) {
+      return null;
+    } catch (ODataJPAModelException e) {
+      return null;
+    } catch (ODataJPARuntimeException e) {
+      return null;
+    }
+  }
+
+  @Override
+  public String generateDeltaToken(final List<Object> deltas, final Query query) {
+    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.000");
+
+    Date date = new Date(System.currentTimeMillis());
+    return dateFormat.format(date);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderTombstoneListener.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderTombstoneListener.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderTombstoneListener.java
index 0545eac..55f2013 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderTombstoneListener.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/listeners/SalesOrderTombstoneListener.java
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * 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.listeners;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PostLoad;
-import javax.persistence.Query;
-
-import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
-import org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneContext;
-import org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneEntityListener;
-import org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderHeader;
-
-public class SalesOrderTombstoneListener extends ODataJPATombstoneEntityListener {
-
-  public static String ENTITY_NAME = "SalesOrderHeader";
-
-  @PostLoad
-  public void handleDelta(final Object entity) {
-    SalesOrderHeader so = (SalesOrderHeader) entity;
-
-    if (so.getCreationDate().getTime().getTime() < ODataJPATombstoneContext.getDeltaTokenUTCTimeStamp()) {
-      return;
-    } else {
-      addToDelta(entity, ENTITY_NAME);
-    }
-  }
-
-  @Override
-  public String generateDeltaToken(final List<Object> deltas, final Query query) {
-    return String.valueOf(System.currentTimeMillis());
-  }
-
-  @Override
-  public Query getQuery(final GetEntitySetUriInfo resultsView, final EntityManager em) {
-    return null;
-  }
-
-}
+/*******************************************************************************
+ * 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.listeners;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PostLoad;
+import javax.persistence.Query;
+
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneContext;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPATombstoneEntityListener;
+import org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderHeader;
+
+public class SalesOrderTombstoneListener extends ODataJPATombstoneEntityListener {
+
+  public static String ENTITY_NAME = "SalesOrderHeader";
+
+  @PostLoad
+  public void handleDelta(final Object entity) {
+    SalesOrderHeader so = (SalesOrderHeader) entity;
+
+    if (so.getCreationDate().getTime().getTime() < ODataJPATombstoneContext.getDeltaTokenUTCTimeStamp()) {
+      return;
+    } else {
+      addToDelta(entity, ENTITY_NAME);
+    }
+  }
+
+  @Override
+  public String generateDeltaToken(final List<Object> deltas, final Query query) {
+    return String.valueOf(System.currentTimeMillis());
+  }
+
+  @Override
+  public Query getQuery(final GetEntitySetUriInfo resultsView, final EntityManager em) {
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 0ae4adf..14adb5e 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
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * 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 javax.persistence.Column;
-import javax.persistence.Embeddable;
-
-@Embeddable
-public class Address {
-
-  public Address() {
-    super();
-  }
-
-  public Address(final short houseNumber, final String streetName, final String city,
-      final String country) {
-    this();
-    this.houseNumber = houseNumber;
-    this.streetName = streetName;
-    this.city = city;
-    this.country = country;
-  }
-
-  @Column(name = "HOUSE_NUMBER")
-  private short houseNumber;
-
-  @Column(name = "STREET_NAME")
-  private String streetName;
-
-  @Column(name = "CITY")
-  private String city;
-
-  @Column(name = "COUNTRY")
-  private String country;
-
-  @Column(name = "PINCODE")
-  private String pincode;
-
-  public String getPincode() {
-    return pincode;
-  }
-
-  public void setPincode(final String pincode) {
-    this.pincode = pincode;
-  }
-
-  public short getHouseNumber() {
-    return houseNumber;
-  }
-
-  public void setHouseNumber(final short houseNumber) {
-    this.houseNumber = houseNumber;
-  }
-
-  public String getStreetName() {
-    return streetName;
-  }
-
-  public void setStreetName(final String streetName) {
-    this.streetName = streetName;
-  }
-
-  public String getCity() {
-    return city;
-  }
-
-  public void setCity(final String city) {
-    this.city = city;
-  }
-
-  public String getCountry() {
-    return country;
-  }
-
-  public void setCountry(final String country) {
-    this.country = country;
-  }
-}
+/*******************************************************************************
+ * 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 javax.persistence.Column;
+import javax.persistence.Embeddable;
+
+@Embeddable
+public class Address {
+
+  public Address() {
+    super();
+  }
+
+  public Address(final short houseNumber, final String streetName, final String city,
+      final String country) {
+    this();
+    this.houseNumber = houseNumber;
+    this.streetName = streetName;
+    this.city = city;
+    this.country = country;
+  }
+
+  @Column(name = "HOUSE_NUMBER")
+  private short houseNumber;
+
+  @Column(name = "STREET_NAME")
+  private String streetName;
+
+  @Column(name = "CITY")
+  private String city;
+
+  @Column(name = "COUNTRY")
+  private String country;
+
+  @Column(name = "PINCODE")
+  private String pincode;
+
+  public String getPincode() {
+    return pincode;
+  }
+
+  public void setPincode(final String pincode) {
+    this.pincode = pincode;
+  }
+
+  public short getHouseNumber() {
+    return houseNumber;
+  }
+
+  public void setHouseNumber(final short houseNumber) {
+    this.houseNumber = houseNumber;
+  }
+
+  public String getStreetName() {
+    return streetName;
+  }
+
+  public void setStreetName(final String streetName) {
+    this.streetName = streetName;
+  }
+
+  public String getCity() {
+    return city;
+  }
+
+  public void setCity(final String city) {
+    this.city = city;
+  }
+
+  public String getCountry() {
+    return country;
+  }
+
+  public void setCountry(final String country) {
+    this.country = country;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 7c8965e..d21e5bc 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
@@ -1,80 +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.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];
-
-  @Id
-  @Column(name = "ID")
-  private long id;
-
-  @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(final List<Material> materials) {
-    this.materials = materials;
-  }
-
-  public long getId() {
-    return id;
-  }
-
-  public void setId(final long id) {
-    this.id = id;
-  }
-
-  public char[] getCode() {
-    return code;
-  }
-
-  public void setCode(final char[] code) {
-    this.code = code;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public void setDescription(final String description) {
-    this.description = description;
-  }
-
-}
+/*******************************************************************************
+ * 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];
+
+  @Id
+  @Column(name = "ID")
+  private long id;
+
+  @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(final List<Material> materials) {
+    this.materials = materials;
+  }
+
+  public long getId() {
+    return id;
+  }
+
+  public void setId(final long id) {
+    this.id = id;
+  }
+
+  public char[] getCode() {
+    return code;
+  }
+
+  public void setCode(final char[] code) {
+    this.code = code;
+  }
+
+  public String getDescription() {
+    return description;
+  }
+
+  public void setDescription(final String description) {
+    this.description = description;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 48243d0..6dabd2a 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
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * 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.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.CascadeType;
-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;
-
-  @Column(name = "CREATED_AT")
-  private Timestamp createdAt;
-
-  @OneToMany(mappedBy = "customer", cascade = CascadeType.ALL)
-  private List<SalesOrderHeader> orders = new ArrayList<SalesOrderHeader>();
-
-  public Long getId() {
-    return id;
-  }
-
-  public void setId(final Long id) {
-    this.id = id;
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(final String name) {
-    this.name = name;
-  }
-
-  public List<SalesOrderHeader> getOrders() {
-    return orders;
-  }
-
-  public void setOrders(final List<SalesOrderHeader> orders) {
-    this.orders = orders;
-  }
-
-  public Address getAddress() {
-    return address;
-  }
-
-  public void setAddress(final Address address) {
-    this.address = address;
-  }
-
-  public Timestamp getCreatedAt() {
-    return createdAt;
-  }
-
-  public void setCreatedAt(final Timestamp createdAt) {
-    this.createdAt = createdAt;
-  }
-
-}
+/*******************************************************************************
+ * 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.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+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;
+
+  @Column(name = "CREATED_AT")
+  private Timestamp createdAt;
+
+  @OneToMany(mappedBy = "customer", cascade = CascadeType.ALL)
+  private List<SalesOrderHeader> orders = new ArrayList<SalesOrderHeader>();
+
+  public Long getId() {
+    return id;
+  }
+
+  public void setId(final Long id) {
+    this.id = id;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(final String name) {
+    this.name = name;
+  }
+
+  public List<SalesOrderHeader> getOrders() {
+    return orders;
+  }
+
+  public void setOrders(final List<SalesOrderHeader> orders) {
+    this.orders = orders;
+  }
+
+  public Address getAddress() {
+    return address;
+  }
+
+  public void setAddress(final Address address) {
+    this.address = address;
+  }
+
+  public Timestamp getCreatedAt() {
+    return createdAt;
+  }
+
+  public void setCreatedAt(final Timestamp createdAt) {
+    this.createdAt = createdAt;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 8a2ef0c..f6e798c 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
@@ -1,136 +1,136 @@
-/*******************************************************************************
- * 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.sql.Blob;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.persistence.Column;
-import javax.persistence.Convert;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinColumns;
-import javax.persistence.Lob;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "T_MATERIAL")
-public class Material {
-
-  public Material() {}
-
-  public Material(final String materialName, final char[] typeCode, final double price,
-      final String measurementUnit) {
-    super();
-    this.materialName = materialName;
-    this.price = price;
-    this.measurementUnit = measurementUnit;
-  }
-
-  @Id
-  @Column(name = "MATERIAL_ID")
-  private long materialId;
-
-  @Column(name = "MATERIAL_NAME")
-  private String materialName;
-
-  @Column(name = "PRICE")
-  private double price;
-
-  @Column(name = "MEASUREMENT_UNIT")
-  private String measurementUnit;
-
-  @Lob
-  @Column(name = "MIMAGE")
-  @Convert(converter = org.apache.olingo.odata2.jpa.processor.ref.converter.BlobToByteConverter.class)
-  private Blob materialImage;
-
-  public Blob getMaterialImage() {
-    return materialImage;
-  }
-
-  public void setMaterialImage(final Blob materialImage) {
-    this.materialImage = materialImage;
-  }
-
-  @ManyToMany
-  private List<Store> stores = new ArrayList<Store>();
-
-  @ManyToOne
-  @JoinColumns({ @JoinColumn(name = "TYPE_CODE", referencedColumnName = "CODE"),
-      @JoinColumn(name = "CAT_ID", referencedColumnName = "ID") })
-  private Category category;
-
-  public long getMaterialId() {
-    return materialId;
-  }
-
-  public void setMaterialId(final long materialId) {
-    this.materialId = materialId;
-  }
-
-  public Category getCategory() {
-    return category;
-  }
-
-  public void setCategory(final Category category) {
-    this.category = category;
-  }
-
-  public String getMaterialName() {
-    return materialName;
-  }
-
-  public void setMaterialName(final String materialName) {
-    this.materialName = materialName;
-  }
-
-  public double getPrice() {
-    return price;
-  }
-
-  public void setPrice(final double price) {
-    this.price = price;
-  }
-
-  public String getMeasurementUnit() {
-    return measurementUnit;
-  }
-
-  public void setMeasurementUnit(final String measurementUnit) {
-    this.measurementUnit = measurementUnit;
-  }
-
-  public List<Store> getStores() {
-    return stores;
-  }
-
-  public void setStores(final List<Store> stores) {
-    this.stores = stores;
-    Iterator<Store> itr = stores.iterator();
-    while (itr.hasNext()) {
-      itr.next().getMaterials().add(this);
-    }
-  }
-}
+/*******************************************************************************
+ * 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.sql.Blob;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
+import javax.persistence.Lob;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "T_MATERIAL")
+public class Material {
+
+  public Material() {}
+
+  public Material(final String materialName, final char[] typeCode, final double price,
+      final String measurementUnit) {
+    super();
+    this.materialName = materialName;
+    this.price = price;
+    this.measurementUnit = measurementUnit;
+  }
+
+  @Id
+  @Column(name = "MATERIAL_ID")
+  private long materialId;
+
+  @Column(name = "MATERIAL_NAME")
+  private String materialName;
+
+  @Column(name = "PRICE")
+  private double price;
+
+  @Column(name = "MEASUREMENT_UNIT")
+  private String measurementUnit;
+
+  @Lob
+  @Column(name = "MIMAGE")
+  @Convert(converter = org.apache.olingo.odata2.jpa.processor.ref.converter.BlobToByteConverter.class)
+  private Blob materialImage;
+
+  public Blob getMaterialImage() {
+    return materialImage;
+  }
+
+  public void setMaterialImage(final Blob materialImage) {
+    this.materialImage = materialImage;
+  }
+
+  @ManyToMany
+  private List<Store> stores = new ArrayList<Store>();
+
+  @ManyToOne
+  @JoinColumns({ @JoinColumn(name = "TYPE_CODE", referencedColumnName = "CODE"),
+      @JoinColumn(name = "CAT_ID", referencedColumnName = "ID") })
+  private Category category;
+
+  public long getMaterialId() {
+    return materialId;
+  }
+
+  public void setMaterialId(final long materialId) {
+    this.materialId = materialId;
+  }
+
+  public Category getCategory() {
+    return category;
+  }
+
+  public void setCategory(final Category category) {
+    this.category = category;
+  }
+
+  public String getMaterialName() {
+    return materialName;
+  }
+
+  public void setMaterialName(final String materialName) {
+    this.materialName = materialName;
+  }
+
+  public double getPrice() {
+    return price;
+  }
+
+  public void setPrice(final double price) {
+    this.price = price;
+  }
+
+  public String getMeasurementUnit() {
+    return measurementUnit;
+  }
+
+  public void setMeasurementUnit(final String measurementUnit) {
+    this.measurementUnit = measurementUnit;
+  }
+
+  public List<Store> getStores() {
+    return stores;
+  }
+
+  public void setStores(final List<Store> stores) {
+    this.stores = stores;
+    Iterator<Store> itr = stores.iterator();
+    while (itr.hasNext()) {
+      itr.next().getMaterials().add(this);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Note.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Note.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Note.java
index 5691dca..434770e 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Note.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Note.java
@@ -1,121 +1,121 @@
-/*******************************************************************************
- * 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.sql.Clob;
-import java.util.Calendar;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-@Entity
-@IdClass(value = NoteKey.class)
-@Table(name = "T_NOTE")
-public class Note {
-
-  public Note() {}
-
-  public Note(final Calendar creationTime, final Calendar creationDate, final String createdBy,
-      final Clob text) {
-    super();
-    this.creationTime = creationTime;
-    this.creationDate = creationDate;
-    this.createdBy = createdBy;
-    this.text = text;
-  }
-
-  @Id
-  @Temporal(TemporalType.TIME)
-  private Calendar creationTime;
-
-  @Id
-  @Temporal(TemporalType.DATE)
-  private Calendar creationDate;
-
-  @Id
-  private String createdBy;
-
-  @Column
-  @Lob
-  private Clob text;
-
-  @Column(name = "SO_ID")
-  private long soId;
-
-  @JoinColumn(name = "SO_ID", referencedColumnName = "SO_ID", insertable = false, updatable = false)
-  @ManyToOne
-  private SalesOrderHeader salesOrderHeader;
-
-  public Calendar getCreationTime() {
-    return creationTime;
-  }
-
-  public void setCreationTime(final Calendar creationTime) {
-    this.creationTime = creationTime;
-  }
-
-  public Calendar getCreationDate() {
-    return creationDate;
-  }
-
-  public void setCreationDate(final Calendar creationDate) {
-    this.creationDate = creationDate;
-  }
-
-  public String getCreatedBy() {
-    return createdBy;
-  }
-
-  public void setCreatedBy(final String createdBy) {
-    this.createdBy = createdBy;
-  }
-
-  public Clob getText() {
-    return text;
-  }
-
-  public void setText(final Clob text) {
-    this.text = text;
-  }
-
-  public long getSoId() {
-    return soId;
-  }
-
-  public void setSoId(final long soId) {
-    this.soId = soId;
-  }
-
-  public SalesOrderHeader getSalesOrderHeader() {
-    return salesOrderHeader;
-  }
-
-  public void setSalesOrderHeader(final SalesOrderHeader salesOrderHeader) {
-    this.salesOrderHeader = salesOrderHeader;
-    this.salesOrderHeader.getNotes().add(this);
-  }
-}
+/*******************************************************************************
+ * 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.sql.Clob;
+import java.util.Calendar;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@IdClass(value = NoteKey.class)
+@Table(name = "T_NOTE")
+public class Note {
+
+  public Note() {}
+
+  public Note(final Calendar creationTime, final Calendar creationDate, final String createdBy,
+      final Clob text) {
+    super();
+    this.creationTime = creationTime;
+    this.creationDate = creationDate;
+    this.createdBy = createdBy;
+    this.text = text;
+  }
+
+  @Id
+  @Temporal(TemporalType.TIME)
+  private Calendar creationTime;
+
+  @Id
+  @Temporal(TemporalType.DATE)
+  private Calendar creationDate;
+
+  @Id
+  private String createdBy;
+
+  @Column
+  @Lob
+  private Clob text;
+
+  @Column(name = "SO_ID")
+  private long soId;
+
+  @JoinColumn(name = "SO_ID", referencedColumnName = "SO_ID", insertable = false, updatable = false)
+  @ManyToOne
+  private SalesOrderHeader salesOrderHeader;
+
+  public Calendar getCreationTime() {
+    return creationTime;
+  }
+
+  public void setCreationTime(final Calendar creationTime) {
+    this.creationTime = creationTime;
+  }
+
+  public Calendar getCreationDate() {
+    return creationDate;
+  }
+
+  public void setCreationDate(final Calendar creationDate) {
+    this.creationDate = creationDate;
+  }
+
+  public String getCreatedBy() {
+    return createdBy;
+  }
+
+  public void setCreatedBy(final String createdBy) {
+    this.createdBy = createdBy;
+  }
+
+  public Clob getText() {
+    return text;
+  }
+
+  public void setText(final Clob text) {
+    this.text = text;
+  }
+
+  public long getSoId() {
+    return soId;
+  }
+
+  public void setSoId(final long soId) {
+    this.soId = soId;
+  }
+
+  public SalesOrderHeader getSalesOrderHeader() {
+    return salesOrderHeader;
+  }
+
+  public void setSalesOrderHeader(final SalesOrderHeader salesOrderHeader) {
+    this.salesOrderHeader = salesOrderHeader;
+    this.salesOrderHeader.getNotes().add(this);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java
index 2585f97..8079d92 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/NoteKey.java
@@ -1,83 +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.jpa.processor.ref.model;
-
-import java.io.Serializable;
-import java.util.Calendar;
-
-public class NoteKey implements Serializable {
-
-  /**
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  public Calendar getCreationTime() {
-    return creationTime;
-  }
-
-  public void setCreationTime(final Calendar creationTime) {
-    this.creationTime = creationTime;
-  }
-
-  public Calendar getCreationDate() {
-    return creationDate;
-  }
-
-  public void setCreationDate(final Calendar creationDate) {
-    this.creationDate = creationDate;
-  }
-
-  public String getCreatedBy() {
-    return createdBy;
-  }
-
-  public void setCreatedBy(final String createdBy) {
-    this.createdBy = createdBy;
-  }
-
-  @Override
-  public int hashCode() {
-    return creationTime.hashCode() + creationDate.hashCode() + createdBy.hashCode();
-  }
-
-  @Override
-  public boolean equals(final Object obj) {
-    if (obj instanceof Note) {
-      Note note = (Note) obj;
-
-      if (!note.getCreatedBy().equals(getCreatedBy())) {
-        return false;
-      }
-      if (!note.getCreationDate().equals(getCreationDate())) {
-        return false;
-      }
-      if (!note.getCreationTime().equals(getCreationTime())) {
-        return false;
-      }
-      return true;
-    }
-    return false;
-  }
-
-  private Calendar creationTime;
-  private Calendar creationDate;
-  private String createdBy;
-
-}
+/*******************************************************************************
+ * 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.io.Serializable;
+import java.util.Calendar;
+
+public class NoteKey implements Serializable {
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  public Calendar getCreationTime() {
+    return creationTime;
+  }
+
+  public void setCreationTime(final Calendar creationTime) {
+    this.creationTime = creationTime;
+  }
+
+  public Calendar getCreationDate() {
+    return creationDate;
+  }
+
+  public void setCreationDate(final Calendar creationDate) {
+    this.creationDate = creationDate;
+  }
+
+  public String getCreatedBy() {
+    return createdBy;
+  }
+
+  public void setCreatedBy(final String createdBy) {
+    this.createdBy = createdBy;
+  }
+
+  @Override
+  public int hashCode() {
+    return creationTime.hashCode() + creationDate.hashCode() + createdBy.hashCode();
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj instanceof Note) {
+      Note note = (Note) obj;
+
+      if (!note.getCreatedBy().equals(getCreatedBy())) {
+        return false;
+      }
+      if (!note.getCreationDate().equals(getCreationDate())) {
+        return false;
+      }
+      if (!note.getCreationTime().equals(getCreationTime())) {
+        return false;
+      }
+      return true;
+    }
+    return false;
+  }
+
+  private Calendar creationTime;
+  private Calendar creationDate;
+  private String createdBy;
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java
index a819ff0..6da7a3c 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java
@@ -1,135 +1,135 @@
-/*******************************************************************************
- * 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 javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.EntityListeners;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-@Entity
-@Table(name = "T_SALESORDERITEM")
-@EntityListeners(org.apache.olingo.odata2.jpa.processor.ref.listeners.SalesOrderItemTombstoneListener.class)
-public class SalesOrderItem {
-
-  public SalesOrderItem() {}
-
-  public SalesOrderItem(final int quantity, final double amount,
-      final double discount, final Material material) {
-    super();
-    this.quantity = quantity;
-    this.amount = amount;
-    this.discount = discount;
-    this.material = material;
-  }
-
-  @EmbeddedId
-  private SalesOrderItemKey salesOrderItemKey;
-
-  @Column
-  private int quantity;
-
-  @Column
-  private double amount;
-
-  @Column
-  private double discount;
-
-  @Transient
-  private double netAmount;
-
-  @Column
-  private boolean delivered;
-
-  public Boolean isDelivered() {
-    return delivered;
-  }
-
-  public void setDelivered(final Boolean deliveryStatus) {
-    delivered = deliveryStatus;
-  }
-
-  @JoinColumn(name = "Material_Id")
-  @ManyToOne
-  private Material material;
-
-  @JoinColumn(name = "Sales_Order_Id", referencedColumnName = "SO_ID", insertable = false, updatable = false)
-  @ManyToOne
-  private SalesOrderHeader salesOrderHeader;
-
-  public SalesOrderItemKey getSalesOrderItemKey() {
-    return salesOrderItemKey;
-  }
-
-  public void setSalesOrderItemKey(final SalesOrderItemKey salesOrderItemKey) {
-    this.salesOrderItemKey = salesOrderItemKey;
-  }
-
-  public int getQuantity() {
-    return quantity;
-  }
-
-  public void setQuantity(final int quantity) {
-    this.quantity = quantity;
-  }
-
-  public double getAmount() {
-    return amount;
-  }
-
-  public void setAmount(final double amount) {
-    this.amount = amount;
-  }
-
-  public double getDiscount() {
-    return discount;
-  }
-
-  public void setDiscount(final double discount) {
-    this.discount = discount;
-  }
-
-  public double getNetAmount() {
-    return netAmount;
-  }
-
-  public void setNetAmount(final double netAmount) {
-    this.netAmount = netAmount;
-  }
-
-  public Material getMaterial() {
-    return material;
-  }
-
-  public void setMaterial(final Material material) {
-    this.material = material;
-  }
-
-  public SalesOrderHeader getSalesOrderHeader() {
-    return salesOrderHeader;
-  }
-
-  public void setSalesOrderHeader(final SalesOrderHeader salesOrderHeader) {
-    this.salesOrderHeader = salesOrderHeader;
-  }
-}
+/*******************************************************************************
+ * 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 javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.EntityListeners;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+@Entity
+@Table(name = "T_SALESORDERITEM")
+@EntityListeners(org.apache.olingo.odata2.jpa.processor.ref.listeners.SalesOrderItemTombstoneListener.class)
+public class SalesOrderItem {
+
+  public SalesOrderItem() {}
+
+  public SalesOrderItem(final int quantity, final double amount,
+      final double discount, final Material material) {
+    super();
+    this.quantity = quantity;
+    this.amount = amount;
+    this.discount = discount;
+    this.material = material;
+  }
+
+  @EmbeddedId
+  private SalesOrderItemKey salesOrderItemKey;
+
+  @Column
+  private int quantity;
+
+  @Column
+  private double amount;
+
+  @Column
+  private double discount;
+
+  @Transient
+  private double netAmount;
+
+  @Column
+  private boolean delivered;
+
+  public Boolean isDelivered() {
+    return delivered;
+  }
+
+  public void setDelivered(final Boolean deliveryStatus) {
+    delivered = deliveryStatus;
+  }
+
+  @JoinColumn(name = "Material_Id")
+  @ManyToOne
+  private Material material;
+
+  @JoinColumn(name = "Sales_Order_Id", referencedColumnName = "SO_ID", insertable = false, updatable = false)
+  @ManyToOne
+  private SalesOrderHeader salesOrderHeader;
+
+  public SalesOrderItemKey getSalesOrderItemKey() {
+    return salesOrderItemKey;
+  }
+
+  public void setSalesOrderItemKey(final SalesOrderItemKey salesOrderItemKey) {
+    this.salesOrderItemKey = salesOrderItemKey;
+  }
+
+  public int getQuantity() {
+    return quantity;
+  }
+
+  public void setQuantity(final int quantity) {
+    this.quantity = quantity;
+  }
+
+  public double getAmount() {
+    return amount;
+  }
+
+  public void setAmount(final double amount) {
+    this.amount = amount;
+  }
+
+  public double getDiscount() {
+    return discount;
+  }
+
+  public void setDiscount(final double discount) {
+    this.discount = discount;
+  }
+
+  public double getNetAmount() {
+    return netAmount;
+  }
+
+  public void setNetAmount(final double netAmount) {
+    this.netAmount = netAmount;
+  }
+
+  public Material getMaterial() {
+    return material;
+  }
+
+  public void setMaterial(final Material material) {
+    this.material = material;
+  }
+
+  public SalesOrderHeader getSalesOrderHeader() {
+    return salesOrderHeader;
+  }
+
+  public void setSalesOrderHeader(final SalesOrderHeader salesOrderHeader) {
+    this.salesOrderHeader = salesOrderHeader;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItemKey.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItemKey.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItemKey.java
index efc09d2..282259b 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItemKey.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItemKey.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * 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.io.Serializable;
-
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-
-@Embeddable
-public class SalesOrderItemKey implements Serializable {
-
-  private static final long serialVersionUID = 1L;
-
-  public SalesOrderItemKey() {}
-
-  public SalesOrderItemKey(final long liId) {
-    super();
-    this.liId = liId;
-  }
-
-  @Column(name = "Sales_Order_Id", nullable = false)
-  private long soId;
-
-  @Column(name = "Sales_Order_Item_Id", unique = true)
-  private long liId;
-
-  @Override
-  public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + (int) (liId ^ (liId >>> 32));
-    result = prime * result + (int) (soId ^ (soId >>> 32));
-    return result;
-  }
-
-  @Override
-  public boolean equals(final Object obj) {
-    if (this == obj) {
-      return true;
-    }
-    if (obj == null) {
-      return false;
-    }
-    if (getClass() != obj.getClass()) {
-      return false;
-    }
-    SalesOrderItemKey other = (SalesOrderItemKey) obj;
-    if (liId != other.liId) {
-      return false;
-    }
-    if (soId != other.soId) {
-      return false;
-    }
-    return true;
-  }
-
-  public long getSoId() {
-    return soId;
-  }
-
-  public void setSoId(final long soId) {
-    this.soId = soId;
-  }
-
-  public long getLiId() {
-    return liId;
-  }
-
-  public void setLiId(final long liId) {
-    this.liId = liId;
-  }
-}
+/*******************************************************************************
+ * 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.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+
+@Embeddable
+public class SalesOrderItemKey implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  public SalesOrderItemKey() {}
+
+  public SalesOrderItemKey(final long liId) {
+    super();
+    this.liId = liId;
+  }
+
+  @Column(name = "Sales_Order_Id", nullable = false)
+  private long soId;
+
+  @Column(name = "Sales_Order_Item_Id", unique = true)
+  private long liId;
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + (int) (liId ^ (liId >>> 32));
+    result = prime * result + (int) (soId ^ (soId >>> 32));
+    return result;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    SalesOrderItemKey other = (SalesOrderItemKey) obj;
+    if (liId != other.liId) {
+      return false;
+    }
+    if (soId != other.soId) {
+      return false;
+    }
+    return true;
+  }
+
+  public long getSoId() {
+    return soId;
+  }
+
+  public void setSoId(final long soId) {
+    this.soId = soId;
+  }
+
+  public long getLiId() {
+    return liId;
+  }
+
+  public void setLiId(final long liId) {
+    this.liId = liId;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Store.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Store.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Store.java
index b88bc3a..e609dc2 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Store.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Store.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * 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.Iterator;
-import java.util.List;
-
-import javax.persistence.Column;
-import javax.persistence.Embedded;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "T_STORE")
-public class Store {
-
-  public Store() {}
-
-  public Store(final String storeName, final Address storeAddress) {
-    super();
-    this.storeName = storeName;
-    this.storeAddress = storeAddress;
-  }
-
-  @Id
-  @Column(name = "STORE_ID")
-  private long storeId;
-
-  @Column(name = "STORE_NAME", unique = true)
-  private String storeName;
-
-  @Embedded
-  private Address storeAddress;
-
-  @ManyToMany(mappedBy = "stores")
-  private List<Material> materials = new ArrayList<Material>();
-
-  public long getStoreId() {
-    return storeId;
-  }
-
-  public void setStoreId(final long storeId) {
-    this.storeId = storeId;
-  }
-
-  public String getStoreName() {
-    return storeName;
-  }
-
-  public void setStoreName(final String storeName) {
-    this.storeName = storeName;
-  }
-
-  public Address getStoreAddress() {
-    return storeAddress;
-  }
-
-  public void setStoreAddress(final Address storeAddress) {
-    this.storeAddress = storeAddress;
-  }
-
-  public List<Material> getMaterials() {
-    return materials;
-  }
-
-  public void setMaterials(final List<Material> materials) {
-    this.materials = materials;
-    Iterator<Material> itr = materials.iterator();
-    while (itr.hasNext()) {
-      itr.next().getStores().add(this);
-    }
-  }
+/*******************************************************************************
+ * 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.Iterator;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "T_STORE")
+public class Store {
+
+  public Store() {}
+
+  public Store(final String storeName, final Address storeAddress) {
+    super();
+    this.storeName = storeName;
+    this.storeAddress = storeAddress;
+  }
+
+  @Id
+  @Column(name = "STORE_ID")
+  private long storeId;
+
+  @Column(name = "STORE_NAME", unique = true)
+  private String storeName;
+
+  @Embedded
+  private Address storeAddress;
+
+  @ManyToMany(mappedBy = "stores")
+  private List<Material> materials = new ArrayList<Material>();
+
+  public long getStoreId() {
+    return storeId;
+  }
+
+  public void setStoreId(final long storeId) {
+    this.storeId = storeId;
+  }
+
+  public String getStoreName() {
+    return storeName;
+  }
+
+  public void setStoreName(final String storeName) {
+    this.storeName = storeName;
+  }
+
+  public Address getStoreAddress() {
+    return storeAddress;
+  }
+
+  public void setStoreAddress(final Address storeAddress) {
+    this.storeAddress = storeAddress;
+  }
+
+  public List<Material> getMaterials() {
+    return materials;
+  }
+
+  public void setMaterials(final List<Material> materials) {
+    this.materials = materials;
+    Iterator<Material> itr = materials.iterator();
+    while (itr.hasNext()) {
+      itr.next().getStores().add(this);
+    }
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 5bbfcf4..023aee1 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
@@ -1,44 +1,44 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
-	license agreements. See the NOTICE file distributed with this work for additional 
-	information regarding copyright ownership. The ASF licenses this file to 
-	you under the Apache License, Version 2.0 (the "License"); you may not use 
-	this file except in compliance with the License. You may obtain a copy of 
-	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
-	by applicable law or agreed to in writing, software distributed under the 
-	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
-	OF ANY KIND, either express or implied. See the License for the specific 
-	language governing permissions and limitations under the License. -->
-<persistence version="2.0"
-	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
-	<persistence-unit name="salesorderprocessing"
-		transaction-type="RESOURCE_LOCAL">
-		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-		<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.Store</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>
-		<class>org.apache.olingo.odata2.jpa.processor.ref.model.AppointmentActivity</class>
-				<class>org.apache.olingo.odata2.jpa.processor.ref.model.Activity</class>
-		<class>org.apache.olingo.odata2.jpa.processor.ref.model.ActivityParty</class>
-		<class>org.apache.olingo.odata2.jpa.processor.ref.converter.BlobToByteConverter</class>
-		<properties>
-			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
-			<property name="javax.persistence.jdbc.url"
-				value="jdbc:hsqldb:mem:org.apache.olingo.jpa.sample" />
-			<property name="javax.persistence.jdbc.user" value="sa" />
-			<property name="javax.persistence.jdbc.password" value="" />
-			<property name="eclipselink.target-database"
-				value="org.eclipse.persistence.platform.database.HSQLPlatform" />
-			<property name="eclipselink.logging.level" value="ALL" />
-			<property name="eclipselink.orm.throw.exceptions" value="true" />
-			<property name="eclipselink.ddl-generation" value="create-tables" />
-			<property name="eclipselink.ddl-generation.output-mode"
-				value="database" />
-		</properties>
-	</persistence-unit>
-</persistence>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+	license agreements. See the NOTICE file distributed with this work for additional 
+	information regarding copyright ownership. The ASF licenses this file to 
+	you under the Apache License, Version 2.0 (the "License"); you may not use 
+	this file except in compliance with the License. You may obtain a copy of 
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+	by applicable law or agreed to in writing, software distributed under the 
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+	OF ANY KIND, either express or implied. See the License for the specific 
+	language governing permissions and limitations under the License. -->
+<persistence version="2.0"
+	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+	<persistence-unit name="salesorderprocessing"
+		transaction-type="RESOURCE_LOCAL">
+		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+		<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.Store</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>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.AppointmentActivity</class>
+				<class>org.apache.olingo.odata2.jpa.processor.ref.model.Activity</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.ActivityParty</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.converter.BlobToByteConverter</class>
+		<properties>
+			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
+			<property name="javax.persistence.jdbc.url"
+				value="jdbc:hsqldb:mem:org.apache.olingo.jpa.sample" />
+			<property name="javax.persistence.jdbc.user" value="sa" />
+			<property name="javax.persistence.jdbc.password" value="" />
+			<property name="eclipselink.target-database"
+				value="org.eclipse.persistence.platform.database.HSQLPlatform" />
+			<property name="eclipselink.logging.level" value="ALL" />
+			<property name="eclipselink.orm.throw.exceptions" value="true" />
+			<property name="eclipselink.ddl-generation" value="create-tables" />
+			<property name="eclipselink.ddl-generation.output-mode"
+				value="database" />
+		</properties>
+	</persistence-unit>
+</persistence>


[3/9] line ending issue again

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 095d7e1..fbe6206 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
@@ -1,403 +1,403 @@
-/*******************************************************************************
- * 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.data;
-
-import java.sql.Blob;
-import java.sql.Clob;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-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;
-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.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;
-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.model.JPAEdmMappingImpl;
-import org.easymock.EasyMock;
-
-public class EdmMockUtilV2 {
-
-  public static interface JPAEdmMappingMock extends JPAEdmMapping, EdmMapping {
-
-  }
-
-  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 {
-
-    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
-    EasyMock.expect(entityType.getName()).andReturn(entityName).anyTimes();
-    EasyMock.expect(entityType.getKeyPropertyNames()).andReturn(mockSimpleKeyPropertyNames(entityName));
-    if (withComplexType == false) {
-      EasyMock.expect(entityType.getPropertyNames()).andReturn(mockPropertyNames(entityName)).anyTimes();
-    } else {
-      EasyMock.expect(entityType.getPropertyNames()).andReturn(mockPropertyNamesWithComplexType(entityName)).anyTimes();
-    }
-
-    EasyMock.expect(entityType.getNavigationPropertyNames()).andReturn(mockNavigationPropertyNames(entityName))
-        .anyTimes();
-    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();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MSTRING)).andReturn(
-          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MSTRING)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MDATETIME)).andReturn(
-          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MDATETIME)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MBLOB)).andReturn(
-          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MBLOB)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_CLOB)).andReturn(
-          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_CLOB)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MC)).andReturn(
-          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MC)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MCARRAY)).andReturn(
-          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MCARRAY)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MCHAR)).andReturn(
-          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MCHAR)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MCHARARRAY)).andReturn(
-          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MCHARARRAY)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)).andReturn(
-          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPATypeMock.NAVIGATION_PROPERTY_X)).andReturn(
-          mockEdmNavigationProperty(JPATypeMock.NAVIGATION_PROPERTY_X, EdmMultiplicity.ONE)).anyTimes();
-    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
-      EasyMock.expect(entityType.getProperty(JPARelatedTypeMock.PROPERTY_NAME_MLONG)).andReturn(
-          mockEdmProperty(entityName, JPARelatedTypeMock.PROPERTY_NAME_MLONG)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPARelatedTypeMock.PROPERTY_NAME_MBYTE)).andReturn(
-          mockEdmProperty(entityName, JPARelatedTypeMock.PROPERTY_NAME_MBYTE)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)).andReturn(
-          mockEdmProperty(entityName, JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)).anyTimes();
-      EasyMock.expect(entityType.getProperty(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE)).andReturn(
-          mockEdmProperty(entityName, JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE)).anyTimes();
-    }
-    EasyMock.replay(entityType);
-    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);
-    propertyNames.add(JPATypeMock.NAVIGATION_PROPERTY_XS);
-    return propertyNames;
-  }
-
-  public static List<String> mockSimpleKeyPropertyNames(final String entityName) {
-    List<String> keyPropertyNames = new ArrayList<String>();
-    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
-      keyPropertyNames.add(JPATypeMock.PROPERTY_NAME_MINT);
-    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
-      keyPropertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MLONG);
-    }
-
-    return keyPropertyNames;
-  }
-
-  public static List<String> mockPropertyNames(final String entityName) {
-    List<String> propertyNames = new ArrayList<String>();
-
-    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
-      propertyNames.add(JPATypeMock.PROPERTY_NAME_MINT);
-      propertyNames.add(JPATypeMock.PROPERTY_NAME_MDATETIME);
-      propertyNames.add(JPATypeMock.PROPERTY_NAME_MSTRING);
-      propertyNames.add(JPATypeMock.PROPERTY_NAME_MBLOB);
-      propertyNames.add(JPATypeMock.PROPERTY_NAME_CLOB);
-      propertyNames.add(JPATypeMock.PROPERTY_NAME_MC);
-      propertyNames.add(JPATypeMock.PROPERTY_NAME_MCARRAY);
-      propertyNames.add(JPATypeMock.PROPERTY_NAME_MCHAR);
-      propertyNames.add(JPATypeMock.PROPERTY_NAME_MCHARARRAY);
-    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
-      propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MLONG);
-      propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MBYTE);
-      propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY);
-      propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE);
-    } else if (entityName.equals(JPATypeEmbeddableMock.ENTITY_NAME)) {
-      propertyNames.add(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT);
-      propertyNames.add(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE);
-    } else if (entityName.equals(JPATypeEmbeddableMock2.ENTITY_NAME)) {
-      propertyNames.add(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT);
-      propertyNames.add(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID);
-    }
-
-    return propertyNames;
-  }
-
-  public static List<String> mockPropertyNamesWithComplexType(final String entityName) {
-    List<String> propertyNames = mockPropertyNames(entityName);
-    propertyNames.add(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE);
-
-    return propertyNames;
-
-  }
-
-  public static EdmAssociationEnd mockEdmAssociatioEnd(final String navigationPropertyName, final String role)
-      throws EdmException {
-    EdmAssociationEnd associationEnd = EasyMock.createMock(EdmAssociationEnd.class);
-    EasyMock.expect(associationEnd.getMultiplicity()).andReturn(EdmMultiplicity.ONE);
-    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
-    EasyMock.expect(entityType.getMapping()).andReturn((EdmMapping) mockEdmMapping("JPARelatedTypeMock", null, null));
-    EasyMock.replay(entityType);
-
-    EasyMock.expect(associationEnd.getEntityType()).andReturn(entityType);
-    EasyMock.replay(associationEnd);
-    return associationEnd;
-  }
-
-  public static EdmAssociation mockEdmAssociation(final String navigationPropertyName) throws EdmException {
-    EdmAssociation edmAssociation = EasyMock.createMock(EdmAssociation.class);
-    EasyMock.expect(edmAssociation.getEnd("TO")).andReturn(mockEdmAssociatioEnd(navigationPropertyName, "TO"));
-    EasyMock.expect(edmAssociation.getEnd("FROM")).andReturn(mockEdmAssociatioEnd(navigationPropertyName, "FROM"));
-    EasyMock.replay(edmAssociation);
-    return edmAssociation;
-  }
-
-  public static EdmEntitySet mockEdmEntitySet(final String entityName, final boolean withComplexType)
-      throws EdmException {
-    EdmEntitySet entitySet = null;
-    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
-      entitySet = EasyMock.createMock(EdmEntitySet.class);
-      EasyMock.expect(entitySet.getEntityType()).andReturn(mockEdmEntityType(entityName, withComplexType)).anyTimes();
-      EasyMock.expect(entitySet.getRelatedEntitySet(EasyMock.isA(EdmNavigationProperty.class))).andReturn(
-          mockEdmEntitySet(JPARelatedTypeMock.ENTITY_NAME, false)).anyTimes();
-    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
-      entitySet = EasyMock.createMock(EdmEntitySet.class);
-      EasyMock.expect(entitySet.getEntityType()).andReturn(mockEdmEntityType(entityName, withComplexType)).anyTimes();
-    }
-
-    EasyMock.replay(entitySet);
-    return entitySet;
-  }
-
-  public static EdmNavigationProperty mockEdmNavigationProperty(final String navigationPropertyName,
-      final EdmMultiplicity multiplicity) throws EdmException {
-
-    EdmEntityType edmEntityType = mockEdmEntityType(JPARelatedTypeMock.ENTITY_NAME, false);
-
-    EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
-    EasyMock.expect(navigationProperty.getType()).andReturn(edmEntityType).anyTimes();
-    EasyMock.expect(navigationProperty.getMultiplicity()).andReturn(multiplicity);
-    EasyMock.expect(navigationProperty.getMapping()).andReturn(
-        (EdmMapping) mockEdmMapping(null, null, navigationPropertyName)).anyTimes();
-    EasyMock.expect(navigationProperty.getToRole()).andReturn("TO");
-    EasyMock.expect(navigationProperty.getRelationship()).andReturn(mockEdmAssociation(navigationPropertyName));
-    if (multiplicity.equals(EdmMultiplicity.ONE)) {
-      EasyMock.expect(navigationProperty.getName()).andReturn(JPATypeMock.NAVIGATION_PROPERTY_X).anyTimes();
-    }
-
-    EasyMock.replay(navigationProperty);
-
-    return navigationProperty;
-  }
-
-  public static EdmProperty mockEdmProperty(final String entityName, final String propertyName) throws EdmException {
-    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
-
-    if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MINT) ||
-        propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING) ||
-        propertyName.equals(JPATypeMock.PROPERTY_NAME_MDATETIME) ||
-        propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB) ||
-        propertyName.equals(JPATypeMock.PROPERTY_NAME_CLOB) ||
-        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY) ||
-        propertyName.equals(JPATypeMock.PROPERTY_NAME_MC) ||
-        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR) ||
-        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY) ||
-        propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT) ||
-        propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT) ||
-        propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID) ||
-        propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MLONG) ||
-        propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTE) ||
-        propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE) ||
-        propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)) {
-
-      EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
-      EasyMock.expect(edmProperty.getType()).andReturn(edmType).anyTimes();
-      EasyMock.expect(edmType.getKind()).andReturn(EdmTypeKind.SIMPLE).anyTimes();
-      if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING) ||
-          propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY) ||
-          propertyName.equals(JPATypeMock.PROPERTY_NAME_MC) ||
-          propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR) ||
-          propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY)) {
-        EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(String.class).anyTimes();
-      } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB)) {
-        EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(Blob.class).anyTimes();
-      } else {
-        EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(Integer.class).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))
-          .anyTimes();
-
-    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE) ||
-        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)) {
-      EdmComplexType complexType = mockComplexType(propertyName);
-
-      EasyMock.expect(edmProperty.getType()).andReturn(complexType).anyTimes();
-      EasyMock.expect(edmProperty.getName()).andReturn(propertyName).anyTimes();
-      EasyMock.expect(edmProperty.getMapping()).andReturn((EdmMapping) mockEdmMapping(null, propertyName, null))
-          .anyTimes();
-
-    }
-
-    EasyMock.replay(edmProperty);
-    return edmProperty;
-  }
-
-  public static EdmComplexType mockComplexType(final String complexPropertyName) throws EdmException {
-
-    String complexTypeName = null;
-    if (complexPropertyName.equals(JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE)) {
-      complexTypeName = JPATypeEmbeddableMock2.ENTITY_NAME;
-    } else if (complexPropertyName.equals(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)) {
-      complexTypeName = JPATypeEmbeddableMock.ENTITY_NAME;
-    }
-
-    EdmComplexType edmComplexType = EasyMock.createMock(EdmComplexType.class);
-    EasyMock.expect(edmComplexType.getKind()).andReturn(EdmTypeKind.COMPLEX);
-    EasyMock.expect(edmComplexType.getPropertyNames()).andReturn(mockPropertyNames(complexTypeName)).anyTimes();
-    EasyMock.expect(edmComplexType.getMapping()).andReturn((EdmMapping) mockEdmMapping(complexTypeName, null, null));
-
-    if (complexTypeName.equals(JPATypeEmbeddableMock.ENTITY_NAME)) {
-      EasyMock.expect(edmComplexType.getProperty(JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT)).andReturn(
-          mockEdmProperty(complexTypeName, JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT)).anyTimes();
-      EasyMock.expect(edmComplexType.getProperty(JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE)).andReturn(
-          mockEdmProperty(complexTypeName, JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE)).anyTimes();
-    } else if (complexTypeName.equals(JPATypeEmbeddableMock2.ENTITY_NAME)) {
-      EasyMock.expect(edmComplexType.getProperty(JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT)).andReturn(
-          mockEdmProperty(complexTypeName, JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT)).anyTimes();
-      EasyMock.expect(edmComplexType.getProperty(JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID)).andReturn(
-          mockEdmProperty(complexTypeName, JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID)).anyTimes();
-    }
-
-    EasyMock.replay(edmComplexType);
-    return edmComplexType;
-  }
-
-  public static JPAEdmMapping mockEdmMapping(final String entityName, final String propertyName,
-      final String navigationPropertyName) {
-    JPAEdmMapping mapping = new JPAEdmMappingImpl();
-
-    if (propertyName == null && entityName != null) {
-      if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
-        mapping.setJPAType(JPATypeMock.class);
-      } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
-        mapping.setJPAType(JPARelatedTypeMock.class);
-      } else if (entityName.equals(JPATypeEmbeddableMock.ENTITY_NAME)) {
-        mapping.setJPAType(JPATypeEmbeddableMock.class);
-      } else if (entityName.equals(JPATypeEmbeddableMock2.ENTITY_NAME)) {
-        mapping.setJPAType(JPATypeEmbeddableMock2.class);
-      }
-    } else if (entityName == null && navigationPropertyName != null) {
-      mapping.setJPAType(JPARelatedTypeMock.class);
-      mapping.setJPAColumnName(JPATypeMock.NAVIGATION_PROPERTY_X);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MINT)) {
-      mapping.setJPAType(int.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MINT);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING)) {
-      mapping.setJPAType(String.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MSTRING);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB)) {
-      mapping.setJPAType(Blob.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MBLOB);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_CLOB)) {
-      mapping.setJPAType(Clob.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_CLOB);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MC)) {
-      mapping.setJPAType(char.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MC);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY)) {
-      mapping.setJPAType(char[].class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MCARRAY);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR)) {
-      mapping.setJPAType(Character.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MCHAR);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY)) {
-      mapping.setJPAType(Character[].class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MCHARARRAY);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MDATETIME)) {
-      mapping.setJPAType(Calendar.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MDATETIME);
-    } else if (propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MLONG)) {
-      mapping.setJPAType(long.class);
-      ((Mapping) mapping).setInternalName(JPARelatedTypeMock.PROPERTY_NAME_MLONG);
-    } else if (propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE)) {
-      mapping.setJPAType(double.class);
-      ((Mapping) mapping).setInternalName(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE);
-    } else if (propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTE)) {
-      mapping.setJPAType(byte.class);
-      ((Mapping) mapping).setInternalName(JPARelatedTypeMock.PROPERTY_NAME_MBYTE);
-    } else if (propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)) {
-      mapping.setJPAType(byte[].class);
-      ((Mapping) mapping).setInternalName(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY);
-    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT)) {
-      mapping.setJPAType(Short.TYPE);
-      ((Mapping) mapping).setInternalName(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT);
-    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT)) {
-      mapping.setJPAType(Float.TYPE);
-      ((Mapping) mapping).setInternalName(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT);
-    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID)) {
-      mapping.setJPAType(UUID.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID);
-    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE)) {
-      mapping.setJPAType(JPATypeEmbeddableMock2.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE);
-    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)) {
-      mapping.setJPAType(JPATypeEmbeddableMock.class);
-      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE);
-    }
-    return mapping;
-  }
-}
+/*******************************************************************************
+ * 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.data;
+
+import java.sql.Blob;
+import java.sql.Clob;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+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;
+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.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;
+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.model.JPAEdmMappingImpl;
+import org.easymock.EasyMock;
+
+public class EdmMockUtilV2 {
+
+  public static interface JPAEdmMappingMock extends JPAEdmMapping, EdmMapping {
+
+  }
+
+  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 {
+
+    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
+    EasyMock.expect(entityType.getName()).andReturn(entityName).anyTimes();
+    EasyMock.expect(entityType.getKeyPropertyNames()).andReturn(mockSimpleKeyPropertyNames(entityName));
+    if (withComplexType == false) {
+      EasyMock.expect(entityType.getPropertyNames()).andReturn(mockPropertyNames(entityName)).anyTimes();
+    } else {
+      EasyMock.expect(entityType.getPropertyNames()).andReturn(mockPropertyNamesWithComplexType(entityName)).anyTimes();
+    }
+
+    EasyMock.expect(entityType.getNavigationPropertyNames()).andReturn(mockNavigationPropertyNames(entityName))
+        .anyTimes();
+    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();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MSTRING)).andReturn(
+          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MSTRING)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MDATETIME)).andReturn(
+          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MDATETIME)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MBLOB)).andReturn(
+          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MBLOB)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_CLOB)).andReturn(
+          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_CLOB)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MC)).andReturn(
+          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MC)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MCARRAY)).andReturn(
+          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MCARRAY)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MCHAR)).andReturn(
+          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MCHAR)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MCHARARRAY)).andReturn(
+          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MCHARARRAY)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)).andReturn(
+          mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPATypeMock.NAVIGATION_PROPERTY_X)).andReturn(
+          mockEdmNavigationProperty(JPATypeMock.NAVIGATION_PROPERTY_X, EdmMultiplicity.ONE)).anyTimes();
+    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
+      EasyMock.expect(entityType.getProperty(JPARelatedTypeMock.PROPERTY_NAME_MLONG)).andReturn(
+          mockEdmProperty(entityName, JPARelatedTypeMock.PROPERTY_NAME_MLONG)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPARelatedTypeMock.PROPERTY_NAME_MBYTE)).andReturn(
+          mockEdmProperty(entityName, JPARelatedTypeMock.PROPERTY_NAME_MBYTE)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)).andReturn(
+          mockEdmProperty(entityName, JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)).anyTimes();
+      EasyMock.expect(entityType.getProperty(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE)).andReturn(
+          mockEdmProperty(entityName, JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE)).anyTimes();
+    }
+    EasyMock.replay(entityType);
+    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);
+    propertyNames.add(JPATypeMock.NAVIGATION_PROPERTY_XS);
+    return propertyNames;
+  }
+
+  public static List<String> mockSimpleKeyPropertyNames(final String entityName) {
+    List<String> keyPropertyNames = new ArrayList<String>();
+    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
+      keyPropertyNames.add(JPATypeMock.PROPERTY_NAME_MINT);
+    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
+      keyPropertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MLONG);
+    }
+
+    return keyPropertyNames;
+  }
+
+  public static List<String> mockPropertyNames(final String entityName) {
+    List<String> propertyNames = new ArrayList<String>();
+
+    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_MINT);
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_MDATETIME);
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_MSTRING);
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_MBLOB);
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_CLOB);
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_MC);
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_MCARRAY);
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_MCHAR);
+      propertyNames.add(JPATypeMock.PROPERTY_NAME_MCHARARRAY);
+    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
+      propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MLONG);
+      propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MBYTE);
+      propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY);
+      propertyNames.add(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE);
+    } else if (entityName.equals(JPATypeEmbeddableMock.ENTITY_NAME)) {
+      propertyNames.add(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT);
+      propertyNames.add(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE);
+    } else if (entityName.equals(JPATypeEmbeddableMock2.ENTITY_NAME)) {
+      propertyNames.add(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT);
+      propertyNames.add(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID);
+    }
+
+    return propertyNames;
+  }
+
+  public static List<String> mockPropertyNamesWithComplexType(final String entityName) {
+    List<String> propertyNames = mockPropertyNames(entityName);
+    propertyNames.add(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE);
+
+    return propertyNames;
+
+  }
+
+  public static EdmAssociationEnd mockEdmAssociatioEnd(final String navigationPropertyName, final String role)
+      throws EdmException {
+    EdmAssociationEnd associationEnd = EasyMock.createMock(EdmAssociationEnd.class);
+    EasyMock.expect(associationEnd.getMultiplicity()).andReturn(EdmMultiplicity.ONE);
+    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
+    EasyMock.expect(entityType.getMapping()).andReturn((EdmMapping) mockEdmMapping("JPARelatedTypeMock", null, null));
+    EasyMock.replay(entityType);
+
+    EasyMock.expect(associationEnd.getEntityType()).andReturn(entityType);
+    EasyMock.replay(associationEnd);
+    return associationEnd;
+  }
+
+  public static EdmAssociation mockEdmAssociation(final String navigationPropertyName) throws EdmException {
+    EdmAssociation edmAssociation = EasyMock.createMock(EdmAssociation.class);
+    EasyMock.expect(edmAssociation.getEnd("TO")).andReturn(mockEdmAssociatioEnd(navigationPropertyName, "TO"));
+    EasyMock.expect(edmAssociation.getEnd("FROM")).andReturn(mockEdmAssociatioEnd(navigationPropertyName, "FROM"));
+    EasyMock.replay(edmAssociation);
+    return edmAssociation;
+  }
+
+  public static EdmEntitySet mockEdmEntitySet(final String entityName, final boolean withComplexType)
+      throws EdmException {
+    EdmEntitySet entitySet = null;
+    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
+      entitySet = EasyMock.createMock(EdmEntitySet.class);
+      EasyMock.expect(entitySet.getEntityType()).andReturn(mockEdmEntityType(entityName, withComplexType)).anyTimes();
+      EasyMock.expect(entitySet.getRelatedEntitySet(EasyMock.isA(EdmNavigationProperty.class))).andReturn(
+          mockEdmEntitySet(JPARelatedTypeMock.ENTITY_NAME, false)).anyTimes();
+    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
+      entitySet = EasyMock.createMock(EdmEntitySet.class);
+      EasyMock.expect(entitySet.getEntityType()).andReturn(mockEdmEntityType(entityName, withComplexType)).anyTimes();
+    }
+
+    EasyMock.replay(entitySet);
+    return entitySet;
+  }
+
+  public static EdmNavigationProperty mockEdmNavigationProperty(final String navigationPropertyName,
+      final EdmMultiplicity multiplicity) throws EdmException {
+
+    EdmEntityType edmEntityType = mockEdmEntityType(JPARelatedTypeMock.ENTITY_NAME, false);
+
+    EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
+    EasyMock.expect(navigationProperty.getType()).andReturn(edmEntityType).anyTimes();
+    EasyMock.expect(navigationProperty.getMultiplicity()).andReturn(multiplicity);
+    EasyMock.expect(navigationProperty.getMapping()).andReturn(
+        (EdmMapping) mockEdmMapping(null, null, navigationPropertyName)).anyTimes();
+    EasyMock.expect(navigationProperty.getToRole()).andReturn("TO");
+    EasyMock.expect(navigationProperty.getRelationship()).andReturn(mockEdmAssociation(navigationPropertyName));
+    if (multiplicity.equals(EdmMultiplicity.ONE)) {
+      EasyMock.expect(navigationProperty.getName()).andReturn(JPATypeMock.NAVIGATION_PROPERTY_X).anyTimes();
+    }
+
+    EasyMock.replay(navigationProperty);
+
+    return navigationProperty;
+  }
+
+  public static EdmProperty mockEdmProperty(final String entityName, final String propertyName) throws EdmException {
+    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
+
+    if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MINT) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_MDATETIME) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_CLOB) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_MC) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY) ||
+        propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT) ||
+        propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT) ||
+        propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID) ||
+        propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MLONG) ||
+        propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTE) ||
+        propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE) ||
+        propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)) {
+
+      EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
+      EasyMock.expect(edmProperty.getType()).andReturn(edmType).anyTimes();
+      EasyMock.expect(edmType.getKind()).andReturn(EdmTypeKind.SIMPLE).anyTimes();
+      if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING) ||
+          propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY) ||
+          propertyName.equals(JPATypeMock.PROPERTY_NAME_MC) ||
+          propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR) ||
+          propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY)) {
+        EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(String.class).anyTimes();
+      } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB)) {
+        EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(Blob.class).anyTimes();
+      } else {
+        EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(Integer.class).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))
+          .anyTimes();
+
+    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE) ||
+        propertyName.equals(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)) {
+      EdmComplexType complexType = mockComplexType(propertyName);
+
+      EasyMock.expect(edmProperty.getType()).andReturn(complexType).anyTimes();
+      EasyMock.expect(edmProperty.getName()).andReturn(propertyName).anyTimes();
+      EasyMock.expect(edmProperty.getMapping()).andReturn((EdmMapping) mockEdmMapping(null, propertyName, null))
+          .anyTimes();
+
+    }
+
+    EasyMock.replay(edmProperty);
+    return edmProperty;
+  }
+
+  public static EdmComplexType mockComplexType(final String complexPropertyName) throws EdmException {
+
+    String complexTypeName = null;
+    if (complexPropertyName.equals(JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE)) {
+      complexTypeName = JPATypeEmbeddableMock2.ENTITY_NAME;
+    } else if (complexPropertyName.equals(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)) {
+      complexTypeName = JPATypeEmbeddableMock.ENTITY_NAME;
+    }
+
+    EdmComplexType edmComplexType = EasyMock.createMock(EdmComplexType.class);
+    EasyMock.expect(edmComplexType.getKind()).andReturn(EdmTypeKind.COMPLEX);
+    EasyMock.expect(edmComplexType.getPropertyNames()).andReturn(mockPropertyNames(complexTypeName)).anyTimes();
+    EasyMock.expect(edmComplexType.getMapping()).andReturn((EdmMapping) mockEdmMapping(complexTypeName, null, null));
+
+    if (complexTypeName.equals(JPATypeEmbeddableMock.ENTITY_NAME)) {
+      EasyMock.expect(edmComplexType.getProperty(JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT)).andReturn(
+          mockEdmProperty(complexTypeName, JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT)).anyTimes();
+      EasyMock.expect(edmComplexType.getProperty(JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE)).andReturn(
+          mockEdmProperty(complexTypeName, JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE)).anyTimes();
+    } else if (complexTypeName.equals(JPATypeEmbeddableMock2.ENTITY_NAME)) {
+      EasyMock.expect(edmComplexType.getProperty(JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT)).andReturn(
+          mockEdmProperty(complexTypeName, JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT)).anyTimes();
+      EasyMock.expect(edmComplexType.getProperty(JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID)).andReturn(
+          mockEdmProperty(complexTypeName, JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID)).anyTimes();
+    }
+
+    EasyMock.replay(edmComplexType);
+    return edmComplexType;
+  }
+
+  public static JPAEdmMapping mockEdmMapping(final String entityName, final String propertyName,
+      final String navigationPropertyName) {
+    JPAEdmMapping mapping = new JPAEdmMappingImpl();
+
+    if (propertyName == null && entityName != null) {
+      if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
+        mapping.setJPAType(JPATypeMock.class);
+      } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
+        mapping.setJPAType(JPARelatedTypeMock.class);
+      } else if (entityName.equals(JPATypeEmbeddableMock.ENTITY_NAME)) {
+        mapping.setJPAType(JPATypeEmbeddableMock.class);
+      } else if (entityName.equals(JPATypeEmbeddableMock2.ENTITY_NAME)) {
+        mapping.setJPAType(JPATypeEmbeddableMock2.class);
+      }
+    } else if (entityName == null && navigationPropertyName != null) {
+      mapping.setJPAType(JPARelatedTypeMock.class);
+      mapping.setJPAColumnName(JPATypeMock.NAVIGATION_PROPERTY_X);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MINT)) {
+      mapping.setJPAType(int.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MINT);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING)) {
+      mapping.setJPAType(String.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MSTRING);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB)) {
+      mapping.setJPAType(Blob.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MBLOB);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_CLOB)) {
+      mapping.setJPAType(Clob.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_CLOB);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MC)) {
+      mapping.setJPAType(char.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MC);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY)) {
+      mapping.setJPAType(char[].class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MCARRAY);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR)) {
+      mapping.setJPAType(Character.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MCHAR);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY)) {
+      mapping.setJPAType(Character[].class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MCHARARRAY);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MDATETIME)) {
+      mapping.setJPAType(Calendar.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MDATETIME);
+    } else if (propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MLONG)) {
+      mapping.setJPAType(long.class);
+      ((Mapping) mapping).setInternalName(JPARelatedTypeMock.PROPERTY_NAME_MLONG);
+    } else if (propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE)) {
+      mapping.setJPAType(double.class);
+      ((Mapping) mapping).setInternalName(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE);
+    } else if (propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTE)) {
+      mapping.setJPAType(byte.class);
+      ((Mapping) mapping).setInternalName(JPARelatedTypeMock.PROPERTY_NAME_MBYTE);
+    } else if (propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)) {
+      mapping.setJPAType(byte[].class);
+      ((Mapping) mapping).setInternalName(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY);
+    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT)) {
+      mapping.setJPAType(Short.TYPE);
+      ((Mapping) mapping).setInternalName(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT);
+    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT)) {
+      mapping.setJPAType(Float.TYPE);
+      ((Mapping) mapping).setInternalName(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT);
+    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID)) {
+      mapping.setJPAType(UUID.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID);
+    } else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE)) {
+      mapping.setJPAType(JPATypeEmbeddableMock2.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE);
+    } else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)) {
+      mapping.setJPAType(JPATypeEmbeddableMock.class);
+      ((Mapping) mapping).setInternalName(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE);
+    }
+    return mapping;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
index dd8207b..59701fb 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
@@ -1,268 +1,268 @@
-/*******************************************************************************
- * 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.data;
-
-import java.sql.Blob;
-import java.sql.Clob;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-import java.util.UUID;
-
-/* ========================================================================= */
-public class JPATypeMock {
-
-  public static final String ENTITY_NAME = "JPATypeMock";
-  public static final String PROPERTY_NAME_MINT = "mInt";
-  public static final String PROPERTY_NAME_MSTRING = "mString";
-  public static final String PROPERTY_NAME_MDATETIME = "mDateTime";
-  public static final String PROPERTY_NAME_MBLOB = "mBlob";
-  public static final String PROPERTY_NAME_CLOB = "mClob";
-  public static final String PROPERTY_NAME_MCHAR = "mChar";
-  public static final String PROPERTY_NAME_MCHARARRAY = "mCharArray";
-  public static final String PROPERTY_NAME_MC = "mC";
-  public static final String PROPERTY_NAME_MCARRAY = "mCArray";
-  public static final String PROPERTY_NAME_MKEY = "key";
-  public static final String PROPERTY_NAME_MCOMPLEXTYPE = "complexType";
-
-  public static final String NAVIGATION_PROPERTY_X = "mRelatedEntity";
-  public static final String NAVIGATION_PROPERTY_XS = "mRelatedEntities";
-
-  private JPATypeEmbeddableMock key;
-  private JPATypeEmbeddableMock complexType;
-  private int mInt;
-  private String mString;
-  private Calendar mDateTime;
-  private Blob mBlob;
-  private Clob mClob;
-  private char mC;
-  private char[] mCArray;
-  private Character mChar;
-  private Character[] mCharArray;
-
-  public Clob getMClob() {
-    return mClob;
-  }
-
-  public void setMClob(final Clob mClob) {
-    this.mClob = mClob;
-  }
-
-  public char getMC() {
-    return mC;
-  }
-
-  public void setMC(final char mC) {
-    this.mC = mC;
-  }
-
-  public char[] getMCArray() {
-    return mCArray;
-  }
-
-  public void setMCArray(final char[] mCArray) {
-    this.mCArray = mCArray;
-  }
-
-  public Character getMChar() {
-    return mChar;
-  }
-
-  public void setMChar(final Character mChar) {
-    this.mChar = mChar;
-  }
-
-  public Character[] getMCharArray() {
-    return mCharArray;
-  }
-
-  public void setMCharArray(final Character[] mCharArray) {
-    this.mCharArray = mCharArray;
-  }
-
-  private JPARelatedTypeMock mRelatedEntity;
-  private List<JPARelatedTypeMock> mRelatedEntities = new ArrayList<JPATypeMock.JPARelatedTypeMock>();
-
-  public String getMString() {
-    return mString;
-  }
-
-  public void setMString(final String mString) {
-    this.mString = mString;
-  }
-
-  public JPATypeEmbeddableMock getKey() {
-    return key;
-  }
-
-  public void setKey(final JPATypeEmbeddableMock key) {
-    this.key = key;
-  }
-
-  public int getMInt() {
-    return mInt;
-  }
-
-  public void setMInt(final int mInt) {
-    this.mInt = mInt;
-  }
-
-  public Calendar getMDateTime() {
-    return mDateTime;
-  }
-
-  public void setMDateTime(final Calendar mDateTime) {
-    this.mDateTime = mDateTime;
-  }
-
-  public JPARelatedTypeMock getMRelatedEntity() {
-    return mRelatedEntity;
-  }
-
-  public void setMRelatedEntity(final JPARelatedTypeMock mRelatedEntity) {
-    this.mRelatedEntity = mRelatedEntity;
-  }
-
-  public List<JPARelatedTypeMock> getMRelatedEntities() {
-    return mRelatedEntities;
-  }
-
-  public void setMRelatedEntities(final List<JPARelatedTypeMock> mRelatedEntities) {
-    this.mRelatedEntities = mRelatedEntities;
-  }
-
-  public JPATypeEmbeddableMock getComplexType() {
-    return complexType;
-  }
-
-  public void setComplexType(final JPATypeEmbeddableMock complexType) {
-    this.complexType = complexType;
-  }
-
-  public Blob getMBlob() {
-    return mBlob;
-  }
-
-  public void setMBlob(final Blob mBlob) {
-    this.mBlob = mBlob;
-  }
-
-  /* ========================================================================= */
-  public static class JPATypeEmbeddableMock {
-
-    public static final String ENTITY_NAME = "JPATypeEmbeddableMock";
-    public static final String PROPERTY_NAME_MSHORT = "mShort";
-    public static final String PROPERTY_NAME_MEMBEDDABLE = "mEmbeddable";
-
-    private short mShort;
-    private JPATypeEmbeddableMock2 mEmbeddable;
-
-    public short getMShort() {
-      return mShort;
-    }
-
-    public void setMShort(final short mShort) {
-      this.mShort = mShort;
-    }
-
-    public JPATypeEmbeddableMock2 getMEmbeddable() {
-      return mEmbeddable;
-    }
-
-    public void setMEmbeddable(final JPATypeEmbeddableMock2 mEmbeddable) {
-      this.mEmbeddable = mEmbeddable;
-    }
-
-  }
-
-  /* ========================================================================= */
-  public static class JPATypeEmbeddableMock2 {
-
-    public static final String ENTITY_NAME = "JPATypeEmbeddableMock2";
-    public static final String PROPERTY_NAME_MUUID = "mUUID";
-    public static final String PROPERTY_NAME_MFLOAT = "mFloat";
-
-    private UUID mUUID;
-    private float mFloat;
-
-    public UUID getMUUID() {
-      return mUUID;
-    }
-
-    public void setMUUID(final UUID mUUID) {
-      this.mUUID = mUUID;
-    }
-
-    public float getMFloat() {
-      return mFloat;
-    }
-
-    public void setMFloat(final float mFloat) {
-      this.mFloat = mFloat;
-    }
-
-  }
-
-  /* ========================================================================= */
-  public static final class JPARelatedTypeMock {
-    public static final String ENTITY_NAME = "JPARelatedTypeMock";
-    public static final String PROPERTY_NAME_MLONG = "mLong";
-    public static final String PROPERTY_NAME_MDOUBLE = "mDouble";
-    public static final String PROPERTY_NAME_MBYTE = "mByte";
-    public static final String PROPERTY_NAME_MBYTEARRAY = "mByteArray";
-
-    private long mLong;
-    private double mDouble;
-    private byte mByte;
-    private byte mByteArray[];
-
-    public long getMLong() {
-      return mLong;
-    }
-
-    public void setMLong(final long key) {
-      mLong = key;
-    }
-
-    public double getMDouble() {
-      return mDouble;
-    }
-
-    public void setMDouble(final double mDouble) {
-      this.mDouble = mDouble;
-    }
-
-    public byte getMByte() {
-      return mByte;
-    }
-
-    public void setMByte(final byte mByte) {
-      this.mByte = mByte;
-    }
-
-    public byte[] getMByteArray() {
-      return mByteArray;
-    }
-
-    public void setMByteArray(final byte mByteArray[]) {
-      this.mByteArray = mByteArray;
-    }
-
-  }
-}
+/*******************************************************************************
+ * 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.data;
+
+import java.sql.Blob;
+import java.sql.Clob;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.UUID;
+
+/* ========================================================================= */
+public class JPATypeMock {
+
+  public static final String ENTITY_NAME = "JPATypeMock";
+  public static final String PROPERTY_NAME_MINT = "mInt";
+  public static final String PROPERTY_NAME_MSTRING = "mString";
+  public static final String PROPERTY_NAME_MDATETIME = "mDateTime";
+  public static final String PROPERTY_NAME_MBLOB = "mBlob";
+  public static final String PROPERTY_NAME_CLOB = "mClob";
+  public static final String PROPERTY_NAME_MCHAR = "mChar";
+  public static final String PROPERTY_NAME_MCHARARRAY = "mCharArray";
+  public static final String PROPERTY_NAME_MC = "mC";
+  public static final String PROPERTY_NAME_MCARRAY = "mCArray";
+  public static final String PROPERTY_NAME_MKEY = "key";
+  public static final String PROPERTY_NAME_MCOMPLEXTYPE = "complexType";
+
+  public static final String NAVIGATION_PROPERTY_X = "mRelatedEntity";
+  public static final String NAVIGATION_PROPERTY_XS = "mRelatedEntities";
+
+  private JPATypeEmbeddableMock key;
+  private JPATypeEmbeddableMock complexType;
+  private int mInt;
+  private String mString;
+  private Calendar mDateTime;
+  private Blob mBlob;
+  private Clob mClob;
+  private char mC;
+  private char[] mCArray;
+  private Character mChar;
+  private Character[] mCharArray;
+
+  public Clob getMClob() {
+    return mClob;
+  }
+
+  public void setMClob(final Clob mClob) {
+    this.mClob = mClob;
+  }
+
+  public char getMC() {
+    return mC;
+  }
+
+  public void setMC(final char mC) {
+    this.mC = mC;
+  }
+
+  public char[] getMCArray() {
+    return mCArray;
+  }
+
+  public void setMCArray(final char[] mCArray) {
+    this.mCArray = mCArray;
+  }
+
+  public Character getMChar() {
+    return mChar;
+  }
+
+  public void setMChar(final Character mChar) {
+    this.mChar = mChar;
+  }
+
+  public Character[] getMCharArray() {
+    return mCharArray;
+  }
+
+  public void setMCharArray(final Character[] mCharArray) {
+    this.mCharArray = mCharArray;
+  }
+
+  private JPARelatedTypeMock mRelatedEntity;
+  private List<JPARelatedTypeMock> mRelatedEntities = new ArrayList<JPATypeMock.JPARelatedTypeMock>();
+
+  public String getMString() {
+    return mString;
+  }
+
+  public void setMString(final String mString) {
+    this.mString = mString;
+  }
+
+  public JPATypeEmbeddableMock getKey() {
+    return key;
+  }
+
+  public void setKey(final JPATypeEmbeddableMock key) {
+    this.key = key;
+  }
+
+  public int getMInt() {
+    return mInt;
+  }
+
+  public void setMInt(final int mInt) {
+    this.mInt = mInt;
+  }
+
+  public Calendar getMDateTime() {
+    return mDateTime;
+  }
+
+  public void setMDateTime(final Calendar mDateTime) {
+    this.mDateTime = mDateTime;
+  }
+
+  public JPARelatedTypeMock getMRelatedEntity() {
+    return mRelatedEntity;
+  }
+
+  public void setMRelatedEntity(final JPARelatedTypeMock mRelatedEntity) {
+    this.mRelatedEntity = mRelatedEntity;
+  }
+
+  public List<JPARelatedTypeMock> getMRelatedEntities() {
+    return mRelatedEntities;
+  }
+
+  public void setMRelatedEntities(final List<JPARelatedTypeMock> mRelatedEntities) {
+    this.mRelatedEntities = mRelatedEntities;
+  }
+
+  public JPATypeEmbeddableMock getComplexType() {
+    return complexType;
+  }
+
+  public void setComplexType(final JPATypeEmbeddableMock complexType) {
+    this.complexType = complexType;
+  }
+
+  public Blob getMBlob() {
+    return mBlob;
+  }
+
+  public void setMBlob(final Blob mBlob) {
+    this.mBlob = mBlob;
+  }
+
+  /* ========================================================================= */
+  public static class JPATypeEmbeddableMock {
+
+    public static final String ENTITY_NAME = "JPATypeEmbeddableMock";
+    public static final String PROPERTY_NAME_MSHORT = "mShort";
+    public static final String PROPERTY_NAME_MEMBEDDABLE = "mEmbeddable";
+
+    private short mShort;
+    private JPATypeEmbeddableMock2 mEmbeddable;
+
+    public short getMShort() {
+      return mShort;
+    }
+
+    public void setMShort(final short mShort) {
+      this.mShort = mShort;
+    }
+
+    public JPATypeEmbeddableMock2 getMEmbeddable() {
+      return mEmbeddable;
+    }
+
+    public void setMEmbeddable(final JPATypeEmbeddableMock2 mEmbeddable) {
+      this.mEmbeddable = mEmbeddable;
+    }
+
+  }
+
+  /* ========================================================================= */
+  public static class JPATypeEmbeddableMock2 {
+
+    public static final String ENTITY_NAME = "JPATypeEmbeddableMock2";
+    public static final String PROPERTY_NAME_MUUID = "mUUID";
+    public static final String PROPERTY_NAME_MFLOAT = "mFloat";
+
+    private UUID mUUID;
+    private float mFloat;
+
+    public UUID getMUUID() {
+      return mUUID;
+    }
+
+    public void setMUUID(final UUID mUUID) {
+      this.mUUID = mUUID;
+    }
+
+    public float getMFloat() {
+      return mFloat;
+    }
+
+    public void setMFloat(final float mFloat) {
+      this.mFloat = mFloat;
+    }
+
+  }
+
+  /* ========================================================================= */
+  public static final class JPARelatedTypeMock {
+    public static final String ENTITY_NAME = "JPARelatedTypeMock";
+    public static final String PROPERTY_NAME_MLONG = "mLong";
+    public static final String PROPERTY_NAME_MDOUBLE = "mDouble";
+    public static final String PROPERTY_NAME_MBYTE = "mByte";
+    public static final String PROPERTY_NAME_MBYTEARRAY = "mByteArray";
+
+    private long mLong;
+    private double mDouble;
+    private byte mByte;
+    private byte mByteArray[];
+
+    public long getMLong() {
+      return mLong;
+    }
+
+    public void setMLong(final long key) {
+      mLong = key;
+    }
+
+    public double getMDouble() {
+      return mDouble;
+    }
+
+    public void setMDouble(final double mDouble) {
+      this.mDouble = mDouble;
+    }
+
+    public byte getMByte() {
+      return mByte;
+    }
+
+    public void setMByte(final byte mByte) {
+      this.mByte = mByte;
+    }
+
+    public byte[] getMByteArray() {
+      return mByteArray;
+    }
+
+    public void setMByteArray(final byte mByteArray[]) {
+      this.mByteArray = mByteArray;
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
index 13e1f05..4f95a0e 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
@@ -1,164 +1,164 @@
-/*******************************************************************************
- * 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.data;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-import java.util.UUID;
-
-import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
-import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
-import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
-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.easymock.EasyMock;
-
-public class ODataEntryMockUtil {
-
-  public static final int VALUE_MINT = 20;
-  public static Calendar VALUE_DATE_TIME = null;
-  public static byte[] VALUE_BLOB = null;
-  public static final String VALUE_CLOB = "ABC";
-  public static final String VALUE_C = "D";
-  public static final String VALUE_CARRAY = "EFG";
-  public static final String VALUE_CHAR = "I";
-  public static final String VALUE_CHARARRAY = "LMN";
-  public static final String VALUE_MSTRING = "Mock";
-  public static final long VALUE_MLONG = 1234567890L;
-  public static final double VALUE_MDOUBLE = 20.12;
-  public static final byte VALUE_MBYTE = 0XA;
-  public static final byte[] VALUE_MBYTEARRAY = new byte[] { 0XA, 0XB };
-  public static final float VALUE_MFLOAT = 2.00F;
-  public static final UUID VALUE_UUID = UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d");
-  public static final short VALUE_SHORT = 2;
-
-  public static ODataEntry mockODataEntry(final String entityName) {
-    ODataEntry oDataEntry = EasyMock.createMock(ODataEntry.class);
-    EasyMock.expect(oDataEntry.getProperties()).andReturn(mockODataEntryProperties(entityName)).anyTimes();
-
-    enhanceMockODataEntry(oDataEntry, false, new ArrayList<String>());
-    EasyMock.replay(oDataEntry);
-    return oDataEntry;
-  }
-
-  public static ODataEntry mockODataEntryWithComplexType(final String entityName) {
-    ODataEntry oDataEntry = EasyMock.createMock(ODataEntry.class);
-    EasyMock.expect(oDataEntry.getProperties()).andReturn(mockODataEntryPropertiesWithComplexType(entityName))
-        .anyTimes();
-
-    enhanceMockODataEntry(oDataEntry, false, new ArrayList<String>());
-    EasyMock.replay(oDataEntry);
-    return oDataEntry;
-  }
-
-  public static Map<String, Object> mockODataEntryProperties(final String entityName) {
-    Map<String, Object> propertyMap = new HashMap<String, Object>();
-
-    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
-      propertyMap.put(JPATypeMock.PROPERTY_NAME_MINT, VALUE_MINT);
-
-      VALUE_DATE_TIME = Calendar.getInstance(TimeZone.getDefault());
-      VALUE_DATE_TIME.set(2013, 1, 1, 1, 1, 1);
-      propertyMap.put(JPATypeMock.PROPERTY_NAME_MDATETIME, VALUE_DATE_TIME);
-
-      VALUE_BLOB = VALUE_MBYTEARRAY;
-      propertyMap.put(JPATypeMock.PROPERTY_NAME_MBLOB, VALUE_BLOB);
-
-      propertyMap.put(JPATypeMock.PROPERTY_NAME_CLOB, VALUE_CLOB);
-      propertyMap.put(JPATypeMock.PROPERTY_NAME_MC, VALUE_C);
-      propertyMap.put(JPATypeMock.PROPERTY_NAME_MCARRAY, VALUE_CARRAY);
-      propertyMap.put(JPATypeMock.PROPERTY_NAME_MCHAR, VALUE_CHAR);
-      propertyMap.put(JPATypeMock.PROPERTY_NAME_MCHARARRAY, VALUE_CHARARRAY);
-      propertyMap.put(JPATypeMock.PROPERTY_NAME_MSTRING, VALUE_MSTRING);
-    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
-      propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MLONG, VALUE_MLONG);
-      propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE, VALUE_MDOUBLE);
-      propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MBYTE, VALUE_MBYTE);
-      propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY, VALUE_MBYTEARRAY);
-    } else if (entityName.equals(JPATypeEmbeddableMock.ENTITY_NAME)) {
-      propertyMap.put(JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT, VALUE_SHORT);
-      propertyMap.put(JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE,
-          mockODataEntryProperties(JPATypeEmbeddableMock2.ENTITY_NAME));
-    } else if (entityName.equals(JPATypeEmbeddableMock2.ENTITY_NAME)) {
-      propertyMap.put(JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT, VALUE_MFLOAT);
-      propertyMap.put(JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID, VALUE_UUID);
-    }
-
-    return propertyMap;
-  }
-
-  public static Map<String, Object> mockODataEntryPropertiesWithComplexType(final String entityName) {
-    Map<String, Object> propertyMap = mockODataEntryProperties(entityName);
-    propertyMap
-        .put(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE, mockODataEntryProperties(JPATypeEmbeddableMock.ENTITY_NAME));
-    return propertyMap;
-  }
-
-  public static Map<String, Object> mockODataEntryPropertiesWithInline(final String entityName) {
-    Map<String, Object> propertyMap = mockODataEntryProperties(entityName);
-    List<ODataEntry> relatedEntries = new ArrayList<ODataEntry>();
-    relatedEntries.add(mockODataEntry(JPARelatedTypeMock.ENTITY_NAME));
-    ODataFeed feed = EasyMock.createMock(ODataFeed.class);
-    EasyMock.expect(feed.getEntries()).andReturn(relatedEntries);
-    EasyMock.replay(feed);
-    propertyMap.put(JPATypeMock.NAVIGATION_PROPERTY_X, feed);
-
-    return propertyMap;
-
-  }
-
-  public static ODataEntry mockODataEntryWithInline(final String entityName) {
-    ODataEntry oDataEntry = EasyMock.createMock(ODataEntry.class);
-    EasyMock.expect(oDataEntry.getProperties()).andReturn(mockODataEntryPropertiesWithInline(entityName)).anyTimes();
-    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
-      List<String> links = new ArrayList<String>();
-      links.add(JPATypeMock.ENTITY_NAME + "(" + ODataEntryMockUtil.VALUE_MINT + ")/"
-          + JPATypeMock.NAVIGATION_PROPERTY_X);
-      enhanceMockODataEntry(oDataEntry, true, links);
-    } else {
-      enhanceMockODataEntry(oDataEntry, false, new ArrayList<String>());
-    }
-    EasyMock.replay(oDataEntry);
-    return oDataEntry;
-  }
-
-  private static void
-      enhanceMockODataEntry(final ODataEntry oDataEntry, final boolean hasInline, final List<String> associationURIs) {
-    EasyMock.expect(oDataEntry.containsInlineEntry()).andReturn(hasInline).anyTimes();
-    EntryMetadata entryMetadata = EasyMock.createMock(EntryMetadata.class);
-    if (hasInline) {
-      EasyMock.expect(entryMetadata.getAssociationUris(JPATypeMock.NAVIGATION_PROPERTY_X)).andReturn(associationURIs)
-          .anyTimes();
-      EasyMock.expect(entryMetadata.getAssociationUris(JPATypeMock.NAVIGATION_PROPERTY_XS)).andReturn(
-          new ArrayList<String>())
-          .anyTimes();
-    } else {
-      EasyMock.expect(entryMetadata.getAssociationUris(EasyMock.isA(String.class))).andReturn(associationURIs)
-          .anyTimes();
-    }
-
-    EasyMock.replay(entryMetadata);
-    EasyMock.expect(oDataEntry.getMetadata()).andReturn(entryMetadata).anyTimes();
-  }
-}
+/*******************************************************************************
+ * 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.data;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+import java.util.UUID;
+
+import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
+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.easymock.EasyMock;
+
+public class ODataEntryMockUtil {
+
+  public static final int VALUE_MINT = 20;
+  public static Calendar VALUE_DATE_TIME = null;
+  public static byte[] VALUE_BLOB = null;
+  public static final String VALUE_CLOB = "ABC";
+  public static final String VALUE_C = "D";
+  public static final String VALUE_CARRAY = "EFG";
+  public static final String VALUE_CHAR = "I";
+  public static final String VALUE_CHARARRAY = "LMN";
+  public static final String VALUE_MSTRING = "Mock";
+  public static final long VALUE_MLONG = 1234567890L;
+  public static final double VALUE_MDOUBLE = 20.12;
+  public static final byte VALUE_MBYTE = 0XA;
+  public static final byte[] VALUE_MBYTEARRAY = new byte[] { 0XA, 0XB };
+  public static final float VALUE_MFLOAT = 2.00F;
+  public static final UUID VALUE_UUID = UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d");
+  public static final short VALUE_SHORT = 2;
+
+  public static ODataEntry mockODataEntry(final String entityName) {
+    ODataEntry oDataEntry = EasyMock.createMock(ODataEntry.class);
+    EasyMock.expect(oDataEntry.getProperties()).andReturn(mockODataEntryProperties(entityName)).anyTimes();
+
+    enhanceMockODataEntry(oDataEntry, false, new ArrayList<String>());
+    EasyMock.replay(oDataEntry);
+    return oDataEntry;
+  }
+
+  public static ODataEntry mockODataEntryWithComplexType(final String entityName) {
+    ODataEntry oDataEntry = EasyMock.createMock(ODataEntry.class);
+    EasyMock.expect(oDataEntry.getProperties()).andReturn(mockODataEntryPropertiesWithComplexType(entityName))
+        .anyTimes();
+
+    enhanceMockODataEntry(oDataEntry, false, new ArrayList<String>());
+    EasyMock.replay(oDataEntry);
+    return oDataEntry;
+  }
+
+  public static Map<String, Object> mockODataEntryProperties(final String entityName) {
+    Map<String, Object> propertyMap = new HashMap<String, Object>();
+
+    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_MINT, VALUE_MINT);
+
+      VALUE_DATE_TIME = Calendar.getInstance(TimeZone.getDefault());
+      VALUE_DATE_TIME.set(2013, 1, 1, 1, 1, 1);
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_MDATETIME, VALUE_DATE_TIME);
+
+      VALUE_BLOB = VALUE_MBYTEARRAY;
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_MBLOB, VALUE_BLOB);
+
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_CLOB, VALUE_CLOB);
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_MC, VALUE_C);
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_MCARRAY, VALUE_CARRAY);
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_MCHAR, VALUE_CHAR);
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_MCHARARRAY, VALUE_CHARARRAY);
+      propertyMap.put(JPATypeMock.PROPERTY_NAME_MSTRING, VALUE_MSTRING);
+    } else if (entityName.equals(JPARelatedTypeMock.ENTITY_NAME)) {
+      propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MLONG, VALUE_MLONG);
+      propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE, VALUE_MDOUBLE);
+      propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MBYTE, VALUE_MBYTE);
+      propertyMap.put(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY, VALUE_MBYTEARRAY);
+    } else if (entityName.equals(JPATypeEmbeddableMock.ENTITY_NAME)) {
+      propertyMap.put(JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT, VALUE_SHORT);
+      propertyMap.put(JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE,
+          mockODataEntryProperties(JPATypeEmbeddableMock2.ENTITY_NAME));
+    } else if (entityName.equals(JPATypeEmbeddableMock2.ENTITY_NAME)) {
+      propertyMap.put(JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT, VALUE_MFLOAT);
+      propertyMap.put(JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID, VALUE_UUID);
+    }
+
+    return propertyMap;
+  }
+
+  public static Map<String, Object> mockODataEntryPropertiesWithComplexType(final String entityName) {
+    Map<String, Object> propertyMap = mockODataEntryProperties(entityName);
+    propertyMap
+        .put(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE, mockODataEntryProperties(JPATypeEmbeddableMock.ENTITY_NAME));
+    return propertyMap;
+  }
+
+  public static Map<String, Object> mockODataEntryPropertiesWithInline(final String entityName) {
+    Map<String, Object> propertyMap = mockODataEntryProperties(entityName);
+    List<ODataEntry> relatedEntries = new ArrayList<ODataEntry>();
+    relatedEntries.add(mockODataEntry(JPARelatedTypeMock.ENTITY_NAME));
+    ODataFeed feed = EasyMock.createMock(ODataFeed.class);
+    EasyMock.expect(feed.getEntries()).andReturn(relatedEntries);
+    EasyMock.replay(feed);
+    propertyMap.put(JPATypeMock.NAVIGATION_PROPERTY_X, feed);
+
+    return propertyMap;
+
+  }
+
+  public static ODataEntry mockODataEntryWithInline(final String entityName) {
+    ODataEntry oDataEntry = EasyMock.createMock(ODataEntry.class);
+    EasyMock.expect(oDataEntry.getProperties()).andReturn(mockODataEntryPropertiesWithInline(entityName)).anyTimes();
+    if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
+      List<String> links = new ArrayList<String>();
+      links.add(JPATypeMock.ENTITY_NAME + "(" + ODataEntryMockUtil.VALUE_MINT + ")/"
+          + JPATypeMock.NAVIGATION_PROPERTY_X);
+      enhanceMockODataEntry(oDataEntry, true, links);
+    } else {
+      enhanceMockODataEntry(oDataEntry, false, new ArrayList<String>());
+    }
+    EasyMock.replay(oDataEntry);
+    return oDataEntry;
+  }
+
+  private static void
+      enhanceMockODataEntry(final ODataEntry oDataEntry, final boolean hasInline, final List<String> associationURIs) {
+    EasyMock.expect(oDataEntry.containsInlineEntry()).andReturn(hasInline).anyTimes();
+    EntryMetadata entryMetadata = EasyMock.createMock(EntryMetadata.class);
+    if (hasInline) {
+      EasyMock.expect(entryMetadata.getAssociationUris(JPATypeMock.NAVIGATION_PROPERTY_X)).andReturn(associationURIs)
+          .anyTimes();
+      EasyMock.expect(entryMetadata.getAssociationUris(JPATypeMock.NAVIGATION_PROPERTY_XS)).andReturn(
+          new ArrayList<String>())
+          .anyTimes();
+    } else {
+      EasyMock.expect(entryMetadata.getAssociationUris(EasyMock.isA(String.class))).andReturn(associationURIs)
+          .anyTimes();
+    }
+
+    EasyMock.replay(entryMetadata);
+    EasyMock.expect(oDataEntry.getMetadata()).andReturn(entryMetadata).anyTimes();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAPluralAttributeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAPluralAttributeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAPluralAttributeMock.java
index 23e7330..dd88da7 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAPluralAttributeMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAPluralAttributeMock.java
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * 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.model;
-
-import java.lang.reflect.Member;
-import java.util.ArrayList;
-
-import javax.persistence.metamodel.ManagedType;
-import javax.persistence.metamodel.PluralAttribute;
-import javax.persistence.metamodel.Type;
-
-public class JPAPluralAttributeMock implements PluralAttribute<Object, ArrayList<String>, String> {
-
-  @Override
-  public String getName() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public javax.persistence.metamodel.Attribute.PersistentAttributeType getPersistentAttributeType() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public ManagedType<Object> getDeclaringType() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public Class<ArrayList<String>> getJavaType() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public Member getJavaMember() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public boolean isAssociation() {
-    // TODO Auto-generated method stub
-    return false;
-  }
-
-  @Override
-  public boolean isCollection() {
-    return false;
-  }
-
-  @Override
-  public javax.persistence.metamodel.Bindable.BindableType getBindableType() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public Class<String> getBindableJavaType() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public javax.persistence.metamodel.PluralAttribute.CollectionType getCollectionType() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
-  public Type<String> getElementType() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
+/*******************************************************************************
+ * 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.model;
+
+import java.lang.reflect.Member;
+import java.util.ArrayList;
+
+import javax.persistence.metamodel.ManagedType;
+import javax.persistence.metamodel.PluralAttribute;
+import javax.persistence.metamodel.Type;
+
+public class JPAPluralAttributeMock implements PluralAttribute<Object, ArrayList<String>, String> {
+
+  @Override
+  public String getName() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public javax.persistence.metamodel.Attribute.PersistentAttributeType getPersistentAttributeType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public ManagedType<Object> getDeclaringType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public Class<ArrayList<String>> getJavaType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public Member getJavaMember() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public boolean isAssociation() {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  @Override
+  public boolean isCollection() {
+    return false;
+  }
+
+  @Override
+  public javax.persistence.metamodel.Bindable.BindableType getBindableType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public Class<String> getBindableJavaType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public javax.persistence.metamodel.PluralAttribute.CollectionType getCollectionType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public Type<String> getElementType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-ref/.gitignore
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/.gitignore b/odata2-jpa-processor/jpa-ref/.gitignore
index fe5d89b..a7ffe90 100644
--- a/odata2-jpa-processor/jpa-ref/.gitignore
+++ b/odata2-jpa-processor/jpa-ref/.gitignore
@@ -1,8 +1,8 @@
-.project
-.classpath
-.settings
-target
-bin
-*.bak
-classes
+.project
+.classpath
+.settings
+target
+bin
+*.bak
+classes
 .DS_Store
\ No newline at end of file


[4/9] line ending issue again

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderDeltaTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderDeltaTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderDeltaTest.java
index f16cbc6..947ed54 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderDeltaTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderDeltaTest.java
@@ -1,357 +1,357 @@
-/*******************************************************************************
- * 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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAPage.JPAPageBuilder;
-import org.junit.Test;
-
-public class JPAPageBuilderDeltaTest {
-
-  private static final int PAGE_SIZE = 10;
-
-  @Test
-  public void testBuildDefaultDelta() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .build();
-
-    assertEquals(20, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-    assertEquals(10, page.getPagedEntities().size());
-
-    List<Object> pagedEntities = page.getPagedEntities();
-
-    assertEquals("9", pagedEntities.get(0));
-    assertEquals("18", pagedEntities.get(9));
-  }
-
-  @Test
-  public void testBuildWithNoSkipTokenDelta() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("0")
-        .build();
-
-    assertEquals(10, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertEquals(10, pagedEntities.size());
-    assertEquals("0", pagedEntities.get(0));
-    assertEquals("9", pagedEntities.get(9));
-  }
-
-  @Test
-  public void testBuildDefaultZeroPageDelta() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(0)
-        .skipToken("10")
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(0, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-    assertEquals(0, page.getPagedEntities().size());
-
-  }
-
-  @Test
-  public void testBuildWithNullSkipToken() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken(null)
-        .build();
-
-    assertEquals(10, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertNotNull(pagedEntities);
-    assertEquals("0", pagedEntities.get(0));
-    assertEquals("9", pagedEntities.get(9));
-  }
-
-  @Test
-  public void testBuildWithInvalidSkipToken() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    try {
-      pageBuilder.entities(mockEntities())
-          .skipToken("AB");
-    } catch (NumberFormatException e) {
-      return;
-    }
-    fail("Exception Expected");
-  }
-
-  @Test
-  public void testBuildWithTop() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("20")
-        .top(5)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(20, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertNotNull(pagedEntities);
-    assertEquals(5, pagedEntities.size());
-    assertEquals("19", pagedEntities.get(0));
-    assertEquals("23", pagedEntities.get(4));
-  }
-
-  @Test
-  public void testBuildWithTopZeroPage() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(0)
-        .skipToken("10")
-        .top(5)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(0, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-    assertEquals(5, page.getPagedEntities().size());
-  }
-
-  @Test
-  public void testBuildWithSkipZeroPage() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(0)
-        .skipToken("10")
-        .skip(5)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(0, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(0, page.getPagedEntities().size());
-  }
-
-  @Test
-  public void testBuildWithTopSkipZeroPage() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(0)
-        .skipToken("10")
-        .skip(5)
-        .top(5)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(0, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-    assertEquals(5, page.getPagedEntities().size());
-  }
-
-  @Test
-  public void testBuildWithTopExceeds() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(15)
-        .build();
-
-    assertEquals(20, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertNotNull(pagedEntities);
-    assertEquals(10, pagedEntities.size());
-    assertEquals("9", pagedEntities.get(0));
-    assertEquals("18", pagedEntities.get(9));
-  }
-
-  @Test
-  public void testBuildWithTopSkipExceeds() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(5)
-        .skip(10)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertEquals(0, pagedEntities.size());
-
-  }
-
-  @Test
-  public void testBuildWithTopSkipMore() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(5)
-        .skip(9)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertNotNull(pagedEntities);
-
-    assertEquals("18", pagedEntities.get(0));
-    assertEquals(1, pagedEntities.size());
-  }
-
-  @Test
-  public void testBuildWithTopMoreSkip() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(15)
-        .skip(9)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertNotNull(pagedEntities);
-
-    assertEquals("18", pagedEntities.get(0));
-    assertEquals(1, pagedEntities.size());
-  }
-
-  @Test
-  public void testBuildWithTopXSkipX() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(15)
-        .skip(15)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertNotNull(pagedEntities);
-
-    assertEquals(0, pagedEntities.size());
-  }
-
-  @Test
-  public void testBuildWithNegativeTop() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(-5)
-        .build();
-
-    assertEquals(20, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertNotNull(pagedEntities);
-
-    assertEquals("9", pagedEntities.get(0));
-    assertEquals(10, pagedEntities.size());
-  }
-
-  @Test
-  public void testBuildWithNegativeTopSkipToken() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("-10")
-        .top(-5)
-        .skip(-1)
-        .build();
-
-    assertEquals(10, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertNotNull(pagedEntities);
-
-    assertEquals(10, pagedEntities.size());
-
-  }
-
-  @Test
-  public void testBuildWithNoRecords() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    JPAPage page = pageBuilder.entities(mockEntities())
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(1)
-        .skip(1)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    List<Object> pagedEntities = page.getPagedEntities();
-    assertNotNull(pagedEntities);
-
-    assertEquals(1, pagedEntities.size());
-    assertEquals("10", pagedEntities.get(0));
-  }
-
-  private List<Object> mockEntities() {
-    List<Object> entities = new ArrayList<Object>();
-    for (int i = 0; i < 30; i++) {
-      entities.add(String.valueOf(i));
-    }
-    return entities;
-  }
-}
+/*******************************************************************************
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAPage.JPAPageBuilder;
+import org.junit.Test;
+
+public class JPAPageBuilderDeltaTest {
+
+  private static final int PAGE_SIZE = 10;
+
+  @Test
+  public void testBuildDefaultDelta() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .build();
+
+    assertEquals(20, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+    assertEquals(10, page.getPagedEntities().size());
+
+    List<Object> pagedEntities = page.getPagedEntities();
+
+    assertEquals("9", pagedEntities.get(0));
+    assertEquals("18", pagedEntities.get(9));
+  }
+
+  @Test
+  public void testBuildWithNoSkipTokenDelta() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("0")
+        .build();
+
+    assertEquals(10, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertEquals(10, pagedEntities.size());
+    assertEquals("0", pagedEntities.get(0));
+    assertEquals("9", pagedEntities.get(9));
+  }
+
+  @Test
+  public void testBuildDefaultZeroPageDelta() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(0)
+        .skipToken("10")
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(0, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+    assertEquals(0, page.getPagedEntities().size());
+
+  }
+
+  @Test
+  public void testBuildWithNullSkipToken() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken(null)
+        .build();
+
+    assertEquals(10, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertNotNull(pagedEntities);
+    assertEquals("0", pagedEntities.get(0));
+    assertEquals("9", pagedEntities.get(9));
+  }
+
+  @Test
+  public void testBuildWithInvalidSkipToken() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    try {
+      pageBuilder.entities(mockEntities())
+          .skipToken("AB");
+    } catch (NumberFormatException e) {
+      return;
+    }
+    fail("Exception Expected");
+  }
+
+  @Test
+  public void testBuildWithTop() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("20")
+        .top(5)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(20, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertNotNull(pagedEntities);
+    assertEquals(5, pagedEntities.size());
+    assertEquals("19", pagedEntities.get(0));
+    assertEquals("23", pagedEntities.get(4));
+  }
+
+  @Test
+  public void testBuildWithTopZeroPage() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(0)
+        .skipToken("10")
+        .top(5)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(0, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+    assertEquals(5, page.getPagedEntities().size());
+  }
+
+  @Test
+  public void testBuildWithSkipZeroPage() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(0)
+        .skipToken("10")
+        .skip(5)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(0, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(0, page.getPagedEntities().size());
+  }
+
+  @Test
+  public void testBuildWithTopSkipZeroPage() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(0)
+        .skipToken("10")
+        .skip(5)
+        .top(5)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(0, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+    assertEquals(5, page.getPagedEntities().size());
+  }
+
+  @Test
+  public void testBuildWithTopExceeds() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(15)
+        .build();
+
+    assertEquals(20, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertNotNull(pagedEntities);
+    assertEquals(10, pagedEntities.size());
+    assertEquals("9", pagedEntities.get(0));
+    assertEquals("18", pagedEntities.get(9));
+  }
+
+  @Test
+  public void testBuildWithTopSkipExceeds() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(5)
+        .skip(10)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertEquals(0, pagedEntities.size());
+
+  }
+
+  @Test
+  public void testBuildWithTopSkipMore() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(5)
+        .skip(9)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertNotNull(pagedEntities);
+
+    assertEquals("18", pagedEntities.get(0));
+    assertEquals(1, pagedEntities.size());
+  }
+
+  @Test
+  public void testBuildWithTopMoreSkip() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(15)
+        .skip(9)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertNotNull(pagedEntities);
+
+    assertEquals("18", pagedEntities.get(0));
+    assertEquals(1, pagedEntities.size());
+  }
+
+  @Test
+  public void testBuildWithTopXSkipX() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(15)
+        .skip(15)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertNotNull(pagedEntities);
+
+    assertEquals(0, pagedEntities.size());
+  }
+
+  @Test
+  public void testBuildWithNegativeTop() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(-5)
+        .build();
+
+    assertEquals(20, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertNotNull(pagedEntities);
+
+    assertEquals("9", pagedEntities.get(0));
+    assertEquals(10, pagedEntities.size());
+  }
+
+  @Test
+  public void testBuildWithNegativeTopSkipToken() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("-10")
+        .top(-5)
+        .skip(-1)
+        .build();
+
+    assertEquals(10, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertNotNull(pagedEntities);
+
+    assertEquals(10, pagedEntities.size());
+
+  }
+
+  @Test
+  public void testBuildWithNoRecords() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    JPAPage page = pageBuilder.entities(mockEntities())
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(1)
+        .skip(1)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    List<Object> pagedEntities = page.getPagedEntities();
+    assertNotNull(pagedEntities);
+
+    assertEquals(1, pagedEntities.size());
+    assertEquals("10", pagedEntities.get(0));
+  }
+
+  private List<Object> mockEntities() {
+    List<Object> entities = new ArrayList<Object>();
+    for (int i = 0; i < 30; i++) {
+      entities.add(String.valueOf(i));
+    }
+    return entities;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderTest.java
index 0232163..326c39f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPageBuilderTest.java
@@ -1,560 +1,560 @@
-/*******************************************************************************
- * 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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.persistence.FlushModeType;
-import javax.persistence.LockModeType;
-import javax.persistence.Parameter;
-import javax.persistence.Query;
-import javax.persistence.TemporalType;
-
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAPage.JPAPageBuilder;
-import org.junit.Test;
-
-public class JPAPageBuilderTest {
-
-  private static final int PAGE_SIZE = 10;
-
-  @Test
-  public void testBuildDefault() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-    assertEquals(1, page.getPagedEntities().size());
-
-    assertEquals(10, query.getFirstResult());
-    assertEquals(10, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildDefaultZeroPage() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(0)
-        .skipToken("10")
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(0, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-    assertEquals(0, page.getPagedEntities().size());
-
-    assertEquals(0, query.getFirstResult());
-    assertEquals(0, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithNoSkipToken() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("0")
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-    assertEquals(1, page.getPagedEntities().size());
-
-    assertEquals(0, query.getFirstResult());
-    assertEquals(10, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithNullSkipToken() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken(null)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(0, query.getFirstResult());
-    assertEquals(10, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithInvalidSkipToken() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    try {
-      pageBuilder.query(query)
-          .skipToken("AB");
-    } catch (NumberFormatException e) {
-      return;
-    }
-    fail("Exception Expected");
-  }
-
-  @Test
-  public void testBuildWithTop() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(5)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(10, query.getFirstResult());
-    assertEquals(5, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithTopZeroPage() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(0)
-        .skipToken("10")
-        .top(5)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(0, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(0, query.getFirstResult());
-    assertEquals(5, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithSkipZeroPage() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(0)
-        .skipToken("10")
-        .skip(5)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(0, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(5, query.getFirstResult());
-    assertEquals(0, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithTopSkipZeroPage() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(0)
-        .skipToken("10")
-        .skip(5)
-        .top(5)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(0, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(5, query.getFirstResult());
-    assertEquals(5, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithTopExceeds() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(15)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(10, query.getFirstResult());
-    assertEquals(10, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithTopSkipExceeds() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(5)
-        .skip(10)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertEquals(0, page.getPagedEntities().size());
-
-    assertEquals(0, query.getFirstResult());
-    assertEquals(0, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithTopSkipMore() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(5)
-        .skip(9)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(19, query.getFirstResult());
-    assertEquals(1, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithTopMoreSkip() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(15)
-        .skip(9)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(19, query.getFirstResult());
-    assertEquals(1, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithTopXSkipX() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(15)
-        .skip(15)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(0, query.getFirstResult());
-    assertEquals(0, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithNegativeTop() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(-5)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(10, query.getFirstResult());
-    assertEquals(10, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithNegativeTopSkipToken() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(false);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("-10")
-        .top(-5)
-        .skip(-1)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(0, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(0, query.getFirstResult());
-    assertEquals(10, query.getMaxResults());
-  }
-
-  @Test
-  public void testBuildWithNoRecords() {
-    JPAPageBuilder pageBuilder = new JPAPageBuilder();
-    Query query = mockQuery(true);
-
-    JPAPage page = pageBuilder.query(query)
-        .pageSize(PAGE_SIZE)
-        .skipToken("10")
-        .top(1)
-        .skip(1)
-        .build();
-
-    assertEquals(0, page.getNextPage());
-    assertEquals(10, page.getStartPage());
-    assertEquals(PAGE_SIZE, page.getPageSize());
-    assertNotNull(page.getPagedEntities());
-
-    assertEquals(11, query.getFirstResult());
-    assertEquals(1, query.getMaxResults());
-  }
-
-  private Query mockQuery(final boolean setNoRecords) {
-
-    return new Query() {
-
-      private int maxResults;
-      private int firstResult;
-
-      @Override
-      public Query setFirstResult(final int arg0) {
-        firstResult = arg0;
-        return this;
-      }
-
-      @Override
-      public Query setMaxResults(final int arg0) {
-        maxResults = arg0;
-        return this;
-      }
-
-      @Override
-      public int getMaxResults() {
-        return maxResults;
-      }
-
-      @Override
-      public int getFirstResult() {
-        return firstResult;
-      }
-
-      @Override
-      public List<Object> getResultList() {
-        List<Object> list = new ArrayList<Object>();
-        if (maxResults > 0 && setNoRecords == false) {
-          list.add(new Integer(1));
-        }
-        return list;
-      }
-
-      @Override
-      public <T> T unwrap(final Class<T> arg0) {
-        return null;
-      }
-
-      @Override
-      public Query setParameter(final int arg0, final Date arg1, final TemporalType arg2) {
-        return null;
-      }
-
-      @Override
-      public Query setParameter(final int arg0, final Calendar arg1, final TemporalType arg2) {
-        return null;
-      }
-
-      @Override
-      public Query setParameter(final String arg0, final Date arg1, final TemporalType arg2) {
-        return null;
-      }
-
-      @Override
-      public Query setParameter(final String arg0, final Calendar arg1, final TemporalType arg2) {
-        return null;
-      }
-
-      @Override
-      public Query setParameter(final Parameter<Date> arg0, final Date arg1, final TemporalType arg2) {
-        return null;
-      }
-
-      @Override
-      public Query setParameter(final Parameter<Calendar> arg0, final Calendar arg1, final TemporalType arg2) {
-        return null;
-      }
-
-      @Override
-      public Query setParameter(final int arg0, final Object arg1) {
-        return null;
-      }
-
-      @Override
-      public Query setParameter(final String arg0, final Object arg1) {
-        return null;
-      }
-
-      @Override
-      public <T> Query setParameter(final Parameter<T> arg0, final T arg1) {
-        return null;
-      }
-
-      @Override
-      public Query setLockMode(final LockModeType arg0) {
-        return null;
-      }
-
-      @Override
-      public Query setHint(final String arg0, final Object arg1) {
-        return null;
-      }
-
-      @Override
-      public Query setFlushMode(final FlushModeType arg0) {
-        return null;
-      }
-
-      @Override
-      public boolean isBound(final Parameter<?> arg0) {
-        return false;
-      }
-
-      @Override
-      public Object getSingleResult() {
-        return null;
-      }
-
-      @Override
-      public Set<Parameter<?>> getParameters() {
-        return null;
-      }
-
-      @Override
-      public Object getParameterValue(final int arg0) {
-        return null;
-      }
-
-      @Override
-      public Object getParameterValue(final String arg0) {
-        return null;
-      }
-
-      @Override
-      public <T> T getParameterValue(final Parameter<T> arg0) {
-        return null;
-      }
-
-      @Override
-      public <T> Parameter<T> getParameter(final int arg0, final Class<T> arg1) {
-        return null;
-      }
-
-      @Override
-      public <T> Parameter<T> getParameter(final String arg0, final Class<T> arg1) {
-        return null;
-      }
-
-      @Override
-      public Parameter<?> getParameter(final int arg0) {
-        return null;
-      }
-
-      @Override
-      public Parameter<?> getParameter(final String arg0) {
-        return null;
-      }
-
-      @Override
-      public LockModeType getLockMode() {
-        return null;
-      }
-
-      @Override
-      public Map<String, Object> getHints() {
-        return null;
-      }
-
-      @Override
-      public FlushModeType getFlushMode() {
-        return null;
-      }
-
-      @Override
-      public int executeUpdate() {
-        return 0;
-      }
-    };
-  }
-
-}
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.access.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.FlushModeType;
+import javax.persistence.LockModeType;
+import javax.persistence.Parameter;
+import javax.persistence.Query;
+import javax.persistence.TemporalType;
+
+import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAPage.JPAPageBuilder;
+import org.junit.Test;
+
+public class JPAPageBuilderTest {
+
+  private static final int PAGE_SIZE = 10;
+
+  @Test
+  public void testBuildDefault() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+    assertEquals(1, page.getPagedEntities().size());
+
+    assertEquals(10, query.getFirstResult());
+    assertEquals(10, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildDefaultZeroPage() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(0)
+        .skipToken("10")
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(0, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+    assertEquals(0, page.getPagedEntities().size());
+
+    assertEquals(0, query.getFirstResult());
+    assertEquals(0, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithNoSkipToken() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("0")
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+    assertEquals(1, page.getPagedEntities().size());
+
+    assertEquals(0, query.getFirstResult());
+    assertEquals(10, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithNullSkipToken() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken(null)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(0, query.getFirstResult());
+    assertEquals(10, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithInvalidSkipToken() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    try {
+      pageBuilder.query(query)
+          .skipToken("AB");
+    } catch (NumberFormatException e) {
+      return;
+    }
+    fail("Exception Expected");
+  }
+
+  @Test
+  public void testBuildWithTop() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(5)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(10, query.getFirstResult());
+    assertEquals(5, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithTopZeroPage() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(0)
+        .skipToken("10")
+        .top(5)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(0, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(0, query.getFirstResult());
+    assertEquals(5, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithSkipZeroPage() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(0)
+        .skipToken("10")
+        .skip(5)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(0, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(5, query.getFirstResult());
+    assertEquals(0, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithTopSkipZeroPage() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(0)
+        .skipToken("10")
+        .skip(5)
+        .top(5)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(0, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(5, query.getFirstResult());
+    assertEquals(5, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithTopExceeds() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(15)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(10, query.getFirstResult());
+    assertEquals(10, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithTopSkipExceeds() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(5)
+        .skip(10)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertEquals(0, page.getPagedEntities().size());
+
+    assertEquals(0, query.getFirstResult());
+    assertEquals(0, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithTopSkipMore() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(5)
+        .skip(9)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(19, query.getFirstResult());
+    assertEquals(1, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithTopMoreSkip() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(15)
+        .skip(9)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(19, query.getFirstResult());
+    assertEquals(1, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithTopXSkipX() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(15)
+        .skip(15)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(0, query.getFirstResult());
+    assertEquals(0, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithNegativeTop() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(-5)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(10, query.getFirstResult());
+    assertEquals(10, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithNegativeTopSkipToken() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(false);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("-10")
+        .top(-5)
+        .skip(-1)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(0, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(0, query.getFirstResult());
+    assertEquals(10, query.getMaxResults());
+  }
+
+  @Test
+  public void testBuildWithNoRecords() {
+    JPAPageBuilder pageBuilder = new JPAPageBuilder();
+    Query query = mockQuery(true);
+
+    JPAPage page = pageBuilder.query(query)
+        .pageSize(PAGE_SIZE)
+        .skipToken("10")
+        .top(1)
+        .skip(1)
+        .build();
+
+    assertEquals(0, page.getNextPage());
+    assertEquals(10, page.getStartPage());
+    assertEquals(PAGE_SIZE, page.getPageSize());
+    assertNotNull(page.getPagedEntities());
+
+    assertEquals(11, query.getFirstResult());
+    assertEquals(1, query.getMaxResults());
+  }
+
+  private Query mockQuery(final boolean setNoRecords) {
+
+    return new Query() {
+
+      private int maxResults;
+      private int firstResult;
+
+      @Override
+      public Query setFirstResult(final int arg0) {
+        firstResult = arg0;
+        return this;
+      }
+
+      @Override
+      public Query setMaxResults(final int arg0) {
+        maxResults = arg0;
+        return this;
+      }
+
+      @Override
+      public int getMaxResults() {
+        return maxResults;
+      }
+
+      @Override
+      public int getFirstResult() {
+        return firstResult;
+      }
+
+      @Override
+      public List<Object> getResultList() {
+        List<Object> list = new ArrayList<Object>();
+        if (maxResults > 0 && setNoRecords == false) {
+          list.add(new Integer(1));
+        }
+        return list;
+      }
+
+      @Override
+      public <T> T unwrap(final Class<T> arg0) {
+        return null;
+      }
+
+      @Override
+      public Query setParameter(final int arg0, final Date arg1, final TemporalType arg2) {
+        return null;
+      }
+
+      @Override
+      public Query setParameter(final int arg0, final Calendar arg1, final TemporalType arg2) {
+        return null;
+      }
+
+      @Override
+      public Query setParameter(final String arg0, final Date arg1, final TemporalType arg2) {
+        return null;
+      }
+
+      @Override
+      public Query setParameter(final String arg0, final Calendar arg1, final TemporalType arg2) {
+        return null;
+      }
+
+      @Override
+      public Query setParameter(final Parameter<Date> arg0, final Date arg1, final TemporalType arg2) {
+        return null;
+      }
+
+      @Override
+      public Query setParameter(final Parameter<Calendar> arg0, final Calendar arg1, final TemporalType arg2) {
+        return null;
+      }
+
+      @Override
+      public Query setParameter(final int arg0, final Object arg1) {
+        return null;
+      }
+
+      @Override
+      public Query setParameter(final String arg0, final Object arg1) {
+        return null;
+      }
+
+      @Override
+      public <T> Query setParameter(final Parameter<T> arg0, final T arg1) {
+        return null;
+      }
+
+      @Override
+      public Query setLockMode(final LockModeType arg0) {
+        return null;
+      }
+
+      @Override
+      public Query setHint(final String arg0, final Object arg1) {
+        return null;
+      }
+
+      @Override
+      public Query setFlushMode(final FlushModeType arg0) {
+        return null;
+      }
+
+      @Override
+      public boolean isBound(final Parameter<?> arg0) {
+        return false;
+      }
+
+      @Override
+      public Object getSingleResult() {
+        return null;
+      }
+
+      @Override
+      public Set<Parameter<?>> getParameters() {
+        return null;
+      }
+
+      @Override
+      public Object getParameterValue(final int arg0) {
+        return null;
+      }
+
+      @Override
+      public Object getParameterValue(final String arg0) {
+        return null;
+      }
+
+      @Override
+      public <T> T getParameterValue(final Parameter<T> arg0) {
+        return null;
+      }
+
+      @Override
+      public <T> Parameter<T> getParameter(final int arg0, final Class<T> arg1) {
+        return null;
+      }
+
+      @Override
+      public <T> Parameter<T> getParameter(final String arg0, final Class<T> arg1) {
+        return null;
+      }
+
+      @Override
+      public Parameter<?> getParameter(final int arg0) {
+        return null;
+      }
+
+      @Override
+      public Parameter<?> getParameter(final String arg0) {
+        return null;
+      }
+
+      @Override
+      public LockModeType getLockMode() {
+        return null;
+      }
+
+      @Override
+      public Map<String, Object> getHints() {
+        return null;
+      }
+
+      @Override
+      public FlushModeType getFlushMode() {
+        return null;
+      }
+
+      @Override
+      public int executeUpdate() {
+        return 0;
+      }
+    };
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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
index 3bc3f14..e39d3af 100644
--- 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
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * 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();
-    ODataJPAServiceFactoryMock mockServiceFactory = new ODataJPAServiceFactoryMock(context);
-    mockServiceFactory.initializeODataJPAContext();
-    EasyMock.expect(context.getServiceFactory()).andReturn(mockServiceFactory).anyTimes();
-    EasyMock.replay(context);
-    return context;
-  }
-
-  public ODataContext mockWithoutOnJPAWriteContent() throws ODataException {
-    ODataContext context = EasyMock.createMock(ODataContext.class);
-    EasyMock.expect(context.getService()).andReturn(odataService).anyTimes();
-    EasyMock.expect(context.getPathInfo()).andReturn(pathInfo).anyTimes();
-    ODataJPAServiceFactoryMock mockServiceFactory = new ODataJPAServiceFactoryMock(context);
-    mockServiceFactory.initializeODataJPAContextX();
-    EasyMock.expect(context.getServiceFactory()).andReturn(mockServiceFactory).anyTimes();
-    EasyMock.replay(context);
-    return context;
-  }
-
-}
+/*******************************************************************************
+ * 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();
+    ODataJPAServiceFactoryMock mockServiceFactory = new ODataJPAServiceFactoryMock(context);
+    mockServiceFactory.initializeODataJPAContext();
+    EasyMock.expect(context.getServiceFactory()).andReturn(mockServiceFactory).anyTimes();
+    EasyMock.replay(context);
+    return context;
+  }
+
+  public ODataContext mockWithoutOnJPAWriteContent() throws ODataException {
+    ODataContext context = EasyMock.createMock(ODataContext.class);
+    EasyMock.expect(context.getService()).andReturn(odataService).anyTimes();
+    EasyMock.expect(context.getPathInfo()).andReturn(pathInfo).anyTimes();
+    ODataJPAServiceFactoryMock mockServiceFactory = new ODataJPAServiceFactoryMock(context);
+    mockServiceFactory.initializeODataJPAContextX();
+    EasyMock.expect(context.getServiceFactory()).andReturn(mockServiceFactory).anyTimes();
+    EasyMock.replay(context);
+    return context;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
index 5fdeece..d7dfc2d 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * 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.processor.ODataContext;
-import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
-import org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory;
-import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-
-public class ODataJPAServiceFactoryMock extends ODataJPAServiceFactory {
-  private ODataContext context = null;
-
-  public ODataJPAServiceFactoryMock(final ODataContext context) {
-    this.context = context;
-  }
-
-  @Override
-  public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
-    ODataJPAContext oDataJPAContext = null;
-    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
-    setOnWriteJPAContent(new OnJPAWriteContentMock());
-    return oDataJPAContext;
-  }
-
-  public ODataJPAContext initializeODataJPAContextX() throws ODataJPARuntimeException {
-    ODataJPAContext oDataJPAContext = null;
-    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
-    setOnWriteJPAContent(null);
-    return oDataJPAContext;
-  }
-}
+/*******************************************************************************
+ * 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.processor.ODataContext;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+
+public class ODataJPAServiceFactoryMock extends ODataJPAServiceFactory {
+  private ODataContext context = null;
+
+  public ODataJPAServiceFactoryMock(final ODataContext context) {
+    this.context = context;
+  }
+
+  @Override
+  public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
+    ODataJPAContext oDataJPAContext = null;
+    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
+    setOnWriteJPAContent(new OnJPAWriteContentMock());
+    return oDataJPAContext;
+  }
+
+  public ODataJPAContext initializeODataJPAContextX() throws ODataJPARuntimeException {
+    ODataJPAContext oDataJPAContext = null;
+    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
+    setOnWriteJPAContent(null);
+    return oDataJPAContext;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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
index c5478db..dfaa329 100644
--- 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
@@ -1,106 +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;
-    }
-
-  }
-}
+/*******************************************************************************
+ * 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/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java
index e0069ce..b571b12 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/OnJPAWriteContentMock.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.jpa.processor.core.mock;
-
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.SQLException;
-
-import javax.sql.rowset.serial.SerialBlob;
-import javax.sql.rowset.serial.SerialClob;
-import javax.sql.rowset.serial.SerialException;
-
-import org.apache.olingo.odata2.jpa.processor.api.OnJPAWriteContent;
-import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-
-public class OnJPAWriteContentMock implements OnJPAWriteContent {
-
-  @Override
-  public Blob getJPABlob(final byte[] binaryData) throws ODataJPARuntimeException {
-    try {
-      return new SerialBlob(binaryData);
-    } catch (SerialException e) {
-      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
-    } catch (SQLException e) {
-      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
-    }
-    return null;
-  }
-
-  @Override
-  public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException {
-    try {
-      return new SerialClob(characterData);
-    } catch (SerialException e) {
-      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
-    } catch (SQLException e) {
-      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
-    }
-    return null;
-  }
-
-}
+/*******************************************************************************
+ * 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.sql.Blob;
+import java.sql.Clob;
+import java.sql.SQLException;
+
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialClob;
+import javax.sql.rowset.serial.SerialException;
+
+import org.apache.olingo.odata2.jpa.processor.api.OnJPAWriteContent;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+
+public class OnJPAWriteContentMock implements OnJPAWriteContent {
+
+  @Override
+  public Blob getJPABlob(final byte[] binaryData) throws ODataJPARuntimeException {
+    try {
+      return new SerialBlob(binaryData);
+    } catch (SerialException e) {
+      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    } catch (SQLException e) {
+      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    }
+    return null;
+  }
+
+  @Override
+  public Clob getJPAClob(final char[] characterData) throws ODataJPARuntimeException {
+    try {
+      return new SerialClob(characterData);
+    } catch (SerialException e) {
+      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    } catch (SQLException e) {
+      ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    }
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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
index 96a920c..b90b79c 100644
--- 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
@@ -1,51 +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;
-
-  }
-}
+/*******************************************************************************
+ * 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/olingo-odata2/blob/b155bda5/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
index 77d1fbd..151cb9a 100644
--- 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
@@ -1,44 +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;
-  }
-
-}
+/*******************************************************************************
+ * 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;
+  }
+
+}


[8/9] git commit: Code cleaning and batch feet adjustments

Posted by ch...@apache.org.
Code cleaning and batch feet adjustments

Signed-off-by: Christian Amend <ch...@apache.org>


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

Branch: refs/heads/olingo436BatchRefactoring
Commit: dbaa667b8a4f80444bf303d20d76b87a570da6a3
Parents: 1f76b21
Author: Christian Holzer <c....@sap.com>
Authored: Thu Oct 9 16:20:15 2014 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Thu Oct 9 16:45:27 2014 +0200

----------------------------------------------------------------------
 .../odata2/core/batch/v2/BatchBodyPart.java     |  2 +-
 .../odata2/core/batch/v2/BatchParser.java       | 11 ---
 .../odata2/core/batch/v2/BatchParserCommon.java | 22 ++---
 .../batch/v2/BatchRequestTransformator.java     |  4 +-
 .../v2/BufferedReaderIncludingLineEndings.java  | 19 +++--
 .../olingo/odata2/core/batch/v2/Header.java     | 18 ++--
 .../core/batch/BatchRequestParserTest.java      | 29 ++-----
 .../src/test/resources/batchLarge.batch         | 88 +-------------------
 8 files changed, 40 insertions(+), 153 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/dbaa667b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchBodyPart.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchBodyPart.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchBodyPart.java
index 288ca1c..d60c29a 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchBodyPart.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchBodyPart.java
@@ -112,7 +112,7 @@ public class BatchBodyPart implements BatchPart {
     return requestList;
   }
 
-  private void validateChangeSetBoundary(final String changeSetBoundary, Header header) throws BatchException {
+  private void validateChangeSetBoundary(final String changeSetBoundary, final Header header) throws BatchException {
     if (changeSetBoundary.equals(boundary)) {
       throw new BatchException(BatchException.INVALID_BOUNDARY.addContent(header.getHeaderField(
           HttpHeaders.CONTENT_TYPE).getLineNumber()));

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/dbaa667b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
index 76b5215..bf4ce93 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
@@ -89,17 +89,6 @@ public class BatchParser {
 
     return resultList;
   }
-  
-  //TODO remove
-//  private List<List<Line>> splitBodyParts(final InputStream in, final String boundary)
-//      throws IOException, BatchException {
-//
-//    final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
-//    final List<Line> message = reader.toList();
-//    reader.close();
-//
-//    return BatchParserCommon.splitMessageByBoundary(message, boundary);
-//  }
 
   private String getBaseUri() throws BatchException {
     String baseUri = "";

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/dbaa667b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
index 3592688..5c6cd69 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
@@ -92,22 +92,22 @@ public class BatchParserCommon {
 
     return new ByteArrayInputStream(message.getBytes());
   }
-  
+
   static List<List<Line>> splitRequestByBoundary(final InputStream in, final String boundary)
       throws BatchException, IOException {
     final List<List<Line>> messageParts = new LinkedList<List<Line>>();
     List<Line> currentPart = new ArrayList<Line>();
     boolean isEndReached = false;
-    //32ms
+
     final String quotedBoundary = Pattern.quote(boundary);
-    final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary +  "--[\\s ]*");
+    final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary + "--[\\s ]*");
     final Pattern boundaryPattern = Pattern.compile("--" + quotedBoundary + "[\\s ]*");
-    
+
     final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
     String currentLine;
     int lineNumber = 1;
-    
-    while((currentLine = reader.readLine()) != null) {
+
+    while ((currentLine = reader.readLine()) != null) {
       if (boundaryDelimiterPattern.matcher(currentLine.toString()).matches()) {
         removeEndingCRLFFromList(currentPart);
         messageParts.add(currentPart);
@@ -146,17 +146,17 @@ public class BatchParserCommon {
 
     return messageParts;
   }
-  
+
   static List<List<Line>> splitMessageByBoundary(final List<Line> message, final String boundary)
       throws BatchException {
     final List<List<Line>> messageParts = new LinkedList<List<Line>>();
     List<Line> currentPart = new ArrayList<Line>();
     boolean isEndReached = false;
-    
+
     final String quotedBoundary = Pattern.quote(boundary);
-    final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary +  "--[\\s ]*");
+    final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary + "--[\\s ]*");
     final Pattern boundaryPattern = Pattern.compile("--" + quotedBoundary + "[\\s ]*");
-    
+
     for (Line currentLine : message) {
       if (boundaryDelimiterPattern.matcher(currentLine.toString()).matches()) {
         removeEndingCRLFFromList(currentPart);
@@ -313,7 +313,7 @@ public class BatchParserCommon {
 
   public static PathInfo parseRequestUri(final Line httpStatusLine, final PathInfo batchRequestPathInfo,
       final String baseUri, final int line)
-      throws BatchException {
+          throws BatchException {
 
     final String odataPathSegmentsAsString;
     final String queryParametersAsString;

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/dbaa667b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
index c7ffa88..4faac22 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
@@ -63,7 +63,7 @@ public class BatchRequestTransformator implements BatchTransformator {
     return resultList;
   }
 
-  private void validateHeader(final BatchPart bodyPart, boolean isChangeSet) throws BatchException {
+  private void validateHeader(final BatchPart bodyPart, final boolean isChangeSet) throws BatchException {
     Header headers = bodyPart.getHeaders();
 
     BatchTransformatorCommon.validateContentType(headers);
@@ -123,7 +123,7 @@ public class BatchRequestTransformator implements BatchTransformator {
         || (operation.getBody().size() == 1 && !operation.getBody().get(0).toString().trim().equals(""));
   }
 
-  private InputStream getBodyStream(final BatchQueryOperation operation, Header headers,
+  private InputStream getBodyStream(final BatchQueryOperation operation, final Header headers,
       final ODataHttpMethod httpMethod) throws BatchException {
 
     if (HTTP_BATCH_METHODS.contains(httpMethod.toString())) {

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/dbaa667b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java
index 7b81dc8..5c7fb7c 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BufferedReaderIncludingLineEndings.java
@@ -57,7 +57,8 @@ public class BufferedReaderIncludingLineEndings extends Reader {
     }
 
     // Check if buffer is filled. Return if EOF is reached
-    if (isBufferReloadRequired() || isEOF()) {
+    // Is buffer refill required
+    if (limit == offset || isEOF()) {
       fillBuffer();
 
       if (isEOF()) {
@@ -70,7 +71,8 @@ public class BufferedReaderIncludingLineEndings extends Reader {
     int currentOutputOffset = bufferOffset;
 
     while (bytesToRead != 0) {
-      if (isBufferReloadRequired()) {
+      // Is buffer refill required?
+      if (limit == offset) {
         fillBuffer();
 
         if (isEOF()) {
@@ -113,6 +115,7 @@ public class BufferedReaderIncludingLineEndings extends Reader {
     boolean foundLineEnd = false; // EOF will be considered as line ending
 
     while (!foundLineEnd) {
+     // Is buffer refill required?
       if (limit == offset) {
         if (fillBuffer() == EOF) {
           foundLineEnd = true;
@@ -129,6 +132,7 @@ public class BufferedReaderIncludingLineEndings extends Reader {
           foundLineEnd = true;
 
           // Check next char. Consume \n if available
+          // Is buffer refill required?
           if (limit == offset) {
             fillBuffer();
           }
@@ -152,7 +156,8 @@ public class BufferedReaderIncludingLineEndings extends Reader {
 
   @Override
   public boolean ready() throws IOException {
-    return !isEOF() && !isBufferReloadRequired();
+    // Not EOF and buffer refill is not required
+    return !isEOF() && !(limit == offset);
   }
 
   @Override
@@ -181,8 +186,8 @@ public class BufferedReaderIncludingLineEndings extends Reader {
       long charactersSkiped = 0;
 
       while (charactersToSkip != 0) {
-        // Check if buffer is empty
-        if (isBufferReloadRequired()) {
+        // Is buffer refill required?
+        if (limit == offset) {
           fillBuffer();
 
           if (isEOF()) {
@@ -204,10 +209,6 @@ public class BufferedReaderIncludingLineEndings extends Reader {
     }
   }
 
-  private boolean isBufferReloadRequired() {
-    return limit == offset;
-  }
-
   private boolean isEOF() {
     return limit == EOF;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/dbaa667b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java
index 6c90e02..d2e26da 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/Header.java
@@ -11,11 +11,11 @@ public class Header implements Cloneable {
 
   private final Map<String, HeaderField> headers = new HashMap<String, HeaderField>();
   private int lineNumber;
-  
-  public Header(int lineNumer) {
-    this.lineNumber = lineNumer;
+
+  public Header(final int lineNumer) {
+    lineNumber = lineNumer;
   }
-  
+
   public void addHeader(final String name, final String value, final int lineNumber) {
     final HeaderField headerField = getHeaderFieldOrDefault(name, lineNumber);
     final List<String> headerValues = headerField.getValues();
@@ -50,13 +50,13 @@ public class Header implements Cloneable {
 
   public String getHeader(final String name) {
     final HeaderField headerField = getHeaderField(name);
-    
+
     return (headerField == null) ? null : headerField.getValue();
   }
 
   public String getHeaderNotNull(final String name) {
     final HeaderField headerField = getHeaderField(name);
-    
+
     return (headerField == null) ? "" : headerField.getValueNotNull();
   }
 
@@ -69,11 +69,11 @@ public class Header implements Cloneable {
   public HeaderField getHeaderField(final String name) {
     return headers.get(name.toLowerCase(Locale.ENGLISH));
   }
-  
+
   public int getLineNumber() {
     return lineNumber;
   }
-  
+
   public Map<String, String> toSingleMap() {
     final Map<String, String> singleMap = new HashMap<String, String>();
 
@@ -87,7 +87,7 @@ public class Header implements Cloneable {
 
   public Map<String, List<String>> toMultiMap() {
     final Map<String, List<String>> singleMap = new HashMap<String, List<String>>();
-    
+
     for (final String key : headers.keySet()) {
       HeaderField field = headers.get(key);
       singleMap.put(field.getFieldName(), field.getValues());

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/dbaa667b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java
index f9287b5..52550fb 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestParserTest.java
@@ -29,7 +29,6 @@ import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.List;
-import java.util.Random;
 
 import org.apache.olingo.odata2.api.batch.BatchException;
 import org.apache.olingo.odata2.api.batch.BatchRequestPart;
@@ -1075,29 +1074,13 @@ public class BatchRequestParserTest {
 
   @Test
   public void testLargeBatch() throws BatchException, IOException {
-    for (int j = 0; j < 200; j++) {
-      String fileName = "/batchLarge.batch";
-      InputStream in = ClassLoader.class.getResourceAsStream(fileName);
-      if (in == null) {
-        throw new IOException("Requested file '" + fileName + "' was not found.");
-      }
-
-      StringBuilder builder = new StringBuilder();
-      Random rnd = new Random();
-      for (int i = 0; i < 300; i++) {
-        builder.append((char) ('A' + rnd.nextInt('Z' - 'A')));
-      }
-
-      // String request = builder.toString() + CRLF + inputStreamToString(in);
-      String request = inputStreamToString(in).replace("Walldorf", builder.toString());
-      in.close();
-      InputStream requestStream = new ByteArrayInputStream(request.getBytes());
-
-      long start = System.currentTimeMillis();
-      BatchParser parser = new BatchParser(contentType, batchProperties, true);
-      parser.parseBatchRequest(requestStream);
-      System.out.println(System.currentTimeMillis() - start);
+    String fileName = "/batchLarge.batch";
+    InputStream in = ClassLoader.class.getResourceAsStream(fileName);
+    if (in == null) {
+      throw new IOException("Requested file '" + fileName + "' was not found.");
     }
+    BatchParser parser = new BatchParser(contentType, batchProperties, true);
+    parser.parseBatchRequest(in);
   }
 
   private List<BatchRequestPart> parse(final String batch) throws BatchException {

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/dbaa667b/odata2-lib/odata-core/src/test/resources/batchLarge.batch
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/resources/batchLarge.batch b/odata2-lib/odata-core/src/test/resources/batchLarge.batch
index 3be0982..6d0fc6e 100644
--- a/odata2-lib/odata-core/src/test/resources/batchLarge.batch
+++ b/odata2-lib/odata-core/src/test/resources/batchLarge.batch
@@ -5,17 +5,13 @@ Content-Transfer-Encoding: binary
 GET Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
 Accept: application/atom+xml
 MaxDataServiceVersion: 2.0
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
 DataServiceVersion: 2.0
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept-Encoding: gzip,deflate
 Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
 
-
 --batch_8194-cf13-1f56
 Content-Type: application/http
 Content-Transfer-Encoding: binary
@@ -23,17 +19,13 @@ Content-Transfer-Encoding: binary
 GET Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
 Accept: application/atom+xml
 MaxDataServiceVersion: 2.0
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
 DataServiceVersion: 2.0
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept-Encoding: gzip,deflate
 Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
 
-
 --batch_8194-cf13-1f56
 Content-Type: application/http
 Content-Transfer-Encoding: binary
@@ -41,17 +33,13 @@ Content-Transfer-Encoding: binary
 GET Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
 Accept: application/atom+xml
 MaxDataServiceVersion: 2.0
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
 DataServiceVersion: 2.0
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept-Encoding: gzip,deflate
 Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
 
-
 --batch_8194-cf13-1f56
 Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd
 
@@ -63,11 +51,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -283,11 +266,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -503,11 +481,7 @@ Content-ID: 1
 PUT Employees('1') HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
+
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -553,11 +527,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -773,11 +742,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -993,11 +957,6 @@ Content-ID: 1
 PUT Employees('1') HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -1043,11 +1002,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -1263,11 +1217,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -1483,11 +1432,6 @@ Content-ID: 1
 PUT Employees('1') HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -1533,11 +1477,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -1753,11 +1692,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -1973,11 +1907,6 @@ Content-ID: 1
 PUT Employees('1') HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -2023,11 +1952,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -2243,11 +2167,6 @@ Content-ID: 1
 POST Employees HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate
@@ -2463,11 +2382,6 @@ Content-ID: 1
 PUT Employees('1') HTTP/1.1
 Host: http://localhost/odata
 Connection: keep-alive
-Content-Length: 1117
-Authorization: Basic YW56ZWlnZXI6ZGlzcGxheQ==
-Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
-X-CSRF-Token: P6no0PBwygp1ie0Gz-YbEg==
-User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
 Content-Type: application/atom+xml
 Accept: */*
 Accept-Encoding: gzip,deflate


[6/9] git commit: line ending issue again

Posted by ch...@apache.org.
line ending issue again


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

Branch: refs/heads/olingo436BatchRefactoring
Commit: b155bda551bc6f8980684d2b2b44e29accb4c524
Parents: f0dc0f7
Author: Christian Amend <ch...@apache.org>
Authored: Thu Oct 9 16:40:52 2014 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Thu Oct 9 16:40:52 2014 +0200

----------------------------------------------------------------------
 odata2-jpa-processor/jpa-core/.gitignore        |   14 +-
 .../processor/core/access/data/JPAEntity.java   |  896 +++++++-------
 .../jpa/processor/core/access/data/JPAPage.java |  422 +++----
 .../core/callback/JPATombstoneCallBack.java     |  120 +-
 .../jpa/processor/core/model/JPAEdmFacets.java  |  188 +--
 .../processor/core/ODataEntityParserTest.java   |  488 ++++----
 .../JPAEntityParserForStaticMethodTest.java     |  660 +++++------
 .../core/access/data/JPAEntityTest.java         |  492 ++++----
 .../processor/core/access/data/JPALinkTest.java |   46 +-
 .../access/data/JPAPageBuilderDeltaTest.java    |  714 +++++------
 .../core/access/data/JPAPageBuilderTest.java    | 1120 +++++++++---------
 .../processor/core/mock/ODataContextMock.java   |  124 +-
 .../core/mock/ODataJPAServiceFactoryMock.java   |   94 +-
 .../processor/core/mock/ODataServiceMock.java   |  212 ++--
 .../core/mock/OnJPAWriteContentMock.java        |  116 +-
 .../jpa/processor/core/mock/PathInfoMock.java   |  102 +-
 .../processor/core/mock/PathSegmentMock.java    |   88 +-
 .../processor/core/mock/data/EdmMockUtilV2.java |  806 ++++++-------
 .../processor/core/mock/data/JPATypeMock.java   |  536 ++++-----
 .../core/mock/data/ODataEntryMockUtil.java      |  328 ++---
 .../core/mock/model/JPAPluralAttributeMock.java |  188 +--
 odata2-jpa-processor/jpa-ref/.gitignore         |   14 +-
 .../ref/converter/BlobToByteConverter.java      |  140 +--
 .../ref/factory/JPAEntityManagerFactory.java    |   92 +-
 .../SalesOrderItemTombstoneListener.java        |  186 +--
 .../listeners/SalesOrderTombstoneListener.java  |  114 +-
 .../odata2/jpa/processor/ref/model/Address.java |  188 +--
 .../jpa/processor/ref/model/Category.java       |  160 +--
 .../jpa/processor/ref/model/Customer.java       |  186 +--
 .../jpa/processor/ref/model/Material.java       |  272 ++---
 .../odata2/jpa/processor/ref/model/Note.java    |  242 ++--
 .../odata2/jpa/processor/ref/model/NoteKey.java |  166 +--
 .../jpa/processor/ref/model/SalesOrderItem.java |  270 ++---
 .../processor/ref/model/SalesOrderItemKey.java  |  178 +--
 .../odata2/jpa/processor/ref/model/Store.java   |  182 +--
 .../src/main/resources/META-INF/persistence.xml |   88 +-
 odata2-jpa-processor/jpa-web/.gitignore         |   14 +-
 .../ref/extension/OnDBWriteContent.java         |  110 +-
 .../jpa/processor/ref/extension/OrderValue.java |   84 +-
 .../jpa/processor/ref/util/DataGenerator.java   |  316 ++---
 40 files changed, 5378 insertions(+), 5378 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/.gitignore
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/.gitignore b/odata2-jpa-processor/jpa-core/.gitignore
index fe5d89b..a7ffe90 100644
--- a/odata2-jpa-processor/jpa-core/.gitignore
+++ b/odata2-jpa-processor/jpa-core/.gitignore
@@ -1,8 +1,8 @@
-.project
-.classpath
-.settings
-target
-bin
-*.bak
-classes
+.project
+.classpath
+.settings
+target
+bin
+*.bak
+classes
 .DS_Store
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/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 19ca88b..847e171 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
@@ -1,449 +1,449 @@
-/*******************************************************************************
- * 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;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-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.EdmNavigationProperty;
-import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmSimpleType;
-import org.apache.olingo.odata2.api.edm.EdmStructuralType;
-import org.apache.olingo.odata2.api.edm.EdmTypeKind;
-import org.apache.olingo.odata2.api.edm.EdmTyped;
-import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
-import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
-import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
-import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
-import org.apache.olingo.odata2.jpa.processor.api.OnJPAWriteContent;
-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.model.JPAEdmMapping;
-
-public class JPAEntity {
-
-  private Object jpaEntity = null;
-  private JPAEntity parentJPAEntity = null;
-  private EdmEntityType oDataEntityType = null;
-  private EdmEntitySet oDataEntitySet = null;
-  private Class<?> jpaType = null;
-  private HashMap<String, Method> accessModifiersWrite = null;
-  private JPAEntityParser jpaEntityParser = null;
-  private ODataJPAContext oDataJPAContext;
-  private OnJPAWriteContent onJPAWriteContent = null;
-  public HashMap<String, List<Object>> relatedJPAEntityMap = null;
-
-  public JPAEntity(final EdmEntityType oDataEntityType, final EdmEntitySet oDataEntitySet,
-      final ODataJPAContext context) {
-    this.oDataEntityType = oDataEntityType;
-    this.oDataEntitySet = oDataEntitySet;
-    oDataJPAContext = context;
-    try {
-      JPAEdmMapping mapping = (JPAEdmMapping) oDataEntityType.getMapping();
-      jpaType = mapping.getJPAType();
-    } catch (EdmException e) {
-      return;
-    }
-    jpaEntityParser = new JPAEntityParser();
-    onJPAWriteContent = oDataJPAContext.getODataContext().getServiceFactory().getCallback(OnJPAWriteContent.class);
-  }
-
-  public void setAccessModifersWrite(final HashMap<String, Method> accessModifiersWrite) {
-    this.accessModifiersWrite = accessModifiersWrite;
-  }
-
-  public void setParentJPAEntity(final JPAEntity jpaEntity) {
-    parentJPAEntity = jpaEntity;
-  }
-
-  public JPAEntity getParentJPAEntity() {
-    return parentJPAEntity;
-  }
-
-  public Object getJPAEntity() {
-    return jpaEntity;
-  }
-
-  @SuppressWarnings("unchecked")
-  private void write(final Map<String, Object> oDataEntryProperties,
-      final boolean isCreate)
-      throws ODataJPARuntimeException {
-    try {
-
-      EdmStructuralType structuralType = null;
-      final List<String> keyNames = oDataEntityType.getKeyPropertyNames();
-
-      if (isCreate) {
-        jpaEntity = instantiateJPAEntity();
-      } else if (jpaEntity == null) {
-        throw ODataJPARuntimeException
-            .throwException(ODataJPARuntimeException.RESOURCE_NOT_FOUND, null);
-      }
-
-      if (accessModifiersWrite == null) {
-        accessModifiersWrite =
-            jpaEntityParser.getAccessModifiers(jpaEntity, oDataEntityType, JPAEntityParser.ACCESS_MODIFIER_SET);
-      }
-
-      if (oDataEntityType == null || oDataEntryProperties == null) {
-        throw ODataJPARuntimeException
-            .throwException(ODataJPARuntimeException.GENERAL, null);
-      }
-
-      final HashMap<String, String> embeddableKeys =
-          jpaEntityParser.getJPAEmbeddableKeyMap(jpaEntity.getClass().getName());
-      Set<String> propertyNames = null;
-      if (embeddableKeys != null) {
-        setEmbeddableKeyProperty(embeddableKeys, oDataEntityType.getKeyProperties(), oDataEntryProperties,
-            jpaEntity);
-
-        propertyNames = new HashSet<String>();
-        propertyNames.addAll(oDataEntryProperties.keySet());
-        for (String key : embeddableKeys.keySet()) {
-          propertyNames.remove(key);
-        }
-      } else {
-        propertyNames = oDataEntryProperties.keySet();
-      }
-
-      for (String propertyName : propertyNames) {
-        EdmTyped edmTyped = (EdmTyped) oDataEntityType.getProperty(propertyName);
-
-        Method accessModifier = null;
-
-        switch (edmTyped.getType().getKind()) {
-        case SIMPLE:
-          if (isCreate == false) {
-            if (keyNames.contains(edmTyped.getName())) {
-              continue;
-            }
-          }
-          accessModifier = accessModifiersWrite.get(propertyName);
-          setProperty(accessModifier, jpaEntity, oDataEntryProperties.get(propertyName), (EdmSimpleType) edmTyped
-              .getType());
-
-          break;
-        case COMPLEX:
-          structuralType = (EdmStructuralType) edmTyped.getType();
-          accessModifier = accessModifiersWrite.get(propertyName);
-          setComplexProperty(accessModifier, jpaEntity,
-              structuralType,
-              (HashMap<String, Object>) oDataEntryProperties.get(propertyName));
-          break;
-        case NAVIGATION:
-        case ENTITY:
-          if (isCreate) {
-            structuralType = (EdmStructuralType) edmTyped.getType();
-            EdmNavigationProperty navProperty = (EdmNavigationProperty) edmTyped;
-            EdmEntitySet edmRelatedEntitySet = oDataEntitySet.getRelatedEntitySet(navProperty);
-            List<ODataEntry> relatedEntries = (List<ODataEntry>) oDataEntryProperties.get(propertyName);
-            if (relatedJPAEntityMap == null) {
-              relatedJPAEntityMap = new HashMap<String, List<Object>>();
-            }
-            List<Object> relatedJPAEntities = new ArrayList<Object>();
-            JPAEntity relatedEntity =
-                new JPAEntity((EdmEntityType) structuralType, edmRelatedEntitySet, oDataJPAContext);
-            for (ODataEntry oDataEntry : relatedEntries) {
-              relatedEntity.setParentJPAEntity(this);
-              relatedEntity.create(oDataEntry);
-              relatedJPAEntities.add(relatedEntity.getJPAEntity());
-            }
-            relatedJPAEntityMap.put(navProperty.getName(), relatedJPAEntities);
-          }
-        default:
-          continue;
-        }
-      }
-    } catch (Exception e) {
-      if (e instanceof ODataJPARuntimeException) {
-        throw (ODataJPARuntimeException) e;
-      }
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
-    }
-  }
-
-  public void create(final ODataEntry oDataEntry) throws ODataJPARuntimeException {
-    if (oDataEntry == null) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL, null);
-    }
-    Map<String, Object> oDataEntryProperties = oDataEntry.getProperties();
-    if (oDataEntry.containsInlineEntry()) {
-      normalizeInlineEntries(oDataEntryProperties);
-    }
-    write(oDataEntryProperties, true);
-
-    EntryMetadata entryMetadata = oDataEntry.getMetadata();
-    List<String> leftNavPrpNames = new ArrayList<String>();
-    try {
-      for (String navigationPropertyName : oDataEntityType.getNavigationPropertyNames()) {
-        List<String> links = entryMetadata.getAssociationUris(navigationPropertyName);
-        if (links.isEmpty()) {
-          continue;
-        } else {
-          EdmNavigationProperty navProperty =
-              (EdmNavigationProperty) oDataEntityType.getProperty(navigationPropertyName);
-          if (relatedJPAEntityMap != null && relatedJPAEntityMap.containsKey(navigationPropertyName)) {
-            JPALink.linkJPAEntities(relatedJPAEntityMap.get(navigationPropertyName), jpaEntity,
-                navProperty);
-          } else if (parentJPAEntity != null
-              &&
-              parentJPAEntity.getEdmEntitySet().getName().equals(
-                  oDataEntitySet.getRelatedEntitySet(navProperty).getName())) {
-            List<Object> targetJPAEntities = new ArrayList<Object>();
-            targetJPAEntities.add(parentJPAEntity.getJPAEntity());
-            JPALink.linkJPAEntities(targetJPAEntities, jpaEntity, navProperty);
-          } else {
-            leftNavPrpNames.add(navigationPropertyName);
-          }
-        }
-      }
-      if (!leftNavPrpNames.isEmpty()) {
-        JPALink link = new JPALink(oDataJPAContext);
-        link.setSourceJPAEntity(jpaEntity);
-        link.create(oDataEntitySet, oDataEntry, leftNavPrpNames);
-      }
-    } catch (EdmException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
-    } catch (ODataJPAModelException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
-    }
-  }
-
-  public EdmEntitySet getEdmEntitySet() {
-    return oDataEntitySet;
-  }
-
-  public void create(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
-    normalizeInlineEntries(oDataEntryProperties);
-    write(oDataEntryProperties, true);
-  }
-
-  public void update(final ODataEntry oDataEntry) throws ODataJPARuntimeException {
-    if (oDataEntry == null) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL, null);
-    }
-    Map<String, Object> oDataEntryProperties = oDataEntry.getProperties();
-    if (oDataEntry.containsInlineEntry()) {
-      normalizeInlineEntries(oDataEntryProperties);
-    }
-    write(oDataEntryProperties, false);
-    JPALink link = new JPALink(oDataJPAContext);
-    link.setSourceJPAEntity(jpaEntity);
-    try {
-      link.create(oDataEntitySet, oDataEntry, oDataEntityType.getNavigationPropertyNames());
-    } catch (EdmException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
-    } catch (ODataJPAModelException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
-    }
-  }
-
-  public void update(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
-    normalizeInlineEntries(oDataEntryProperties);
-    write(oDataEntryProperties, false);
-  }
-
-  public void setJPAEntity(final Object jpaEntity) {
-    this.jpaEntity = jpaEntity;
-  }
-
-  @SuppressWarnings("unchecked")
-  protected void setComplexProperty(Method accessModifier, final Object jpaEntity,
-      final EdmStructuralType edmComplexType, final HashMap<String, Object> propertyValue)
-      throws EdmException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
-      InstantiationException, ODataJPARuntimeException, NoSuchMethodException, SecurityException, SQLException {
-
-    JPAEdmMapping mapping = (JPAEdmMapping) edmComplexType.getMapping();
-    Object embeddableObject = mapping.getJPAType().newInstance();
-    accessModifier.invoke(jpaEntity, embeddableObject);
-
-    HashMap<String, Method> accessModifiers =
-        jpaEntityParser.getAccessModifiers(embeddableObject, edmComplexType, JPAEntityParser.ACCESS_MODIFIER_SET);
-
-    for (String edmPropertyName : edmComplexType.getPropertyNames()) {
-      EdmTyped edmTyped = (EdmTyped) edmComplexType.getProperty(edmPropertyName);
-      accessModifier = accessModifiers.get(edmPropertyName);
-      if (edmTyped.getType().getKind().toString().equals(EdmTypeKind.COMPLEX.toString())) {
-        EdmStructuralType structualType = (EdmStructuralType) edmTyped.getType();
-        setComplexProperty(accessModifier, embeddableObject, structualType, (HashMap<String, Object>) propertyValue
-            .get(edmPropertyName));
-      } else {
-        setProperty(accessModifier, embeddableObject, propertyValue.get(edmPropertyName), (EdmSimpleType) edmTyped
-            .getType());
-      }
-    }
-  }
-
-  protected void setProperty(final Method method, final Object entity, final Object entityPropertyValue,
-      final EdmSimpleType type) throws
-      IllegalAccessException, IllegalArgumentException, InvocationTargetException, ODataJPARuntimeException {
-    if (entityPropertyValue != null) {
-      Class<?> parameterType = method.getParameterTypes()[0];
-      if (type != null && type.getDefaultType().equals(String.class)) {
-        if (parameterType.equals(String.class)) {
-          method.invoke(entity, entityPropertyValue);
-        } else if (parameterType.equals(char[].class)) {
-          char[] characters = ((String) entityPropertyValue).toCharArray();
-          method.invoke(entity, characters);
-        } else if (parameterType.equals(char.class)) {
-          char c = ((String) entityPropertyValue).charAt(0);
-          method.invoke(entity, c);
-        } else if (parameterType.equals(Character[].class)) {
-          Character[] characters = JPAEntityParser.toCharacterArray((String) entityPropertyValue);
-          method.invoke(entity, (Object) characters);
-        } else if (parameterType.equals(Character.class)) {
-          Character c = Character.valueOf(((String) entityPropertyValue).charAt(0));
-          method.invoke(entity, c);
-        }
-      } else if (parameterType.equals(Blob.class)) {
-        if (onJPAWriteContent == null) {
-          throw ODataJPARuntimeException
-              .throwException(ODataJPARuntimeException.ERROR_JPA_BLOB_NULL, null);
-        } else {
-          method.invoke(entity, onJPAWriteContent.getJPABlob((byte[]) entityPropertyValue));
-        }
-      } else if (parameterType.equals(Clob.class)) {
-        if (onJPAWriteContent == null) {
-          throw ODataJPARuntimeException
-              .throwException(ODataJPARuntimeException.ERROR_JPA_CLOB_NULL, null);
-        } else {
-          method.invoke(entity, onJPAWriteContent.getJPAClob(((String) entityPropertyValue).toCharArray()));
-        }
-      } else if (parameterType.equals(Timestamp.class)) {
-        Timestamp ts = new Timestamp(((Calendar) entityPropertyValue).getTimeInMillis());
-        method.invoke(entity, ts);
-      } else if (parameterType.equals(java.util.Date.class)) {
-        method.invoke(entity, ((Calendar) entityPropertyValue).getTime());
-      } else if (parameterType.equals(java.sql.Date.class)) {
-        long timeInMs = ((Calendar) entityPropertyValue).getTimeInMillis();
-        method.invoke(entity, new java.sql.Date(timeInMs));
-      } else if (parameterType.equals(java.sql.Time.class)) {
-        long timeInMs = ((Calendar) entityPropertyValue).getTimeInMillis();
-        method.invoke(entity, new java.sql.Time(timeInMs));
-      } else {
-        method.invoke(entity, entityPropertyValue);
-      }
-    }
-  }
-
-  protected void setEmbeddableKeyProperty(final HashMap<String, String> embeddableKeys,
-      final List<EdmProperty> oDataEntryKeyProperties,
-      final Map<String, Object> oDataEntryProperties, final Object entity)
-      throws ODataJPARuntimeException, EdmException, IllegalAccessException, IllegalArgumentException,
-      InvocationTargetException, InstantiationException {
-
-    HashMap<String, Object> embeddableObjMap = new HashMap<String, Object>();
-    List<EdmProperty> leftODataEntryKeyProperties = new ArrayList<EdmProperty>();
-    HashMap<String, String> leftEmbeddableKeys = new HashMap<String, String>();
-
-    for (EdmProperty edmProperty : oDataEntryKeyProperties) {
-      if (oDataEntryProperties.containsKey(edmProperty.getName()) == false) {
-        continue;
-      }
-
-      String edmPropertyName = edmProperty.getName();
-      String embeddableKeyNameComposite = embeddableKeys.get(edmPropertyName);
-      if (embeddableKeyNameComposite == null) {
-        continue;
-      }
-      String embeddableKeyNameSplit[] = embeddableKeyNameComposite.split("\\.");
-      String methodPartName = null;
-      Method method = null;
-      Object embeddableObj = null;
-
-      if (embeddableObjMap.containsKey(embeddableKeyNameSplit[0]) == false) {
-        methodPartName = embeddableKeyNameSplit[0];
-        method = jpaEntityParser.getAccessModifierSet(entity, methodPartName);
-        embeddableObj = method.getParameterTypes()[0].newInstance();
-        method.invoke(entity, embeddableObj);
-        embeddableObjMap.put(embeddableKeyNameSplit[0], embeddableObj);
-      } else {
-        embeddableObj = embeddableObjMap.get(embeddableKeyNameSplit[0]);
-      }
-
-      if (embeddableKeyNameSplit.length == 2) {
-        methodPartName = embeddableKeyNameSplit[1];
-        method = jpaEntityParser.getAccessModifierSet(embeddableObj, methodPartName);
-        Object simpleObj = oDataEntryProperties.get(edmProperty.getName());
-        method.invoke(embeddableObj, simpleObj);
-      } else if (embeddableKeyNameSplit.length > 2) { // Deeply nested
-        leftODataEntryKeyProperties.add(edmProperty);
-        leftEmbeddableKeys
-            .put(edmPropertyName, embeddableKeyNameComposite.split(embeddableKeyNameSplit[0] + ".", 2)[1]);
-      }
-    }
-  }
-
-  protected Object instantiateJPAEntity() throws InstantiationException, IllegalAccessException {
-    if (jpaType == null) {
-      throw new InstantiationException();
-    }
-
-    return jpaType.newInstance();
-  }
-
-  private void normalizeInlineEntries(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
-    List<ODataEntry> entries = null;
-    try {
-      for (String navigationPropertyName : oDataEntityType.getNavigationPropertyNames()) {
-        Object inline = oDataEntryProperties.get(navigationPropertyName);
-        if (inline instanceof ODataFeed) {
-          entries = ((ODataFeed) inline).getEntries();
-        } else if (inline instanceof ODataEntry) {
-          entries = new ArrayList<ODataEntry>();
-          entries.add((ODataEntry) inline);
-        }
-        if (entries != null) {
-          oDataEntryProperties.put(navigationPropertyName, entries);
-          entries = null;
-        }
-      }
-    } catch (EdmException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
-    }
-  }
+/*******************************************************************************
+ * 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;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+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.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.EdmSimpleType;
+import org.apache.olingo.odata2.api.edm.EdmStructuralType;
+import org.apache.olingo.odata2.api.edm.EdmTypeKind;
+import org.apache.olingo.odata2.api.edm.EdmTyped;
+import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
+import org.apache.olingo.odata2.jpa.processor.api.OnJPAWriteContent;
+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.model.JPAEdmMapping;
+
+public class JPAEntity {
+
+  private Object jpaEntity = null;
+  private JPAEntity parentJPAEntity = null;
+  private EdmEntityType oDataEntityType = null;
+  private EdmEntitySet oDataEntitySet = null;
+  private Class<?> jpaType = null;
+  private HashMap<String, Method> accessModifiersWrite = null;
+  private JPAEntityParser jpaEntityParser = null;
+  private ODataJPAContext oDataJPAContext;
+  private OnJPAWriteContent onJPAWriteContent = null;
+  public HashMap<String, List<Object>> relatedJPAEntityMap = null;
+
+  public JPAEntity(final EdmEntityType oDataEntityType, final EdmEntitySet oDataEntitySet,
+      final ODataJPAContext context) {
+    this.oDataEntityType = oDataEntityType;
+    this.oDataEntitySet = oDataEntitySet;
+    oDataJPAContext = context;
+    try {
+      JPAEdmMapping mapping = (JPAEdmMapping) oDataEntityType.getMapping();
+      jpaType = mapping.getJPAType();
+    } catch (EdmException e) {
+      return;
+    }
+    jpaEntityParser = new JPAEntityParser();
+    onJPAWriteContent = oDataJPAContext.getODataContext().getServiceFactory().getCallback(OnJPAWriteContent.class);
+  }
+
+  public void setAccessModifersWrite(final HashMap<String, Method> accessModifiersWrite) {
+    this.accessModifiersWrite = accessModifiersWrite;
+  }
+
+  public void setParentJPAEntity(final JPAEntity jpaEntity) {
+    parentJPAEntity = jpaEntity;
+  }
+
+  public JPAEntity getParentJPAEntity() {
+    return parentJPAEntity;
+  }
+
+  public Object getJPAEntity() {
+    return jpaEntity;
+  }
+
+  @SuppressWarnings("unchecked")
+  private void write(final Map<String, Object> oDataEntryProperties,
+      final boolean isCreate)
+      throws ODataJPARuntimeException {
+    try {
+
+      EdmStructuralType structuralType = null;
+      final List<String> keyNames = oDataEntityType.getKeyPropertyNames();
+
+      if (isCreate) {
+        jpaEntity = instantiateJPAEntity();
+      } else if (jpaEntity == null) {
+        throw ODataJPARuntimeException
+            .throwException(ODataJPARuntimeException.RESOURCE_NOT_FOUND, null);
+      }
+
+      if (accessModifiersWrite == null) {
+        accessModifiersWrite =
+            jpaEntityParser.getAccessModifiers(jpaEntity, oDataEntityType, JPAEntityParser.ACCESS_MODIFIER_SET);
+      }
+
+      if (oDataEntityType == null || oDataEntryProperties == null) {
+        throw ODataJPARuntimeException
+            .throwException(ODataJPARuntimeException.GENERAL, null);
+      }
+
+      final HashMap<String, String> embeddableKeys =
+          jpaEntityParser.getJPAEmbeddableKeyMap(jpaEntity.getClass().getName());
+      Set<String> propertyNames = null;
+      if (embeddableKeys != null) {
+        setEmbeddableKeyProperty(embeddableKeys, oDataEntityType.getKeyProperties(), oDataEntryProperties,
+            jpaEntity);
+
+        propertyNames = new HashSet<String>();
+        propertyNames.addAll(oDataEntryProperties.keySet());
+        for (String key : embeddableKeys.keySet()) {
+          propertyNames.remove(key);
+        }
+      } else {
+        propertyNames = oDataEntryProperties.keySet();
+      }
+
+      for (String propertyName : propertyNames) {
+        EdmTyped edmTyped = (EdmTyped) oDataEntityType.getProperty(propertyName);
+
+        Method accessModifier = null;
+
+        switch (edmTyped.getType().getKind()) {
+        case SIMPLE:
+          if (isCreate == false) {
+            if (keyNames.contains(edmTyped.getName())) {
+              continue;
+            }
+          }
+          accessModifier = accessModifiersWrite.get(propertyName);
+          setProperty(accessModifier, jpaEntity, oDataEntryProperties.get(propertyName), (EdmSimpleType) edmTyped
+              .getType());
+
+          break;
+        case COMPLEX:
+          structuralType = (EdmStructuralType) edmTyped.getType();
+          accessModifier = accessModifiersWrite.get(propertyName);
+          setComplexProperty(accessModifier, jpaEntity,
+              structuralType,
+              (HashMap<String, Object>) oDataEntryProperties.get(propertyName));
+          break;
+        case NAVIGATION:
+        case ENTITY:
+          if (isCreate) {
+            structuralType = (EdmStructuralType) edmTyped.getType();
+            EdmNavigationProperty navProperty = (EdmNavigationProperty) edmTyped;
+            EdmEntitySet edmRelatedEntitySet = oDataEntitySet.getRelatedEntitySet(navProperty);
+            List<ODataEntry> relatedEntries = (List<ODataEntry>) oDataEntryProperties.get(propertyName);
+            if (relatedJPAEntityMap == null) {
+              relatedJPAEntityMap = new HashMap<String, List<Object>>();
+            }
+            List<Object> relatedJPAEntities = new ArrayList<Object>();
+            JPAEntity relatedEntity =
+                new JPAEntity((EdmEntityType) structuralType, edmRelatedEntitySet, oDataJPAContext);
+            for (ODataEntry oDataEntry : relatedEntries) {
+              relatedEntity.setParentJPAEntity(this);
+              relatedEntity.create(oDataEntry);
+              relatedJPAEntities.add(relatedEntity.getJPAEntity());
+            }
+            relatedJPAEntityMap.put(navProperty.getName(), relatedJPAEntities);
+          }
+        default:
+          continue;
+        }
+      }
+    } catch (Exception e) {
+      if (e instanceof ODataJPARuntimeException) {
+        throw (ODataJPARuntimeException) e;
+      }
+      throw ODataJPARuntimeException
+          .throwException(ODataJPARuntimeException.GENERAL
+              .addContent(e.getMessage()), e);
+    }
+  }
+
+  public void create(final ODataEntry oDataEntry) throws ODataJPARuntimeException {
+    if (oDataEntry == null) {
+      throw ODataJPARuntimeException
+          .throwException(ODataJPARuntimeException.GENERAL, null);
+    }
+    Map<String, Object> oDataEntryProperties = oDataEntry.getProperties();
+    if (oDataEntry.containsInlineEntry()) {
+      normalizeInlineEntries(oDataEntryProperties);
+    }
+    write(oDataEntryProperties, true);
+
+    EntryMetadata entryMetadata = oDataEntry.getMetadata();
+    List<String> leftNavPrpNames = new ArrayList<String>();
+    try {
+      for (String navigationPropertyName : oDataEntityType.getNavigationPropertyNames()) {
+        List<String> links = entryMetadata.getAssociationUris(navigationPropertyName);
+        if (links.isEmpty()) {
+          continue;
+        } else {
+          EdmNavigationProperty navProperty =
+              (EdmNavigationProperty) oDataEntityType.getProperty(navigationPropertyName);
+          if (relatedJPAEntityMap != null && relatedJPAEntityMap.containsKey(navigationPropertyName)) {
+            JPALink.linkJPAEntities(relatedJPAEntityMap.get(navigationPropertyName), jpaEntity,
+                navProperty);
+          } else if (parentJPAEntity != null
+              &&
+              parentJPAEntity.getEdmEntitySet().getName().equals(
+                  oDataEntitySet.getRelatedEntitySet(navProperty).getName())) {
+            List<Object> targetJPAEntities = new ArrayList<Object>();
+            targetJPAEntities.add(parentJPAEntity.getJPAEntity());
+            JPALink.linkJPAEntities(targetJPAEntities, jpaEntity, navProperty);
+          } else {
+            leftNavPrpNames.add(navigationPropertyName);
+          }
+        }
+      }
+      if (!leftNavPrpNames.isEmpty()) {
+        JPALink link = new JPALink(oDataJPAContext);
+        link.setSourceJPAEntity(jpaEntity);
+        link.create(oDataEntitySet, oDataEntry, leftNavPrpNames);
+      }
+    } catch (EdmException e) {
+      throw ODataJPARuntimeException
+          .throwException(ODataJPARuntimeException.GENERAL
+              .addContent(e.getMessage()), e);
+    } catch (ODataJPAModelException e) {
+      throw ODataJPARuntimeException
+          .throwException(ODataJPARuntimeException.GENERAL
+              .addContent(e.getMessage()), e);
+    }
+  }
+
+  public EdmEntitySet getEdmEntitySet() {
+    return oDataEntitySet;
+  }
+
+  public void create(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
+    normalizeInlineEntries(oDataEntryProperties);
+    write(oDataEntryProperties, true);
+  }
+
+  public void update(final ODataEntry oDataEntry) throws ODataJPARuntimeException {
+    if (oDataEntry == null) {
+      throw ODataJPARuntimeException
+          .throwException(ODataJPARuntimeException.GENERAL, null);
+    }
+    Map<String, Object> oDataEntryProperties = oDataEntry.getProperties();
+    if (oDataEntry.containsInlineEntry()) {
+      normalizeInlineEntries(oDataEntryProperties);
+    }
+    write(oDataEntryProperties, false);
+    JPALink link = new JPALink(oDataJPAContext);
+    link.setSourceJPAEntity(jpaEntity);
+    try {
+      link.create(oDataEntitySet, oDataEntry, oDataEntityType.getNavigationPropertyNames());
+    } catch (EdmException e) {
+      throw ODataJPARuntimeException
+          .throwException(ODataJPARuntimeException.GENERAL
+              .addContent(e.getMessage()), e);
+    } catch (ODataJPAModelException e) {
+      throw ODataJPARuntimeException
+          .throwException(ODataJPARuntimeException.GENERAL
+              .addContent(e.getMessage()), e);
+    }
+  }
+
+  public void update(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
+    normalizeInlineEntries(oDataEntryProperties);
+    write(oDataEntryProperties, false);
+  }
+
+  public void setJPAEntity(final Object jpaEntity) {
+    this.jpaEntity = jpaEntity;
+  }
+
+  @SuppressWarnings("unchecked")
+  protected void setComplexProperty(Method accessModifier, final Object jpaEntity,
+      final EdmStructuralType edmComplexType, final HashMap<String, Object> propertyValue)
+      throws EdmException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
+      InstantiationException, ODataJPARuntimeException, NoSuchMethodException, SecurityException, SQLException {
+
+    JPAEdmMapping mapping = (JPAEdmMapping) edmComplexType.getMapping();
+    Object embeddableObject = mapping.getJPAType().newInstance();
+    accessModifier.invoke(jpaEntity, embeddableObject);
+
+    HashMap<String, Method> accessModifiers =
+        jpaEntityParser.getAccessModifiers(embeddableObject, edmComplexType, JPAEntityParser.ACCESS_MODIFIER_SET);
+
+    for (String edmPropertyName : edmComplexType.getPropertyNames()) {
+      EdmTyped edmTyped = (EdmTyped) edmComplexType.getProperty(edmPropertyName);
+      accessModifier = accessModifiers.get(edmPropertyName);
+      if (edmTyped.getType().getKind().toString().equals(EdmTypeKind.COMPLEX.toString())) {
+        EdmStructuralType structualType = (EdmStructuralType) edmTyped.getType();
+        setComplexProperty(accessModifier, embeddableObject, structualType, (HashMap<String, Object>) propertyValue
+            .get(edmPropertyName));
+      } else {
+        setProperty(accessModifier, embeddableObject, propertyValue.get(edmPropertyName), (EdmSimpleType) edmTyped
+            .getType());
+      }
+    }
+  }
+
+  protected void setProperty(final Method method, final Object entity, final Object entityPropertyValue,
+      final EdmSimpleType type) throws
+      IllegalAccessException, IllegalArgumentException, InvocationTargetException, ODataJPARuntimeException {
+    if (entityPropertyValue != null) {
+      Class<?> parameterType = method.getParameterTypes()[0];
+      if (type != null && type.getDefaultType().equals(String.class)) {
+        if (parameterType.equals(String.class)) {
+          method.invoke(entity, entityPropertyValue);
+        } else if (parameterType.equals(char[].class)) {
+          char[] characters = ((String) entityPropertyValue).toCharArray();
+          method.invoke(entity, characters);
+        } else if (parameterType.equals(char.class)) {
+          char c = ((String) entityPropertyValue).charAt(0);
+          method.invoke(entity, c);
+        } else if (parameterType.equals(Character[].class)) {
+          Character[] characters = JPAEntityParser.toCharacterArray((String) entityPropertyValue);
+          method.invoke(entity, (Object) characters);
+        } else if (parameterType.equals(Character.class)) {
+          Character c = Character.valueOf(((String) entityPropertyValue).charAt(0));
+          method.invoke(entity, c);
+        }
+      } else if (parameterType.equals(Blob.class)) {
+        if (onJPAWriteContent == null) {
+          throw ODataJPARuntimeException
+              .throwException(ODataJPARuntimeException.ERROR_JPA_BLOB_NULL, null);
+        } else {
+          method.invoke(entity, onJPAWriteContent.getJPABlob((byte[]) entityPropertyValue));
+        }
+      } else if (parameterType.equals(Clob.class)) {
+        if (onJPAWriteContent == null) {
+          throw ODataJPARuntimeException
+              .throwException(ODataJPARuntimeException.ERROR_JPA_CLOB_NULL, null);
+        } else {
+          method.invoke(entity, onJPAWriteContent.getJPAClob(((String) entityPropertyValue).toCharArray()));
+        }
+      } else if (parameterType.equals(Timestamp.class)) {
+        Timestamp ts = new Timestamp(((Calendar) entityPropertyValue).getTimeInMillis());
+        method.invoke(entity, ts);
+      } else if (parameterType.equals(java.util.Date.class)) {
+        method.invoke(entity, ((Calendar) entityPropertyValue).getTime());
+      } else if (parameterType.equals(java.sql.Date.class)) {
+        long timeInMs = ((Calendar) entityPropertyValue).getTimeInMillis();
+        method.invoke(entity, new java.sql.Date(timeInMs));
+      } else if (parameterType.equals(java.sql.Time.class)) {
+        long timeInMs = ((Calendar) entityPropertyValue).getTimeInMillis();
+        method.invoke(entity, new java.sql.Time(timeInMs));
+      } else {
+        method.invoke(entity, entityPropertyValue);
+      }
+    }
+  }
+
+  protected void setEmbeddableKeyProperty(final HashMap<String, String> embeddableKeys,
+      final List<EdmProperty> oDataEntryKeyProperties,
+      final Map<String, Object> oDataEntryProperties, final Object entity)
+      throws ODataJPARuntimeException, EdmException, IllegalAccessException, IllegalArgumentException,
+      InvocationTargetException, InstantiationException {
+
+    HashMap<String, Object> embeddableObjMap = new HashMap<String, Object>();
+    List<EdmProperty> leftODataEntryKeyProperties = new ArrayList<EdmProperty>();
+    HashMap<String, String> leftEmbeddableKeys = new HashMap<String, String>();
+
+    for (EdmProperty edmProperty : oDataEntryKeyProperties) {
+      if (oDataEntryProperties.containsKey(edmProperty.getName()) == false) {
+        continue;
+      }
+
+      String edmPropertyName = edmProperty.getName();
+      String embeddableKeyNameComposite = embeddableKeys.get(edmPropertyName);
+      if (embeddableKeyNameComposite == null) {
+        continue;
+      }
+      String embeddableKeyNameSplit[] = embeddableKeyNameComposite.split("\\.");
+      String methodPartName = null;
+      Method method = null;
+      Object embeddableObj = null;
+
+      if (embeddableObjMap.containsKey(embeddableKeyNameSplit[0]) == false) {
+        methodPartName = embeddableKeyNameSplit[0];
+        method = jpaEntityParser.getAccessModifierSet(entity, methodPartName);
+        embeddableObj = method.getParameterTypes()[0].newInstance();
+        method.invoke(entity, embeddableObj);
+        embeddableObjMap.put(embeddableKeyNameSplit[0], embeddableObj);
+      } else {
+        embeddableObj = embeddableObjMap.get(embeddableKeyNameSplit[0]);
+      }
+
+      if (embeddableKeyNameSplit.length == 2) {
+        methodPartName = embeddableKeyNameSplit[1];
+        method = jpaEntityParser.getAccessModifierSet(embeddableObj, methodPartName);
+        Object simpleObj = oDataEntryProperties.get(edmProperty.getName());
+        method.invoke(embeddableObj, simpleObj);
+      } else if (embeddableKeyNameSplit.length > 2) { // Deeply nested
+        leftODataEntryKeyProperties.add(edmProperty);
+        leftEmbeddableKeys
+            .put(edmPropertyName, embeddableKeyNameComposite.split(embeddableKeyNameSplit[0] + ".", 2)[1]);
+      }
+    }
+  }
+
+  protected Object instantiateJPAEntity() throws InstantiationException, IllegalAccessException {
+    if (jpaType == null) {
+      throw new InstantiationException();
+    }
+
+    return jpaType.newInstance();
+  }
+
+  private void normalizeInlineEntries(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
+    List<ODataEntry> entries = null;
+    try {
+      for (String navigationPropertyName : oDataEntityType.getNavigationPropertyNames()) {
+        Object inline = oDataEntryProperties.get(navigationPropertyName);
+        if (inline instanceof ODataFeed) {
+          entries = ((ODataFeed) inline).getEntries();
+        } else if (inline instanceof ODataEntry) {
+          entries = new ArrayList<ODataEntry>();
+          entries.add((ODataEntry) inline);
+        }
+        if (entries != null) {
+          oDataEntryProperties.put(navigationPropertyName, entries);
+          entries = null;
+        }
+      }
+    } catch (EdmException e) {
+      throw ODataJPARuntimeException
+          .throwException(ODataJPARuntimeException.GENERAL
+              .addContent(e.getMessage()), e);
+    }
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPage.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPage.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPage.java
index 7aff111..07d7dd9 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPage.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAPage.java
@@ -1,211 +1,211 @@
-/*******************************************************************************
- * 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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.Query;
-
-import org.apache.olingo.odata2.jpa.processor.api.access.JPAPaging;
-
-public class JPAPage implements JPAPaging {
-
-  private int pageSize;
-  private int startPage;
-  private int nextPage;
-  private List<Object> pagedEntries;
-
-  protected JPAPage(final int startPage, final int nextPage, final List<Object> pagedEntities, final int pageSize) {
-    this.pageSize = pageSize;
-    this.startPage = startPage;
-    this.nextPage = nextPage;
-    pagedEntries = pagedEntities;
-  }
-
-  @Override
-  public int getPageSize() {
-    return pageSize;
-  }
-
-  @Override
-  public List<Object> getPagedEntities() {
-    return pagedEntries;
-  }
-
-  @Override
-  public int getNextPage() {
-    return nextPage;
-  }
-
-  @Override
-  public int getStartPage() {
-    return startPage;
-  }
-
-  public static class JPAPageBuilder {
-
-    private int pageSize;
-    private int startPage;
-    private int nextPage;
-    private int top = -1;
-    private int skip;
-    private int skipToken;
-    private Query query;
-    private List<Object> entities;
-    private List<Object> pagedEntities;
-
-    private static class TopSkip {
-      public int top;
-      public int skip;
-    }
-
-    public JPAPageBuilder() {}
-
-    public JPAPageBuilder pageSize(final int pageSize) {
-      this.pageSize = pageSize;
-      return this;
-    }
-
-    public JPAPageBuilder query(final Query query) {
-      this.query = query;
-      return this;
-    }
-
-    public JPAPage build() {
-      if (entities != null) {
-        return buildFromEntities();
-      } else {
-        return buildFromQuery();
-      }
-    }
-
-    private JPAPage buildFromEntities() {
-      TopSkip topSkip = formulateTopSkip();
-      pagedEntities = new ArrayList<Object>();
-      if (topSkip.skip <= 0) {
-        topSkip.skip = 1;
-      }
-      for (int i = topSkip.skip - 1, j = 0; (j < topSkip.top && i < entities.size()); j++) {
-        pagedEntities.add(entities.get(i++));
-      }
-      formulateNextPage();
-      return new JPAPage(startPage, nextPage, pagedEntities, pageSize);
-    }
-
-    @SuppressWarnings("unchecked")
-    private JPAPage buildFromQuery() {
-      TopSkip topSkip = formulateTopSkip();
-      query.setFirstResult(topSkip.skip);
-      query.setMaxResults(topSkip.top);
-      pagedEntities = query.getResultList();
-      formulateNextPage();
-      return new JPAPage(startPage, nextPage, pagedEntities, pageSize);
-    }
-
-    private TopSkip formulateTopSkip() {
-      TopSkip topSkip = new TopSkip();
-      int size = 0;
-      if (pageSize <= 0) {
-        if (skip > 0) {
-          topSkip.skip = skip;
-        }
-        if (top > 0) {
-          topSkip.top = top;
-        }
-      } else {
-        if (skip >= pageSize) { // No Records to fetch
-          startPage = skipToken;
-          nextPage = 0;
-        } else {
-          // Max Results
-          size = top + skip;
-          if (size > pageSize) {
-            if (skip == 0) {
-              topSkip.top = pageSize;
-            } else {
-              topSkip.top = pageSize - skip;
-            }
-          } else {
-            if (top > 0) {
-              topSkip.top = top;
-            } else {
-              topSkip.top = pageSize;
-            }
-          }
-
-          startPage = skipToken;
-          if (skip > 0) {
-            topSkip.skip = startPage + skip;
-          } else {
-            topSkip.skip = startPage;
-          }
-        }
-      }
-      return topSkip;
-    }
-
-    private void formulateNextPage() {
-      if (pagedEntities.size() == 0) {
-        nextPage = 0;
-      } else if (pagedEntities.size() < pageSize) {
-        nextPage = 0;
-      } else {
-        nextPage = startPage + pageSize;
-      }
-    }
-
-    public JPAPageBuilder skip(final int skip) {
-      this.skip = skip;
-      if (skip < 0) {
-        this.skip = 0;
-      } else {
-        this.skip = skip;
-      }
-      return this;
-    }
-
-    public JPAPageBuilder skipToken(final String skipToken) throws NumberFormatException {
-      if (skipToken == null) {
-        this.skipToken = 0;
-      } else {
-        this.skipToken = new Integer(skipToken).intValue();
-        if (this.skipToken < 0) {
-          this.skipToken = 0;
-        }
-      }
-
-      return this;
-    }
-
-    public JPAPageBuilder top(final int top) {
-      if (top < 0) {
-        this.top = 0;
-      } else {
-        this.top = top;
-      }
-      return this;
-    }
-
-    public JPAPageBuilder entities(final List<Object> result) {
-      entities = result;
-      return this;
-    }
-  }
-}
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Query;
+
+import org.apache.olingo.odata2.jpa.processor.api.access.JPAPaging;
+
+public class JPAPage implements JPAPaging {
+
+  private int pageSize;
+  private int startPage;
+  private int nextPage;
+  private List<Object> pagedEntries;
+
+  protected JPAPage(final int startPage, final int nextPage, final List<Object> pagedEntities, final int pageSize) {
+    this.pageSize = pageSize;
+    this.startPage = startPage;
+    this.nextPage = nextPage;
+    pagedEntries = pagedEntities;
+  }
+
+  @Override
+  public int getPageSize() {
+    return pageSize;
+  }
+
+  @Override
+  public List<Object> getPagedEntities() {
+    return pagedEntries;
+  }
+
+  @Override
+  public int getNextPage() {
+    return nextPage;
+  }
+
+  @Override
+  public int getStartPage() {
+    return startPage;
+  }
+
+  public static class JPAPageBuilder {
+
+    private int pageSize;
+    private int startPage;
+    private int nextPage;
+    private int top = -1;
+    private int skip;
+    private int skipToken;
+    private Query query;
+    private List<Object> entities;
+    private List<Object> pagedEntities;
+
+    private static class TopSkip {
+      public int top;
+      public int skip;
+    }
+
+    public JPAPageBuilder() {}
+
+    public JPAPageBuilder pageSize(final int pageSize) {
+      this.pageSize = pageSize;
+      return this;
+    }
+
+    public JPAPageBuilder query(final Query query) {
+      this.query = query;
+      return this;
+    }
+
+    public JPAPage build() {
+      if (entities != null) {
+        return buildFromEntities();
+      } else {
+        return buildFromQuery();
+      }
+    }
+
+    private JPAPage buildFromEntities() {
+      TopSkip topSkip = formulateTopSkip();
+      pagedEntities = new ArrayList<Object>();
+      if (topSkip.skip <= 0) {
+        topSkip.skip = 1;
+      }
+      for (int i = topSkip.skip - 1, j = 0; (j < topSkip.top && i < entities.size()); j++) {
+        pagedEntities.add(entities.get(i++));
+      }
+      formulateNextPage();
+      return new JPAPage(startPage, nextPage, pagedEntities, pageSize);
+    }
+
+    @SuppressWarnings("unchecked")
+    private JPAPage buildFromQuery() {
+      TopSkip topSkip = formulateTopSkip();
+      query.setFirstResult(topSkip.skip);
+      query.setMaxResults(topSkip.top);
+      pagedEntities = query.getResultList();
+      formulateNextPage();
+      return new JPAPage(startPage, nextPage, pagedEntities, pageSize);
+    }
+
+    private TopSkip formulateTopSkip() {
+      TopSkip topSkip = new TopSkip();
+      int size = 0;
+      if (pageSize <= 0) {
+        if (skip > 0) {
+          topSkip.skip = skip;
+        }
+        if (top > 0) {
+          topSkip.top = top;
+        }
+      } else {
+        if (skip >= pageSize) { // No Records to fetch
+          startPage = skipToken;
+          nextPage = 0;
+        } else {
+          // Max Results
+          size = top + skip;
+          if (size > pageSize) {
+            if (skip == 0) {
+              topSkip.top = pageSize;
+            } else {
+              topSkip.top = pageSize - skip;
+            }
+          } else {
+            if (top > 0) {
+              topSkip.top = top;
+            } else {
+              topSkip.top = pageSize;
+            }
+          }
+
+          startPage = skipToken;
+          if (skip > 0) {
+            topSkip.skip = startPage + skip;
+          } else {
+            topSkip.skip = startPage;
+          }
+        }
+      }
+      return topSkip;
+    }
+
+    private void formulateNextPage() {
+      if (pagedEntities.size() == 0) {
+        nextPage = 0;
+      } else if (pagedEntities.size() < pageSize) {
+        nextPage = 0;
+      } else {
+        nextPage = startPage + pageSize;
+      }
+    }
+
+    public JPAPageBuilder skip(final int skip) {
+      this.skip = skip;
+      if (skip < 0) {
+        this.skip = 0;
+      } else {
+        this.skip = skip;
+      }
+      return this;
+    }
+
+    public JPAPageBuilder skipToken(final String skipToken) throws NumberFormatException {
+      if (skipToken == null) {
+        this.skipToken = 0;
+      } else {
+        this.skipToken = new Integer(skipToken).intValue();
+        if (this.skipToken < 0) {
+          this.skipToken = 0;
+        }
+      }
+
+      return this;
+    }
+
+    public JPAPageBuilder top(final int top) {
+      if (top < 0) {
+        this.top = 0;
+      } else {
+        this.top = top;
+      }
+      return this;
+    }
+
+    public JPAPageBuilder entities(final List<Object> result) {
+      entities = result;
+      return this;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPATombstoneCallBack.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPATombstoneCallBack.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPATombstoneCallBack.java
index 6ae9b2b..a462696 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPATombstoneCallBack.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/callback/JPATombstoneCallBack.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.jpa.processor.core.callback;
-
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.ep.callback.TombstoneCallback;
-import org.apache.olingo.odata2.api.ep.callback.TombstoneCallbackResult;
-import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
-
-public class JPATombstoneCallBack implements TombstoneCallback {
-
-  private static final String DELTA_TOKEN_STRING = "?!deltatoken=";
-  private String baseUri;
-  private String deltaTokenValue;
-  private GetEntitySetUriInfo resultsView;
-
-  public JPATombstoneCallBack(final String baseUri, final GetEntitySetUriInfo resultsView,
-      final String deltaTokenValue) {
-    this.baseUri = baseUri;
-    this.deltaTokenValue = deltaTokenValue;
-    this.resultsView = resultsView;
-  }
-
-  @Override
-  public TombstoneCallbackResult getTombstoneCallbackResult() {
-    TombstoneCallbackResult jpaTombstoneCallBackResult = new TombstoneCallbackResult();
-
-    jpaTombstoneCallBackResult.setDeltaLink(buildToken());
-    return jpaTombstoneCallBackResult;
-  }
-
-  private String buildToken() {
-    StringBuilder tokenBuilder = new StringBuilder();
-    tokenBuilder.append(baseUri);
-    try {
-      tokenBuilder.append(resultsView.getTargetEntitySet().getName());
-    } catch (EdmException e) {
-      // Nothing
-    }
-    tokenBuilder.append(DELTA_TOKEN_STRING);
-    tokenBuilder.append(deltaTokenValue);
-    return tokenBuilder.toString();
-  }
-}
+/*******************************************************************************
+ * 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.callback;
+
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.ep.callback.TombstoneCallback;
+import org.apache.olingo.odata2.api.ep.callback.TombstoneCallbackResult;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+
+public class JPATombstoneCallBack implements TombstoneCallback {
+
+  private static final String DELTA_TOKEN_STRING = "?!deltatoken=";
+  private String baseUri;
+  private String deltaTokenValue;
+  private GetEntitySetUriInfo resultsView;
+
+  public JPATombstoneCallBack(final String baseUri, final GetEntitySetUriInfo resultsView,
+      final String deltaTokenValue) {
+    this.baseUri = baseUri;
+    this.deltaTokenValue = deltaTokenValue;
+    this.resultsView = resultsView;
+  }
+
+  @Override
+  public TombstoneCallbackResult getTombstoneCallbackResult() {
+    TombstoneCallbackResult jpaTombstoneCallBackResult = new TombstoneCallbackResult();
+
+    jpaTombstoneCallBackResult.setDeltaLink(buildToken());
+    return jpaTombstoneCallBackResult;
+  }
+
+  private String buildToken() {
+    StringBuilder tokenBuilder = new StringBuilder();
+    tokenBuilder.append(baseUri);
+    try {
+      tokenBuilder.append(resultsView.getTargetEntitySet().getName());
+    } catch (EdmException e) {
+      // Nothing
+    }
+    tokenBuilder.append(DELTA_TOKEN_STRING);
+    tokenBuilder.append(deltaTokenValue);
+    return tokenBuilder.toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/b155bda5/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java
index 916b49c..51cd37b 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * 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.model;
-
-import java.lang.reflect.AnnotatedElement;
-
-import javax.persistence.Column;
-import javax.persistence.metamodel.Attribute;
-
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.provider.Facets;
-import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
-
-public class JPAEdmFacets {
-  public static void setFacets(final Attribute<?, ?> jpaAttribute, final SimpleProperty edmProperty) {
-    EdmSimpleTypeKind edmTypeKind = edmProperty.getType();
-    Facets facets = new Facets();
-    edmProperty.setFacets(facets);
-
-    Column column = null;
-    if (jpaAttribute.getJavaMember() instanceof AnnotatedElement) {
-      column = ((AnnotatedElement) jpaAttribute
-          .getJavaMember()).getAnnotation(Column.class);
-    }
-
-    if (column == null) {
-      return;
-    }
-
-    setNullable(column, edmProperty);
-
-    switch (edmTypeKind) {
-    case Binary:
-      setMaxLength(column, edmProperty);
-      break;
-    case DateTime:
-      setPrecision(column, edmProperty);
-      break;
-    case DateTimeOffset:
-      setPrecision(column, edmProperty);
-      break;
-    case Time:
-      setPrecision(column, edmProperty);
-      break;
-    case Decimal:
-      setPrecision(column, edmProperty);
-      setScale(column, edmProperty);
-      break;
-    case String:
-      setMaxLength(column, edmProperty);
-      break;
-    default:
-      break;
-    }
-  }
-
-  private static void setNullable(final Column column, final SimpleProperty edmProperty) {
-    ((Facets) edmProperty.getFacets()).setNullable(column.nullable());
-  }
-
-  private static void setMaxLength(final Column column, final SimpleProperty edmProperty) {
-    if (column.length() > 0) {
-      ((Facets) edmProperty.getFacets()).setMaxLength(column.length());
-    }
-  }
-
-  private static void setPrecision(final Column column, final SimpleProperty edmProperty) {
-    if (column.precision() > 0) {
-      ((Facets) edmProperty.getFacets()).setPrecision(column.precision());
-    }
-  }
-
-  private static void setScale(final Column column, final SimpleProperty edmProperty) {
-    if (column.scale() > 0) {
-      ((Facets) edmProperty.getFacets()).setScale(column.scale());
-    }
-  }
-}
+/*******************************************************************************
+ * 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.model;
+
+import java.lang.reflect.AnnotatedElement;
+
+import javax.persistence.Column;
+import javax.persistence.metamodel.Attribute;
+
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+import org.apache.olingo.odata2.api.edm.provider.Facets;
+import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
+
+public class JPAEdmFacets {
+  public static void setFacets(final Attribute<?, ?> jpaAttribute, final SimpleProperty edmProperty) {
+    EdmSimpleTypeKind edmTypeKind = edmProperty.getType();
+    Facets facets = new Facets();
+    edmProperty.setFacets(facets);
+
+    Column column = null;
+    if (jpaAttribute.getJavaMember() instanceof AnnotatedElement) {
+      column = ((AnnotatedElement) jpaAttribute
+          .getJavaMember()).getAnnotation(Column.class);
+    }
+
+    if (column == null) {
+      return;
+    }
+
+    setNullable(column, edmProperty);
+
+    switch (edmTypeKind) {
+    case Binary:
+      setMaxLength(column, edmProperty);
+      break;
+    case DateTime:
+      setPrecision(column, edmProperty);
+      break;
+    case DateTimeOffset:
+      setPrecision(column, edmProperty);
+      break;
+    case Time:
+      setPrecision(column, edmProperty);
+      break;
+    case Decimal:
+      setPrecision(column, edmProperty);
+      setScale(column, edmProperty);
+      break;
+    case String:
+      setMaxLength(column, edmProperty);
+      break;
+    default:
+      break;
+    }
+  }
+
+  private static void setNullable(final Column column, final SimpleProperty edmProperty) {
+    ((Facets) edmProperty.getFacets()).setNullable(column.nullable());
+  }
+
+  private static void setMaxLength(final Column column, final SimpleProperty edmProperty) {
+    if (column.length() > 0) {
+      ((Facets) edmProperty.getFacets()).setMaxLength(column.length());
+    }
+  }
+
+  private static void setPrecision(final Column column, final SimpleProperty edmProperty) {
+    if (column.precision() > 0) {
+      ((Facets) edmProperty.getFacets()).setPrecision(column.precision());
+    }
+  }
+
+  private static void setScale(final Column column, final SimpleProperty edmProperty) {
+    if (column.scale() > 0) {
+      ((Facets) edmProperty.getFacets()).setScale(column.scale());
+    }
+  }
+}


[9/9] git commit: Revert input stream splitting

Posted by ch...@apache.org.
Revert input stream splitting

Signed-off-by: Christian Amend <ch...@apache.org>


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

Branch: refs/heads/olingo436BatchRefactoring
Commit: 8dfd515e89e1ddf0ec91f347264bb4be9144c6d3
Parents: dbaa667
Author: Christian Holzer <c....@sap.com>
Authored: Thu Oct 9 16:31:23 2014 +0200
Committer: Christian Amend <ch...@apache.org>
Committed: Thu Oct 9 16:45:27 2014 +0200

----------------------------------------------------------------------
 .../odata2/core/batch/v2/BatchParser.java       | 14 ++++-
 .../odata2/core/batch/v2/BatchParserCommon.java | 56 --------------------
 2 files changed, 13 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/8dfd515e/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
index bf4ce93..09bf987 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParser.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.core.batch.v2;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -80,7 +81,7 @@ public class BatchParser {
     final String baseUri = getBaseUri();
     final String boundary = BatchParserCommon.getBoundary(contentTypeMime, 1);
     final List<BatchParserResult> resultList = new LinkedList<BatchParserResult>();
-    final List<List<Line>> bodyPartStrings = BatchParserCommon.splitRequestByBoundary(in, boundary);
+    final List<List<Line>> bodyPartStrings = splitBodyParts(in, boundary);
 
     for (List<Line> bodyPartString : bodyPartStrings) {
       BatchBodyPart bodyPart = new BatchBodyPart(bodyPartString, boundary, isStrict).parse();
@@ -89,6 +90,17 @@ public class BatchParser {
 
     return resultList;
   }
+  
+  private List<List<Line>> splitBodyParts(final InputStream in, final String boundary)
+      throws IOException, BatchException {
+
+    final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
+    final List<Line> message = reader.toList();
+    reader.close();
+
+    return BatchParserCommon.splitMessageByBoundary(message, boundary);
+  }
+
 
   private String getBaseUri() throws BatchException {
     String baseUri = "";

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/8dfd515e/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
index 5c6cd69..cac340e 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
@@ -19,9 +19,7 @@
 package org.apache.olingo.odata2.core.batch.v2;
 
 import java.io.ByteArrayInputStream;
-import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
@@ -93,60 +91,6 @@ public class BatchParserCommon {
     return new ByteArrayInputStream(message.getBytes());
   }
 
-  static List<List<Line>> splitRequestByBoundary(final InputStream in, final String boundary)
-      throws BatchException, IOException {
-    final List<List<Line>> messageParts = new LinkedList<List<Line>>();
-    List<Line> currentPart = new ArrayList<Line>();
-    boolean isEndReached = false;
-
-    final String quotedBoundary = Pattern.quote(boundary);
-    final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary + "--[\\s ]*");
-    final Pattern boundaryPattern = Pattern.compile("--" + quotedBoundary + "[\\s ]*");
-
-    final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
-    String currentLine;
-    int lineNumber = 1;
-
-    while ((currentLine = reader.readLine()) != null) {
-      if (boundaryDelimiterPattern.matcher(currentLine.toString()).matches()) {
-        removeEndingCRLFFromList(currentPart);
-        messageParts.add(currentPart);
-        isEndReached = true;
-      } else if (boundaryPattern.matcher(currentLine.toString()).matches()) {
-        removeEndingCRLFFromList(currentPart);
-        messageParts.add(currentPart);
-        currentPart = new LinkedList<Line>();
-      } else {
-        currentPart.add(new Line(currentLine, lineNumber));
-      }
-
-      if (isEndReached) {
-        break;
-      }
-
-      lineNumber++;
-    }
-    reader.close();
-
-    // Remove preamble
-    if (messageParts.size() > 0) {
-      messageParts.remove(0);
-    } else {
-
-      throw new BatchException(BatchException.MISSING_BOUNDARY_DELIMITER.addContent(1));
-    }
-
-    if (!isEndReached) {
-      throw new BatchException(BatchException.MISSING_CLOSE_DELIMITER.addContent(1));
-    }
-
-    if (messageParts.size() == 0) {
-      throw new BatchException(BatchException.NO_MATCH_WITH_BOUNDARY_STRING.addContent(boundary).addContent(0));
-    }
-
-    return messageParts;
-  }
-
   static List<List<Line>> splitMessageByBoundary(final List<Line> message, final String boundary)
       throws BatchException {
     final List<List<Line>> messageParts = new LinkedList<List<Line>>();