olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [39/51] [partial] Refactored project structure
Date Tue, 24 Sep 2013 12:43:06 GMT
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleStatementBuilderTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
deleted file mode 100644
index 9d2ed67..0000000
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
+++ /dev/null
@@ -1,142 +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.jpql;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-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.EdmMapping;
-import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmSimpleType;
-import org.apache.olingo.odata2.api.uri.KeyPredicate;
-import org.apache.olingo.odata2.processor.api.jpa.access.JPAJoinClause;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContextType;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLJoinSelectSingleContextView;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLStatement;
-import org.easymock.EasyMock;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class JPQLJoinSelectSingleStatementBuilderTest {
-  JPQLJoinSelectSingleContextView context = null;
-
-  @BeforeClass
-  public static void setUpBeforeClass() throws Exception {}
-
-  @AfterClass
-  public static void tearDownAfterClass() throws Exception {}
-
-  public void setUp(final List<JPAJoinClause> joinClauseList) throws Exception {
-    context = EasyMock.createMock(JPQLJoinSelectSingleContextView.class);
-    EasyMock.expect(context.getJPAEntityAlias()).andStubReturn("gt1");
-    EasyMock.expect(context.getJPAEntityName()).andStubReturn("SOHeader");
-    EasyMock.expect(context.getType()).andStubReturn(JPQLContextType.SELECT);
-    EasyMock.expect(context.getKeyPredicates()).andStubReturn(createKeyPredicates());
-    EasyMock.expect(context.getSelectExpression()).andStubReturn("gt1");
-    EasyMock.expect(context.getJPAJoinClauses()).andStubReturn(joinClauseList);
-    EasyMock.replay(context);
-  }
-
-  private List<JPAJoinClause> getJoinClauseList() {
-    List<JPAJoinClause> joinClauseList = new ArrayList<JPAJoinClause>();
-    JPAJoinClause jpaOuterJoinClause =
-        new JPAJoinClause("SOHeader", "soh", null, null, "soh.soId = 1", JPAJoinClause.JOIN.LEFT);
-    joinClauseList.add(jpaOuterJoinClause);
-    jpaOuterJoinClause =
-        new JPAJoinClause("SOHeader", "soh", "soItem", "soi", "soi.shId = soh.soId", JPAJoinClause.JOIN.LEFT);
-    joinClauseList.add(jpaOuterJoinClause);
-    jpaOuterJoinClause =
-        new JPAJoinClause("SOItem", "si", "material", "mat", "mat.id = 'abc'", JPAJoinClause.JOIN.LEFT);
-    joinClauseList.add(jpaOuterJoinClause);
-    return joinClauseList;
-  }
-
-  @After
-  public void tearDown() throws Exception {}
-
-  @Test
-  public void testBuild() throws Exception {
-    setUp(getJoinClauseList());
-    JPQLJoinSelectSingleStatementBuilder jpqlJoinSelectsingleStatementBuilder =
-        new JPQLJoinSelectSingleStatementBuilder(context);
-    try {
-      JPQLStatement jpqlStatement = jpqlJoinSelectsingleStatementBuilder.build();
-      assertEquals(
-          "SELECT gt1 FROM SOHeader soh JOIN soh.soItem soi JOIN soi.material mat WHERE soh.soId = 1 AND " +
-          "soi.shId = soh.soId AND mat.id = 'abc'",
-          jpqlStatement.toString());
-    } catch (ODataJPARuntimeException e) {
-      fail("Should not have come here");
-    }
-
-  }
-
-  private List<KeyPredicate> createKeyPredicates() throws EdmException {
-    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
-    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
-    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
-    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
-    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soid");
-    EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
-    EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
-    EasyMock.expect(edmProperty.getType()).andStubReturn(edmType);
-    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(edmProperty);
-
-    EasyMock.replay(edmType, edmMapping, edmProperty, keyPredicate);
-    List<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>();
-    keyPredicates.add(keyPredicate);
-    return keyPredicates;
-  }
-
-  @Test
-  public void testJoinClauseAsNull() throws Exception {
-    setUp(null);
-    JPQLJoinSelectSingleStatementBuilder jpqlJoinSelectsingleStatementBuilder =
-        new JPQLJoinSelectSingleStatementBuilder(context);
-    try {
-      jpqlJoinSelectsingleStatementBuilder.build();
-      fail("Should not have come here");
-    } catch (ODataJPARuntimeException e) {
-      assertTrue(true);
-    }
-  }
-
-  @Test
-  public void testJoinClauseListAsEmpty() throws Exception {
-    List<JPAJoinClause> joinClauseList = new ArrayList<JPAJoinClause>();
-    setUp(joinClauseList);
-    JPQLJoinSelectSingleStatementBuilder jpqlJoinSelectsingleStatementBuilder =
-        new JPQLJoinSelectSingleStatementBuilder(context);
-    try {
-      jpqlJoinSelectsingleStatementBuilder.build();
-      fail("Should not have come here");
-    } catch (ODataJPARuntimeException e) {
-      assertTrue(true);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinStatementBuilderTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinStatementBuilderTest.java
deleted file mode 100644
index 14300bc..0000000
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinStatementBuilderTest.java
+++ /dev/null
@@ -1,121 +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.jpql;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.olingo.odata2.processor.api.jpa.access.JPAJoinClause;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContextType;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLJoinContextView;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLStatement;
-import org.easymock.EasyMock;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class JPQLJoinStatementBuilderTest {
-  JPQLJoinContextView context = null;
-
-  @BeforeClass
-  public static void setUpBeforeClass() throws Exception {}
-
-  @AfterClass
-  public static void tearDownAfterClass() throws Exception {}
-
-  public void setUp(final List<JPAJoinClause> joinClauseList) throws Exception {
-    context = EasyMock.createMock(JPQLJoinContextView.class);
-    EasyMock.expect(context.getJPAEntityAlias()).andStubReturn("mat");
-    EasyMock.expect(context.getJPAEntityName()).andStubReturn("SOHeader");
-    EasyMock.expect(context.getType()).andStubReturn(JPQLContextType.SELECT);
-    EasyMock.expect(context.getSelectExpression()).andStubReturn("mat");
-    EasyMock.expect(context.getWhereExpression()).andStubReturn("soh.buyerId = 2");
-    HashMap<String, String> orderByMap = new HashMap<String, String>();
-    orderByMap.put("mat.buyerId", "asc");
-    orderByMap.put("mat.city", "desc");
-    EasyMock.expect(context.getOrderByCollection()).andStubReturn(orderByMap);
-    EasyMock.expect(context.getJPAJoinClauses()).andStubReturn(joinClauseList);
-    EasyMock.replay(context);
-  }
-
-  private List<JPAJoinClause> getJoinClauseList() {
-    List<JPAJoinClause> joinClauseList = new ArrayList<JPAJoinClause>();
-    JPAJoinClause jpaOuterJoinClause =
-        new JPAJoinClause("SOHeader", "soh", null, null, "soh.createdBy = 'Peter'", JPAJoinClause.JOIN.LEFT);
-    joinClauseList.add(jpaOuterJoinClause);
-    jpaOuterJoinClause =
-        new JPAJoinClause("SOHeader", "soh", "soItem", "soi", "soi.shId = soh.soId", JPAJoinClause.JOIN.LEFT);
-    joinClauseList.add(jpaOuterJoinClause);
-    jpaOuterJoinClause =
-        new JPAJoinClause("SOItem", "si", "material", "mat", "mat.id = 'abc'", JPAJoinClause.JOIN.LEFT);
-    joinClauseList.add(jpaOuterJoinClause);
-    return joinClauseList;
-  }
-
-  @After
-  public void tearDown() throws Exception {}
-
-  @Test
-  public void testBuild() throws Exception {
-    setUp(getJoinClauseList());
-    JPQLJoinStatementBuilder jpqlJoinStatementBuilder = new JPQLJoinStatementBuilder(context);
-    try {
-      JPQLStatement jpqlStatement = jpqlJoinStatementBuilder.build();
-      assertEquals(
-          "SELECT mat FROM SOHeader soh JOIN soh.soItem soi JOIN soi.material mat WHERE soh.buyerId = 2 AND " +
-          "soh.createdBy = 'Peter' AND soi.shId = soh.soId AND mat.id = 'abc' ORDER BY mat.buyerId asc , mat.city desc",
-          jpqlStatement.toString());
-    } catch (ODataJPARuntimeException e) {
-      fail("Should not have come here");
-    }
-
-  }
-
-  @Test
-  public void testJoinClauseAsNull() throws Exception {
-    setUp(null);
-    JPQLJoinStatementBuilder jpqlJoinStatementBuilder = new JPQLJoinStatementBuilder(context);
-    try {
-      jpqlJoinStatementBuilder.build();
-      fail("Should not have come here");
-    } catch (ODataJPARuntimeException e) {
-      assertTrue(true);
-    }
-  }
-
-  @Test
-  public void testJoinClauseListAsEmpty() throws Exception {
-    setUp(new ArrayList<JPAJoinClause>());
-    JPQLJoinStatementBuilder jpqlJoinStatementBuilder = new JPQLJoinStatementBuilder(context);
-    try {
-      jpqlJoinStatementBuilder.build();
-      fail("Should not have come here");
-    } catch (ODataJPARuntimeException e) {
-      assertTrue(true);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectContextImplTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectContextImplTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectContextImplTest.java
deleted file mode 100644
index 817d8d3..0000000
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectContextImplTest.java
+++ /dev/null
@@ -1,385 +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.jpql;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-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.edm.EdmMapping;
-import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmType;
-import org.apache.olingo.odata2.api.uri.KeyPredicate;
-import org.apache.olingo.odata2.api.uri.SelectItem;
-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.OrderByExpression;
-import org.apache.olingo.odata2.api.uri.expression.OrderExpression;
-import org.apache.olingo.odata2.api.uri.expression.PropertyExpression;
-import org.apache.olingo.odata2.api.uri.expression.SortOrder;
-import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
-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.jpql.JPQLContext;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContextType;
-import org.apache.olingo.odata2.processor.core.jpa.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.processor.core.jpa.jpql.JPQLSelectContext.JPQLSelectContextBuilder;
-import org.easymock.EasyMock;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class JPQLSelectContextImplTest {
-
-  private static String entityTypeName = "MockEntity";
-  private static String[] fields = { "Field1", "Field2" };
-  private static List<KeyPredicate> keyPredicates;
-  private static SortOrder[] orderType = { SortOrder.asc, SortOrder.desc };
-
-  private static JPQLSelectContextBuilder builder;
-  private static JPQLSelectContext selectContext;
-
-  @BeforeClass
-  public static void setup() {
-
-  }
-
-  private void buildSelectContext(final boolean orderByIsNull, final boolean selectFieldsIsNull,
-      final boolean filterIsNull, final boolean isTopNull, final boolean isSkipNull) {
-    builder = null;
-    selectContext = null;
-    keyPredicates = new ArrayList<KeyPredicate>();
-    GetEntitySetUriInfo resultsView = EasyMock.createMock(GetEntitySetUriInfo.class);
-
-    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
-    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
-    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
-    EdmProperty kpProperty = EasyMock.createMock(EdmProperty.class);
-    EdmType edmType1 = EasyMock.createMock(EdmType.class);
-    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
-    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
-    try {
-      EasyMock.expect(mapping.getInternalName()).andStubReturn("Field1");
-      EasyMock.expect(kpProperty.getMapping()).andStubReturn(mapping);
-      EasyMock.expect(kpProperty.getType()).andStubReturn(edmType1);
-
-    } catch (EdmException e2) {
-      fail("this should not happen");
-    }
-    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(kpProperty);
-    EasyMock.replay(mapping, edmType1, kpProperty, keyPredicate);
-    keyPredicates.add(keyPredicate);
-    int i = 0;
-    List<OrderExpression> orderList = new ArrayList<OrderExpression>(2);
-    do {
-
-      EdmType edmType = EasyMock.createMock(EdmType.class);
-      try {
-        EasyMock.expect(edmType.getName()).andStubReturn(fields[i]);
-        EasyMock.replay(edmType);
-      } catch (EdmException e2) {
-        fail("Exception not Expected");
-      }
-
-      PropertyExpression commonExpression = EasyMock.createMock(PropertyExpression.class);
-      EasyMock.expect(commonExpression.getEdmType()).andStubReturn(edmType);
-
-      EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);
-      EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
-      EasyMock.expect(edmMapping.getInternalName()).andStubReturn(fields[i]);
-      try {
-        EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
-      } catch (EdmException e) {
-        // TODO Auto-generated catch block
-        e.printStackTrace();
-      }
-      EasyMock.expect(commonExpression.getEdmProperty()).andStubReturn(edmTyped);
-      OrderExpression order = EasyMock.createMock(OrderExpression.class);
-      EasyMock.expect(order.getExpression()).andStubReturn(commonExpression);
-      EasyMock.expect(order.getSortOrder()).andStubReturn(orderType[i]);
-      EasyMock.replay(edmMapping, edmTyped, commonExpression);
-      EasyMock.replay(order);
-
-      orderList.add(order);
-
-    } while (++i < 2);
-
-    OrderByExpression orderBy = EasyMock.createMock(OrderByExpression.class);
-    EasyMock.expect(orderBy.getOrders()).andStubReturn(orderList);
-    EasyMock.replay(orderBy);
-
-    try {
-      i = 0;
-      List<SelectItem> selectItemList = new ArrayList<SelectItem>(2);
-      do {
-        EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
-        EasyMock.expect(edmMapping.getInternalName()).andStubReturn(fields[i]);
-        EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
-        EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
-        EasyMock.replay(edmMapping, edmProperty);
-
-        SelectItem selectItem = EasyMock.createMock(SelectItem.class);
-        EasyMock.expect(selectItem.getProperty()).andStubReturn(edmProperty);
-        EasyMock.replay(selectItem);
-
-        selectItemList.add(selectItem);
-
-      } while (++i < 2);
-      EasyMock.expect(entityType.getMapping()).andStubReturn(null);
-      EasyMock.expect(entityType.getName()).andStubReturn(entityTypeName);
-      EasyMock.expect(entityType.getKeyProperties()).andStubReturn(getLocalKeyProperties());
-
-      EasyMock.replay(entityType);
-      EasyMock.expect(entitySet.getEntityType()).andStubReturn(entityType);
-      EasyMock.replay(entitySet);
-
-      EasyMock.expect(resultsView.getTargetEntitySet()).andStubReturn(entitySet);
-      if (orderByIsNull) {
-        EasyMock.expect(resultsView.getOrderBy()).andStubReturn(null);
-      } else {
-        EasyMock.expect(resultsView.getOrderBy()).andStubReturn(orderBy);
-      }
-      if (selectFieldsIsNull) {
-        EasyMock.expect(resultsView.getSelect()).andStubReturn(null);
-      } else {
-        EasyMock.expect(resultsView.getSelect()).andStubReturn(selectItemList);
-      }
-      // FilterExpression filterExpression =
-      // EasyMock.createMock(FilterExpression.class);
-      // EasyMock.expect(filterExpression.g)
-      if (filterIsNull) {
-        EasyMock.expect(resultsView.getFilter()).andStubReturn(null);
-      } else {
-        EasyMock.expect(resultsView.getFilter()).andStubReturn(
-            getFilterExpressionMockedObj(ExpressionKind.PROPERTY, "SalesOrder"));
-      }
-      if (isTopNull) {
-        EasyMock.expect(resultsView.getTop()).andStubReturn(null);
-      } else {
-        EasyMock.expect(resultsView.getTop()).andStubReturn(10);
-      }
-      if (isSkipNull) {
-        EasyMock.expect(resultsView.getSkip()).andStubReturn(null);
-      } else {
-        EasyMock.expect(resultsView.getSkip()).andStubReturn(0);
-      }
-      EasyMock.expect(resultsView.getKeyPredicates()).andStubReturn(keyPredicates);
-      EasyMock.replay(resultsView);
-
-    } catch (EdmException e1) {
-      fail("Exception not Expected");
-    }
-    try {
-      builder = (JPQLSelectContextBuilder) JPQLContext.createBuilder(JPQLContextType.SELECT, resultsView);
-
-      selectContext = (JPQLSelectContext) builder.build();
-    } catch (ODataJPAModelException e) {
-      fail("Exception not Expected");
-    } catch (ODataJPARuntimeException e) {
-      fail("Runtime Exception thrown");
-    }
-  }
-
-  private List<EdmProperty> getLocalKeyProperties() {
-    List<EdmProperty> propertyList = new ArrayList<EdmProperty>();
-    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
-    try {
-      EasyMock.expect(edmProperty.getName()).andStubReturn("Field1");
-      EasyMock.expect(edmProperty.getMapping()).andStubReturn(null);
-    } catch (EdmException e) {
-      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
-    }
-    EasyMock.replay(edmProperty);
-    propertyList.add(edmProperty);
-    return propertyList;
-  }
-
-  @Test
-  public void testEntityNameThrowingException() {
-    // buildSelectContext(false, false, false);
-    GetEntitySetUriInfo resultsView = EasyMock.createMock(GetEntitySetUriInfo.class);
-
-    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
-    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
-
-    try {
-      EasyMock.expect(entityType.getName()).andStubThrow(new EdmException(null));
-      EasyMock.expect(entitySet.getEntityType()).andStubThrow(new EdmException(null));
-    } catch (EdmException e1) {
-      // throw new ODataException();
-    }
-
-    EasyMock.replay(entityType);
-    EasyMock.replay(entitySet);
-
-    EasyMock.expect(resultsView.getTargetEntitySet()).andStubReturn(entitySet);
-    EasyMock.expect(resultsView.getOrderBy()).andStubReturn(null);
-    EasyMock.expect(resultsView.getSelect()).andStubReturn(null);
-    EasyMock.expect(resultsView.getFilter()).andStubReturn(null);
-    EasyMock.replay(resultsView);
-    try {
-      JPQLSelectContextBuilder builder1 =
-          (JPQLSelectContextBuilder) JPQLContext.createBuilder(JPQLContextType.SELECT, resultsView);
-
-      builder1.build();
-      fail("Should not come here");
-    } catch (ODataJPAModelException e) {
-      fail();
-    } catch (ODataJPARuntimeException e) {
-      assertTrue(true);
-    }
-  }
-
-  @Test
-  public void testSelectFieldsAsNull() {
-    buildSelectContext(false, true, true, true, true);
-
-    try {
-      selectContext = (JPQLSelectContext) builder.build();
-      assertEquals("E2", selectContext.getSelectExpression());
-    } catch (ODataJPAModelException e) {
-      fail();
-    } catch (ODataJPARuntimeException e) {
-      fail();
-    }
-  }
-
-  @Test
-  public void testGetOrderByCollection() {
-    buildSelectContext(false, false, true, true, true);
-    assertEquals(true, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[0]));
-    assertEquals("", selectContext.getOrderByCollection().get("E1." + JPQLSelectContextImplTest.fields[0]));
-
-    assertEquals(true, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[1]));
-    assertEquals("DESC", selectContext.getOrderByCollection().get("E1." + JPQLSelectContextImplTest.fields[1]));
-  }
-
-  @Test
-  public void testGetWhereExpression() {
-    buildSelectContext(false, false, true, true, true);
-    // fail("Not yet implemented");
-  }
-
-  @Test
-  public void testGetJPAEntityName() {
-    buildSelectContext(false, false, true, true, true);
-    assertEquals(JPQLSelectContextImplTest.entityTypeName, selectContext.getJPAEntityName());
-  }
-
-  @Test
-  public void testGetType() {
-    buildSelectContext(false, false, true, true, true);
-    assertEquals(JPQLContextType.SELECT, selectContext.getType());
-  }
-
-  @Test
-  public void testCreateBuilder() {
-    buildSelectContext(false, false, true, true, true);
-    assertEquals(JPQLSelectContextBuilder.class.toString(), builder.getClass().toString());
-  }
-
-  @Test
-  public void testEntitySetAsNull() {
-    buildSelectContext(false, false, true, true, true);
-    try {
-      JPQLSelectContextBuilder builder =
-          (JPQLSelectContextBuilder) JPQLContext.createBuilder(JPQLContextType.SELECT, null);
-
-      JPQLSelectContext selectContext1 = (JPQLSelectContext) builder.build();
-      assertNull(selectContext1.getJPAEntityAlias());
-      assertNull(selectContext1.getJPAEntityName());
-      assertNull(selectContext1.getOrderByCollection());
-      assertNull(selectContext1.getSelectExpression());
-      assertNull(selectContext1.getType());
-      assertNull(selectContext1.getWhereExpression());
-    } catch (ODataJPAModelException e) {
-      fail("Exception not Expected");
-    } catch (ODataJPARuntimeException e) {
-      fail("Runtime Exception thrown");
-    }
-  }
-
-  @Test
-  public void testOrderingWithSkip() {
-    buildSelectContext(true, false, true, true, false);
-    assertEquals(true, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[0]));
-    assertEquals("", selectContext.getOrderByCollection().get("E1." + JPQLSelectContextImplTest.fields[0]));
-
-    assertEquals(false, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[1]));
-
-  }
-
-  @Test
-  public void testOrderingWithTop() {
-    buildSelectContext(true, false, true, false, true);
-    assertEquals(true, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[0]));
-    assertEquals("", selectContext.getOrderByCollection().get("E1." + JPQLSelectContextImplTest.fields[0]));
-
-    assertEquals(false, selectContext.getOrderByCollection().containsKey("E1." + JPQLSelectContextImplTest.fields[1]));
-
-  }
-
-  @Test
-  public void testOrderByTopSkipAsNull() {
-    buildSelectContext(true, true, true, true, true);
-    assertNull(selectContext.getOrderByCollection());
-  }
-
-  @Test
-  public void testFilter() {
-    buildSelectContext(true, false, false, false, false);
-    assertEquals("E1.field", selectContext.whereCondition);
-
-  }
-
-  private FilterExpression getFilterExpressionMockedObj(final ExpressionKind leftOperandExpKind,
-      final String propertyName) throws EdmException {
-    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 PropertyExpression getPropertyExpressionMockedObj(final ExpressionKind expKind, final String propertyName) {
-    PropertyExpression leftOperandPropertyExpresion = EasyMock.createMock(PropertyExpression.class);
-    EasyMock.expect(leftOperandPropertyExpresion.getKind()).andReturn(ExpressionKind.PROPERTY);
-    EasyMock.expect(leftOperandPropertyExpresion.getPropertyName()).andReturn(propertyName);
-    EdmProperty edmtTyped = EasyMock.createMock(EdmProperty.class);
-    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
-    EasyMock.expect(mapping.getInternalName()).andStubReturn("field");
-    try {
-      EasyMock.expect(edmtTyped.getMapping()).andStubReturn(mapping);
-    } catch (EdmException e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-    EasyMock.expect(leftOperandPropertyExpresion.getEdmProperty()).andReturn(edmtTyped);
-    EasyMock.replay(mapping, edmtTyped, leftOperandPropertyExpresion);
-    return leftOperandPropertyExpresion;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleContextImplTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleContextImplTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleContextImplTest.java
deleted file mode 100644
index 841ff5a..0000000
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleContextImplTest.java
+++ /dev/null
@@ -1,198 +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.jpql;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-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.edm.EdmMapping;
-import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmType;
-import org.apache.olingo.odata2.api.uri.KeyPredicate;
-import org.apache.olingo.odata2.api.uri.SelectItem;
-import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
-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.jpql.JPQLContext;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContextType;
-import org.apache.olingo.odata2.processor.core.jpa.jpql.JPQLSelectSingleContext.JPQLSelectSingleContextBuilder;
-import org.easymock.EasyMock;
-import org.junit.Test;
-
-public class JPQLSelectSingleContextImplTest {
-
-  private static String entityTypeName = "MockEntity";
-  private static String[] fields = { "Field1", "Field2" };
-  private static List<KeyPredicate> keyPredicates;
-
-  private static JPQLSelectSingleContextBuilder builder;
-  private static JPQLSelectSingleContext selectContext;
-
-  private void buildContextBuilder(final boolean isSelectNull) {
-    builder = null;
-    selectContext = null;
-    keyPredicates = new ArrayList<KeyPredicate>();
-    GetEntityUriInfo resultsView = EasyMock.createMock(GetEntityUriInfo.class);
-
-    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
-    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
-
-    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
-    EdmProperty kpProperty = EasyMock.createMock(EdmProperty.class);
-    EdmType edmType = EasyMock.createMock(EdmType.class);
-    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
-    try {
-      EasyMock.expect(kpProperty.getName()).andStubReturn("Field1");
-      EasyMock.expect(kpProperty.getType()).andStubReturn(edmType);
-
-    } catch (EdmException e2) {
-      fail("this should not happen");
-    }
-    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(kpProperty);
-    EasyMock.replay(edmType, kpProperty, keyPredicate);
-    keyPredicates.add(keyPredicate);
-    int i = 0;
-    try {
-
-      List<SelectItem> selectItemList = new ArrayList<SelectItem>(2);
-      do {
-        EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
-        EasyMock.expect(edmMapping.getInternalName()).andStubReturn(fields[i]);
-        EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
-        EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
-        EasyMock.replay(edmMapping, edmProperty);
-
-        SelectItem selectItem = EasyMock.createMock(SelectItem.class);
-        EasyMock.expect(selectItem.getProperty()).andStubReturn(edmProperty);
-        EasyMock.replay(selectItem);
-
-        selectItemList.add(selectItem);
-
-      } while (++i < 2);
-
-      EasyMock.expect(entityType.getMapping()).andStubReturn(null);
-      EasyMock.expect(entityType.getName()).andStubReturn(entityTypeName);
-      EasyMock.replay(entityType);
-      EasyMock.expect(entitySet.getEntityType()).andStubReturn(entityType);
-      EasyMock.replay(entitySet);
-
-      EasyMock.expect(resultsView.getTargetEntitySet()).andStubReturn(entitySet);
-      if (isSelectNull) {
-        selectItemList = null;
-      }
-      EasyMock.expect(resultsView.getSelect()).andStubReturn(selectItemList);
-      ArrayList<KeyPredicate> arrayList = new ArrayList<KeyPredicate>();
-      arrayList.add(keyPredicate);
-      EasyMock.expect(resultsView.getKeyPredicates()).andStubReturn(arrayList);
-      EasyMock.replay(resultsView);
-
-    } catch (EdmException e1) {
-      fail("Exception not Expected");
-    }
-    try {
-      builder = (JPQLSelectSingleContextBuilder) JPQLContext.createBuilder(JPQLContextType.SELECT_SINGLE, resultsView);
-
-      selectContext = (JPQLSelectSingleContext) builder.build();
-    } catch (ODataJPAModelException e) {
-      fail("Exception not Expected");
-    } catch (ODataJPARuntimeException e) {
-      fail("Runtime Exception thrown");
-    }
-  }
-
-  @Test
-  public void testEntityNameThrowingException() {
-    // buildSelectContext(false, false, false);
-    GetEntityUriInfo resultsView = EasyMock.createMock(GetEntityUriInfo.class);
-
-    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
-    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
-
-    try {
-      EasyMock.expect(entityType.getName()).andStubThrow(new EdmException(null));
-      EasyMock.expect(entitySet.getEntityType()).andStubThrow(new EdmException(null));
-    } catch (EdmException e1) {
-      // throw new ODataException();
-    }
-
-    EasyMock.replay(entityType);
-    EasyMock.replay(entitySet);
-
-    EasyMock.expect(resultsView.getTargetEntitySet()).andStubReturn(entitySet);
-    EasyMock.expect(resultsView.getSelect()).andStubReturn(null);
-    EasyMock.expect(resultsView.getFilter()).andStubReturn(null);
-    EasyMock.replay(resultsView);
-    try {
-      JPQLSelectSingleContextBuilder builder1 =
-          (JPQLSelectSingleContextBuilder) JPQLContext.createBuilder(JPQLContextType.SELECT_SINGLE, resultsView);
-      builder1.build();
-      fail("Should not come here");
-    } catch (ODataJPAModelException e) {
-      fail();
-    } catch (ODataJPARuntimeException e) {
-      assertTrue(true);
-    }
-  }
-
-  @Test
-  public void testSlectedFieldsAsNull() {
-    buildContextBuilder(true);
-    try {
-      selectContext = (JPQLSelectSingleContext) builder.build();
-      assertEquals("E2", selectContext.getSelectExpression());
-    } catch (ODataJPAModelException e) {
-      fail();
-    } catch (ODataJPARuntimeException e) {
-      fail();
-    }
-  }
-
-  @Test
-  public void getKeyPredicates() {
-    buildContextBuilder(false);
-    assertEquals(keyPredicates.size(), selectContext.getKeyPredicates().size());
-    assertEquals(keyPredicates, selectContext.getKeyPredicates());
-  }
-
-  @Test
-  public void testGetJPAEntityName() {
-    buildContextBuilder(false);
-    assertEquals(JPQLSelectSingleContextImplTest.entityTypeName, selectContext.getJPAEntityName());
-  }
-
-  @Test
-  public void testGetType() {
-    buildContextBuilder(false);
-    assertEquals(JPQLContextType.SELECT_SINGLE, selectContext.getType());
-  }
-
-  @Test
-  public void testCreateBuilder() {
-    buildContextBuilder(false);
-    assertEquals(JPQLSelectSingleContextBuilder.class.toString(), builder.getClass().toString());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleStatementBuilderTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleStatementBuilderTest.java
deleted file mode 100644
index c5d5f95..0000000
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleStatementBuilderTest.java
+++ /dev/null
@@ -1,123 +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.jpql;
-
-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.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.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmSimpleType;
-import org.apache.olingo.odata2.api.uri.KeyPredicate;
-import org.apache.olingo.odata2.api.uri.SelectItem;
-import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
-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.jpql.JPQLContext;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContext.JPQLContextBuilder;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContextType;
-import org.easymock.EasyMock;
-import org.junit.Before;
-import org.junit.Test;
-
-public class JPQLSelectSingleStatementBuilderTest {
-
-  /**
-   * @throws java.lang.Exception
-   */
-  private JPQLSelectSingleStatementBuilder JPQLSelectSingleStatementBuilder;
-
-  @Before
-  public void setUp() throws Exception {
-
-  }
-
-  private JPQLSelectSingleContext createSelectContext() throws ODataJPARuntimeException, EdmException {
-    // Object Instantiation
-
-    JPQLSelectSingleContext JPQLSelectSingleContextImpl = null;// new JPQLSelectSingleContextImpl();
-    GetEntityUriInfo getEntityView = EasyMock.createMock(GetEntityUriInfo.class);
-
-    EdmEntitySet edmEntitySet = EasyMock.createMock(EdmEntitySet.class);
-    EdmEntityType edmEntityType = EasyMock.createMock(EdmEntityType.class);
-    List<SelectItem> selectItemList = null;
-
-    // Setting up the expected value
-    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
-    EdmProperty kpProperty = EasyMock.createMock(EdmProperty.class);
-    EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
-    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
-    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("Field1");
-    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
-    try {
-      EasyMock.expect(kpProperty.getName()).andStubReturn("Field1");
-      EasyMock.expect(kpProperty.getType()).andStubReturn(edmType);
-
-      EasyMock.expect(kpProperty.getMapping()).andStubReturn(edmMapping);
-
-    } catch (EdmException e2) {
-      fail("this should not happen");
-    }
-    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(kpProperty);
-    EasyMock.replay(edmMapping, edmType, kpProperty, keyPredicate);
-    EasyMock.expect(getEntityView.getTargetEntitySet()).andStubReturn(edmEntitySet);
-    EasyMock.expect(getEntityView.getSelect()).andStubReturn(selectItemList);
-
-    EasyMock.expect(edmEntitySet.getEntityType()).andStubReturn(edmEntityType);
-    EasyMock.replay(edmEntitySet);
-    EasyMock.expect(edmEntityType.getMapping()).andStubReturn(null);
-    EasyMock.expect(edmEntityType.getName()).andStubReturn("SalesOrderHeader");
-    EasyMock.replay(edmEntityType);
-    ArrayList<KeyPredicate> arrayList = new ArrayList<KeyPredicate>();
-    arrayList.add(keyPredicate);
-    EasyMock.expect(getEntityView.getKeyPredicates()).andStubReturn(arrayList);
-    EasyMock.replay(getEntityView);
-
-    JPQLContextBuilder contextBuilder1 = JPQLContext.createBuilder(JPQLContextType.SELECT_SINGLE, getEntityView);
-    try {
-      JPQLSelectSingleContextImpl = (JPQLSelectSingleContext) contextBuilder1.build();
-    } catch (ODataJPAModelException e) {
-      fail("Model Exception thrown");
-    }
-
-    return JPQLSelectSingleContextImpl;
-  }
-
-  /**
-   * Test method for {@link org.apache.olingo.odata2.processor.jpa.jpql.JPQLSelectSingleStatementBuilder#build)}.
-   * @throws EdmException
-   * @throws ODataJPARuntimeException
-   */
-
-  @Test
-  public void testBuildSimpleQuery() throws EdmException, ODataJPARuntimeException {
-    JPQLSelectSingleContext JPQLSelectSingleContextImpl = createSelectContext();
-    JPQLSelectSingleStatementBuilder = new JPQLSelectSingleStatementBuilder(JPQLSelectSingleContextImpl);
-
-    assertEquals("SELECT E1 FROM SalesOrderHeader E1 WHERE E1.Field1 = 1", JPQLSelectSingleStatementBuilder.build()
-        .toString());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectStatementBuilderTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectStatementBuilderTest.java
deleted file mode 100644
index 2434809..0000000
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectStatementBuilderTest.java
+++ /dev/null
@@ -1,135 +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.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.processor.api.jpa.exception.ODataJPAModelException;
-import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContext;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContext.JPQLContextBuilder;
-import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContextType;
-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/57599da6/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/mock/ODataJPAContextMock.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/mock/ODataJPAContextMock.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/mock/ODataJPAContextMock.java
deleted file mode 100644
index 891aace..0000000
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/mock/ODataJPAContextMock.java
+++ /dev/null
@@ -1,56 +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.mock;
-
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.metamodel.Metamodel;
-
-import org.apache.olingo.odata2.processor.api.jpa.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.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/57599da6/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/mock/data/EdmMockUtil.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/mock/data/EdmMockUtil.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/mock/data/EdmMockUtil.java
deleted file mode 100644
index 57866e3..0000000
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/mock/data/EdmMockUtil.java
+++ /dev/null
@@ -1,337 +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.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.processor.core.jpa.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;
-  }
-
-}


Mime
View raw message