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/18 10:12:09 UTC

[11/37] [OLINGO-82] Renamed the project folder name to odata2-jpa-processor

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1b479e6c/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraint.java
----------------------------------------------------------------------
diff --git a/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraint.java b/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraint.java
deleted file mode 100644
index 2888a9a..0000000
--- a/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraint.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.processor.core.jpa.model;
-
-import org.apache.olingo.odata2.api.edm.provider.ReferentialConstraint;
-import org.apache.olingo.odata2.processor.api.jpa.access.JPAEdmBuilder;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmAssociationView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmEntityTypeView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmPropertyView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmReferentialConstraintRoleView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmReferentialConstraintRoleView.RoleType;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmReferentialConstraintView;
-
-public class JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements JPAEdmReferentialConstraintView {
-
-  private JPAEdmRefConstraintBuilder builder = null;
-
-  private boolean exists = false;
-  private boolean firstBuild = true;
-
-  private JPAEdmAssociationView associationView;
-  private JPAEdmPropertyView propertyView;
-  private JPAEdmEntityTypeView entityTypeView;
-
-  private ReferentialConstraint referentialConstraint;
-
-  private JPAEdmReferentialConstraintRoleView principalRoleView;
-  private JPAEdmReferentialConstraintRoleView dependentRoleView;
-
-  private String relationShipName;
-
-  public JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
-      final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView) {
-    super(associationView);
-    this.associationView = associationView;
-    this.propertyView = propertyView;
-    this.entityTypeView = entityTypeView;
-
-    relationShipName = associationView.getEdmAssociation().getName();
-  }
-
-  @Override
-  public JPAEdmBuilder getBuilder() {
-    if (builder == null) {
-      builder = new JPAEdmRefConstraintBuilder();
-    }
-
-    return builder;
-  }
-
-  @Override
-  public ReferentialConstraint getEdmReferentialConstraint() {
-    return referentialConstraint;
-  }
-
-  @Override
-  public boolean isExists() {
-    return exists;
-  }
-
-  @Override
-  public String getEdmRelationShipName() {
-    return relationShipName;
-  }
-
-  private class JPAEdmRefConstraintBuilder implements JPAEdmBuilder {
-    /*
-     * Check if Ref Constraint was already Built. If Ref constraint was
-     * already built consistently then do not build referential constraint.
-     * 
-     * For Ref Constraint to be consistently built Principal and Dependent
-     * roles must be consistently built. If Principal or Dependent roles are
-     * not consistently built then try building them again.
-     * 
-     * The Principal and Dependent roles could be have been built
-     * inconsistently if the required EDM Entity Types or EDM properties are
-     * yet to be built. In such cases rebuilding these roles would make them
-     * consistent.
-     */
-    @Override
-    public void build() throws ODataJPAModelException, ODataJPARuntimeException {
-
-      if (firstBuild) {
-        firstBuild();
-      } else {
-        if (exists && !firstBuild && principalRoleView.isConsistent() == false) {
-          principalRoleView.getBuilder().build();
-        }
-
-        if (exists && !firstBuild && dependentRoleView.isConsistent() == false) {
-          dependentRoleView.getBuilder().build();
-        }
-      }
-
-      if (principalRoleView.isConsistent()) {
-        referentialConstraint.setPrincipal(principalRoleView.getEdmReferentialConstraintRole());
-      }
-
-      if (dependentRoleView.isConsistent()) {
-        referentialConstraint.setDependent(dependentRoleView.getEdmReferentialConstraintRole());
-      }
-
-      exists = principalRoleView.isExists() & dependentRoleView.isExists();
-
-      isConsistent = principalRoleView.isConsistent() & dependentRoleView.isConsistent();
-
-    }
-
-    private void firstBuild() throws ODataJPAModelException, ODataJPARuntimeException {
-      firstBuild = false;
-      if (principalRoleView == null && dependentRoleView == null) {
-
-        principalRoleView =
-            new JPAEdmReferentialConstraintRole(RoleType.PRINCIPAL, entityTypeView, propertyView, associationView);
-        principalRoleView.getBuilder().build();
-
-        dependentRoleView =
-            new JPAEdmReferentialConstraintRole(RoleType.DEPENDENT, entityTypeView, propertyView, associationView);
-        dependentRoleView.getBuilder().build();
-
-        if (referentialConstraint == null) {
-          referentialConstraint = new ReferentialConstraint();
-        }
-      }
-
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1b479e6c/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraintRole.java
----------------------------------------------------------------------
diff --git a/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraintRole.java b/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraintRole.java
deleted file mode 100644
index 3761d4b..0000000
--- a/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmReferentialConstraintRole.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.processor.core.jpa.model;
-
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinColumns;
-import javax.persistence.metamodel.Attribute;
-
-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.EntityType;
-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.ReferentialConstraintRole;
-import org.apache.olingo.odata2.processor.api.jpa.access.JPAEdmBuilder;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmAssociationView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmEntityTypeView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmMapping;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmPropertyView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmReferentialConstraintRoleView;
-
-public class JPAEdmReferentialConstraintRole extends JPAEdmBaseViewImpl implements JPAEdmReferentialConstraintRoleView {
-  /*
-   * Static Buffer
-   */
-  private static Attribute<?, ?> bufferedJPAAttribute = null;
-  private static ArrayList<JoinColumn> bufferedJoinColumns = new ArrayList<JoinColumn>();
-  /*
-   * Static Buffer
-   */
-
-  private boolean firstBuild = true;
-
-  private JPAEdmEntityTypeView entityTypeView;
-  private JPAEdmReferentialConstraintRoleView.RoleType roleType;
-
-  private Attribute<?, ?> jpaAttribute;
-  private ArrayList<String> jpaColumnNames;
-  private Association association;
-
-  private boolean roleExists = false;
-
-  private JPAEdmRefConstraintRoleBuilder builder;
-  private ReferentialConstraintRole currentRole;
-
-  public JPAEdmReferentialConstraintRole(final JPAEdmReferentialConstraintRoleView.RoleType roleType,
-      final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView,
-      final JPAEdmAssociationView associationView) {
-
-    super(entityTypeView);
-    this.entityTypeView = entityTypeView;
-    this.roleType = roleType;
-
-    jpaAttribute = propertyView.getJPAAttribute();
-    association = associationView.getEdmAssociation();
-
-  }
-
-  @Override
-  public boolean isExists() {
-    return roleExists;
-
-  }
-
-  @Override
-  public JPAEdmBuilder getBuilder() {
-    if (builder == null) {
-      builder = new JPAEdmRefConstraintRoleBuilder();
-    }
-
-    return builder;
-  }
-
-  @Override
-  public RoleType getRoleType() {
-    return roleType;
-  }
-
-  @Override
-  public ReferentialConstraintRole getEdmReferentialConstraintRole() {
-    return currentRole;
-  }
-
-  @Override
-  public String getJPAColumnName() {
-    return null;
-  }
-
-  @Override
-  public String getEdmEntityTypeName() {
-    return null;
-  }
-
-  @Override
-  public String getEdmAssociationName() {
-    return null;
-  }
-
-  private class JPAEdmRefConstraintRoleBuilder implements JPAEdmBuilder {
-
-    @Override
-    public void build() throws ODataJPAModelException {
-      if (firstBuild) {
-        firstBuild();
-      } else if (roleExists) {
-        try {
-          buildRole();
-        } catch (SecurityException e) {
-          throw ODataJPAModelException.throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()), e);
-        } catch (NoSuchFieldException e) {
-          throw ODataJPAModelException.throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()), e);
-        }
-      }
-
-    }
-
-    private void firstBuild() {
-      firstBuild = false;
-      isConsistent = false;
-
-      extractJoinColumns();
-
-      if (!roleExists) {
-        return;
-      }
-
-      jpaColumnNames = new ArrayList<String>();
-
-      for (JoinColumn joinColumn : bufferedJoinColumns) {
-        if (roleType == RoleType.PRINCIPAL) {
-          jpaColumnNames.add(joinColumn.referencedColumnName());
-        } else if (roleType == RoleType.DEPENDENT) {
-          jpaColumnNames.add(joinColumn.name());
-        }
-      }
-
-    }
-
-    private void buildRole() throws SecurityException, NoSuchFieldException {
-
-      if (currentRole == null) {
-        currentRole = new ReferentialConstraintRole();
-        String jpaAttributeType = null;
-        EntityType edmEntityType = null;
-
-        if (roleType == RoleType.PRINCIPAL) {
-          jpaAttributeType = jpaAttribute.getJavaType().getSimpleName();
-          if (jpaAttributeType.equals("List")) {
-            Type type =
-                ((ParameterizedType) jpaAttribute.getJavaMember().getDeclaringClass().getDeclaredField(
-                    jpaAttribute.getName()).getGenericType()).getActualTypeArguments()[0];
-            int lastIndexOfDot = type.toString().lastIndexOf(".");
-            jpaAttributeType = type.toString().substring(lastIndexOfDot + 1);
-          }
-          edmEntityType = entityTypeView.searchEdmEntityType(jpaAttributeType);
-        } else if (roleType == RoleType.DEPENDENT) {
-          edmEntityType =
-              entityTypeView.searchEdmEntityType(jpaAttribute.getDeclaringType().getJavaType().getSimpleName());
-        }
-
-        List<PropertyRef> propertyRefs = new ArrayList<PropertyRef>();
-        if (edmEntityType != null) {
-          for (String columnName : jpaColumnNames) {
-            for (Property property : edmEntityType.getProperties()) {
-              if (columnName.equals(((JPAEdmMapping) property.getMapping()).getJPAColumnName())) {
-                PropertyRef propertyRef = new PropertyRef();
-                propertyRef.setName(property.getName());
-                propertyRefs.add(propertyRef);
-                break;
-              }
-            }
-          }
-          currentRole.setPropertyRefs(propertyRefs);
-          if (propertyRefs.isEmpty()) {
-            isConsistent = false;
-            return;
-          }
-          AssociationEnd end = association.getEnd1();
-          if (end.getType().getName().equals(edmEntityType.getName())) {
-            currentRole.setRole(end.getRole());
-            isConsistent = true;
-          } else {
-            end = association.getEnd2();
-            if (end.getType().getName().equals(edmEntityType.getName())) {
-              currentRole.setRole(end.getRole());
-              isConsistent = true;
-            }
-          }
-        }
-
-      }
-    }
-
-    private void extractJoinColumns() {
-      /*
-       * Check against Static Buffer whether the join column was already
-       * extracted.
-       */
-      if (!jpaAttribute.equals(bufferedJPAAttribute)) {
-        bufferedJPAAttribute = jpaAttribute;
-        bufferedJoinColumns.clear();
-      } else if (bufferedJoinColumns.isEmpty()) {
-        roleExists = false;
-        return;
-      } else {
-        roleExists = true;
-        return;
-      }
-
-      AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
-
-      if (annotatedElement == null) {
-        return;
-      }
-
-      JoinColumn joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
-      if (joinColumn == null) {
-        JoinColumns joinColumns = annotatedElement.getAnnotation(JoinColumns.class);
-
-        if (joinColumns != null) {
-          JoinColumn[] joinColumnArray = joinColumns.value();
-
-          for (JoinColumn element : joinColumnArray) {
-            bufferedJoinColumns.add(element);
-          }
-        } else {
-          return;
-        }
-      } else {
-        bufferedJoinColumns.add(joinColumn);
-      }
-      roleExists = true;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1b479e6c/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmSchema.java
----------------------------------------------------------------------
diff --git a/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmSchema.java b/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmSchema.java
deleted file mode 100644
index b9ded8b..0000000
--- a/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmSchema.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.processor.core.jpa.model;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.edm.provider.Association;
-import org.apache.olingo.odata2.api.edm.provider.ComplexType;
-import org.apache.olingo.odata2.api.edm.provider.EntityType;
-import org.apache.olingo.odata2.api.edm.provider.NavigationProperty;
-import org.apache.olingo.odata2.api.edm.provider.Schema;
-import org.apache.olingo.odata2.processor.api.jpa.access.JPAEdmBuilder;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmAssociationView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmComplexTypeView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmEntityContainerView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmEntitySetView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmEntityTypeView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmModelView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
-import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-
-public class JPAEdmSchema extends JPAEdmBaseViewImpl implements JPAEdmSchemaView {
-
-  private Schema schema;
-  private JPAEdmComplexTypeView complexTypeView;
-  private JPAEdmEntityContainerView entityContainerView;
-  private JPAEdmAssociationView associationView = null;
-  private List<String> nonKeyComplexList = null;
-  private HashMap<Class<?>, String[]> customOperations = null;
-
-  public JPAEdmSchema(final JPAEdmModelView modelView) {
-    super(modelView);
-    if (nonKeyComplexList == null) {
-      nonKeyComplexList = new ArrayList<String>();
-    }
-  }
-
-  @Override
-  public List<String> getNonKeyComplexTypeList() {
-    return nonKeyComplexList;
-  }
-
-  @Override
-  public void addNonKeyComplexName(final String complexTypeName) {
-    nonKeyComplexList.add(complexTypeName);
-  }
-
-  @Override
-  public Schema getEdmSchema() {
-    return schema;
-  }
-
-  @Override
-  public JPAEdmEntityContainerView getJPAEdmEntityContainerView() {
-    return entityContainerView;
-  }
-
-  @Override
-  public JPAEdmComplexTypeView getJPAEdmComplexTypeView() {
-    return complexTypeView;
-  }
-
-  @Override
-  public JPAEdmBuilder getBuilder() {
-    if (builder == null) {
-      builder = new JPAEdmSchemaBuilder();
-    }
-
-    return builder;
-  }
-
-  @Override
-  public void clean() {
-    super.clean();
-    schema = null;
-  }
-
-  private class JPAEdmSchemaBuilder implements JPAEdmBuilder {
-    /*
-     * 
-     * Each call to build method creates a new EDM Schema. The newly created
-     * schema is built with Entity Containers, associations, Complex Types
-     * and Entity Types.
-     * 
-     * ************************************************************ Build
-     * EDM Schema - STEPS
-     * ************************************************************ 1) Build
-     * Name for EDM Schema 2) Build EDM Complex Types from JPA Embeddable
-     * Types 3) Add EDM Complex Types to EDM Schema 4) Build EDM Entity
-     * Container 5) Add EDM Entity Container to EDM Schema 6) Fetch Built
-     * EDM Entity Types from EDM Entity Container 7) Add EDM Entity Types to
-     * EDM Schema 8) Fetch Built EDM Association Sets from EDM Entity
-     * Container 9) Fetch Built EDM Associations from EDM Association Set
-     * 10) Add EDM Association to EDM Schema
-     * ************************************************************ Build
-     * EDM Schema - STEPS
-     * ************************************************************
-     */
-    @Override
-    public void build() throws ODataJPAModelException, ODataJPARuntimeException {
-
-      schema = new Schema();
-      JPAEdmNameBuilder.build(JPAEdmSchema.this);
-
-      associationView = new JPAEdmAssociation(JPAEdmSchema.this);
-
-      complexTypeView = new JPAEdmComplexType(JPAEdmSchema.this);
-      complexTypeView.getBuilder().build();
-
-      if (getJPAEdmExtension() != null) {
-        getJPAEdmExtension().extendWithOperation(JPAEdmSchema.this);
-      }
-
-      entityContainerView = new JPAEdmEntityContainer(JPAEdmSchema.this);
-      entityContainerView.getBuilder().build();
-      schema.setEntityContainers(entityContainerView.getConsistentEdmEntityContainerList());
-
-      JPAEdmEntitySetView entitySetView = entityContainerView.getJPAEdmEntitySetView();
-      if (entitySetView.isConsistent() && entitySetView.getJPAEdmEntityTypeView() != null) {
-        JPAEdmEntityTypeView entityTypeView = entitySetView.getJPAEdmEntityTypeView();
-        if (entityTypeView.isConsistent() && !entityTypeView.getConsistentEdmEntityTypes().isEmpty()) {
-          schema.setEntityTypes(entityTypeView.getConsistentEdmEntityTypes());
-        }
-      }
-      if (complexTypeView.isConsistent()) {
-        List<ComplexType> complexTypes = complexTypeView.getConsistentEdmComplexTypes();
-        List<ComplexType> existingComplexTypes = new ArrayList<ComplexType>();
-        for (ComplexType complexType : complexTypes) {
-          if (complexType != null && nonKeyComplexList.contains(complexType.getName())) {// null check for exclude
-            existingComplexTypes.add(complexType);
-          }
-        }
-        if (!existingComplexTypes.isEmpty()) {
-          schema.setComplexTypes(existingComplexTypes);
-        }
-      }
-
-      List<String> existingAssociationList = new ArrayList<String>();
-      if (associationView.isConsistent() && !associationView.getConsistentEdmAssociationList().isEmpty()) {
-
-        List<Association> consistentAssociationList = associationView.getConsistentEdmAssociationList();
-        schema.setAssociations(consistentAssociationList);
-        for (Association association : consistentAssociationList) {
-          existingAssociationList.add(association.getName());
-        }
-
-      }
-      List<EntityType> entityTypes =
-          entityContainerView.getJPAEdmEntitySetView().getJPAEdmEntityTypeView().getConsistentEdmEntityTypes();
-      List<NavigationProperty> navigationProperties;
-      if (entityTypes != null && !entityTypes.isEmpty()) {
-        for (EntityType entityType : entityTypes) {
-
-          List<NavigationProperty> consistentNavigationProperties = null;
-          navigationProperties = entityType.getNavigationProperties();
-          if (navigationProperties != null) {
-            consistentNavigationProperties = new ArrayList<NavigationProperty>();
-            for (NavigationProperty navigationProperty : navigationProperties) {
-              if (existingAssociationList.contains(navigationProperty.getRelationship().getName())) {
-                consistentNavigationProperties.add(navigationProperty);
-              }
-            }
-            if (consistentNavigationProperties.isEmpty()) {
-              entityType.setNavigationProperties(null);
-            } else {
-              entityType.setNavigationProperties(consistentNavigationProperties);
-            }
-          }
-
-        }
-      }
-
-    }
-
-  }
-
-  @Override
-  public final JPAEdmAssociationView getJPAEdmAssociationView() {
-    return associationView;
-  }
-
-  @Override
-  public void registerOperations(final Class<?> customClass, final String[] methodNames) {
-    if (customOperations == null) {
-      customOperations = new HashMap<Class<?>, String[]>();
-    }
-
-    customOperations.put(customClass, methodNames);
-
-  }
-
-  @Override
-  public HashMap<Class<?>, String[]> getRegisteredOperations() {
-    return customOperations;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1b479e6c/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/_JPAEdmFunctionImportBuilder.java
----------------------------------------------------------------------
diff --git a/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/_JPAEdmFunctionImportBuilder.java b/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/_JPAEdmFunctionImportBuilder.java
deleted file mode 100644
index da8054c..0000000
--- a/odata2-processor-jpa/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/_JPAEdmFunctionImportBuilder.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.processor.core.jpa.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.annotation.edm.FunctionImport.Multiplicity;
-import org.apache.olingo.odata2.api.annotation.edm.FunctionImport.ReturnType;
-import org.apache.olingo.odata2.api.annotation.edm.Parameter;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.provider.ComplexType;
-import org.apache.olingo.odata2.api.edm.provider.EntityType;
-import org.apache.olingo.odata2.api.edm.provider.Facets;
-import org.apache.olingo.odata2.api.edm.provider.FunctionImport;
-import org.apache.olingo.odata2.api.edm.provider.FunctionImportParameter;
-import org.apache.olingo.odata2.api.edm.provider.Mapping;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmComplexTypeView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmEntityTypeView;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmMapping;
-import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
-import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-import org.apache.olingo.odata2.processor.core.jpa.access.model.JPATypeConvertor;
-
-@Deprecated
-public final class _JPAEdmFunctionImportBuilder {
-
-  private JPAEdmEntityTypeView jpaEdmEntityTypeView = null;
-  private JPAEdmComplexTypeView jpaEdmComplexTypeView = null;
-  private JPAEdmSchemaView schemaView;
-
-  public void setJPAEdmEntityTypeView(final JPAEdmEntityTypeView jpaEdmEntityTypeView) {
-    this.jpaEdmEntityTypeView = jpaEdmEntityTypeView;
-  }
-
-  public void setSchemaView(final JPAEdmSchemaView schemaView) {
-    this.schemaView = schemaView;
-  }
-
-  public void setJPAEdmComplexTypeView(final JPAEdmComplexTypeView jpaEdmComplexTypeView) {
-    this.jpaEdmComplexTypeView = jpaEdmComplexTypeView;
-  }
-
-  public FunctionImport buildFunctionImport(final Method method,
-      final org.apache.olingo.odata2.api.annotation.edm.FunctionImport annotation) throws ODataJPAModelException {
-
-    if (method != null && annotation != null && annotation.returnType() != ReturnType.NONE) {
-      FunctionImport functionImport = new FunctionImport();
-
-      if (annotation.name().equals("")) {
-        functionImport.setName(method.getName());
-      } else {
-        functionImport.setName(annotation.name());
-      }
-
-      JPAEdmMapping mapping = new JPAEdmMappingImpl();
-      ((Mapping) mapping).setInternalName(method.getName());
-      mapping.setJPAType(method.getDeclaringClass());
-      functionImport.setMapping((Mapping) mapping);
-
-      functionImport.setHttpMethod(annotation.httpMethod().name().toString());
-
-      buildReturnType(functionImport, method, annotation);
-      buildParameter(functionImport, method);
-      return functionImport;
-    }
-    return null;
-
-  }
-
-  private void buildParameter(final FunctionImport functionImport, final Method method)
-      throws ODataJPAModelException {
-
-    Annotation[][] annotations = method.getParameterAnnotations();
-    Class<?>[] parameterTypes = method.getParameterTypes();
-    List<FunctionImportParameter> funcImpList = new ArrayList<FunctionImportParameter>();
-    JPAEdmMapping mapping = null;
-    int j = 0;
-    for (Annotation[] annotationArr : annotations) {
-      Class<?> parameterType = parameterTypes[j++];
-
-      for (Annotation element : annotationArr) {
-        if (element instanceof Parameter) {
-          Parameter annotation = (Parameter) element;
-          FunctionImportParameter functionImportParameter = new FunctionImportParameter();
-          if (annotation.name().equals("")) {
-            throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_PARAM_NAME_EXP.addContent(method
-                .getDeclaringClass().getName(), method.getName()), null);
-          } else {
-            functionImportParameter.setName(annotation.name());
-          }
-
-          functionImportParameter.setType(JPATypeConvertor.convertToEdmSimpleType(parameterType, null));
-          functionImportParameter.setMode(annotation.mode().toString());
-
-          Facets facets = new Facets();
-          if (annotation.facets().maxLength() > 0) {
-            facets.setMaxLength(annotation.facets().maxLength());
-          }
-          if (annotation.facets().nullable() == false) {
-            facets.setNullable(false);
-          } else {
-            facets.setNullable(true);
-          }
-
-          if (annotation.facets().precision() > 0) {
-            facets.setPrecision(annotation.facets().precision());
-          }
-          if (annotation.facets().scale() >= 0) {
-            facets.setScale(annotation.facets().scale());
-          }
-
-          functionImportParameter.setFacets(facets);
-          mapping = new JPAEdmMappingImpl();
-          mapping.setJPAType(parameterType);
-          functionImportParameter.setMapping((Mapping) mapping);
-          funcImpList.add(functionImportParameter);
-        }
-      }
-    }
-    if (!funcImpList.isEmpty()) {
-      functionImport.setParameters(funcImpList);
-    }
-  }
-
-  private void buildReturnType(final FunctionImport functionImport, final Method method,
-      final org.apache.olingo.odata2.api.annotation.edm.FunctionImport annotation) throws ODataJPAModelException {
-    org.apache.olingo.odata2.api.annotation.edm.FunctionImport.ReturnType returnType = annotation.returnType();
-    Multiplicity multiplicity = null;
-
-    if (returnType != ReturnType.NONE) {
-      org.apache.olingo.odata2.api.edm.provider.ReturnType functionReturnType =
-          new org.apache.olingo.odata2.api.edm.provider.ReturnType();
-      multiplicity = annotation.multiplicity();
-
-      if (multiplicity == Multiplicity.MANY) {
-        functionReturnType.setMultiplicity(EdmMultiplicity.MANY);
-      } else {
-        functionReturnType.setMultiplicity(EdmMultiplicity.ONE);
-      }
-
-      if (returnType == ReturnType.ENTITY_TYPE) {
-        String entitySet = annotation.entitySet();
-        if (entitySet.equals("")) {
-          throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_ENTITYSET_EXP, null);
-        }
-        functionImport.setEntitySet(entitySet);
-      }
-
-      Class<?> methodReturnType = method.getReturnType();
-      if (methodReturnType == null || methodReturnType.getName().equals("void")) {
-        throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_RETURN_TYPE_EXP.addContent(method
-            .getDeclaringClass(), method.getName()), null);
-      }
-      switch (returnType) {
-      case ENTITY_TYPE:
-        EntityType edmEntityType = null;
-        if (multiplicity == Multiplicity.ONE) {
-          edmEntityType = jpaEdmEntityTypeView.searchEdmEntityType(methodReturnType.getSimpleName());
-        } else if (multiplicity == Multiplicity.MANY) {
-          edmEntityType = jpaEdmEntityTypeView.searchEdmEntityType(getReturnTypeSimpleName(method));
-        }
-
-        if (edmEntityType == null) {
-          throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_RETURN_TYPE_ENTITY_NOT_FOUND
-              .addContent(method.getDeclaringClass(), method.getName(), methodReturnType.getSimpleName()), null);
-        }
-        functionReturnType.setTypeName(JPAEdmNameBuilder.build(schemaView, edmEntityType.getName()));
-        break;
-      case SCALAR:
-
-        EdmSimpleTypeKind edmSimpleTypeKind = JPATypeConvertor.convertToEdmSimpleType(methodReturnType, null);
-        functionReturnType.setTypeName(edmSimpleTypeKind.getFullQualifiedName());
-
-        break;
-      case COMPLEX_TYPE:
-        ComplexType complexType = null;
-        if (multiplicity == Multiplicity.ONE) {
-          complexType = jpaEdmComplexTypeView.searchEdmComplexType(methodReturnType.getName());
-        } else if (multiplicity == Multiplicity.MANY) {
-          complexType = jpaEdmComplexTypeView.searchEdmComplexType(getReturnTypeName(method));
-        }
-        if (complexType == null) {
-          throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_RETURN_TYPE_ENTITY_NOT_FOUND
-              .addContent(method.getDeclaringClass(), method.getName(), methodReturnType.getSimpleName()), null);
-        }
-        functionReturnType.setTypeName(JPAEdmNameBuilder.build(schemaView, complexType.getName()));
-        break;
-      default:
-        break;
-      }
-      functionImport.setReturnType(functionReturnType);
-    }
-  }
-
-  private String getReturnTypeName(final Method method) {
-    try {
-      ParameterizedType pt = (ParameterizedType) method.getGenericReturnType();
-      Type t = pt.getActualTypeArguments()[0];
-      return ((Class<?>) t).getName();
-    } catch (ClassCastException e) {
-      return method.getReturnType().getName();
-    }
-  }
-
-  private String getReturnTypeSimpleName(final Method method) {
-    try {
-      ParameterizedType pt = (ParameterizedType) method.getGenericReturnType();
-      Type t = pt.getActualTypeArguments()[0];
-      return ((Class<?>) t).getSimpleName();
-    } catch (ClassCastException e) {
-      return method.getReturnType().getSimpleName();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1b479e6c/odata2-processor-jpa/jpa-core/src/main/resources/jpaprocessor_msg.properties
----------------------------------------------------------------------
diff --git a/odata2-processor-jpa/jpa-core/src/main/resources/jpaprocessor_msg.properties b/odata2-processor-jpa/jpa-core/src/main/resources/jpaprocessor_msg.properties
deleted file mode 100644
index 5eb96fb..0000000
--- a/odata2-processor-jpa/jpa-core/src/main/resources/jpaprocessor_msg.properties
+++ /dev/null
@@ -1,61 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-#        or more contributor license agreements.  See the NOTICE file
-#        distributed with this work for additional information
-#        regarding copyright ownership.  The ASF licenses this file
-#        to you under the Apache License, Version 2.0 (the
-#        "License"); you may not use this file except in compliance
-#        with the License.  You may obtain a copy of the License at
-# 
-#          http://www.apache.org/licenses/LICENSE-2.0
-# 
-#        Unless required by applicable law or agreed to in writing,
-#        software distributed under the License is distributed on an
-#        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#        KIND, either express or implied.  See the License for the
-#        specific language governing permissions and limitations
-#        under the License.
-#-------------------------------------------------------------------------------
-# Fall Back translations
-#
-
-#JPA EDM Provider Errors
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.GENERAL="OData - JPA Metadata: Internal error [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.INNER_EXCEPTION="%1$s: %2$s.\n"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.INVALID_ENTITY_TYPE="OData - JPA Model Processor: Invalid Entity Type [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.INVALID_COMPLEX_TYPE="OData - JPA Model Processor: Invalid Complex Type [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.INVALID_ASSOCIATION ="OData - JPA Model Processor: Invalid Association [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.INVALID_ENTITYSET="OData - JPA Model Processor: Invalid Entity set [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.INVALID_ENTITYCONTAINER="OData - JPA Model Processor: Invalid Entity Container [%1$s]"
-org.apache.olingo.odata2.processor.jap.exception.ODataJPAModelException.INVALID_ASSOCIATION_SET="OData - JPA Model Processor: Invalid Association Set [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.INVALID_FUNC_IMPORT="OData - JPA Model Processor: Invalid Function Import [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.BUILDER_NULL="OData - JPA Model Processor: JPA Builder not initialized"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.FUNC_ENTITYSET_EXP="OData - JPA Model Processor: Entity Set expected for Function Import with return type as Entity Type with Multiplicity Many"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.FUNC_RETURN_TYPE_EXP="OData - JPA Model Processor: Return type expected. Class: [%1$s], Method: [%2$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.FUNC_RETURN_TYPE_ENTITY_NOT_FOUND="OData - JPA Model Processor: Return type not found. Class: [%1$s], Method: [%2$s], Type: [%3$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.FUNC_PARAM_NAME_EXP="OData - JPA Model Processor: Parameter Name for function import expected. Class: [%1$s]", Method: [%2$s]"
-
-#JPA Type converter Errors
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAModelException.TYPE_NOT_SUPPORTED="OData - JPA Type Converter: Type [%1$s] not supported"
-
-#JPA Runtime Errors
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ENTITY_MANAGER_NOT_INITIALIZED="OData - JPA Service Factory: Java Persistence Entity Manager not initialized"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.GENERAL="OData - JPA Runtime: Internal error [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.INNER_EXCEPTION="%1$s: %2$s.\n"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.JOIN_CLAUSE_EXPECTED="OData - JPA Runtime: Join Clause expected"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.RESOURCE_NOT_FOUND="OData - JPA Runtime: Resource not found"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_ODATA_FILTER_CONDITION="OData - JPA Runtime: Filter condition not correct"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_JPQL_QUERY_CREATE="OData - JPA Runtime: JPA query syntax is not correct"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_JPQL_CREATE_REQUEST="OData - JPA Runtime: JPA create request is not correct"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_JPQL_UPDATE_REQUEST="OData - JPA Runtime: JPA update request is not correct"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_JPQL_DELETE_REQUEST="OData - JPA Runtime: JPA delete URL is not correct"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_JPQL_KEY_VALUE="Key parameter value is not correct for [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_JPQL_PARAM_VALUE="Parameter value is not correct for [%1$s]"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_JPQL_UNIQUE_CONSTRAINT="Violation of unique constraint"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_JPQL_INTEGRITY_CONSTRAINT="Integrity constraint violation"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.RELATIONSHIP_INVALID="OData - JPA Runtime: Invalid link"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.RESOURCE_X_NOT_FOUND="OData - JPA Runtime: Resource [%1$s] not found"
-
-#JPA Common Errors
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPAException.ODATA_JPACTX_NULL="OData JPA: OData JPA Context cannot be null"
-org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException.ERROR_JPQLCTXBLDR_CREATE="OData JPA: Error creating JPQL Context Builder"

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1b479e6c/odata2-processor-jpa/jpa-core/src/test/java/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/odata2-processor-jpa/jpa-core/src/test/java/META-INF/MANIFEST.MF b/odata2-processor-jpa/jpa-core/src/test/java/META-INF/MANIFEST.MF
deleted file mode 100644
index 5e94951..0000000
--- a/odata2-processor-jpa/jpa-core/src/test/java/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Class-Path: 
-

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1b479e6c/odata2-processor-jpa/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/ODataExpressionParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-processor-jpa/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/ODataExpressionParserTest.java b/odata2-processor-jpa/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/ODataExpressionParserTest.java
deleted file mode 100644
index 390c7fe..0000000
--- a/odata2-processor-jpa/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/ODataExpressionParserTest.java
+++ /dev/null
@@ -1,515 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.processor.core.jpa;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.edm.EdmFacets;
-import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
-import org.apache.olingo.odata2.api.edm.EdmMapping;
-import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmSimpleType;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.EdmTypeKind;
-import org.apache.olingo.odata2.api.edm.EdmTyped;
-import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.api.uri.KeyPredicate;
-import org.apache.olingo.odata2.api.uri.expression.BinaryExpression;
-import org.apache.olingo.odata2.api.uri.expression.BinaryOperator;
-import org.apache.olingo.odata2.api.uri.expression.CommonExpression;
-import org.apache.olingo.odata2.api.uri.expression.ExpressionKind;
-import org.apache.olingo.odata2.api.uri.expression.FilterExpression;
-import org.apache.olingo.odata2.api.uri.expression.LiteralExpression;
-import org.apache.olingo.odata2.api.uri.expression.MemberExpression;
-import org.apache.olingo.odata2.api.uri.expression.MethodExpression;
-import org.apache.olingo.odata2.api.uri.expression.MethodOperator;
-import org.apache.olingo.odata2.api.uri.expression.PropertyExpression;
-import org.apache.olingo.odata2.api.uri.expression.UnaryExpression;
-import org.apache.olingo.odata2.api.uri.expression.UnaryOperator;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.processor.core.jpa.common.ODataJPATestConstants;
-import org.easymock.EasyMock;
-import org.junit.Test;
-
-public class ODataExpressionParserTest {
-
-  private static final String EXPECTED_STR_1 = "gwt1.SalesOrder = 1234";
-  private static final String EXPECTED_STR_2 = "gwt1.SalesOrder >= 1234 AND gwt1.SalesABC <> XYZ";
-  private static final String EXPECTED_STR_3 = "gwt1.SalesOrder >= 1234 OR gwt1.SalesABC <> XYZ";
-  private static final String EXPECTED_STR_4 = "gwt1.SalesOrder < 1234 AND gwt1.SalesABC <= XYZ";
-  private static final String EXPECTED_STR_5 = "gwt1.LineItems > 2345 AND gwt1.SalesOrder >= Amazon";
-  private static final String EXPECTED_STR_6 = "gwt1.Address.city = \'City_3\'";
-  private static final String EXPECTED_STR_7 = "gwt1.Address.city.area = \'BTM\'";
-  private static final String EXPECTED_STR_8 = "gwt1.field1 = 1 AND gwt1.field2 = 'abc'";
-  private static final String EXPECTED_STR_9 = "gwt1.BuyerAddress, gwt1.BuyerName, gwt1.BuyerId";
-  private static final String EXPECTED_STR_10 = "gwt1.SalesOrder";
-  private static final String EXPECTED_STR_11 = "NOT(gwt1.deliveryStatus)";
-  private static final String EXPECTED_STR_12 =
-      "(CASE WHEN (gwt1.currencyCode LIKE '%Ru%') THEN TRUE ELSE FALSE END) = true";
-  private static final String EXPECTED_STR_13 = "SUBSTRING(gwt1.currencyCode, 1 + 1 , 2) = 'NR'";
-  private static final String EXPECTED_STR_14 = "LOWER(gwt1.currencyCode) = 'inr rupees'";
-  private static final String EXPECTED_STR_15 =
-      "(CASE WHEN (LOWER(gwt1.currencyCode) LIKE '%nr rupees%') THEN TRUE ELSE FALSE END) = true";
-  private static final String EXPECTED_STR_16 =
-      "(CASE WHEN (gwt1.currencyCode LIKE '%INR%') THEN TRUE ELSE FALSE END) = true";
-  private static final String EXPECTED_STR_17 =
-      "(CASE WHEN (LOWER(gwt1.currencyCode) LIKE '%nr rupees%') THEN TRUE ELSE FALSE END) = true";
-
-  private static final String ADDRESS = "Address";
-  private static final String CITY = "city";
-  private static final String AREA = "area";
-  private static final String SALES_ORDER = "SalesOrder";
-  private static final String SALES_ABC = "SalesABC";
-  private static final String SAMPLE_DATA_1 = "1234";
-  private static final String SAMPLE_DATA_2 = "2345";
-  private static final String SAMPLE_DATA_XYZ = "XYZ";
-  private static final String SAMPLE_DATA_BTM = "\'BTM\'";
-  private static final String SAMPLE_DATA_CITY_3 = "\'City_3\'";
-  private static final String SAMPLE_DATA_LINE_ITEMS = "LineItems";
-  private static final String SAMPLE_DATA_AMAZON = "Amazon";
-  private static final String SAMPLE_DATA_FIELD1 = "field1";
-  private static final String SAMPLE_DATA_FIELD2 = "field2";
-
-  private static final String TABLE_ALIAS = "gwt1"; //$NON-NLS-1$
-
-  @Test
-  public void testParseWhereExpression() {
-    try {
-      String parsedStr = ODataJPATestConstants.EMPTY_STRING;
-      // Simple Binary query -
-      parsedStr =
-          ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpressionMockedObj(BinaryOperator.EQ,
-              ExpressionKind.PROPERTY, SALES_ORDER, SAMPLE_DATA_1), TABLE_ALIAS);
-
-      assertEquals(EXPECTED_STR_1, parsedStr);
-      // complex query -
-      parsedStr = ODataJPATestConstants.EMPTY_STRING;
-
-      CommonExpression exp1 =
-          getBinaryExpressionMockedObj(BinaryOperator.GE, ExpressionKind.PROPERTY, SALES_ORDER, SAMPLE_DATA_1);
-      CommonExpression exp2 =
-          getBinaryExpressionMockedObj(BinaryOperator.NE, ExpressionKind.PROPERTY, SALES_ABC, SAMPLE_DATA_XYZ);
-      parsedStr =
-          ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(exp1, BinaryOperator.AND, exp2),
-              TABLE_ALIAS);
-      assertEquals(EXPECTED_STR_2, parsedStr);
-    } 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);
-    }
-  }
-
-  @Test
-  public void testMoreThanOneBinaryExpression() {
-    // complex query -
-    String parsedStr = ODataJPATestConstants.EMPTY_STRING;
-    CommonExpression exp1 =
-        getBinaryExpressionMockedObj(BinaryOperator.GE, ExpressionKind.PROPERTY, SALES_ORDER, SAMPLE_DATA_1);
-    CommonExpression exp2 =
-        getBinaryExpressionMockedObj(BinaryOperator.NE, ExpressionKind.PROPERTY, SALES_ABC, SAMPLE_DATA_XYZ);
-    try {
-      parsedStr =
-          ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(exp1, BinaryOperator.AND, exp2),
-              TABLE_ALIAS);
-      assertEquals(EXPECTED_STR_2, parsedStr);
-      parsedStr =
-          ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(exp1, BinaryOperator.OR, exp2),
-              TABLE_ALIAS);
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    assertEquals(EXPECTED_STR_3, parsedStr);
-  }
-
-  @Test
-  public void testParseFilterExpression() {
-    try {
-      assertEquals(EXPECTED_STR_10, ODataExpressionParser.parseToJPAWhereExpression(getFilterExpressionMockedObj(
-          ExpressionKind.PROPERTY, SALES_ORDER), TABLE_ALIAS));
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testAllBinaryOperators() { // Test for all Binary Operators
-    // complex query -
-    String parsedStr1 = ODataJPATestConstants.EMPTY_STRING;
-    String parsedStr2 = ODataJPATestConstants.EMPTY_STRING;
-
-    CommonExpression exp1 =
-        getBinaryExpressionMockedObj(BinaryOperator.LT, ExpressionKind.PROPERTY, SALES_ORDER, SAMPLE_DATA_1);
-    CommonExpression exp2 =
-        getBinaryExpressionMockedObj(BinaryOperator.LE, ExpressionKind.PROPERTY, SALES_ABC, SAMPLE_DATA_XYZ);
-
-    try {
-      parsedStr1 =
-          ODataExpressionParser.parseToJPAWhereExpression((BinaryExpression) getBinaryExpression(exp1,
-              BinaryOperator.AND, exp2), TABLE_ALIAS);
-      assertEquals(EXPECTED_STR_4, parsedStr1);
-
-      CommonExpression exp3 =
-          getBinaryExpressionMockedObj(BinaryOperator.GT, ExpressionKind.PROPERTY, SAMPLE_DATA_LINE_ITEMS,
-              SAMPLE_DATA_2);
-      CommonExpression exp4 =
-          getBinaryExpressionMockedObj(BinaryOperator.GE, ExpressionKind.PROPERTY, SALES_ORDER, SAMPLE_DATA_AMAZON);
-
-      parsedStr2 =
-          ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(exp3, BinaryOperator.AND, exp4),
-              TABLE_ALIAS);
-
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    assertEquals(EXPECTED_STR_5, parsedStr2);
-  }
-
-  @Test
-  public void testParseMemberExpression() {
-    try {
-      assertEquals(EXPECTED_STR_6, ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(
-          getMemberExpressionMockedObj(ADDRESS, CITY), BinaryOperator.EQ,
-          getLiteralExpressionMockedObj(SAMPLE_DATA_CITY_3)), TABLE_ALIAS));
-      assertEquals(EXPECTED_STR_7, ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(
-          getMultipleMemberExpressionMockedObj(ADDRESS, CITY, AREA), BinaryOperator.EQ,
-          getLiteralExpressionMockedObj(SAMPLE_DATA_BTM)), TABLE_ALIAS));
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  @Test
-  public void testParseMethodExpression() {
-    try {
-      assertEquals(EXPECTED_STR_12, ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(
-          getMethodExpressionMockedObj(MethodOperator.SUBSTRINGOF, "'Ru'", "currencyCode", null, 2), BinaryOperator.EQ,
-          getLiteralExpressionMockedObj("true")), TABLE_ALIAS));
-      assertEquals(EXPECTED_STR_13, ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(
-          getMethodExpressionMockedObj(MethodOperator.SUBSTRING, "currencyCode", "1", "2", 3), BinaryOperator.EQ,
-          getLiteralExpressionMockedObj("'NR'")), TABLE_ALIAS));
-      assertEquals(EXPECTED_STR_14, ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(
-          getMethodExpressionMockedObj(MethodOperator.TOLOWER, "currencyCode", null, null, 1), BinaryOperator.EQ,
-          getLiteralExpressionMockedObj("'inr rupees'")), TABLE_ALIAS));
-      assertEquals(EXPECTED_STR_15, ODataExpressionParser.parseToJPAWhereExpression(getBinaryExpression(
-          getMultipleMethodExpressionMockedObj(MethodOperator.SUBSTRINGOF, "'nr rupees'", MethodOperator.TOLOWER,
-              "currencyCode", 2, 1), BinaryOperator.EQ, getLiteralExpressionMockedObj("true")), TABLE_ALIAS));
-      assertEquals(EXPECTED_STR_16, ODataExpressionParser.parseToJPAWhereExpression(
-          getFilterExpressionForFunctionsMockedObj(MethodOperator.SUBSTRINGOF, "'INR'", null, "currencyCode", 2, null)
-          /*
-           * getBinaryExpression(
-           * getMemberExpressionMockedObj(ADDRESS,
-           * CITY),
-           * BinaryOperator.EQ,
-           * getLiteralExpressionMockedObj(SAMPLE_DATA_CITY_3))
-           */, TABLE_ALIAS));
-      assertEquals(EXPECTED_STR_17, ODataExpressionParser.parseToJPAWhereExpression(
-          getFilterExpressionForFunctionsMockedObj(MethodOperator.SUBSTRINGOF, "'nr rupees'", MethodOperator.TOLOWER,
-              "currencyCode", 2, 1)
-          /*
-           * getBinaryExpression(
-           * getMemberExpressionMockedObj(ADDRESS,
-           * CITY),
-           * BinaryOperator.EQ,
-           * getLiteralExpressionMockedObj(SAMPLE_DATA_CITY_3))
-           */, TABLE_ALIAS));
-
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-  }
-
-  private CommonExpression getMethodExpressionMockedObj(final MethodOperator methodOperator, final String firstName,
-      final String secondName, final String thirdName, final Integer parameterCount) {
-
-    List<CommonExpression> parameters = new ArrayList<CommonExpression>();
-
-    if (methodOperator == MethodOperator.SUBSTRINGOF) {
-      parameters.add(getLiteralExpressionMockedObj(firstName));
-      parameters.add(getPropertyExpressionMockedObj(ExpressionKind.PROPERTY, secondName));
-    } else if (methodOperator == MethodOperator.SUBSTRING) {
-      parameters.add(getPropertyExpressionMockedObj(ExpressionKind.PROPERTY, firstName));
-      parameters.add(getLiteralExpressionMockedObj(secondName));
-      parameters.add(getLiteralExpressionMockedObj(thirdName));
-    } else if (methodOperator == MethodOperator.TOLOWER) {
-      parameters.add(getPropertyExpressionMockedObj(ExpressionKind.PROPERTY, firstName));
-    }
-
-    MethodExpression methodExpression = EasyMock.createMock(MethodExpression.class);
-
-    EasyMock.expect(methodExpression.getKind()).andStubReturn(ExpressionKind.METHOD);
-    EasyMock.expect(methodExpression.getMethod()).andStubReturn(methodOperator);
-    EasyMock.expect(methodExpression.getParameterCount()).andStubReturn(parameterCount);
-    EasyMock.expect(methodExpression.getParameters()).andStubReturn(parameters);
-    EasyMock.replay(methodExpression);
-
-    return methodExpression;
-  }
-
-  private CommonExpression getMultipleMethodExpressionMockedObj(final MethodOperator methodOperator1,
-      final String firstName, final MethodOperator methodOperator2, final String secondName,
-      final Integer parameterCount1, final Integer parameterCount2) {
-
-    // complex query
-    List<CommonExpression> parameters = new ArrayList<CommonExpression>();
-
-    parameters.add(getLiteralExpressionMockedObj(firstName));
-    parameters.add(getMethodExpressionMockedObj(methodOperator2, secondName, null, null, 1));
-
-    MethodExpression methodExpression = EasyMock.createMock(MethodExpression.class);
-
-    EasyMock.expect(methodExpression.getKind()).andStubReturn(ExpressionKind.METHOD);
-    EasyMock.expect(methodExpression.getMethod()).andStubReturn(methodOperator1);
-    EasyMock.expect(methodExpression.getParameterCount()).andStubReturn(parameterCount1);
-    EasyMock.expect(methodExpression.getParameters()).andStubReturn(parameters);
-    EasyMock.replay(methodExpression);
-
-    return methodExpression;
-  }
-
-  private CommonExpression getMultipleMemberExpressionMockedObj(final String string1, final String string2,
-      final String string3) {
-
-    MemberExpression memberExpression = EasyMock.createMock(MemberExpression.class);
-
-    EasyMock.expect(memberExpression.getPath()).andStubReturn(getMemberExpressionMockedObj(string1, string2));
-    EasyMock.expect(memberExpression.getProperty()).andStubReturn(
-        getPropertyExpressionMockedObj(ExpressionKind.PROPERTY, string3));
-    EasyMock.expect(memberExpression.getKind()).andStubReturn(ExpressionKind.MEMBER);
-    EasyMock.replay(memberExpression);
-
-    return memberExpression;
-  }
-
-  @Test
-  public void testParseUnaryExpression() {
-
-    UnaryExpression unaryExpression =
-        getUnaryExpressionMockedObj(getPropertyExpressionMockedObj(ExpressionKind.PROPERTY, "deliveryStatus"),
-            org.apache.olingo.odata2.api.uri.expression.UnaryOperator.NOT);
-    try {
-      assertEquals(EXPECTED_STR_11, ODataExpressionParser.parseToJPAWhereExpression(unaryExpression, TABLE_ALIAS));
-    } catch (ODataException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-
-  }
-
-  private UnaryExpression
-      getUnaryExpressionMockedObj(final CommonExpression operand, final UnaryOperator unaryOperator) {
-    UnaryExpression unaryExpression = EasyMock.createMock(UnaryExpression.class);
-    EasyMock.expect(unaryExpression.getKind()).andStubReturn(ExpressionKind.UNARY);
-    EasyMock.expect(unaryExpression.getOperand()).andStubReturn(operand);
-    EasyMock.expect(unaryExpression.getOperator()).andStubReturn(unaryOperator);
-
-    EasyMock.replay(unaryExpression);
-    return unaryExpression;
-  }
-
-  private CommonExpression getMemberExpressionMockedObj(final String pathUriLiteral, final String propertyUriLiteral) {
-    MemberExpression memberExpression = EasyMock.createMock(MemberExpression.class);
-    EasyMock.expect(memberExpression.getPath()).andStubReturn(
-        getPropertyExpressionMockedObj(ExpressionKind.PROPERTY, pathUriLiteral));
-    EasyMock.expect(memberExpression.getProperty()).andStubReturn(
-        getPropertyExpressionMockedObj(ExpressionKind.PROPERTY, propertyUriLiteral));
-    EasyMock.expect(memberExpression.getKind()).andStubReturn(ExpressionKind.MEMBER);
-
-    EasyMock.replay(memberExpression);
-    return memberExpression;
-  }
-
-  private LiteralExpression getLiteralExpressionMockedObj(final String uriLiteral) {
-    LiteralExpression rightOperandLiteralExpresion = EasyMock.createMock(LiteralExpression.class);
-    EasyMock.expect(rightOperandLiteralExpresion.getKind()).andStubReturn(ExpressionKind.LITERAL);
-    EasyMock.expect(rightOperandLiteralExpresion.getUriLiteral()).andStubReturn(uriLiteral);// SAMPLE_DATA
-    EasyMock.expect(rightOperandLiteralExpresion.getEdmType()).andStubReturn(getEdmSimpleTypeMockedObj(uriLiteral));
-    EasyMock.replay(rightOperandLiteralExpresion);
-    return rightOperandLiteralExpresion;
-
-  }
-
-  private EdmSimpleType getEdmSimpleTypeMockedObj(final String value) {
-    EdmSimpleType edmSimpleType = EasyMock.createMock(EdmSimpleType.class);
-    try {
-      EasyMock.expect(edmSimpleType.getName()).andReturn(value);
-      EasyMock.expect(edmSimpleType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
-      EasyMock.expect(edmSimpleType.valueOfString(value, EdmLiteralKind.URI, getEdmFacetsMockedObj(), null))
-          .andStubReturn(value);
-      EasyMock.expect(edmSimpleType.valueOfString(value, EdmLiteralKind.URI, null, null)).andStubReturn(value);
-      EasyMock.expect(edmSimpleType.valueToString(value, EdmLiteralKind.DEFAULT, getEdmFacetsMockedObj()))
-          .andStubReturn(value);
-      EasyMock.expect(edmSimpleType.valueToString(value, EdmLiteralKind.DEFAULT, null)).andStubReturn(value);
-    } catch (EdmException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    EasyMock.expect(edmSimpleType.getDefaultType()).andStubReturn(null);
-    EasyMock.replay(edmSimpleType);
-    return edmSimpleType;
-  }
-
-  private EdmFacets getEdmFacetsMockedObj() {
-    EdmFacets facets = EasyMock.createMock(EdmFacets.class);
-
-    EasyMock.replay(facets);
-    return facets;
-  }
-
-  private PropertyExpression getPropertyExpressionMockedObj(final ExpressionKind expKind, final String propertyName) {
-    PropertyExpression leftOperandPropertyExpresion = EasyMock.createMock(PropertyExpression.class);
-    EasyMock.expect(leftOperandPropertyExpresion.getKind()).andStubReturn(ExpressionKind.PROPERTY);
-    EasyMock.expect(leftOperandPropertyExpresion.getPropertyName()).andStubReturn(propertyName);
-    EasyMock.expect(leftOperandPropertyExpresion.getEdmProperty()).andStubReturn(getEdmTypedMockedObj(propertyName));
-    EasyMock.replay(leftOperandPropertyExpresion);
-    return leftOperandPropertyExpresion;
-  }
-
-  private EdmTyped getEdmTypedMockedObj(final String propertyName) {
-    EdmProperty mockedEdmProperty = EasyMock.createMock(EdmProperty.class);
-    try {
-      EasyMock.expect(mockedEdmProperty.getMapping()).andStubReturn(getEdmMappingMockedObj(propertyName));
-      EasyMock.replay(mockedEdmProperty);
-    } catch (EdmException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    return mockedEdmProperty;
-  }
-
-  private EdmMapping getEdmMappingMockedObj(final String propertyName) {
-    EdmMapping mockedEdmMapping = EasyMock.createMock(EdmMapping.class);
-    EasyMock.expect(mockedEdmMapping.getInternalName()).andStubReturn(propertyName);
-    EasyMock.replay(mockedEdmMapping);
-    return mockedEdmMapping;
-  }
-
-  private BinaryExpression getBinaryExpressionMockedObj(final BinaryOperator operator,
-      final ExpressionKind leftOperandExpKind, final String propertyName, final String literalStr) {
-    BinaryExpression binaryExpression = EasyMock.createMock(BinaryExpression.class);
-    EasyMock.expect(binaryExpression.getKind()).andStubReturn(ExpressionKind.BINARY);
-    EasyMock.expect(binaryExpression.getLeftOperand()).andStubReturn(
-        getPropertyExpressionMockedObj(leftOperandExpKind, propertyName));
-    EasyMock.expect(binaryExpression.getOperator()).andStubReturn(operator);
-    EasyMock.expect(binaryExpression.getRightOperand()).andStubReturn(getLiteralExpressionMockedObj(literalStr));
-
-    EasyMock.replay(binaryExpression);
-    return binaryExpression;
-  }
-
-  private FilterExpression getFilterExpressionMockedObj(final ExpressionKind leftOperandExpKind,
-      final String propertyName) {
-    FilterExpression filterExpression = EasyMock.createMock(FilterExpression.class);
-    EasyMock.expect(filterExpression.getKind()).andStubReturn(ExpressionKind.FILTER);
-    EasyMock.expect(filterExpression.getExpression()).andStubReturn(
-        getPropertyExpressionMockedObj(leftOperandExpKind, propertyName));
-
-    EasyMock.replay(filterExpression);
-    return filterExpression;
-  }
-
-  private FilterExpression getFilterExpressionForFunctionsMockedObj(final MethodOperator methodOperator1,
-      final String firstName, final MethodOperator methodOperator2, final String secondName,
-      final Integer parameterCount1, final Integer parameterCount2) {
-    // default value handling of SUBSTRINGOF
-    FilterExpression filterExpression = EasyMock.createMock(FilterExpression.class);
-    EasyMock.expect(filterExpression.getKind()).andStubReturn(ExpressionKind.FILTER);
-    if ((methodOperator2 != null) && (parameterCount2 != null)) {
-      EasyMock.expect(filterExpression.getExpression()).andStubReturn(
-          getMultipleMethodExpressionMockedObj(methodOperator1, firstName, methodOperator2, secondName,
-              parameterCount1, parameterCount2));
-    } else {
-      EasyMock.expect(filterExpression.getExpression()).andStubReturn(
-          getMethodExpressionMockedObj(methodOperator1, firstName, secondName, null, parameterCount1));
-    }
-
-    EasyMock.replay(filterExpression);
-    return filterExpression;
-  }
-
-  private CommonExpression getBinaryExpression(final CommonExpression leftOperand, final BinaryOperator operator,
-      final CommonExpression rightOperand) {
-    BinaryExpression binaryExpression = EasyMock.createMock(BinaryExpression.class);
-    EasyMock.expect(binaryExpression.getKind()).andStubReturn(ExpressionKind.BINARY);
-    EasyMock.expect(binaryExpression.getLeftOperand()).andStubReturn(leftOperand);
-    EasyMock.expect(binaryExpression.getRightOperand()).andStubReturn(rightOperand);
-    EasyMock.expect(binaryExpression.getOperator()).andStubReturn(operator);
-
-    EasyMock.replay(binaryExpression);
-    return binaryExpression;
-  }
-
-  @Test
-  public void testParseKeyPredicates() {
-    // Setting up the expected value
-    KeyPredicate keyPredicate1 = EasyMock.createMock(KeyPredicate.class);
-    EdmProperty kpProperty1 = EasyMock.createMock(EdmProperty.class);
-    EasyMock.expect(keyPredicate1.getLiteral()).andStubReturn("1");
-    KeyPredicate keyPredicate2 = EasyMock.createMock(KeyPredicate.class);
-    EdmProperty kpProperty2 = EasyMock.createMock(EdmProperty.class);
-    EasyMock.expect(keyPredicate2.getLiteral()).andStubReturn("abc");
-    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
-    try {
-      EasyMock.expect(kpProperty1.getName()).andStubReturn(SAMPLE_DATA_FIELD1);
-      EasyMock.expect(kpProperty1.getType()).andStubReturn(EdmSimpleTypeKind.Int32.getEdmSimpleTypeInstance());
-      EasyMock.expect(kpProperty2.getName()).andStubReturn(SAMPLE_DATA_FIELD2);
-      EasyMock.expect(kpProperty2.getType()).andStubReturn(EdmSimpleTypeKind.String.getEdmSimpleTypeInstance());
-      EasyMock.expect(keyPredicate1.getProperty()).andStubReturn(kpProperty1);
-      EasyMock.expect(kpProperty1.getMapping()).andReturn(edmMapping);
-      EasyMock.expect(edmMapping.getInternalName()).andReturn(SAMPLE_DATA_FIELD1);
-      EasyMock.expect(keyPredicate2.getProperty()).andStubReturn(kpProperty2);
-      EasyMock.expect(kpProperty2.getMapping()).andReturn(edmMapping);
-    } catch (EdmException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    EasyMock.expect(edmMapping.getInternalName()).andReturn(SAMPLE_DATA_FIELD2);
-    EasyMock.replay(edmMapping);
-    EasyMock.replay(kpProperty1, keyPredicate1, kpProperty2, keyPredicate2);
-
-    ArrayList<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>();
-    keyPredicates.add(keyPredicate1);
-    keyPredicates.add(keyPredicate2);
-    String str = null;
-
-    try {
-      str = ODataExpressionParser.parseKeyPredicates(keyPredicates, TABLE_ALIAS);
-    } catch (ODataJPARuntimeException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-
-    assertEquals(EXPECTED_STR_8, str);
-  }
-
-  @Test
-  public void testParseToJPASelectExpression() {
-
-    ArrayList<String> selectedFields = new ArrayList<String>();
-    selectedFields.add("BuyerAddress");
-    selectedFields.add("BuyerName");
-    selectedFields.add("BuyerId");
-
-    assertEquals(EXPECTED_STR_9, ODataExpressionParser.parseToJPASelectExpression(TABLE_ALIAS, selectedFields));
-    assertEquals(TABLE_ALIAS, ODataExpressionParser.parseToJPASelectExpression(TABLE_ALIAS, null));
-
-    selectedFields.clear();
-    assertEquals(TABLE_ALIAS, ODataExpressionParser.parseToJPASelectExpression(TABLE_ALIAS, selectedFields));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1b479e6c/odata2-processor-jpa/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/ODataJPAContextImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-processor-jpa/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/ODataJPAContextImplTest.java b/odata2-processor-jpa/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/ODataJPAContextImplTest.java
deleted file mode 100644
index 10e65c0..0000000
--- a/odata2-processor-jpa/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/ODataJPAContextImplTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.processor.core.jpa;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.api.processor.ODataContext;
-import org.apache.olingo.odata2.api.processor.ODataProcessor;
-import org.apache.olingo.odata2.processor.api.jpa.ODataJPAContext;
-import org.apache.olingo.odata2.processor.core.jpa.edm.ODataJPAEdmProvider;
-import org.apache.olingo.odata2.processor.core.jpa.mock.ODataJPAContextMock;
-import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ODataJPAContextImplTest {
-
-  private ODataContext odataContext = null;
-  private ODataJPAContext odataJPAContext = null;
-  private EdmProvider edmProvider = null;
-  private EntityManagerFactory emf = null;
-  private EntityManager em = null;
-  private ODataProcessor processor = null;
-
-  @Before
-  public void setup() {
-
-    edmProvider = new ODataJPAEdmProvider();
-    emf = EasyMock.createMock(EntityManagerFactory.class);
-    em = EasyMock.createMock(EntityManager.class);
-    EasyMock.replay(em);
-
-    EasyMock.expect(emf.createEntityManager()).andStubReturn(em);
-    EasyMock.replay(emf);
-
-    odataContext = EasyMock.createMock(ODataContext.class);
-    List<Locale> listLocale = new ArrayList<Locale>();
-    listLocale.add(Locale.ENGLISH);
-    listLocale.add(Locale.GERMAN);
-
-    EasyMock.expect(odataContext.getAcceptableLanguages()).andStubReturn(listLocale);
-    EasyMock.replay(odataContext);
-
-    processor = EasyMock.createMock(ODataProcessor.class);
-    EasyMock.replay(processor);
-
-    odataJPAContext = new ODataJPAContextImpl();
-    odataJPAContext.setEdmProvider(edmProvider);
-    odataJPAContext.setEntityManagerFactory(emf);
-    odataJPAContext.setODataContext(odataContext);
-    odataJPAContext.setODataProcessor(processor);
-    odataJPAContext.setPersistenceUnitName(ODataJPAContextMock.PERSISTENCE_UNIT_NAME);
-    odataJPAContext.setJPAEdmMappingModel(ODataJPAContextMock.MAPPING_MODEL);
-  }
-
-  @Test
-  public void testgetMethodsOfODataJPAContext() {
-
-    assertEquals(odataJPAContext.getEdmProvider().hashCode(), edmProvider.hashCode());
-    assertEquals(odataJPAContext.getEntityManagerFactory().hashCode(), emf.hashCode());
-    assertEquals(odataJPAContext.getODataContext().hashCode(), odataContext.hashCode());
-    assertEquals(odataJPAContext.getODataProcessor().hashCode(), processor.hashCode());
-    assertEquals(odataJPAContext.getPersistenceUnitName(), ODataJPAContextMock.PERSISTENCE_UNIT_NAME);
-    assertEquals(odataJPAContext.getJPAEdmMappingModel(), ODataJPAContextMock.MAPPING_MODEL);
-
-    EntityManager em1 = odataJPAContext.getEntityManager();
-    EntityManager em2 = odataJPAContext.getEntityManager();
-    if (em1 != null && em2 != null) {
-      assertEquals(em1.hashCode(), em2.hashCode());
-    }
-
-  }
-
-}