You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/12/28 15:18:09 UTC

[11/31] [OLINGO-99] Re-factor Package Names. Following are the changes

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
new file mode 100644
index 0000000..7a14f6c
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * 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.jpql;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.HashMap;
+import java.util.List;
+
+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.uri.SelectItem;
+import org.apache.olingo.odata2.api.uri.expression.FilterExpression;
+import org.apache.olingo.odata2.api.uri.expression.OrderByExpression;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
+import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext;
+import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectStatementBuilder;
+import org.easymock.EasyMock;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JPQLSelectStatementBuilderTest {
+
+  /**
+   * @throws java.lang.Exception
+   */
+  private JPQLSelectStatementBuilder jpqlSelectStatementBuilder;
+
+  @Before
+  public void setUp() throws Exception {
+
+  }
+
+  private JPQLSelectContext createSelectContext(final OrderByExpression orderByExpression,
+      final FilterExpression filterExpression) throws ODataJPARuntimeException, EdmException {
+    // Object Instantiation
+
+    JPQLSelectContext jpqlSelectContextImpl = null;
+    GetEntitySetUriInfo getEntitySetView = EasyMock.createMock(GetEntitySetUriInfo.class);
+
+    EdmEntitySet edmEntitySet = EasyMock.createMock(EdmEntitySet.class);
+    EdmEntityType edmEntityType = EasyMock.createMock(EdmEntityType.class);
+    List<SelectItem> selectItemList = null;
+
+    // Setting up the expected value
+
+    EasyMock.expect(getEntitySetView.getTargetEntitySet()).andStubReturn(edmEntitySet);
+    EasyMock.expect(getEntitySetView.getOrderBy()).andStubReturn(orderByExpression);
+    EasyMock.expect(getEntitySetView.getSelect()).andStubReturn(selectItemList);
+    EasyMock.expect(getEntitySetView.getFilter()).andStubReturn(filterExpression);
+    EasyMock.replay(getEntitySetView);
+    EasyMock.expect(edmEntitySet.getEntityType()).andStubReturn(edmEntityType);
+    EasyMock.replay(edmEntitySet);
+    EasyMock.expect(edmEntityType.getMapping()).andStubReturn(null);
+    EasyMock.expect(edmEntityType.getName()).andStubReturn("SalesOrderHeader");
+    EasyMock.replay(edmEntityType);
+
+    JPQLContextBuilder contextBuilder1 = JPQLContext.createBuilder(JPQLContextType.SELECT, getEntitySetView);
+    try {
+      jpqlSelectContextImpl = (JPQLSelectContext) contextBuilder1.build();
+    } catch (ODataJPAModelException e) {
+      fail("Model Exception thrown");
+    }
+
+    return jpqlSelectContextImpl;
+  }
+
+  /**
+   * Test method for {@link org.apache.olingo.odata2.processor.jpa.jpql.JPQLSelectStatementBuilder#build)}.
+   * @throws EdmException
+   * @throws ODataJPARuntimeException
+   */
+
+  @Test
+  public void testBuildSimpleQuery() throws EdmException, ODataJPARuntimeException {
+    OrderByExpression orderByExpression = EasyMock.createMock(OrderByExpression.class);
+    JPQLSelectContext jpqlSelectContextImpl = createSelectContext(orderByExpression, null);
+    jpqlSelectStatementBuilder = new JPQLSelectStatementBuilder(jpqlSelectContextImpl);
+
+    assertEquals("SELECT E1 FROM SalesOrderHeader E1", jpqlSelectStatementBuilder.build().toString());
+  }
+
+  @Test
+  public void testBuildQueryWithOrderBy() throws EdmException, ODataJPARuntimeException {
+    OrderByExpression orderByExpression = EasyMock.createMock(OrderByExpression.class);
+
+    JPQLSelectContext jpqlSelectContextImpl = createSelectContext(orderByExpression, null);
+    HashMap<String, String> orderByCollection = new HashMap<String, String>();
+    orderByCollection.put("E1.soID", "ASC");
+    orderByCollection.put("E1.buyerId", "DESC");
+    jpqlSelectContextImpl.setOrderByCollection(orderByCollection);
+    jpqlSelectStatementBuilder = new JPQLSelectStatementBuilder(jpqlSelectContextImpl);
+
+    assertEquals("SELECT E1 FROM SalesOrderHeader E1 ORDER BY E1.soID ASC , E1.buyerId DESC",
+        jpqlSelectStatementBuilder.build().toString());
+  }
+
+  @Test
+  public void testBuildQueryWithFilter() throws EdmException, ODataJPARuntimeException {
+    OrderByExpression orderByExpression = EasyMock.createMock(OrderByExpression.class);
+    FilterExpression filterExpression = null;// getFilterExpressionMockedObj();
+    JPQLSelectContext jpqlSelectContextImpl = createSelectContext(orderByExpression, filterExpression);
+    jpqlSelectContextImpl.setWhereExpression("E1.soID >= 1234");
+
+    jpqlSelectStatementBuilder = new JPQLSelectStatementBuilder(jpqlSelectContextImpl);
+
+    assertEquals("SELECT E1 FROM SalesOrderHeader E1 WHERE E1.soID >= 1234", jpqlSelectStatementBuilder.build()
+        .toString());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
new file mode 100644
index 0000000..83ae7c0
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
@@ -0,0 +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.core.mock;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.metamodel.Metamodel;
+
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
+import org.easymock.EasyMock;
+
+public abstract class ODataJPAContextMock {
+
+  public static final String NAMESPACE = "salesorderprocessing";
+  public static final String MAPPING_MODEL = "SalesOrderProcessingMappingModel";
+  public static final String PERSISTENCE_UNIT_NAME = "salesorderprocessing";
+
+  public static ODataJPAContext mockODataJPAContext() {
+    ODataJPAContext odataJPAContext = EasyMock.createMock(ODataJPAContext.class);
+    EasyMock.expect(odataJPAContext.getPersistenceUnitName()).andStubReturn(NAMESPACE);
+    EasyMock.expect(odataJPAContext.getEntityManagerFactory()).andReturn(mockEntityManagerFactory());
+    EasyMock.expect(odataJPAContext.getJPAEdmMappingModel()).andReturn(MAPPING_MODEL);
+    EasyMock.expect(odataJPAContext.getJPAEdmExtension()).andReturn(null);
+    EasyMock.expect(odataJPAContext.getDefaultNaming()).andReturn(true);
+    EasyMock.replay(odataJPAContext);
+    return odataJPAContext;
+  }
+
+  private static EntityManagerFactory mockEntityManagerFactory() {
+    EntityManagerFactory emf = EasyMock.createMock(EntityManagerFactory.class);
+    EasyMock.expect(emf.getMetamodel()).andReturn(mockMetaModel());
+    EasyMock.replay(emf);
+    return emf;
+  }
+
+  private static Metamodel mockMetaModel() {
+    Metamodel metaModel = EasyMock.createMock(Metamodel.class);
+    EasyMock.replay(metaModel);
+    return metaModel;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtil.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtil.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtil.java
new file mode 100644
index 0000000..e525ffd
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtil.java
@@ -0,0 +1,337 @@
+/*******************************************************************************
+ * 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 static org.junit.Assert.fail;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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.EdmType;
+import org.apache.olingo.odata2.api.edm.EdmTypeKind;
+import org.apache.olingo.odata2.api.edm.EdmTyped;
+import org.apache.olingo.odata2.api.ep.callback.WriteEntryCallbackContext;
+import org.apache.olingo.odata2.api.ep.callback.WriteFeedCallbackContext;
+import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
+import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.easymock.EasyMock;
+
+public class EdmMockUtil {
+
+  public static ExpandSelectTreeNode mockExpandSelectTreeNode() {
+    ExpandSelectTreeNode nextExpandNode = EasyMock.createMock(ExpandSelectTreeNode.class);
+    Map<String, ExpandSelectTreeNode> nextLink = null;
+    EasyMock.expect(nextExpandNode.getLinks()).andStubReturn(nextLink);
+    EasyMock.replay(nextExpandNode);
+    ExpandSelectTreeNode expandNode = EasyMock.createMock(ExpandSelectTreeNode.class);
+    Map<String, ExpandSelectTreeNode> links = new HashMap<String, ExpandSelectTreeNode>();
+    links.put("SalesOrderLineItemDetails", nextExpandNode);
+    EasyMock.expect(expandNode.getLinks()).andStubReturn(links);
+    EasyMock.replay(expandNode);
+    return expandNode;
+  }
+
+  public static ExpandSelectTreeNode mockCurrentExpandSelectTreeNode() {
+    ExpandSelectTreeNode expandNode = EasyMock.createMock(ExpandSelectTreeNode.class);
+    Map<String, ExpandSelectTreeNode> links = new HashMap<String, ExpandSelectTreeNode>();
+    EasyMock.expect(expandNode.getLinks()).andStubReturn(links);
+    EasyMock.replay(expandNode);
+    return expandNode;
+  }
+
+  public static List<ArrayList<NavigationPropertySegment>> getExpandList() {
+    List<ArrayList<NavigationPropertySegment>> expandList = new ArrayList<ArrayList<NavigationPropertySegment>>();
+    ArrayList<NavigationPropertySegment> expands = new ArrayList<NavigationPropertySegment>();
+    expands.add(mockNavigationPropertySegment());
+    expandList.add(expands);
+    return expandList;
+  }
+
+  public static WriteFeedCallbackContext getWriteFeedCallBackContext() {
+    URI selfLink = null;
+    WriteFeedCallbackContext writeContext = new WriteFeedCallbackContext();
+    try {
+      selfLink = new URI("SalesOrders(2L)/SalesOrderLineItemDetails");
+      writeContext.setSelfLink(selfLink);
+      writeContext.setCurrentExpandSelectTreeNode(mockCurrentExpandSelectTreeNode());
+      writeContext.setNavigationProperty(mockNavigationProperty());
+      writeContext.setSourceEntitySet(mockSourceEntitySet());
+      writeContext.setEntryData(getFeedData());
+
+    } catch (URISyntaxException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+    return writeContext;
+  }
+
+  public static WriteEntryCallbackContext getWriteEntryCallBackContext() {
+    WriteEntryCallbackContext writeContext = new WriteEntryCallbackContext();
+    writeContext.setCurrentExpandSelectTreeNode(mockCurrentExpandSelectTreeNode());
+    writeContext.setNavigationProperty(mockNavigationProperty());
+    writeContext.setSourceEntitySet(mockSourceEntitySet());
+    writeContext.setEntryData(getEntryData());
+    return writeContext;
+  }
+
+  private static EdmEntitySet mockSourceEntitySet() {
+    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
+    try {
+      EasyMock.expect(entitySet.getEntityType()).andStubReturn(mockSourceEdmEntityType());
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(entitySet);
+    return entitySet;
+  }
+
+  public static EdmEntityType mockSourceEdmEntityType() {
+    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
+    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
+    List<String> navigationPropertyNames = new ArrayList<String>();
+    List<String> propertyNames = new ArrayList<String>();
+    propertyNames.add("id");
+    propertyNames.add("description");
+    navigationPropertyNames.add("SalesOrderLineItemDetails");
+    try {
+      EasyMock.expect(mapping.getInternalName()).andStubReturn("SalesOrderHeader");
+      EasyMock.replay(mapping);
+      EasyMock.expect(entityType.getName()).andStubReturn("SalesOrderHeader");
+      EasyMock.expect(entityType.getMapping()).andStubReturn(mapping);
+      EasyMock.expect(entityType.getNavigationPropertyNames()).andStubReturn(navigationPropertyNames);
+      EasyMock.expect(entityType.getProperty("SalesOrderLineItemDetails")).andStubReturn(mockNavigationProperty());
+      EdmProperty property1 = mockEdmPropertyOfSource1();
+      EasyMock.expect(entityType.getProperty("id")).andStubReturn(property1);
+      EasyMock.expect(entityType.getProperty("description")).andStubReturn(mockEdmPropertyOfSource2());
+      EasyMock.expect(entityType.getPropertyNames()).andStubReturn(propertyNames);
+
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(entityType);
+    return entityType;
+  }
+
+  private static EdmTyped mockEdmPropertyOfSource2() {
+    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
+    EdmType type = EasyMock.createMock(EdmType.class);
+    EasyMock.expect(type.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+    EasyMock.replay(type);
+    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
+    EasyMock.expect(mapping.getInternalName()).andStubReturn("description");
+    EasyMock.replay(mapping);
+    try {
+      EasyMock.expect(edmProperty.getName()).andStubReturn("description");
+      EasyMock.expect(edmProperty.getType()).andStubReturn(type);
+      EasyMock.expect(edmProperty.getMapping()).andStubReturn(mapping);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(edmProperty);
+    return edmProperty;
+  }
+
+  private static EdmProperty mockEdmPropertyOfSource1() {
+    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
+    EdmType type = EasyMock.createMock(EdmType.class);
+    EasyMock.expect(type.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+    EasyMock.replay(type);
+    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
+    EasyMock.expect(mapping.getInternalName()).andStubReturn("id");
+    EasyMock.replay(mapping);
+    try {
+      EasyMock.expect(edmProperty.getName()).andStubReturn("id");
+      EasyMock.expect(edmProperty.getType()).andStubReturn(type);
+      EasyMock.expect(edmProperty.getMapping()).andStubReturn(mapping);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(edmProperty);
+    return edmProperty;
+  }
+
+  private static Map<String, Object> getFeedData() {
+    Map<String, Object> entryData = new HashMap<String, Object>();
+    entryData.put("id", 1);
+    entryData.put("description", "laptop");
+    List<SalesOrderLineItem> salesOrderLineItems = new ArrayList<SalesOrderLineItem>();
+    salesOrderLineItems.add(new SalesOrderLineItem(23));
+    salesOrderLineItems.add(new SalesOrderLineItem(45));
+    entryData.put("SalesOrderLineItemDetails", salesOrderLineItems);
+    return entryData;
+  }
+
+  private static Map<String, Object> getEntryData() {
+    Map<String, Object> entryData = new HashMap<String, Object>();
+    entryData.put("id", 1);
+    entryData.put("description", "laptop");
+    entryData.put("SalesOrderLineItemDetails", new SalesOrderLineItem(23));
+    return entryData;
+  }
+
+  private static NavigationPropertySegment mockNavigationPropertySegment() {
+    NavigationPropertySegment navigationPropSegment = EasyMock.createMock(NavigationPropertySegment.class);
+    EasyMock.expect(navigationPropSegment.getNavigationProperty()).andStubReturn(mockNavigationProperty());
+    EasyMock.expect(navigationPropSegment.getTargetEntitySet()).andStubReturn(mockTargetEntitySet());
+    EasyMock.replay(navigationPropSegment);
+    return navigationPropSegment;
+  }
+
+  public static NavigationPropertySegment mockThirdNavigationPropertySegment() {
+    NavigationPropertySegment navigationPropSegment = EasyMock.createMock(NavigationPropertySegment.class);
+    EasyMock.expect(navigationPropSegment.getNavigationProperty()).andStubReturn(mockSecondNavigationProperty());
+    EasyMock.expect(navigationPropSegment.getTargetEntitySet()).andStubReturn(mockThirdEntitySet());
+    EasyMock.replay(navigationPropSegment);
+    return navigationPropSegment;
+  }
+
+  public static EdmNavigationProperty mockSecondNavigationProperty() {
+    EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
+    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
+    EasyMock.expect(mapping.getInternalName()).andStubReturn("materials");
+    EasyMock.replay(mapping);
+    try {
+      EasyMock.expect(navigationProperty.getMultiplicity()).andStubReturn(EdmMultiplicity.ONE);
+      EasyMock.expect(navigationProperty.getMapping()).andStubReturn(mapping);
+      EasyMock.expect(navigationProperty.getName()).andStubReturn("MaterialDetails");
+      EasyMock.expect(navigationProperty.getFromRole()).andStubReturn("SalesOrderLineItem");
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(navigationProperty);
+    return navigationProperty;
+  }
+
+  public static EdmEntitySet mockTargetEntitySet() {
+    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
+    try {
+      EasyMock.expect(entitySet.getEntityType()).andStubReturn(mockTargetEdmEntityType());
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(entitySet);
+    return entitySet;
+  }
+
+  public static EdmEntitySet mockThirdEntitySet() {
+    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
+    try {
+      EasyMock.expect(entitySet.getEntityType()).andStubReturn(mockThirdEdmEntityType());
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(entitySet);
+    return entitySet;
+
+  }
+
+  private static EdmEntityType mockThirdEdmEntityType() {
+    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
+    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
+
+    List<String> propertyNames = new ArrayList<String>();
+    propertyNames.add("price");
+    try {
+      EasyMock.expect(mapping.getInternalName()).andStubReturn("Material");
+      EasyMock.replay(mapping);
+      EasyMock.expect(entityType.getName()).andStubReturn("Material");
+      EasyMock.expect(entityType.getMapping()).andStubReturn(mapping);
+      EdmProperty property = mockEdmPropertyOfTarget();
+      EasyMock.expect(entityType.getProperty("price")).andStubReturn(property);
+      EasyMock.expect(entityType.getPropertyNames()).andStubReturn(propertyNames);
+
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(entityType);
+    return entityType;
+  }
+
+  public static EdmEntityType mockTargetEdmEntityType() {
+    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
+    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
+
+    List<String> propertyNames = new ArrayList<String>();
+    propertyNames.add("price");
+    try {
+      EasyMock.expect(mapping.getInternalName()).andStubReturn("SalesOrderLineItem");
+      EasyMock.replay(mapping);
+      EasyMock.expect(entityType.getName()).andStubReturn("SalesOrderLineItem");
+      EasyMock.expect(entityType.getMapping()).andStubReturn(mapping);
+      EdmProperty property = mockEdmPropertyOfTarget();
+      EasyMock.expect(entityType.getProperty("price")).andStubReturn(property);
+      EasyMock.expect(entityType.getPropertyNames()).andStubReturn(propertyNames);
+
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(entityType);
+    return entityType;
+  }
+
+  private static EdmProperty mockEdmPropertyOfTarget() {
+    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
+
+    EdmType type = EasyMock.createMock(EdmType.class);
+    EasyMock.expect(type.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+    EasyMock.replay(type);
+    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
+    EasyMock.expect(mapping.getInternalName()).andStubReturn("price");
+    EasyMock.replay(mapping);
+    try {
+      EasyMock.expect(edmProperty.getName()).andStubReturn("price");
+      EasyMock.expect(edmProperty.getType()).andStubReturn(type);
+      EasyMock.expect(edmProperty.getMapping()).andStubReturn(mapping);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(edmProperty);
+    return edmProperty;
+  }
+
+  public static EdmNavigationProperty mockNavigationProperty() {
+    EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
+    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
+    EasyMock.expect(mapping.getInternalName()).andStubReturn("salesOrderLineItems");
+    EasyMock.replay(mapping);
+    try {
+      EasyMock.expect(navigationProperty.getMultiplicity()).andStubReturn(EdmMultiplicity.MANY);
+      EasyMock.expect(navigationProperty.getMapping()).andStubReturn(mapping);
+      EasyMock.expect(navigationProperty.getName()).andStubReturn("SalesOrderLineItemDetails");
+      EasyMock.expect(navigationProperty.getFromRole()).andStubReturn("SalesOrderHeader");
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(navigationProperty);
+    return navigationProperty;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/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
new file mode 100644
index 0000000..2189219
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * 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.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.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.EdmType;
+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 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));
+    EasyMock.expect(entityType.getKind()).andReturn(EdmTypeKind.ENTITY);
+    EasyMock.expect(entityType.getMapping()).andReturn((EdmMapping) mockEdmMapping(entityName, null, null));
+    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_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<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);
+    } 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.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)) {
+
+      EdmType edmType = EasyMock.createMock(EdmType.class);
+      EasyMock.expect(edmProperty.getType()).andReturn(edmType).anyTimes();
+      EasyMock.expect(edmType.getKind()).andReturn(EdmTypeKind.SIMPLE).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_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/incubator-olingo-odata2/blob/63b621a8/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
new file mode 100644
index 0000000..9242df9
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/JPATypeMock.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * 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.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_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 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 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/incubator-olingo-odata2/blob/63b621a8/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
new file mode 100644
index 0000000..92912cc
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/ODataEntryMockUtil.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * 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.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 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 = { 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();
+
+    EasyMock.expect(oDataEntry.containsInlineEntry()).andReturn(false);
+    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();
+
+    EasyMock.expect(oDataEntry.containsInlineEntry()).andReturn(false);
+    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);
+
+      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)) {
+      EasyMock.expect(oDataEntry.containsInlineEntry()).andReturn(true);
+    } else {
+      EasyMock.expect(oDataEntry.containsInlineEntry()).andReturn(false);
+    }
+    EasyMock.replay(oDataEntry);
+    return oDataEntry;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderHeader.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderHeader.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderHeader.java
new file mode 100644
index 0000000..1236d96
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderHeader.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.List;
+
+public class SalesOrderHeader {
+
+  private int id;
+  private String description;
+
+  public SalesOrderHeader() {}
+
+  public SalesOrderHeader(final int id, final String description) {
+    super();
+    this.id = id;
+    this.description = description;
+  }
+
+  private List<SalesOrderLineItem> salesOrderLineItems = new ArrayList<SalesOrderLineItem>();
+
+  public String getDescription() {
+    return description;
+  }
+
+  public void setDescription(final String description) {
+    this.description = description;
+  }
+
+  public int getId() {
+    return id;
+  }
+
+  public void setId(final int id) {
+    this.id = id;
+  }
+
+  public List<SalesOrderLineItem> getSalesOrderLineItems() {
+    return salesOrderLineItems;
+  }
+
+  public void setSalesOrderLineItems(final List<SalesOrderLineItem> salesOrderLineItems) {
+    this.salesOrderLineItems = salesOrderLineItems;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderLineItem.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderLineItem.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderLineItem.java
new file mode 100644
index 0000000..be28f13
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderLineItem.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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;
+
+public class SalesOrderLineItem {
+
+  private int price;
+
+  public SalesOrderLineItem(final int price) {
+    super();
+    this.price = price;
+  }
+
+  public int getPrice() {
+    return price;
+  }
+
+  public void setPrice(final int price) {
+    this.price = price;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderLineItemKey.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderLineItemKey.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderLineItemKey.java
new file mode 100644
index 0000000..9f6048b
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/SalesOrderLineItemKey.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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;
+
+public class SalesOrderLineItemKey {
+
+  private int soId;
+  private int liId;
+
+  public SalesOrderLineItemKey() {
+
+  }
+
+  public SalesOrderLineItemKey(final int soId, final int liId) {
+    super();
+    this.soId = soId;
+    this.liId = liId;
+  }
+
+  public int getSoId() {
+    return soId;
+  }
+
+  public void setSoId(final int soId) {
+    this.soId = soId;
+  }
+
+  public int getLiId() {
+    return liId;
+  }
+
+  public void setLiId(final int liId) {
+    this.liId = liId;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/EdmSchemaMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/EdmSchemaMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/EdmSchemaMock.java
new file mode 100644
index 0000000..5b927f5
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/EdmSchemaMock.java
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * 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.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+import org.apache.olingo.odata2.api.edm.provider.Association;
+import org.apache.olingo.odata2.api.edm.provider.AssociationEnd;
+import org.apache.olingo.odata2.api.edm.provider.AssociationSet;
+import org.apache.olingo.odata2.api.edm.provider.AssociationSetEnd;
+import org.apache.olingo.odata2.api.edm.provider.ComplexType;
+import org.apache.olingo.odata2.api.edm.provider.EntityContainer;
+import org.apache.olingo.odata2.api.edm.provider.EntitySet;
+import org.apache.olingo.odata2.api.edm.provider.EntityType;
+import org.apache.olingo.odata2.api.edm.provider.FunctionImport;
+import org.apache.olingo.odata2.api.edm.provider.Key;
+import org.apache.olingo.odata2.api.edm.provider.Mapping;
+import org.apache.olingo.odata2.api.edm.provider.Property;
+import org.apache.olingo.odata2.api.edm.provider.PropertyRef;
+import org.apache.olingo.odata2.api.edm.provider.Schema;
+import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmMappingImpl;
+
+public class EdmSchemaMock {
+
+  private static final String ASSOCIATION_ROLE_NAME_ONE = "SalesOrderHeader";
+  private static final String ASSOCIATION_NAME = "SalesOrderHeader_SalesOrderItem";
+  private static final String ASSOCIATION_SET_NAME = "SalesOrderHeader_SalesOrderItemSet";
+  private static final String ASSOCIATION_ROLE_NAME_TWO = "SalesOrderItem";
+  private static final String NAMESPACE = "salesorderprocessing";
+  private static final String ENTITY_CONTAINER_NAME = "salesorderprocessingContainer";
+  private static final String ENTITY_NAME_ONE = "SalesOrderHeader";
+  private static final String ENTITY_NAME_TWO = "SalesOrderItem";
+  private static final String ENTITY_SET_NAME_ONE = "SalesOrderHeaders";
+  private static final String FUNCTION_IMPORT_NAME_ONE = "SalesOrder_FunctionImport1";
+  private static final String FUNCTION_IMPORT_NAME_TWO = "SalesOrder_FunctionImport2";
+  private static final String ENTITY_SET_NAME_TWO = "SalesOrderItems";
+  private static final String COMPLEX_TYPE_NAME_ONE = "Address";
+  private static final String COMPLEX_TYPE_NAME_TWO = "SalesOrderItemKey";
+
+  public static Schema createMockEdmSchema() {
+    Schema schema = new Schema();
+    schema.setNamespace(NAMESPACE);
+    schema.setComplexTypes(createComplexTypes());
+    schema.setEntityContainers(createEntityContainer());
+    schema.setEntityTypes(createEntityTypes());
+    schema.setAssociations(createAssociations());
+    return schema;
+  }
+
+  private static List<EntityContainer> createEntityContainer() {
+    List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
+    EntityContainer entityContainer = new EntityContainer();
+    entityContainer.setDefaultEntityContainer(true);
+    entityContainer.setName(ENTITY_CONTAINER_NAME);
+    entityContainer.setEntitySets(createEntitySets());
+    entityContainer.setAssociationSets(createAssociationSets());
+    entityContainer.setFunctionImports(createFunctionImports());
+    entityContainers.add(entityContainer);
+    return entityContainers;
+  }
+
+  private static List<AssociationSet> createAssociationSets() {
+    List<AssociationSet> associationSets = new ArrayList<AssociationSet>();
+    AssociationSet associationSet = new AssociationSet();
+    associationSet.setName(ASSOCIATION_SET_NAME);
+    associationSet.setAssociation(new FullQualifiedName(NAMESPACE, ASSOCIATION_NAME));
+    associationSet
+        .setEnd1(new AssociationSetEnd().setEntitySet(ENTITY_SET_NAME_ONE).setRole(ASSOCIATION_ROLE_NAME_ONE));
+    associationSet
+        .setEnd2(new AssociationSetEnd().setEntitySet(ENTITY_SET_NAME_TWO).setRole(ASSOCIATION_ROLE_NAME_TWO));
+    associationSets.add(associationSet);
+    return associationSets;
+  }
+
+  private static List<EntitySet> createEntitySets() {
+    List<EntitySet> entitySets = new ArrayList<EntitySet>();
+    EntitySet entitySet = new EntitySet();
+    entitySet.setName(ENTITY_SET_NAME_ONE);
+    entitySet.setEntityType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_ONE));
+    entitySets.add(entitySet);
+    entitySet = new EntitySet();
+    entitySet.setName(ENTITY_SET_NAME_TWO);
+    entitySet.setEntityType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_TWO));
+    entitySets.add(entitySet);
+    return entitySets;
+  }
+
+  private static List<FunctionImport> createFunctionImports() {
+    List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
+    FunctionImport functionImport = new FunctionImport();
+    functionImport.setName(FUNCTION_IMPORT_NAME_ONE);
+    functionImports.add(functionImport);
+    functionImport = new FunctionImport();
+    functionImport.setName(FUNCTION_IMPORT_NAME_TWO);
+    functionImports.add(functionImport);
+    return functionImports;
+  }
+
+  private static List<Association> createAssociations() {
+    List<Association> associations = new ArrayList<Association>();
+    Association association = new Association();
+    association.setName(ASSOCIATION_NAME);
+    association.setEnd1(new AssociationEnd().setMultiplicity(EdmMultiplicity.ONE).setRole(ASSOCIATION_ROLE_NAME_ONE)
+        .setType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_ONE)));
+    association.setEnd2(new AssociationEnd().setMultiplicity(EdmMultiplicity.MANY).setRole(ASSOCIATION_ROLE_NAME_TWO)
+        .setType(new FullQualifiedName(NAMESPACE, ENTITY_NAME_TWO)));
+    associations.add(association);
+    return associations;
+  }
+
+  private static List<EntityType> createEntityTypes() {
+    List<EntityType> entityTypes = new ArrayList<EntityType>();
+    EntityType entityType = new EntityType();
+    entityType.setName(ENTITY_NAME_ONE);
+    String[] keyNamesOne = { "SoId" };
+    entityType.setKey(createKey(keyNamesOne));
+    entityTypes.add(entityType);
+
+    entityType = new EntityType();
+    entityType.setName(ENTITY_NAME_TWO);
+    String[] keyNamesTwo = { "SoId", "LiId" };
+    entityType.setKey(createKey(keyNamesTwo));
+    entityTypes.add(entityType);
+    return entityTypes;
+
+  }
+
+  private static Key createKey(final String[] keyNames) {
+    Key key = new Key();
+    List<PropertyRef> keys = new ArrayList<PropertyRef>();
+    for (String keyName : keyNames) {
+      keys.add(new PropertyRef().setName(keyName));
+    }
+    key.setKeys(keys);
+    return null;
+  }
+
+  private static List<ComplexType> createComplexTypes() {
+    List<ComplexType> complexTypes = new ArrayList<ComplexType>();
+    ComplexType complexTypeOne = new ComplexType();
+    complexTypeOne.setName(COMPLEX_TYPE_NAME_ONE);
+    complexTypeOne.setProperties(createComplexTypePropertiesOne());
+    complexTypes.add(complexTypeOne);
+    ComplexType complexTypeTwo = new ComplexType();
+    complexTypeTwo.setName(COMPLEX_TYPE_NAME_TWO);
+    complexTypeTwo.setProperties(createComplexTypePropertiesTwo());
+    complexTypes.add(complexTypeTwo);
+    return complexTypes;
+  }
+
+  private static List<Property> createComplexTypePropertiesTwo() {
+    List<Property> properties = new ArrayList<Property>();
+    SimpleProperty property = new SimpleProperty();
+    property.setName("SoId");
+    property.setType(EdmSimpleTypeKind.Int64);
+    JPAEdmMapping mapping = new JPAEdmMappingImpl();
+    mapping.setJPAColumnName("Sales_Order_Id");
+    ((Mapping) mapping).setInternalName("SalesOrderItemKey.SoId");
+    property.setMapping((Mapping) mapping);
+    properties.add(property);
+    property = new SimpleProperty();
+    property.setName("LiId");
+    property.setType(EdmSimpleTypeKind.Int64);
+    mapping = new JPAEdmMappingImpl();
+    mapping.setJPAColumnName("Sales_Order_Item_Id");
+    property.setMapping((Mapping) mapping);
+    properties.add(property);
+    return properties;
+
+  }
+
+  private static List<Property> createComplexTypePropertiesOne() {
+    List<Property> properties = new ArrayList<Property>();
+    SimpleProperty property = new SimpleProperty();
+    property.setName("StreetName");
+    property.setType(EdmSimpleTypeKind.String);
+    JPAEdmMapping mapping = new JPAEdmMappingImpl();
+    mapping.setJPAColumnName("STREET_NAME");
+    property.setMapping((Mapping) mapping);
+    properties.add(property);
+    property = new SimpleProperty();
+    property.setName("City");
+    property.setType(EdmSimpleTypeKind.String);
+    mapping = new JPAEdmMappingImpl();
+    mapping.setJPAColumnName("CITY");
+    property.setMapping((Mapping) mapping);
+    properties.add(property);
+    return properties;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAAttributeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAAttributeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAAttributeMock.java
new file mode 100644
index 0000000..f21cbae
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAAttributeMock.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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 javax.persistence.metamodel.Attribute;
+import javax.persistence.metamodel.ManagedType;
+
+public abstract class JPAAttributeMock<X, Y> implements Attribute<X, Y> {
+
+  @Override
+  public ManagedType<X> getDeclaringType() {
+    return null;
+  }
+
+  @Override
+  public Member getJavaMember() {
+    return null;
+  }
+
+  @Override
+  public Class<Y> getJavaType() {
+    return null;
+  }
+
+  @Override
+  public String getName() {
+    return null;
+  }
+
+  @Override
+  public javax.persistence.metamodel.Attribute.PersistentAttributeType getPersistentAttributeType() {
+    return null;
+  }
+
+  @Override
+  public boolean isAssociation() {
+    return false;
+  }
+
+  @Override
+  public boolean isCollection() {
+    return false;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPACustomProcessorMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPACustomProcessorMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPACustomProcessorMock.java
new file mode 100644
index 0000000..6f7d16e
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPACustomProcessorMock.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmFacets;
+import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.ReturnType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.ReturnType.Type;
+import org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImportParameter;
+
+public class JPACustomProcessorMock {
+
+  public static final String className = "JPACustomProcessorMock";
+  public static final String edmName = "JPACustomProcessor";
+
+  @EdmFunctionImport(name = "Method1", entitySet = "MockSet", returnType = @ReturnType(type = Type.ENTITY,
+      isCollection = true))
+  public List<JPACustomProcessorMock> method1(@EdmFunctionImportParameter(name = "Param1", facets = @EdmFacets(
+      nullable = true,
+      maxLength = 2)) final String param1, final int param2, @EdmFunctionImportParameter(name = "Param3",
+      facets = @EdmFacets(precision = 10, scale = 2)) final double param3) {
+    return new ArrayList<JPACustomProcessorMock>();
+  }
+
+  @EdmFunctionImport(name = "Method2", entitySet = "MockSet", returnType = @ReturnType(type = Type.ENTITY,
+      isCollection = true))
+  public List<JPACustomProcessorMock> method2(
+      @EdmFunctionImportParameter(facets = @EdmFacets(maxLength = 2), name = "Param2") final String param2) {
+    return new ArrayList<JPACustomProcessorMock>();
+  }
+
+  @EdmFunctionImport(returnType = @ReturnType(type = Type.SIMPLE))
+  public int method3(@EdmFunctionImportParameter(name = "Param3") final String param3) {
+    return 0;
+  }
+
+  @EdmFunctionImport(returnType = @ReturnType(type = Type.ENTITY,
+      isCollection = false), entitySet = "MockSet")
+  public JPACustomProcessorMock method7() {
+    return null;
+  }
+
+  @EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX,
+      isCollection = false))
+  public JPACustomProcessorMock method9() {
+    return null;
+  }
+
+  @EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX,
+      isCollection = true))
+  public List<JPACustomProcessorMock> method10() {
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEdmMockData.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEdmMockData.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEdmMockData.java
new file mode 100644
index 0000000..9b692a4
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEdmMockData.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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 org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.EntityType.EntityTypeA;
+
+public interface JPAEdmMockData {
+  /*
+   * Edm Complex Type Mock Data
+   */
+  public interface ComplexType {
+
+    public interface ComplexTypeA {
+      public static final String name = "ComplexTypeA";
+      public static final Class<ComplexTypeA> clazz = ComplexTypeA.class;
+
+      public interface Property {
+        public static final String PROPERTY_A = "A";
+        public static final String PROPERTY_B = "B";
+        public static final String PROPERTY_C = "C";
+      }
+
+    }
+
+    public interface ComplexTypeB {
+      public static final String name = "ComplexTypeB";
+
+      public interface Property {
+        public static final String PROPERTY_D = "D";
+        public static final String PROPERTY_E = "E";
+      }
+
+    }
+  }
+
+  public interface EntityType {
+    public interface EntityTypeA {
+      public static final String name = "SalesOrderHeader";
+      public static final Class<EntityTypeA> entityClazz = EntityTypeA.class;
+
+      public interface Property {
+        public static final String PROPERTY_A = SimpleType.SimpleTypeA.NAME;
+
+      }
+
+    }
+  }
+
+  public interface SimpleType {
+    public interface SimpleTypeA {
+      public static final String NAME = "SOID";
+      public static final Class<String> clazz = String.class;
+      public static final Class<EntityTypeA> declaringClazz = EntityType.EntityTypeA.class;
+    }
+  }
+}