olingo-commits mailing list archives

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

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

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/7ab8cd93/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
index 5fdeece..d7dfc2d 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAServiceFactoryMock.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata2.jpa.processor.core.mock;
-
-import org.apache.olingo.odata2.api.processor.ODataContext;
-import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
-import org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory;
-import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-
-public class ODataJPAServiceFactoryMock extends ODataJPAServiceFactory {
-  private ODataContext context = null;
-
-  public ODataJPAServiceFactoryMock(final ODataContext context) {
-    this.context = context;
-  }
-
-  @Override
-  public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
-    ODataJPAContext oDataJPAContext = null;
-    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
-    setOnWriteJPAContent(new OnJPAWriteContentMock());
-    return oDataJPAContext;
-  }
-
-  public ODataJPAContext initializeODataJPAContextX() throws ODataJPARuntimeException {
-    ODataJPAContext oDataJPAContext = null;
-    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
-    setOnWriteJPAContent(null);
-    return oDataJPAContext;
-  }
-}
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.mock;
+
+import org.apache.olingo.odata2.api.processor.ODataContext;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+
+public class ODataJPAServiceFactoryMock extends ODataJPAServiceFactory {
+  private ODataContext context = null;
+
+  public ODataJPAServiceFactoryMock(final ODataContext context) {
+    this.context = context;
+  }
+
+  @Override
+  public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException {
+    ODataJPAContext oDataJPAContext = null;
+    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
+    setOnWriteJPAContent(new OnJPAWriteContentMock());
+    return oDataJPAContext;
+  }
+
+  public ODataJPAContext initializeODataJPAContextX() throws ODataJPARuntimeException {
+    ODataJPAContext oDataJPAContext = null;
+    oDataJPAContext = ODataJPAContextMock.mockODataJPAContext(context);
+    setOnWriteJPAContent(null);
+    return oDataJPAContext;
+  }
+}

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

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

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

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


Mime
View raw message