You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2016/08/12 12:35:55 UTC

olingo-odata4 git commit: [OLINGO-1004] Delete FilterFactoryTestITCase

Repository: olingo-odata4
Updated Branches:
  refs/heads/master 2def64edb -> deb1d2036


[OLINGO-1004] Delete FilterFactoryTestITCase

Duplicated in FilterSystemQueryITCase


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

Branch: refs/heads/master
Commit: deb1d2036f48a68e439a38dc2e636b48b49974b1
Parents: 2def64e
Author: Christian Amend <ch...@sap.com>
Authored: Fri Aug 12 14:34:37 2016 +0200
Committer: Christian Amend <ch...@sap.com>
Committed: Fri Aug 12 14:34:37 2016 +0200

----------------------------------------------------------------------
 .../fit/base/FilterFactoryTestITCase.java       | 62 --------------------
 .../tecsvc/client/FilterSystemQueryITCase.java  | 32 ++++++++++
 2 files changed, 32 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/deb1d203/fit/src/test/java/org/apache/olingo/fit/base/FilterFactoryTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/FilterFactoryTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/FilterFactoryTestITCase.java
deleted file mode 100644
index ccf97a0..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/base/FilterFactoryTestITCase.java
+++ /dev/null
@@ -1,62 +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.fit.base;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.uri.FilterArgFactory;
-import org.apache.olingo.client.api.uri.FilterFactory;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.api.uri.URIFilter;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.junit.Test;
-
-public class FilterFactoryTestITCase extends AbstractTestITCase {
-
-  private FilterFactory getFilterFactory() {
-    return getClient().getFilterFactory();
-  }
-
-  private FilterArgFactory getFilterArgFactory() {
-    return getFilterFactory().getArgFactory();
-  }
-
-  @Test
-  public void crossjoin() {
-    final URIFilter filter = getFilterFactory().eq(
-        getFilterArgFactory().property("Orders/OrderID"), getFilterArgFactory().property("Customers/Order"));
-
-    final URIBuilder uriBuilder =
-        client.newURIBuilder(testStaticServiceRootURL).appendCrossjoinSegment("Customers", "Orders").filter(filter);
-
-    final ODataEntitySetRequest<ClientEntitySet> req =
-        client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-    req.setFormat(ContentType.JSON_FULL_METADATA);
-
-    final ClientEntitySet feed = req.execute().getBody();
-    assertEquals(3, feed.getEntities().size());
-
-    for (ClientEntity entity : feed.getEntities()) {
-      assertEquals(2, entity.getNavigationLinks().size());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/deb1d203/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
index 9e3a4f5..17308d3 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
@@ -31,6 +31,10 @@ import org.apache.olingo.client.api.communication.response.ODataEntityCreateResp
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.uri.FilterArgFactory;
+import org.apache.olingo.client.api.uri.FilterFactory;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.URIFilter;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.http.HttpHeader;
 import org.apache.olingo.commons.api.http.HttpStatusCode;
@@ -44,6 +48,34 @@ public class FilterSystemQueryITCase extends AbstractParamTecSvcITCase {
   private static final String ES_ALL_PRIM = "ESAllPrim";
   private static final String ES_MIX_ENUM_DEF_COLL_COMP = "ESMixEnumDefCollComp";
 
+  
+  @Test
+  public void useFilterFactory() {
+    final URIFilter filter = getFilterFactory().eq(
+        getFilterArgFactory().property("PropertyInt16"), getFilterArgFactory().literal(new Integer(0)));
+
+    final URIBuilder uriBuilder =
+        getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).filter(filter);
+
+    final ODataEntitySetRequest<ClientEntitySet> req =
+        getClient().getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+
+    final ODataRetrieveResponse<ClientEntitySet> result = req.execute();
+    assertEquals(1, result.getBody().getEntities().size());
+
+    ClientEntity clientEntity = result.getBody().getEntities().get(0);
+    assertShortOrInt(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+  }
+  
+  private FilterFactory getFilterFactory() {
+    return getClient().getFilterFactory();
+  }
+
+  private FilterArgFactory getFilterArgFactory() {
+    return getFilterFactory().getArgFactory();
+  }
+
+  
   @Test
   public void timeOfDayLiteral() {
     ODataRetrieveResponse<ClientEntitySet> result = sendRequest(ES_ALL_PRIM, "PropertyTimeOfDay eq 03:26:05");