Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 06D31200B62 for ; Thu, 28 Jul 2016 14:59:25 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 05537160A63; Thu, 28 Jul 2016 12:59:25 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4E77D160A85 for ; Thu, 28 Jul 2016 14:59:24 +0200 (CEST) Received: (qmail 46754 invoked by uid 500); 28 Jul 2016 12:59:23 -0000 Mailing-List: contact commits-help@olingo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@olingo.apache.org Delivered-To: mailing list commits@olingo.apache.org Received: (qmail 46731 invoked by uid 99); 28 Jul 2016 12:59:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2016 12:59:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5EBA5E0844; Thu, 28 Jul 2016 12:59:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chrisam@apache.org To: commits@olingo.apache.org Date: Thu, 28 Jul 2016 12:59:24 -0000 Message-Id: <8672b97d188245e28d86bebacdf954fa@git.apache.org> In-Reply-To: <92e8a60516b14e7ba0f09998f8335dc4@git.apache.org> References: <92e8a60516b14e7ba0f09998f8335dc4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] olingo-odata4 git commit: [OLINGO-964] Add test for new expand type cast handling archived-at: Thu, 28 Jul 2016 12:59:25 -0000 [OLINGO-964] Add test for new expand type cast handling Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/bde34e59 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/bde34e59 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/bde34e59 Branch: refs/heads/master Commit: bde34e597fee96e8288f496556bb272a572a13fd Parents: 8a10f47 Author: Christian Amend Authored: Thu Jul 28 14:53:44 2016 +0200 Committer: Christian Amend Committed: Thu Jul 28 14:53:44 2016 +0200 ---------------------------------------------------------------------- .../core/uri/parser/TestFullResourcePath.java | 17 +++++++++++++++-- .../core/uri/testutil/ResourceValidator.java | 6 ++++++ 2 files changed, 21 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bde34e59/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java ---------------------------------------------------------------------- diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java index d60e6c3..82335a3 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java @@ -2716,6 +2716,19 @@ public class TestFullResourcePath { .n() .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false); + testUri.run("ESKeyNav", "$expand=NavPropertyETTwoKeyNavMany/Namespace1_Alias.ETBaseTwoKeyNav" + + "($expand=NavPropertyETBaseTwoKeyNavOne)") + .isKind(UriInfoKind.resource) + .goExpand().goPath().first() + .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true) + .isType(EntityTypeProvider.nameETTwoKeyNav, true) + .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) + .goUpExpandValidator() + // go to the expand options of the current expand + .goExpand() + .goPath().first() + .isNavProperty("NavPropertyETBaseTwoKeyNavOne", EntityTypeProvider.nameETBaseTwoKeyNav, false); + testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref,NavPropertyETTwoKeyNavMany($skip=2;$top=1)") .isKind(UriInfoKind.resource) .goExpand().first() @@ -5848,9 +5861,9 @@ public class TestFullResourcePath { testFilter.runOnETKeyNavEx("PropertyInt16 gt @alias") .isInAliasToValueMap("@alias", null); testFilter.runOnETKeyNavEx("PropertyInt16 gt @alias&@alias=@alias") - .isInAliasToValueMap("@alias", "@alias"); + .isInAliasToValueMap("@alias", "@alias"); testFilter.runOnETKeyNavEx("@alias&@alias=@alias2&@alias2=true or @alias") - .isInAliasToValueMap("@alias", "@alias2"); + .isInAliasToValueMap("@alias", "@alias2"); } @Test http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bde34e59/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java ---------------------------------------------------------------------- diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java index 90ac68c..2bcdbc1 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java @@ -223,6 +223,9 @@ public class ResourceValidator implements TestValidator { // input parameter type may be null in order to assert that the singleTypeFilter is not set EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry(); + if(actualType == null && type != null){ + fail("Expected an entry type filter of type: " + type.getFullQualifiedNameAsString()); + } assertEquals(type, type == null ? actualType : actualType.getFullQualifiedName()); return this; @@ -235,6 +238,9 @@ public class ResourceValidator implements TestValidator { // input parameter type may be null in order to assert that the collectionTypeFilter is not set EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection(); + if(actualType == null && expectedType != null){ + fail("Expected an collection type filter of type: " + expectedType.getFullQualifiedNameAsString()); + } assertEquals(expectedType, expectedType == null || actualType == null ? actualType : actualType.getFullQualifiedName());