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/01/12 15:19:20 UTC

[1/5] olingo-odata4 git commit: [OLINGO-834] URI parser shall not ignore empty path segments

Repository: olingo-odata4
Updated Branches:
  refs/heads/master b0866014d -> 3295bcc06


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestUriParserImpl.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestUriParserImpl.java
new file mode 100644
index 0000000..fa7a0df
--- /dev/null
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestUriParserImpl.java
@@ -0,0 +1,1046 @@
+/*
+ * 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.server.core.uri.parser;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.apache.olingo.server.api.uri.UriInfoKind;
+import org.apache.olingo.server.api.uri.UriResourceKind;
+import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
+import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
+import org.apache.olingo.server.core.uri.testutil.FilterValidator;
+import org.apache.olingo.server.core.uri.testutil.ResourceValidator;
+import org.apache.olingo.server.core.uri.testutil.TestUriValidator;
+import org.apache.olingo.server.core.uri.validator.UriValidationException;
+import org.apache.olingo.server.tecsvc.provider.ActionProvider;
+import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider;
+import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
+import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
+import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
+import org.apache.olingo.server.tecsvc.provider.PropertyProvider;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class TestUriParserImpl {
+  private final Edm edm = OData.newInstance().createServiceMetadata(
+      new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
+  private final TestUriValidator testUri = new TestUriValidator().setEdm(edm);
+  private final ResourceValidator testRes = new ResourceValidator().setEdm(edm);
+  private final FilterValidator testFilter = new FilterValidator().setEdm(edm);
+
+  private final String PropertyBoolean = "PropertyBoolean=true";
+  private final String PropertyByte = "PropertyByte=1";
+  private final String PropertyDate = "PropertyDate=2013-09-25";
+  private final String PropertyDateTimeOffset = "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00";
+  private final String PropertyDecimal = "PropertyDecimal=12";
+  private final String PropertyDuration = "PropertyDuration=duration'P50903316DT2H25M4S'";
+  private final String PropertyGuid = "PropertyGuid=12345678-1234-1234-1234-123456789012";
+  private final String PropertyInt16 = "PropertyInt16=1";
+  private final String PropertyInt32 = "PropertyInt32=12";
+  private final String PropertyInt64 = "PropertyInt64=64";
+  private final String PropertySByte = "PropertySByte=1";
+  private final String PropertyString = "PropertyString='ABC'";
+  private final String PropertyTimeOfDay = "PropertyTimeOfDay=12:34:55";
+
+  private final String allKeys = PropertyString + "," + PropertyInt16 + "," + PropertyBoolean + "," + PropertyByte
+      + "," + PropertySByte + "," + PropertyInt32 + "," + PropertyInt64 + "," + PropertyDecimal + "," + PropertyDate
+      + "," + PropertyDateTimeOffset + "," + PropertyDuration + "," + PropertyGuid + "," + PropertyTimeOfDay;
+
+  @Test
+  public void boundFunctionImport_VarParameters() {
+    // no input
+    testRes.run("ESKeyNav(1)/olingo.odata.test1.BFCETKeyNavRTETKeyNav()")
+    .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
+    .at(1).isUriPathInfoKind(UriResourceKind.function);
+
+    // one input
+    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')")
+    .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
+    .at(1).isUriPathInfoKind(UriResourceKind.function)
+    .isParameter(0, "ParameterString", "'ABC'");
+
+    // two input
+    testRes.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
+    .at(0)
+    .isUriPathInfoKind(UriResourceKind.function)
+    .isParameter(0, "ParameterInt16", "1")
+    .isParameter(1, "ParameterString", "'2'");
+  }
+
+  @Test
+  public void functionBound_varReturnType() {
+    final String esTwoKeyNav = "ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')";
+
+    // returning primitive
+    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()")
+    .at(0)
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+    .at(1)
+    .isUriPathInfoKind(UriResourceKind.function)
+    .isType(PropertyProvider.nameString, false);
+
+    // returning collection of primitive
+    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()")
+    .at(0)
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+    .at(1)
+    .isUriPathInfoKind(UriResourceKind.function)
+    .isType(PropertyProvider.nameString, true);
+
+    // returning single complex
+    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()")
+    .at(0)
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+    .at(1)
+    .isUriPathInfoKind(UriResourceKind.function)
+    .isType(ComplexTypeProvider.nameCTTwoPrim, false);
+
+    // returning collection of complex
+    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
+    .at(0)
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+    .at(1)
+    .isUriPathInfoKind(UriResourceKind.function)
+    .isType(ComplexTypeProvider.nameCTTwoPrim, true);
+
+    // returning single entity
+    testRes.run(
+        esTwoKeyNav + "/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false);
+
+    // returning collection of entity (aka entitySet)
+    testRes.run(esTwoKeyNav + "/olingo.odata.test1.BFCSINavRTESTwoKeyNav()")
+    .at(0)
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+    .at(1)
+    .isUriPathInfoKind(UriResourceKind.function)
+    .isType(EntityTypeProvider.nameETTwoKeyNav, true);
+  }
+
+  @Test
+  public void actionImport_VarReturnType() {
+    testRes.run(ContainerProvider.AIRT_STRING).isKind(UriInfoKind.resource)
+    .first()
+    .isActionImport(ContainerProvider.AIRT_STRING)
+    .isAction(ActionProvider.nameUARTString.getName())
+    .isType(PropertyProvider.nameString, false);
+
+    testRes.run(ContainerProvider.AIRT_COLL_STRING_TWO_PARAM).isKind(UriInfoKind.resource)
+        .first()
+        .isActionImport(ContainerProvider.AIRT_COLL_STRING_TWO_PARAM)
+        .isAction(ActionProvider.nameUARTCollStringTwoParam.getName())
+        .isType(PropertyProvider.nameString, true);
+
+    testRes.run(ContainerProvider.AIRTCT_TWO_PRIM_PARAM).isKind(UriInfoKind.resource)
+    .first()
+    .isActionImport(ContainerProvider.AIRTCT_TWO_PRIM_PARAM)
+    .isAction(ActionProvider.nameUARTCTTwoPrimParam.getName())
+    .isType(ComplexTypeProvider.nameCTTwoPrim, false);
+
+    testRes.run(ContainerProvider.AIRT_COLL_CT_TWO_PRIM_PARAM).isKind(UriInfoKind.resource)
+    .first()
+    .isActionImport(ContainerProvider.AIRT_COLL_CT_TWO_PRIM_PARAM)
+    .isAction(ActionProvider.nameUARTCollCTTwoPrimParam.getName())
+    .isType(ComplexTypeProvider.nameCTTwoPrim, true);
+
+    testRes.run(ContainerProvider.AIRTET_TWO_KEY_TWO_PRIM_PARAM).isKind(UriInfoKind.resource)
+    .first()
+    .isActionImport(ContainerProvider.AIRTET_TWO_KEY_TWO_PRIM_PARAM)
+    .isAction(ActionProvider.nameUARTETTwoKeyTwoPrimParam.getName())
+    .isType(EntityTypeProvider.nameETTwoKeyTwoPrim, false);
+
+    testUri.runEx(ContainerProvider.AIRT_STRING + "/invalidElement")
+        .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
+  }
+
+  @Test
+  public void count() {
+    // count entity set
+    testRes.run("ESAllPrim/$count")
+    .at(0)
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETAllPrim, true)
+    .at(1)
+    .isUriPathInfoKind(UriResourceKind.count);
+
+    // count on collection of complex
+    testRes.run("ESKeyNav(1)/CollPropertyComp/$count")
+    .at(0)
+    .isType(EntityTypeProvider.nameETKeyNav)
+    .at(1)
+    .isType(ComplexTypeProvider.nameCTPrimComp, true)
+    .at(2)
+    .isUriPathInfoKind(UriResourceKind.count);
+
+    // count on collection of primitive
+    testRes.run("ESCollAllPrim(1)/CollPropertyString/$count")
+    .at(1)
+    .isType(PropertyProvider.nameString, true)
+    .at(2)
+    .isUriPathInfoKind(UriResourceKind.count);
+  }
+
+  @Test
+  public void crossJoin() throws Exception {
+    testUri.run("$crossjoin(ESAllKey)")
+    .isKind(UriInfoKind.crossjoin)
+    .isCrossJoinEntityList(Arrays.asList("ESAllKey"));
+
+    testUri.run("$crossjoin(ESAllKey,ESTwoPrim)")
+    .isKind(UriInfoKind.crossjoin)
+    .isCrossJoinEntityList(Arrays.asList("ESAllKey", "ESTwoPrim"));
+  }
+
+  @Test
+  public void entityFailOnValidation() throws Exception {
+    // simple entity set; with qualifiedentityTypeName; with filter
+    testUri.runEx("$entity/olingo.odata.test1.ETTwoPrim", "$filter=PropertyInt16 eq 123&$id=ESAllKey")
+        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+  }
+
+  @Test
+  public void entity() throws Exception {
+    // simple entity set
+    testUri.run("$entity", "$id=ESAllPrim").isKind(UriInfoKind.entityId)
+    .isKind(UriInfoKind.entityId)
+    .isIdText("ESAllPrim");
+
+    // simple entity set; $format before $id
+    testUri.run("$entity", "$format=xml&$id=ETAllPrim").isKind(UriInfoKind.entityId)
+    .isFormatText("xml")
+    .isIdText("ETAllPrim");
+
+    testUri.run("$entity", "$format=xml&abc=123&$id=ESAllKey").isKind(UriInfoKind.entityId)
+    .isFormatText("xml")
+    .isCustomParameter(0, "abc", "123")
+    .isIdText("ESAllKey");
+
+    // simple entity set; $format after $id
+    testUri.run("$entity", "$id=ETAllPrim&$format=xml").isKind(UriInfoKind.entityId)
+    .isIdText("ETAllPrim")
+    .isFormatText("xml");
+
+    // simple entity set; $format and custom parameter after $id
+    testUri.run("$entity", "$id=ETAllPrim&$format=xml&abc=123").isKind(UriInfoKind.entityId)
+    .isIdText("ETAllPrim")
+    .isFormatText("xml")
+    .isCustomParameter(0, "abc", "123");
+
+    // simple entity set; $format before $id and custom parameter after $id
+    testUri.run("$entity", "$format=xml&$id=ETAllPrim&abc=123").isKind(UriInfoKind.entityId)
+    .isFormatText("xml")
+    .isIdText("ETAllPrim")
+    .isCustomParameter(0, "abc", "123");
+
+    // simple entity set; with qualifiedentityTypeName
+    testUri.run("$entity/olingo.odata.test1.ETTwoPrim", "$id=ESBase")
+    .isEntityType(EntityTypeProvider.nameETTwoPrim)
+    .isIdText("ESBase");
+
+    // simple entity set; with qualifiedentityTypeName;
+    testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim")
+    .isEntityType(EntityTypeProvider.nameETBase)
+    .isKind(UriInfoKind.entityId)
+    .isIdText("ESTwoPrim");
+
+    // simple entity set; with qualifiedentityTypeName; with format
+    testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim&$format=atom")
+    .isKind(UriInfoKind.entityId)
+    .isEntityType(EntityTypeProvider.nameETBase)
+    .isIdText("ESTwoPrim")
+    .isFormatText("atom");
+
+    // simple entity set; with qualifiedentityTypeName; with select
+    testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim&$select=*")
+    .isKind(UriInfoKind.entityId)
+    .isEntityType(EntityTypeProvider.nameETBase)
+    .isIdText("ESTwoPrim")
+    .isSelectItemStar(0);
+
+    // simple entity set; with qualifiedentityTypeName; with expand
+    testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim&$expand=*")
+    .isKind(UriInfoKind.entityId)
+    .isEntityType(EntityTypeProvider.nameETBase)
+    .isIdText("ESTwoPrim")
+    .goExpand().first().isSegmentStar();
+  }
+
+  @Test
+  public void entitySet() throws Exception {
+    // plain entity set
+    testRes.run("ESAllPrim")
+    .isEntitySet("ESAllPrim")
+    .isType(EntityTypeProvider.nameETAllPrim);
+
+    // with one key; simple key notation
+    testRes.run("ESAllPrim(1)")
+    .isEntitySet("ESAllPrim")
+    .isType(EntityTypeProvider.nameETAllPrim)
+    .isKeyPredicate(0, "PropertyInt16", "1");
+
+    // with one key; name value key notation
+    testRes.run("ESAllPrim(PropertyInt16=1)")
+    .isEntitySet("ESAllPrim")
+    .isKeyPredicate(0, "PropertyInt16", "1");
+
+    // with two keys
+    testRes.run("ESTwoKeyTwoPrim(PropertyInt16=1,PropertyString='ABC')")
+    .isEntitySet("ESTwoKeyTwoPrim")
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .isKeyPredicate(1, "PropertyString", "'ABC'");
+
+    // with all keys
+    testRes.run("ESAllKey(" + allKeys + ")")
+    .isEntitySet("ESAllKey")
+    .isKeyPredicate(0, "PropertyString", "'ABC'")
+    .isKeyPredicate(1, "PropertyInt16", "1")
+    .isKeyPredicate(2, "PropertyBoolean", "true")
+    .isKeyPredicate(3, "PropertyByte", "1")
+    .isKeyPredicate(4, "PropertySByte", "1")
+    .isKeyPredicate(5, "PropertyInt32", "12")
+    .isKeyPredicate(6, "PropertyInt64", "64")
+    .isKeyPredicate(7, "PropertyDecimal", "12")
+    .isKeyPredicate(8, "PropertyDate", "2013-09-25")
+    .isKeyPredicate(9, "PropertyDateTimeOffset", "2002-10-10T12:00:00-05:00")
+    .isKeyPredicate(10, "PropertyDuration", "duration'P50903316DT2H25M4S'")
+    .isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012")
+    .isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55");
+  }
+
+  @Test
+  public void entitySet_NavigationProperty() {
+    // with navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
+    .at(0)
+    .isEntitySet("ESKeyNav")
+    .isType(EntityTypeProvider.nameETKeyNav)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(1)
+    .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+    .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    // with navigation property -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
+    .at(0)
+    .isEntitySet("ESKeyNav")
+    .isType(EntityTypeProvider.nameETKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(1)
+    .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+    .at(2)
+    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+    // with navigation property -> navigation property -> navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
+    .at(0)
+    .isEntitySet("ESKeyNav")
+    .isType(EntityTypeProvider.nameETKeyNav)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(1)
+    .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+    .isType(EntityTypeProvider.nameETTwoKeyNav)
+    .at(2)
+    .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+    .isType(EntityTypeProvider.nameETKeyNav);
+
+    // with navigation property(key)
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)")
+    .at(0)
+    .isEntitySet("ESKeyNav")
+    .at(1)
+    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1");
+
+    // with navigation property(key) -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/PropertyString").at(0)
+    .at(0)
+    .isEntitySet("ESKeyNav")
+    .at(1)
+    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(2)
+    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+    // with navigation property(key) -> navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne")
+    .isEntitySet("ESKeyNav")
+    .at(1)
+    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(2)
+    .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
+
+    // with navigation property(key) -> navigation property(key)
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)")
+    .isEntitySet("ESKeyNav")
+    .isType(EntityTypeProvider.nameETKeyNav)
+    .at(1)
+    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(2)
+    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1");
+
+    // with navigation property(key) -> navigation property -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne/PropertyString")
+    .at(0)
+    .isEntitySet("ESKeyNav")
+    .isType(EntityTypeProvider.nameETKeyNav)
+    .at(1)
+    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(2)
+    .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+    .isType(EntityTypeProvider.nameETKeyNav)
+    .at(3)
+    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+    // with navigation property(key) -> navigation property(key) -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)/PropertyString")
+    .at(0)
+    .isEntitySet("ESKeyNav")
+    .isType(EntityTypeProvider.nameETKeyNav)
+    .at(1)
+    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(2)
+    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(3)
+    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+  }
+
+  @Test
+  public void entitySet_Property() {
+    // with property
+    testRes.run("ESAllPrim(1)/PropertyString")
+    .at(0)
+    .isEntitySet("ESAllPrim")
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(1)
+    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+    // with complex property
+    testRes.run("ESCompAllPrim(1)/PropertyComp")
+    .at(0)
+    .isEntitySet("ESCompAllPrim")
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(1)
+    .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false);
+
+    // with two properties
+    testRes.run("ESCompAllPrim(1)/PropertyComp/PropertyString")
+    .at(0)
+    .isEntitySet("ESCompAllPrim")
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(1)
+    .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false)
+    .at(2)
+    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+  }
+
+  @Test
+  public void entitySet_TypeFilter() {
+    // filter
+    testRes.run("ESTwoPrim/olingo.odata.test1.ETBase")
+    .at(0)
+    .isEntitySet("ESTwoPrim")
+    .isType(EntityTypeProvider.nameETTwoPrim, true)
+    .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
+    .isTypeFilterOnEntry(null);
+
+    // filter before key predicate
+    testRes.run("ESTwoPrim/olingo.odata.test1.ETBase(PropertyInt16=1)")
+    .at(0)
+    .isEntitySet("ESTwoPrim")
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETTwoPrim)
+    .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
+    .isTypeFilterOnEntry(null)
+    .at(0)
+    .isType(EntityTypeProvider.nameETTwoPrim, false)
+    .isKeyPredicate(0, "PropertyInt16", "1");
+
+    // filter before key predicate; property of sub type
+    testRes.run("ESTwoPrim/olingo.odata.test1.ETBase(PropertyInt16=1)/AdditionalPropertyString_5")
+    .at(0)
+    .isEntitySet("ESTwoPrim")
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETTwoPrim)
+    .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
+    .isTypeFilterOnEntry(null)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(1)
+    .isType(PropertyProvider.nameString)
+    .isPrimitiveProperty("AdditionalPropertyString_5", PropertyProvider.nameString, false);
+
+    // filter after key predicate
+    testRes.run("ESTwoPrim(PropertyInt16=1)/olingo.odata.test1.ETBase")
+    .at(0)
+    .isEntitySet("ESTwoPrim")
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETTwoPrim, false)
+    .isTypeFilterOnCollection(null)
+    .isTypeFilterOnEntry(EntityTypeProvider.nameETBase)
+    .isKeyPredicate(0, "PropertyInt16", "1");
+
+    // filter after key predicate; property of sub type
+    testRes.run("ESTwoPrim(PropertyInt16=1)/olingo.odata.test1.ETBase/AdditionalPropertyString_5")
+    .at(0)
+    .isEntitySet("ESTwoPrim")
+    .isUriPathInfoKind(UriResourceKind.entitySet)
+    .isType(EntityTypeProvider.nameETTwoPrim)
+    .isTypeFilterOnCollection(null)
+    .isTypeFilterOnEntry(EntityTypeProvider.nameETBase)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .at(1)
+    .isPrimitiveProperty("AdditionalPropertyString_5", PropertyProvider.nameString, false)
+    .isType(PropertyProvider.nameString);
+  }
+
+  @Test
+  public void unary() throws Exception {
+    testFilter.runOnETAllPrim("not PropertyBoolean").is("<not <PropertyBoolean>>");
+    testFilter.runOnETAllPrim("-PropertyInt16 eq PropertyInt16").is("<<- <PropertyInt16>> eq <PropertyInt16>>");
+  }
+
+  @Test
+  public void filterComplexMixedPriority() throws Exception {
+    testFilter.runOnETAllPrim("PropertyBoolean or true and false")
+        .is("<<PropertyBoolean> or <<true> and <false>>>");
+    testFilter.runOnETAllPrim("PropertyBoolean or true and PropertyInt64 eq PropertyByte")
+        .is("<<PropertyBoolean> or <<true> and <<PropertyInt64> eq <PropertyByte>>>>");
+    testFilter.runOnETAllPrim("PropertyBoolean or PropertyInt32 eq PropertyInt64 and true")
+        .is("<<PropertyBoolean> or <<<PropertyInt32> eq <PropertyInt64>> and <true>>>");
+    testFilter.runOnETAllPrim("PropertyBoolean or PropertyInt32 eq PropertyInt64 and PropertyByte eq PropertySByte")
+        .is("<<PropertyBoolean> or <<<PropertyInt32> eq <PropertyInt64>> "
+            + "and <<PropertyByte> eq <PropertySByte>>>>");
+    testFilter.runOnETAllPrim("PropertyInt16 eq PropertyInt32 or PropertyBoolean and true")
+        .is("<<<PropertyInt16> eq <PropertyInt32>> or <<PropertyBoolean> and <true>>>");
+    testFilter.runOnETAllPrim("PropertyInt16 eq PropertyInt32 or PropertyBoolean and PropertyByte eq PropertySByte")
+        .is("<<<PropertyInt16> eq <PropertyInt32>> "
+            + "or <<PropertyBoolean> and <<PropertyByte> eq <PropertySByte>>>>");
+    testFilter.runOnETAllPrim("PropertyInt16 eq PropertyInt32 or PropertyInt64 eq PropertyByte and PropertyBoolean")
+        .is("<<<PropertyInt16> eq <PropertyInt32>> "
+            + "or <<<PropertyInt64> eq <PropertyByte>> and <PropertyBoolean>>>");
+    testFilter.runOnETAllPrim("PropertyInt16 eq PropertyInt32 or PropertyInt64 eq PropertyByte "
+        + "and PropertySByte eq PropertyDecimal")
+        .is("<<<PropertyInt16> eq <PropertyInt32>> or <<<PropertyInt64> eq <PropertyByte>> "
+            + "and <<PropertySByte> eq <PropertyDecimal>>>>");
+  }
+
+  @Test
+  public void filterSimpleSameBinaryBinaryBinaryPriority() throws Exception {
+    testFilter.runOnETAllPrim("1 add 2 add 3 add 4 ge 0").isCompr("<<<< <1> add   <2>> add  <3>>  add <4>> ge <0>>");
+    testFilter.runOnETAllPrim("1 add 2 add 3 div 4 ge 0").isCompr("<<<  <1> add   <2>> add <<3>   div <4>>> ge <0>>");
+    testFilter.runOnETAllPrim("1 add 2 div 3 add 4 ge 0").isCompr("<<<  <1> add  <<2>  div  <3>>> add <4>> ge <0>>");
+    testFilter.runOnETAllPrim("1 add 2 div 3 div 4 ge 0").isCompr("<<   <1> add <<<2>  div  <3>>  div <4>>> ge <0>>");
+    testFilter.runOnETAllPrim("1 div 2 add 3 add 4 ge 0").isCompr("<<<< <1> div   <2>> add  <3>>  add <4>> ge <0>>");
+    testFilter.runOnETAllPrim("1 div 2 add 3 div 4 ge 0").isCompr("<<<  <1> div   <2>> add <<3>   div <4>>> ge <0>>");
+    testFilter.runOnETAllPrim("1 div 2 div 3 add 4 ge 0").isCompr("<<<< <1> div   <2>> div  <3>>  add <4>> ge <0>>");
+    testFilter.runOnETAllPrim("1 div 2 div 3 div 4 ge 0").isCompr("<<<< <1> div   <2>> div  <3>>  div <4>> ge <0>>");
+  }
+
+  @Test
+  public void functionImport_VarParameters() {
+    // no input
+    testRes.run("FINRTInt16()")
+    .isFunctionImport("FINRTInt16")
+    .isFunction("UFNRTInt16")
+    .isType(PropertyProvider.nameInt16);
+
+    // one input
+    testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
+    .isFunctionImport("FICRTETTwoKeyNavParam")
+    .isFunction("UFCRTETTwoKeyNavParam")
+    .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    // two input
+    testRes.run("FICRTStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
+    .isFunctionImport("FICRTStringTwoParam")
+    .isFunction("UFCRTStringTwoParam")
+    .isType(PropertyProvider.nameString);
+  }
+
+  @Test
+  public void functionImport_VarReturning() {
+    // returning primitive
+    testRes.run("FINRTInt16()")
+    .isFunctionImport("FINRTInt16")
+    .isFunction("UFNRTInt16")
+    .isType(PropertyProvider.nameInt16, false);
+
+    // returning collection of primitive
+    testRes.run("FICRTCollStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
+    .isFunctionImport("FICRTCollStringTwoParam")
+    .isFunction("UFCRTCollStringTwoParam")
+    .isType(PropertyProvider.nameString, true);
+
+    // returning single complex
+    testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)")
+    .isFunctionImport("FICRTCTAllPrimTwoParam")
+    .isFunction("UFCRTCTAllPrimTwoParam")
+    .isType(ComplexTypeProvider.nameCTAllPrim, false);
+
+    // returning collection of complex
+    testRes.run("FICRTCollCTTwoPrim()")
+    .isFunctionImport("FICRTCollCTTwoPrim")
+    .isFunction("UFCRTCollCTTwoPrim")
+    .isType(ComplexTypeProvider.nameCTTwoPrim, true);
+
+    // returning single entity
+    testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
+    .isFunctionImport("FICRTETTwoKeyNavParam")
+    .isFunction("UFCRTETTwoKeyNavParam")
+    .isType(EntityTypeProvider.nameETTwoKeyNav, false);
+
+    // returning collection of entity (aka entitySet)
+    testRes.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)")
+    .isFunctionImport("FICRTCollESTwoKeyNavParam")
+    .isFunction("UFCRTCollETTwoKeyNavParam")
+    .isType(EntityTypeProvider.nameETTwoKeyNav, true);
+  }
+
+  @Test
+  public void functionImportChain() {
+    // test chain; returning single complex
+    testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)/PropertyInt16")
+    .at(0)
+    .isFunctionImport("FICRTCTAllPrimTwoParam")
+    .isFunction("UFCRTCTAllPrimTwoParam")
+    .isType(ComplexTypeProvider.nameCTAllPrim, false)
+    .isParameter(0, "ParameterString", "'ABC'")
+    .isParameter(1, "ParameterInt16", "1")
+    .at(1)
+    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+    // test chains; returning single entity
+    testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16")
+    .at(0)
+    .isFunctionImport("FICRTETTwoKeyNavParam")
+    .isFunction("UFCRTETTwoKeyNavParam")
+    .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+    .isParameter(0, "ParameterInt16", "1")
+    .at(1)
+    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+    // test chains; returning collection of entity (aka entitySet)
+    testRes.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')")
+    .at(0)
+    .isFunctionImport("FICRTCollESTwoKeyNavParam")
+    .isFunction("UFCRTCollETTwoKeyNavParam")
+    .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+    .isParameter(0, "ParameterInt16", "1")
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .isKeyPredicate(1, "PropertyString", "'ABC'");
+
+    // test chains; returning collection of entity (aka entitySet)
+    testRes.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')/PropertyInt16")
+    .at(0)
+    .isFunctionImport("FICRTCollESTwoKeyNavParam")
+    .isFunction("UFCRTCollETTwoKeyNavParam")
+    .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+    .isParameter(0, "ParameterInt16", "1")
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .isKeyPredicate(1, "PropertyString", "'ABC'")
+    .at(1)
+    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+  }
+
+  @Test
+  public void metaData() throws Exception {
+    // Parsing the fragment may be used if a uri has to be parsed on the consumer side.
+    // On the producer side this feature is currently not supported, so the context fragment
+    // part is only available as text.
+
+    testUri.run("$metadata")
+    .isKind(UriInfoKind.metadata);
+
+    testUri.run("$metadata", "$format=atom")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom");
+
+    // with context (client usage)
+
+    testUri.run("$metadata", null, "$ref")
+    .isKind(UriInfoKind.metadata)
+    .isFragmentText("$ref");
+
+    testUri.run("$metadata", "$format=atom", "$ref")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("$ref");
+
+    testUri.run("$metadata", "$format=atom", "Collection($ref)")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("Collection($ref)");
+
+    testUri.run("$metadata", "$format=atom", "Collection(Edm.EntityType)")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("Collection(Edm.EntityType)");
+
+    testUri.run("$metadata", "$format=atom", "Collection(Edm.ComplexType)")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("Collection(Edm.ComplexType)");
+
+    testUri.run("$metadata", "$format=atom", "SINav")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("SINav");
+
+    testUri.run("$metadata", "$format=atom", "SINav/PropertyInt16")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("SINav/PropertyInt16");
+
+    testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavOne")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("SINav/NavPropertyETKeyNavOne");
+
+    testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavMany(1)")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("SINav/NavPropertyETKeyNavMany(1)");
+
+    testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavOne/PropertyInt16")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("SINav/NavPropertyETKeyNavOne/PropertyInt16");
+
+    testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavMany(1)/PropertyInt16")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("SINav/NavPropertyETKeyNavMany(1)/PropertyInt16");
+
+    testUri.run("$metadata", "$format=atom", "SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
+
+    testUri.run("$metadata", "$format=atom",
+        "SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
+        .isKind(UriInfoKind.metadata)
+        .isFormatText("atom")
+        .isFragmentText("SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
+
+    testUri.run("$metadata", "$format=atom", "olingo.odata.test1.ETAllKey")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("olingo.odata.test1.ETAllKey");
+
+    testUri.run("$metadata", "$format=atom", "ESTwoPrim/$deletedEntity")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESTwoPrim/$deletedEntity");
+
+    testUri.run("$metadata", "$format=atom", "ESTwoPrim/$link")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESTwoPrim/$link");
+
+    testUri.run("$metadata", "$format=atom", "ESTwoPrim/$deletedLink")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESTwoPrim/$deletedLink");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav/PropertyInt16")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav/PropertyInt16");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavOne")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavMany(1)")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16");
+
+    testUri.run("$metadata", "$format=atom",
+        "ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
+        .isKind(UriInfoKind.metadata)
+        .isFormatText("atom")
+        .isFragmentText("ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
+
+    testUri.run(
+        "$metadata", "$format=atom", "ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
+        .isKind(UriInfoKind.metadata)
+        .isFormatText("atom")
+        .isFragmentText("ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav(PropertyInt16,PropertyString)")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav(PropertyInt16,PropertyString)");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav/$entity")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav/$entity");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav/$delta")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav/$delta");
+
+    testUri.run("$metadata", "$format=atom", "ESKeyNav/(PropertyInt16,PropertyString)/$delta")
+    .isKind(UriInfoKind.metadata)
+    .isFormatText("atom")
+    .isFragmentText("ESKeyNav/(PropertyInt16,PropertyString)/$delta");
+
+  }
+
+  @Test
+  public void ref() throws Exception {
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/$ref");
+  }
+
+  @Test
+  public void singleton() {
+    // plain singleton
+    testRes.run("SINav")
+    .isSingleton("SINav")
+    .isType(EntityTypeProvider.nameETTwoKeyNav);
+  }
+
+  @Test
+  public void navigationProperty() {
+    // with navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
+    .at(0).isEntitySet("ESKeyNav")
+    .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
+
+    // with navigation property -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
+    .at(0).isEntitySet("ESKeyNav")
+    .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+    .at(2).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+    // with navigation property -> navigation property -> navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
+    .at(0).isEntitySet("ESKeyNav")
+    .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+    .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
+
+    // with navigation property(key)
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')")
+    .at(0).isEntitySet("ESKeyNav")
+    .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .isKeyPredicate(1, "PropertyString", "'1'");
+
+    // with navigation property(key) -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/PropertyString")
+    .at(0).isEntitySet("ESKeyNav")
+    .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .isKeyPredicate(1, "PropertyString", "'1'")
+    .at(2).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+    // with navigation property(key) -> navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/NavPropertyETKeyNavOne")
+    .at(0).isEntitySet("ESKeyNav")
+    .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+    .isKeyPredicate(0, "PropertyInt16", "1")
+    .isKeyPredicate(1, "PropertyString", "'1'")
+    .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
+
+    // with navigation property(key) -> navigation property(key)
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
+        + "/NavPropertyETKeyNavMany(1)")
+        .at(0).isEntitySet("ESKeyNav")
+        .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'1'")
+        .at(2).isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1");
+
+    // with navigation property(key) -> navigation property -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
+        + "/NavPropertyETKeyNavOne/PropertyString")
+        .at(0).isEntitySet("ESKeyNav")
+        .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'1'")
+        .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+        .at(3).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+    // with navigation property(key) -> navigation property(key) -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
+        + "/NavPropertyETKeyNavMany(1)/PropertyString")
+        .at(0).isEntitySet("ESKeyNav")
+        .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'1'")
+        .at(2).isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(3).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+  }
+
+  @Test
+  public void singleton_Property() {
+    // with property
+    testRes.run("SINav/PropertyInt16")
+    .at(0)
+    .isSingleton("SINav")
+    .isType(EntityTypeProvider.nameETTwoKeyNav)
+    .at(1)
+    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+    // with complex property
+    testRes.run("SINav/PropertyComp")
+    .at(0)
+    .isSingleton("SINav")
+    .isType(EntityTypeProvider.nameETTwoKeyNav)
+    .at(1)
+    .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false);
+
+    // with two properties
+    testRes.run("SINav/PropertyComp/PropertyInt16")
+    .at(0)
+    .isSingleton("SINav")
+    .isType(EntityTypeProvider.nameETTwoKeyNav)
+    .at(1)
+    .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
+    .at(2)
+    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+  }
+
+  @Test
+  public void value() throws Exception {
+    testUri.run("ESAllPrim(1)/PropertyString/$value");
+  }
+
+  @Test
+  public void memberStartingWithCastFailOnValidation1() throws Exception {
+    // on EntityType entry
+    testUri.runEx("ESTwoKeyNav(Property16=1,PropertyString='ABC')",
+        "$filter=olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate")
+        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
+  }
+
+  @Test
+  public void memberStartingWithCastFailOnValidation2() throws Exception {
+    testUri.runEx("FICRTCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')",
+        "$filter=olingo.odata.test1.CTBase/AdditionalPropString")
+        .isExSemantic(UriParserSemanticException.MessageKeys.TYPES_NOT_COMPATIBLE);
+  }
+
+  @Test
+  public void memberStartingWithCast() throws Exception {
+    // on EntityType collection
+    testFilter.runOnETTwoKeyNav("olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate eq null")
+    .left()
+    .isMember()
+    .isMemberStartType(EntityTypeProvider.nameETBaseTwoKeyNav).goPath()
+    .at(0).isType(PropertyProvider.nameDate);
+
+    // on Complex collection
+    testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')",
+        "$filter=olingo.odata.test1.CTBase/AdditionalPropString eq null")
+        .goFilter().left().isMember()
+        .isMemberStartType(ComplexTypeProvider.nameCTBase).goPath()
+        .at(0).isType(PropertyProvider.nameString);
+  }
+
+  @Test
+  public void complexTypeCastFollowingAsCollection() throws Exception {
+    testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')/olingo.odata.test1.CTBase");
+  }
+
+  @Test
+  public void alias() throws Exception {
+    testFilter.runOnETAllPrim("PropertyInt16 eq @p1&@p1=1")
+        .is("<<PropertyInt16> eq <@p1>>");
+  }
+
+  @Test
+  public void lambda() throws Exception {
+    testFilter.runOnETTwoKeyNav("CollPropertyComp/all(l:true)")
+        .is("<CollPropertyComp/<ALL;<true>>>");
+
+    testFilter.runOnETTwoKeyNav("CollPropertyComp/all(x:x/PropertyInt16 eq 2)")
+        .is("<CollPropertyComp/<ALL;<<x/PropertyInt16> eq <2>>>>");
+
+    testFilter.runOnETTwoKeyNav("CollPropertyComp/any(l:true)")
+        .is("<CollPropertyComp/<ANY;<true>>>");
+    testFilter.runOnETTwoKeyNav("CollPropertyComp/any()")
+        .is("<CollPropertyComp/<ANY;>>");
+  }
+
+  @Test
+  public void customQueryOption() throws Exception {
+    testUri.run("ESTwoKeyNav", "custom")
+        .isCustomParameter(0, "custom", "");
+    testUri.run("ESTwoKeyNav", "custom=ABC")
+        .isCustomParameter(0, "custom", "ABC");
+  }
+
+  @Test
+  @Ignore("Geo types are not supported yet.")
+  public void geo() throws Exception {
+    testFilter.runOnETAllPrim("geo.distance(PropertySByte,PropertySByte)")
+        .is("<geo.distance(<PropertySByte>,<PropertySByte>)>")
+        .isMethod(MethodKind.GEODISTANCE, 2);
+    testFilter.runOnETAllPrim("geo.length(PropertySByte)")
+        .is("<geo.length(<PropertySByte>)>")
+        .isMethod(MethodKind.GEOLENGTH, 1);
+    testFilter.runOnETAllPrim("geo.intersects(PropertySByte,PropertySByte)")
+        .is("<geo.intersects(<PropertySByte>,<PropertySByte>)>")
+        .isMethod(MethodKind.GEOINTERSECTS, 2);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
index db9f5be..c3d90c9 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
@@ -33,11 +33,11 @@ import org.apache.olingo.server.api.uri.queryoption.SystemQueryOption;
 import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
 import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
 import org.apache.olingo.server.core.uri.UriInfoImpl;
+import org.apache.olingo.server.core.uri.parser.search.SearchTermImpl;
 import org.apache.olingo.server.core.uri.queryoption.expression.AliasImpl;
 import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl;
 import org.junit.Test;
 
-//TOOD add getKind check to all
 public class QueryOptionTest {
 
   @Test
@@ -196,6 +196,7 @@ public class QueryOptionTest {
   @Test
   public void testOrderByOptionImpl() {
     OrderByOptionImpl option = new OrderByOptionImpl();
+    assertEquals(SystemQueryOptionKind.ORDERBY, option.getKind());
 
     OrderByItemImpl order0 = new OrderByItemImpl();
     OrderByItemImpl order1 = new OrderByItemImpl();
@@ -217,14 +218,17 @@ public class QueryOptionTest {
   }
 
   @Test
-  public void testSearchOptionImpl() {
+  public void searchOptionImpl() {
     SearchOptionImpl option = new SearchOptionImpl();
     assertEquals(SystemQueryOptionKind.SEARCH, option.getKind());
-    // $search is not supported yet
+
+    final SearchTermImpl searchExpression = new SearchTermImpl("A");
+    option.setSearchExpression(searchExpression);
+    assertEquals(searchExpression, option.getSearchExpression());
   }
 
   @Test
-  public void testSelectItemImpl() {
+  public void selectItemImpl() {
     SelectItemImpl option = new SelectItemImpl();
 
     // no typed collection else case ( e.g. if not path is added)
@@ -244,7 +248,7 @@ public class QueryOptionTest {
   }
 
   @Test
-  public void testSelectOptionImpl() {
+  public void selectOptionImpl() {
     SelectOptionImpl option = new SelectOptionImpl();
     assertEquals(SystemQueryOptionKind.SELECT, option.getKind());
 


[5/5] olingo-odata4 git commit: [OLINGO-834] URI parser shall not ignore empty path segments

Posted by ch...@apache.org.
[OLINGO-834] URI parser shall not ignore empty path segments

Signed-off-by: Christian Amend <ch...@sap.com>


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

Branch: refs/heads/master
Commit: 3295bcc062206b2764fe33692004541d0b602bed
Parents: b086601
Author: Klaus Straubinger <kl...@sap.com>
Authored: Tue Jan 12 15:05:01 2016 +0100
Committer: Christian Amend <ch...@sap.com>
Committed: Tue Jan 12 15:18:45 2016 +0100

----------------------------------------------------------------------
 .../olingo/fit/tecsvc/http/BasicHttpITCase.java |    4 +-
 .../olingo/server/core/uri/parser/Parser.java   |   22 +-
 .../server/core/uri/parser/ParserHelper.java    |    2 +-
 .../server/core/uri/parser/UriDecoder.java      |   45 +-
 .../core/uri/parser/search/SearchParser.java    |    2 +-
 .../server/core/uri/validator/UriValidator.java |   67 +-
 .../core/uri/parser/ExpressionParserTest.java   |    8 +-
 .../server/core/uri/parser/LexerTest.java       |  318 +
 .../server/core/uri/parser/UriDecoderTest.java  |   17 +-
 .../search/SearchParserAndTokenizerTest.java    |   33 +-
 .../uri/parser/search/SearchParserTest.java     |   16 +-
 .../uri/parser/search/SearchTokenizerTest.java  |   15 +-
 .../core/uri/antlr/TestFullResourcePath.java    | 5900 -----------------
 .../olingo/server/core/uri/antlr/TestLexer.java |  323 -
 .../core/uri/antlr/TestUriParserImpl.java       | 1046 ----
 .../core/uri/parser/TestFullResourcePath.java   | 5905 ++++++++++++++++++
 .../core/uri/parser/TestUriParserImpl.java      | 1046 ++++
 .../core/uri/queryoption/QueryOptionTest.java   |   14 +-
 18 files changed, 7374 insertions(+), 7409 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java
index e097581..bb13989 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java
@@ -114,7 +114,7 @@ public class BasicHttpITCase extends AbstractBaseTestITCase {
 
   @Test
   public void testIEEE754ParameterContentNegotiation() throws Exception {
-    final URL url = new URL(SERVICE_URI + "/ESAllPrim(32767)?$format=application/json;IEEE754Compatible=true");
+    final URL url = new URL(SERVICE_URI + "ESAllPrim(32767)?$format=application/json;IEEE754Compatible=true");
     final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
     connection.setRequestMethod(HttpMethod.GET.name());
     connection.setRequestProperty(HttpHeader.ACCEPT, "application/json;IEEE754Compatible=false");
@@ -131,7 +131,7 @@ public class BasicHttpITCase extends AbstractBaseTestITCase {
 
   @Test
   public void testIEEE754ParameterViaAcceptHeader() throws Exception {
-    final URL url = new URL(SERVICE_URI + "/ESAllPrim(32767)");
+    final URL url = new URL(SERVICE_URI + "ESAllPrim(32767)");
     final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
     connection.setRequestMethod(HttpMethod.GET.name());
     connection.setRequestProperty(HttpHeader.ACCEPT, "application/json;IEEE754Compatible=true");

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
index 86f5749..34944c8 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
@@ -19,6 +19,7 @@
 package org.apache.olingo.server.core.uri.parser;
 
 import java.util.ArrayDeque;
+import java.util.Collections;
 import java.util.Deque;
 import java.util.List;
 
@@ -60,6 +61,7 @@ public class Parser {
   private static final String ATOM = "atom";
   private static final String JSON = "json";
   private static final String XML = "xml";
+  private static final String DOLLAR = "$";
   private static final String AT = "@";
   private static final String NULL = "null";
 
@@ -78,14 +80,19 @@ public class Parser {
     Deque<EdmType> contextTypes = new ArrayDeque<EdmType>();
     boolean contextIsCollection = false;
 
-    final List<String> pathSegmentsDecoded = UriDecoder.splitAndDecodePath(path);
-    final int numberOfSegments = pathSegmentsDecoded.size();
+    List<String> pathSegmentsDecoded = UriDecoder.splitAndDecodePath(path);
+    int numberOfSegments = pathSegmentsDecoded.size();
+    // Remove an initial empty segment resulting from the expected '/' at the beginning of the path.
+    if (numberOfSegments > 1 && pathSegmentsDecoded.get(0).isEmpty()) {
+      pathSegmentsDecoded.remove(0);
+      numberOfSegments--;
+    }
 
     // first, read the decoded path segments
-    final String firstSegment = numberOfSegments == 0 ? "" : pathSegmentsDecoded.get(0);
+    final String firstSegment = pathSegmentsDecoded.get(0);
 
     if (firstSegment.isEmpty()) {
-      ensureLastSegment(firstSegment, 0, numberOfSegments);
+      ensureLastSegment(firstSegment, 1, numberOfSegments);
       contextUriInfo.setKind(UriInfoKind.service);
 
     } else if (firstSegment.equals("$batch")) {
@@ -168,11 +175,12 @@ public class Parser {
     }
 
     // second, read the system query options and the custom query options
-    final List<QueryOption> options = UriDecoder.splitAndDecodeOptions(query);
+    final List<QueryOption> options =
+        query == null ? Collections.<QueryOption> emptyList() : UriDecoder.splitAndDecodeOptions(query);
     for (final QueryOption option : options) {
       final String optionName = option.getName();
       final String optionValue = option.getText();
-      if (optionName.startsWith("$")) {
+      if (optionName.startsWith(DOLLAR)) {
         SystemQueryOption systemOption = null;
         if (optionName.equals(SystemQueryOptionKind.FILTER.toString())) {
           UriTokenizer filterTokenizer = new UriTokenizer(optionValue);
@@ -315,7 +323,7 @@ public class Parser {
               UriParserSyntaxException.MessageKeys.DUPLICATED_ALIAS, optionName);
         }
 
-      } else {
+      } else if (!optionName.isEmpty()) {
         contextUriInfo.addCustomQueryOption((CustomQueryOption) option);
       }
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ParserHelper.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ParserHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ParserHelper.java
index 7f4abf7..852c43a 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ParserHelper.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ParserHelper.java
@@ -157,7 +157,7 @@ public class ParserHelper {
     final List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
     if (tokenizer.next(TokenKind.CLOSE)) {
       throw new UriParserSemanticException(
-          "Expected " + keyPropertyRefs.size() + " key predicates but none.",
+          "Expected " + keyPropertyRefs.size() + " key predicates but got none.",
           UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES,
           Integer.toString(keyPropertyRefs.size()), "0");
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
index 6450bf6..1cc5ec5 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
@@ -19,8 +19,6 @@
 package org.apache.olingo.server.core.uri.parser;
 
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -33,7 +31,7 @@ public class UriDecoder {
   /** Splits the path string at '/' characters and percent-decodes the resulting path segments. */
   protected static List<String> splitAndDecodePath(final String path) throws UriParserSyntaxException {
     List<String> pathSegmentsDecoded = new ArrayList<String>();
-    for (final String segment : splitSkipEmpty(path, '/')) {
+    for (final String segment : split(path, '/')) {
       pathSegmentsDecoded.add(decode(segment));
     }
     return pathSegmentsDecoded;
@@ -42,58 +40,39 @@ public class UriDecoder {
   /**
    * Splits the query-option string at '&' characters, the resulting parts at '=' characters,
    * and separately percent-decodes names and values of the resulting name-value pairs.
+   * If there is no '=' character in an option, the whole option is considered as name.
    */
   protected static List<QueryOption> splitAndDecodeOptions(final String queryOptionString)
       throws UriParserSyntaxException {
-    if (queryOptionString == null || queryOptionString.isEmpty()) {
-      return Collections.emptyList();
-    }
-
     List<QueryOption> queryOptions = new ArrayList<QueryOption>();
-    for (final String option : splitSkipEmpty(queryOptionString, '&')) {
-      final List<String> pair = splitFirst(option, '=');
+    for (final String option : split(queryOptionString, '&')) {
+      final int pos = option.indexOf('=');
+      final String name = pos >= 0 ? option.substring(0, pos)  : option;
+      final String text = pos >= 0 ? option.substring(pos + 1) : "";
       queryOptions.add(new CustomQueryOptionImpl()
-          .setName(decode(pair.get(0)))
-          .setText(decode(pair.get(1))));
+          .setName(decode(name))
+          .setText(decode(text)));
     }
     return queryOptions;
   }
 
-  private static List<String> splitFirst(final String input, final char c) {
-    int pos = input.indexOf(c);
-    if (pos >= 0) {
-      return Arrays.asList(input.substring(0, pos), input.substring(pos + 1));
-    } else {
-      return Arrays.asList(input, "");
-    }
-  }
-
   /**
-   * Splits the input string at the given character and drops all empty elements.
+   * Splits the input string at the given character.
    * @param input string to split
    * @param c character at which to split
    * @return list of elements (can be empty)
    */
-  private static List<String> splitSkipEmpty(final String input, final char c) {
-    if (input.isEmpty() || input.length() == 1 && input.charAt(0) == c) {
-      return Collections.emptyList();
-    }
-
+  private static List<String> split(final String input, final char c) {
     List<String> list = new LinkedList<String>();
 
     int start = 0;
     int end;
-
     while ((end = input.indexOf(c, start)) >= 0) {
-      if (start != end) {
-        list.add(input.substring(start, end));
-      }
+      list.add(input.substring(start, end));
       start = end + 1;
     }
 
-    if (input.charAt(input.length() - 1) != c) {
-      list.add(input.substring(start));
-    }
+    list.add(input.substring(start));
 
     return list;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/search/SearchParser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/search/SearchParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/search/SearchParser.java
index 4fccb81..6c3db4f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/search/SearchParser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/search/SearchParser.java
@@ -50,7 +50,7 @@ public class SearchParser {
       searchExpression = parse(tokenizer.tokenize(searchQuery));
     } catch (SearchTokenizerException e) {
       String message = e.getMessage();
-      throw new SearchParserException("Tokenizer exception with message: " + message,
+      throw new SearchParserException("Tokenizer exception with message: " + message, e,
           SearchParserException.MessageKeys.TOKENIZER_EXCEPTION, message);
     }
     final SearchOptionImpl searchOption = new SearchOptionImpl();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
index 149d1fc..5d842fb 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
@@ -286,9 +286,9 @@ public class UriValidator {
           RowIndexForUriType.mediaStream : RowIndexForUriType.propertyPrimitiveValue;
       break;
     default:
-      throw new UriValidationException("Unexpected kind in path segment before $value: "
-          + secondLastPathSegment.getKind(), UriValidationException.MessageKeys.UNALLOWED_KIND_BEFORE_VALUE,
-          secondLastPathSegment.toString());
+      throw new UriValidationException(
+          "Unexpected kind in path segment before $value: " + secondLastPathSegment.getKind(),
+          UriValidationException.MessageKeys.UNALLOWED_KIND_BEFORE_VALUE, secondLastPathSegment.toString());
     }
     return idx;
   }
@@ -302,9 +302,9 @@ public class UriValidator {
       return ((UriResourcePartTyped) secondLastPathSegment).isCollection() ?
           RowIndexForUriType.references : RowIndexForUriType.reference;
     } else {
-      throw new UriValidationException("secondLastPathSegment not a class of UriResourcePartTyped: "
-          + lastPathSegment.getClass(), UriValidationException.MessageKeys.LAST_SEGMENT_NOT_TYPED, lastPathSegment
-          .toString());
+      throw new UriValidationException(
+          "secondLastPathSegment not a class of UriResourcePartTyped: " + lastPathSegment.getClass(),
+          UriValidationException.MessageKeys.LAST_SEGMENT_NOT_TYPED, lastPathSegment.toString());
     }
   }
 
@@ -314,40 +314,36 @@ public class UriValidator {
       return ((UriResourcePartTyped) lastPathSegment).isCollection() ?
           RowIndexForUriType.propertyPrimitiveCollection : RowIndexForUriType.propertyPrimitive;
     } else {
-      throw new UriValidationException("lastPathSegment not a class of UriResourcePartTyped: "
-          + lastPathSegment.getClass(), UriValidationException.MessageKeys.LAST_SEGMENT_NOT_TYPED, lastPathSegment
-          .toString());
+      throw new UriValidationException(
+          "lastPathSegment not a class of UriResourcePartTyped: " + lastPathSegment.getClass(),
+          UriValidationException.MessageKeys.LAST_SEGMENT_NOT_TYPED, lastPathSegment.toString());
     }
   }
 
   private RowIndexForUriType rowIndexForFunction(final UriResource lastPathSegment) throws UriValidationException {
     final UriResourceFunction uriFunction = (UriResourceFunction) lastPathSegment;
-    final EdmReturnType returnType = uriFunction.getFunction().getReturnType();
-
     if (!uriFunction.getFunction().isComposable()) {
       return RowIndexForUriType.none;
     }
 
+    final boolean isCollection = uriFunction.isCollection();
+    final EdmTypeKind typeKind = uriFunction.getFunction().getReturnType().getType().getKind();
     RowIndexForUriType idx;
-    switch (returnType.getType().getKind()) {
+    switch (typeKind) {
     case ENTITY:
-      idx = returnType.isCollection() && uriFunction.getKeyPredicates().isEmpty() ?
-          RowIndexForUriType.entitySet : RowIndexForUriType.entity;
+      idx = isCollection ? RowIndexForUriType.entitySet : RowIndexForUriType.entity;
       break;
     case PRIMITIVE:
     case ENUM:
     case DEFINITION:
-      idx = returnType.isCollection() ? RowIndexForUriType.propertyPrimitiveCollection :
-                                        RowIndexForUriType.propertyPrimitive;
+      idx = isCollection ? RowIndexForUriType.propertyPrimitiveCollection : RowIndexForUriType.propertyPrimitive;
       break;
     case COMPLEX:
-      idx = returnType.isCollection() ? RowIndexForUriType.propertyComplexCollection :
-                                        RowIndexForUriType.propertyComplex;
+      idx = isCollection ? RowIndexForUriType.propertyComplexCollection : RowIndexForUriType.propertyComplex;
       break;
     default:
-      throw new UriValidationException("Unsupported function return type: " + returnType.getType().getKind(),
-          UriValidationException.MessageKeys.UNSUPPORTED_FUNCTION_RETURN_TYPE,
-          returnType.getType().getKind().toString());
+      throw new UriValidationException("Unsupported function return type: " + typeKind,
+          UriValidationException.MessageKeys.UNSUPPORTED_FUNCTION_RETURN_TYPE, typeKind.toString());
     }
 
     return idx;
@@ -512,18 +508,17 @@ public class UriValidator {
       for (SystemQueryOption option : uriInfo.getSystemQueryOptions()) {
         options.append(option.getName()).append(" ");
       }
-      throw new UriValidationException("System query option " + options.toString() + " not allowed for method "
-          + httpMethod, UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED_FOR_HTTP_METHOD,
+      throw new UriValidationException(
+          "System query option " + options.toString() + " not allowed for method " + httpMethod,
+          UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED_FOR_HTTP_METHOD,
           options.toString(), httpMethod.toString());
     }
   }
 
   private boolean isAction(final UriInfo uriInfo) {
     List<UriResource> uriResourceParts = uriInfo.getUriResourceParts();
-    if (uriResourceParts.isEmpty()) {
-      return false;
-    }
-    return UriResourceKind.action == uriResourceParts.get(uriResourceParts.size() - 1).getKind();
+    return !uriResourceParts.isEmpty()
+        && UriResourceKind.action == uriResourceParts.get(uriResourceParts.size() - 1).getKind();
   }
 
   private void validateParameters(final UriInfo uriInfo) throws UriValidationException {
@@ -531,18 +526,18 @@ public class UriValidator {
       final boolean isFunction = pathSegment.getKind() == UriResourceKind.function;
 
       if (isFunction) {
-        final UriResourceFunction functionPathSegement = (UriResourceFunction) pathSegment;
-        final EdmFunction edmFuntion = functionPathSegement.getFunction();
+        final UriResourceFunction functionPathSegment = (UriResourceFunction) pathSegment;
+        final EdmFunction edmFunction = functionPathSegment.getFunction();
 
         final Map<String, UriParameter> parameters = new HashMap<String, UriParameter>();
-        for (final UriParameter parameter : functionPathSegement.getParameters()) {
+        for (final UriParameter parameter : functionPathSegment.getParameters()) {
           parameters.put(parameter.getName(), parameter);
         }
 
         boolean firstParameter = true;
-        for (final String parameterName : edmFuntion.getParameterNames()) {
+        for (final String parameterName : edmFunction.getParameterNames()) {
           final UriParameter parameter = parameters.get(parameterName);
-          final boolean isNullable = edmFuntion.getParameter(parameterName).isNullable();
+          final boolean isNullable = edmFunction.getParameter(parameterName).isNullable();
 
           if (parameter != null) {
             /** No alias, value explicit null */
@@ -560,7 +555,7 @@ public class UriValidator {
             }
 
             parameters.remove(parameterName);
-          } else if (!isNullable && !(firstParameter && edmFuntion.isBound())) {
+          } else if (!isNullable && !(firstParameter && edmFunction.isBound())) {
             // The first parameter of bound functions is implicit provided by the preceding path segment
             throw new UriValidationException("Missing non nullable parameter " + parameterName,
                 UriValidationException.MessageKeys.MISSING_PARAMETER, parameterName);
@@ -586,11 +581,11 @@ public class UriValidator {
       if (isEntitySet || pathSegment.getKind() == UriResourceKind.navigationProperty || isEntityColFunction) {
         final List<UriParameter> keyPredicates = isEntitySet ?
             ((UriResourceEntitySet) pathSegment).getKeyPredicates() :
-            isEntityColFunction ? ((UriResourceFunction) pathSegment).getKeyPredicates()
-                : ((UriResourceNavigation) pathSegment).getKeyPredicates();
+            isEntityColFunction ?
+                ((UriResourceFunction) pathSegment).getKeyPredicates() :
+                ((UriResourceNavigation) pathSegment).getKeyPredicates();
 
         if (keyPredicates != null) {
-
                 final EdmEntityType entityType = isEntitySet ?
                     ((UriResourceEntitySet) pathSegment).getEntityType() :
                       isEntityColFunction ? (EdmEntityType) ((UriResourceFunction) pathSegment).getType()

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java
index 94d5373..f495c5b 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java
@@ -290,15 +290,13 @@ public class ExpressionParserTest {
     }
     expressionString += ')';
 
-    Expression expression = parseExpression(expressionString);
-    assertNotNull(expression);
-    return expression;
+    return parseExpression(expressionString);
   }
 
   private Expression parseExpression(final String expressionString)
       throws UriParserException, UriValidationException {
     UriTokenizer tokenizer = new UriTokenizer(expressionString);
-    Expression expression = new ExpressionParser(mock(Edm.class), odata).parse(tokenizer, null, null);
+    final Expression expression = new ExpressionParser(mock(Edm.class), odata).parse(tokenizer, null, null);
     assertNotNull(expression);
     assertTrue(tokenizer.next(TokenKind.EOF));
     return expression;
@@ -306,7 +304,7 @@ public class ExpressionParserTest {
 
   private void wrongExpression(final String expressionString) {
     try {
-      new ExpressionParser(mock(Edm.class), odata).parse(new UriTokenizer(expressionString), null, null);
+      parseExpression(expressionString);
       fail("Expected exception not thrown.");
     } catch (final UriParserException e) {
       assertNotNull(e);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/LexerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/LexerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/LexerTest.java
new file mode 100644
index 0000000..df3b506
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/LexerTest.java
@@ -0,0 +1,318 @@
+/*
+ * 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.server.core.uri.parser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.olingo.server.core.uri.parser.UriTokenizer;
+import org.apache.olingo.server.core.uri.parser.UriTokenizer.TokenKind;
+import org.junit.Test;
+
+/**
+ * Tests originally written for the ANTLR lexer.
+ */
+public class LexerTest {
+
+  private TokenValidator test = new TokenValidator();
+
+  @Test
+  public void unary() {
+    test.run("-a eq a").has(TokenKind.MinusOperator, TokenKind.ODataIdentifier, TokenKind.EqualsOperator,
+        TokenKind.ODataIdentifier).isInput();
+  }
+
+  @Test
+  public void uriTokens() {
+//    test.run("#").isType(TokenKind.FRAGMENT).isInput();
+    test.run("$count").has(TokenKind.COUNT).isInput();
+    test.run("$ref").has(TokenKind.REF).isInput();
+    test.run("$value").has(TokenKind.VALUE).isInput();
+  }
+
+  @Test
+  public void queryOptionsTokens() {
+    test.run("$skip=1").has(TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+    test.run("$skip=2").has(TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+    test.run("$skip=123").has(TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+
+    test.run("$top=1").has(TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+    test.run("$top=2").has(TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+    test.run("$top=123").has(TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+
+    test.run("$levels=1").has(TokenKind.LEVELS, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+    test.run("$levels=2").has(TokenKind.LEVELS, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+    test.run("$levels=123").has(TokenKind.LEVELS, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+    test.run("$levels=max").has(TokenKind.LEVELS, TokenKind.EQ, TokenKind.MAX).isInput();
+
+//    test.run("$format=atom").has(TokenKind.FORMAT, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
+//    test.run("$format=json").has(TokenKind.FORMAT, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
+//    test.run("$format=xml").has(TokenKind.FORMAT,, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
+//    test.run("$format=abc/def").has(TokenKind.FORMAT, TokenKind.EQ,
+//        TokenKind.ODataIdentifier, TokenKind.SLASH, TokenKind.ODataIdentifier).isInput();
+
+//    test.run("$id=123").has(TokenKind.ID, TokenKind.EQ, TokenKind.IntegerValue).isInput();
+//    test.run("$id=ABC").has(TokenKind.ID, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
+
+//    test.run("$skiptoken=ABC").has(TokenKind.SKIPTOKEN, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
+//    test.run("$skiptoken=ABC").has(TokenKind.SKIPTOKEN, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
+
+    test.run("$search=\"ABC\"").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase).isInput();
+    test.run("$search=ABC").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word).isInput();
+    test.run("$search=\"A%20B%20C\"").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase).isInput();
+    test.run("$search=Test Test").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word,
+        TokenKind.AndOperatorSearch, TokenKind.Word).isInput();
+    test.run("$search=Test&$filter=ABC eq 1").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word);
+  }
+
+  @Test
+  public void queryOptionsDefaultMode() {
+    test.run("$expand=ABC($skip=1)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE).isInput();
+    test.run("$expand=ABC($skip=123)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE).isInput();
+    test.run("$expand=ABC($search=abc)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word, TokenKind.CLOSE).isInput();
+    test.run("$expand=ABC($search=\"123\")").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase, TokenKind.CLOSE).isInput();
+    test.run("$expand=ABC($top=1)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE).isInput();
+    test.run("$expand=ABC($top=123)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE).isInput();
+
+    test.run("$expand=ABC($expand=DEF($skip=1))").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE, TokenKind.CLOSE)
+        .isInput();
+    test.run("$expand=ABC($expand=DEF($skip=123))").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE, TokenKind.CLOSE)
+        .isInput();
+
+    test.run("$expand=ABC($expand=DEF($top=1))").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE, TokenKind.CLOSE)
+        .isInput();
+    test.run("$expand=ABC($expand=DEF($top=123))").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+        TokenKind.OPEN, TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE, TokenKind.CLOSE)
+        .isInput();
+
+    test.run("$expand=ABC($expand=DEF($search=Test Test))")
+        .has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+            TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+            TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word,
+            TokenKind.AndOperatorSearch, TokenKind.Word, TokenKind.CLOSE, TokenKind.CLOSE)
+        .isInput();
+    test.run("$expand=ABC($expand=DEF($search=\"Test\" \"Test\"))")
+        .has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+            TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+            TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase,
+            TokenKind.AndOperatorSearch, TokenKind.Phrase, TokenKind.CLOSE, TokenKind.CLOSE)
+        .isInput();
+    test.run("$expand=ABC($expand=DEF($search=\"Test\" \"Test\";$filter=PropertyInt16 eq 0;$orderby=PropertyInt16))")
+        .has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+            TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
+            TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase,
+            TokenKind.AndOperatorSearch, TokenKind.Phrase, TokenKind.SEMI,
+            TokenKind.FILTER, TokenKind.EQ, TokenKind.ODataIdentifier, TokenKind.EqualsOperator,
+            TokenKind.IntegerValue, TokenKind.SEMI,
+            TokenKind.ORDERBY, TokenKind.EQ, TokenKind.ODataIdentifier, TokenKind.CLOSE, TokenKind.CLOSE)
+        .isInput();
+  }
+
+  @Test
+  public void queryExpressions() {
+    test.run("$it").has(TokenKind.IT).isText("$it");
+
+    test.run("$filter=contains(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.ContainsMethod).isText("contains(");
+
+    test.run("$filter=containsabc").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.ODataIdentifier)
+        .isText("containsabc");
+
+    test.run("$filter=startswith(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.StartswithMethod)
+        .isText("startswith(");
+    test.run("$filter=endswith(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.EndswithMethod).isText("endswith(");
+    test.run("$filter=length(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.LengthMethod).isText("length(");
+    test.run("$filter=indexof(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.IndexofMethod).isText("indexof(");
+    test.run("$filter=substring(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.SubstringMethod).isText("substring(");
+    test.run("$filter=tolower(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.TolowerMethod).isText("tolower(");
+    test.run("$filter=toupper(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.ToupperMethod).isText("toupper(");
+    test.run("$filter=trim(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.TrimMethod).isText("trim(");
+    test.run("$filter=concat(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.ConcatMethod).isText("concat(");
+  }
+
+  @Test
+  public void literalDataValues() {
+    // null
+    test.run("null").has(TokenKind.NULL).isInput();
+
+    // binary
+    test.run("binary'ABCD'").has(TokenKind.BinaryValue).isInput();
+    test.run("BiNaRy'ABCD'").has(TokenKind.BinaryValue).isInput();
+
+    // boolean
+    test.run("true").has(TokenKind.BooleanValue).isInput();
+    test.run("false").has(TokenKind.BooleanValue).isInput();
+    test.run("TrUe").has(TokenKind.BooleanValue).isInput();
+    test.run("FaLsE").has(TokenKind.BooleanValue).isInput();
+
+    // Lexer rule INT
+    test.run("123").has(TokenKind.IntegerValue).isInput();
+    test.run("123456789").has(TokenKind.IntegerValue).isInput();
+    test.run("+123").has(TokenKind.IntegerValue).isInput();
+    test.run("+123456789").has(TokenKind.IntegerValue).isInput();
+    test.run("-123").has(TokenKind.IntegerValue).isInput();
+    test.run("-123456789").has(TokenKind.IntegerValue).isInput();
+
+    // Lexer rule DECIMAL
+    test.run("0.1").has(TokenKind.DecimalValue).isInput();
+    test.run("1.1").has(TokenKind.DecimalValue).isInput();
+    test.run("+0.1").has(TokenKind.DecimalValue).isInput();
+    test.run("+1.1").has(TokenKind.DecimalValue).isInput();
+    test.run("-0.1").has(TokenKind.DecimalValue).isInput();
+    test.run("-1.1").has(TokenKind.DecimalValue).isInput();
+
+    // Lexer rule EXP
+    test.run("1.1e+1").has(TokenKind.DoubleValue).isInput();
+    test.run("1.1e-1").has(TokenKind.DoubleValue).isInput();
+
+    test.run("NaN").has(TokenKind.DoubleValue).isInput();
+    test.run("-INF").has(TokenKind.DoubleValue).isInput();
+    test.run("INF").has(TokenKind.DoubleValue).isInput();
+
+    // Lexer rule GUID
+    test.run("1234ABCD-12AB-23CD-45EF-123456780ABC").has(TokenKind.GuidValue).isInput();
+    test.run("1234ABCD-12AB-23CD-45EF-123456780ABC").has(TokenKind.GuidValue).isInput();
+
+    // Lexer rule DATE
+    test.run("2013-11-15").has(TokenKind.DateValue).isInput();
+
+    // Lexer rule DATETIMEOFFSET
+    test.run("2013-11-15T13:35Z").has(TokenKind.DateTimeOffsetValue).isInput();
+    test.run("2013-11-15T13:35:10Z").has(TokenKind.DateTimeOffsetValue).isInput();
+    test.run("2013-11-15T13:35:10.1234Z").has(TokenKind.DateTimeOffsetValue).isInput();
+
+    test.run("2013-11-15T13:35:10.1234+01:30").has(TokenKind.DateTimeOffsetValue).isInput();
+    test.run("2013-11-15T13:35:10.1234-01:12").has(TokenKind.DateTimeOffsetValue).isInput();
+
+    test.run("2013-11-15T13:35Z").has(TokenKind.DateTimeOffsetValue).isInput();
+
+    // Lexer rule DURATION
+    test.run("duration'PT67S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'PT67.89S'").has(TokenKind.DurationValue).isInput();
+
+    test.run("duration'PT5M'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'PT5M67S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'PT5M67.89S'").has(TokenKind.DurationValue).isInput();
+
+    test.run("duration'PT4H'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'PT4H67S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'PT4H67.89S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'PT4H5M'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'PT4H5M67S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'PT4H5M67.89S'").has(TokenKind.DurationValue).isInput();
+
+    test.run("duration'P3D'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT67S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT67.89S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT5M'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT5M67S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT5M67.89S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT4H'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT4H67S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT4H67.89S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT4H5M'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT4H5M67S'").has(TokenKind.DurationValue).isInput();
+    test.run("duration'P3DT4H5M67.89S'").has(TokenKind.DurationValue).isInput();
+
+    test.run("DuRaTiOn'P3DT4H5M67.89S'").has(TokenKind.DurationValue).isInput();
+    test.run("DuRaTiOn'-P3DT4H5M67.89S'").has(TokenKind.DurationValue).isInput();
+
+    test.run("20:00").has(TokenKind.TimeOfDayValue).isInput();
+    test.run("20:15:01").has(TokenKind.TimeOfDayValue).isInput();
+    test.run("20:15:01.02").has(TokenKind.TimeOfDayValue).isInput();
+
+    test.run("20:15:01.02").has(TokenKind.TimeOfDayValue).isInput();
+
+    // String
+    test.run("'ABC'").has(TokenKind.StringValue).isInput();
+    test.run("'A%20C'").has(TokenKind.StringValue).isInput();
+    test.run("'%20%20%20ABC'").has(TokenKind.StringValue).isInput();
+  }
+
+  @Test
+  public void delims() {
+    // The last two chars are not in cPCT_ENCODED_UNESCAPED.
+//    final String cPCT_ENCODED = "%45%46%47" + "%22" + "%5C";
+//    final String cUNRESERVED = "ABCabc123-._~";
+//    final String cOTHER_DELIMS = "!()*+,;";
+//    final String cSUB_DELIMS = "$&'=" + cOTHER_DELIMS;
+
+//    private static final String cPCHAR = cUNRESERVED + cPCT_ENCODED + cSUB_DELIMS + ":@";
+//    final String reserved = "/";
+    // Test lexer rule UNRESERVED
+//    test.run("$format=A/" + cUNRESERVED).has(TokenKind.FORMAT).isInput();
+//    test.run("$format=A/" + cUNRESERVED + reserved).has(TokenKind.FORMAT).isText(cUNRESERVED);
+    // Test lexer rule PCT_ENCODED
+//    test.run("$format=A/" + cPCT_ENCODED).has(TokenKind.FORMAT).isInput();
+//    test.run("$format=A/" + cPCT_ENCODED + reserved).has(TokenKind.FORMAT).isText(cPCT_ENCODED);
+    // Test lexer rule SUB_DELIMS
+//    test.run("$format=A/" + cSUB_DELIMS).has(TokenKind.FORMAT).isInput();
+//    test.run("$format=A/" + cSUB_DELIMS + reserved).has(TokenKind.FORMAT).isText("$");
+    // Test lexer rule PCHAR rest
+//    test.run("$format=A/:@").has(TokenKind.FORMAT).isInput();
+//    test.run("$format=A/:@" + reserved).has(TokenKind.FORMAT).isText(":@");
+    // Test lexer rule PCHAR all
+//    test.run("$format=" + cPCHAR + "/" + cPCHAR).has(TokenKind.FORMAT).isInput();
+  }
+
+  public class TokenValidator {
+
+    private String input = null;
+    private UriTokenizer tokenizer = null;
+    private String curText = null;
+
+    public TokenValidator run(final String uri) {
+      input = uri;
+      tokenizer = new UriTokenizer(uri);
+      curText = "";
+      return this;
+    }
+
+    public TokenValidator has(final TokenKind... expected) {
+      for (final TokenKind kind : expected) {
+        assertTrue(tokenizer.next(kind));
+        curText += tokenizer.getText();
+      }
+      return this;
+    }
+
+    public TokenValidator isText(final String expected) {
+      assertEquals(expected, tokenizer.getText());
+      return this;
+    }
+
+    public TokenValidator isInput() {
+      assertEquals(input, curText);
+      assertTrue(tokenizer.next(TokenKind.EOF));
+      return this;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/UriDecoderTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/UriDecoderTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/UriDecoderTest.java
index 20ab94f..243cb45 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/UriDecoderTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/UriDecoderTest.java
@@ -19,7 +19,6 @@
 package org.apache.olingo.server.core.uri.parser;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.Arrays;
@@ -32,13 +31,14 @@ public class UriDecoderTest {
 
   @Test
   public void split() throws Exception {
-    assertTrue(UriDecoder.splitAndDecodePath("").isEmpty());
-    assertTrue(UriDecoder.splitAndDecodePath("/").isEmpty());
+    assertEquals(Arrays.asList(""), UriDecoder.splitAndDecodePath(""));
+    assertEquals(Arrays.asList("", ""), UriDecoder.splitAndDecodePath("/"));
     assertEquals(Arrays.asList("a"), UriDecoder.splitAndDecodePath("a"));
-    assertEquals(Arrays.asList("a"), UriDecoder.splitAndDecodePath("a/"));
-    assertEquals(Arrays.asList("a"), UriDecoder.splitAndDecodePath("/a"));
-    assertEquals(Arrays.asList("a", "a"), UriDecoder.splitAndDecodePath("a/a"));
-    assertEquals(Arrays.asList("a", "a"), UriDecoder.splitAndDecodePath("/a/a"));
+    assertEquals(Arrays.asList("a", ""), UriDecoder.splitAndDecodePath("a/"));
+    assertEquals(Arrays.asList("", "a"), UriDecoder.splitAndDecodePath("/a"));
+    assertEquals(Arrays.asList("a", "b"), UriDecoder.splitAndDecodePath("a/b"));
+    assertEquals(Arrays.asList("", "a", "b"), UriDecoder.splitAndDecodePath("/a/b"));
+    assertEquals(Arrays.asList("", "a", "", "", "b", ""), UriDecoder.splitAndDecodePath("/a///b/"));
   }
 
   @Test
@@ -49,7 +49,7 @@ public class UriDecoderTest {
 
   @Test
   public void options() throws Exception {
-    assertTrue(UriDecoder.splitAndDecodeOptions("").isEmpty());
+    checkOption("", "", "");
 
     checkOption("a", "a", "");
     checkOption("a=b", "a", "b");
@@ -67,6 +67,7 @@ public class UriDecoderTest {
 
     checkOption("=&=", "", "");
     assertEquals(2, UriDecoder.splitAndDecodeOptions("=&=").size());
+    assertEquals(13, UriDecoder.splitAndDecodeOptions("&&&&&&&&&&&&").size());
 
     checkOption("=&c=d", "", "");
     checkOption("=&c=d", "c", "d");

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserAndTokenizerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserAndTokenizerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserAndTokenizerTest.java
index 9bb7d6f..f19fc82 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserAndTokenizerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserAndTokenizerTest.java
@@ -194,7 +194,7 @@ public class SearchParserAndTokenizerTest {
   }
 
   private static Validator assertQuery(final String searchQuery) {
-    return Validator.init(searchQuery);
+    return new Validator(searchQuery);
   }
 
   private static class Validator {
@@ -204,18 +204,12 @@ public class SearchParserAndTokenizerTest {
       this.searchQuery = searchQuery;
     }
 
-    private static Validator init(final String searchQuery) {
-      return new Validator(searchQuery);
-    }
-
-    private void resultsIn(final SearchParserException.MessageKey key)
-        throws SearchTokenizerException {
-
+    private void resultsIn(final SearchParserException.MessageKey key) throws SearchTokenizerException {
       try {
         resultsIn(searchQuery);
-      } catch (SearchParserException e) {
-        Assert.assertEquals("SearchParserException with unexpected message '" + e.getMessage() +
-            "' was thrown.", key, e.getMessageKey());
+      } catch (final SearchParserException e) {
+        Assert.assertEquals("SearchParserException with unexpected message '" + e.getMessage() + "' was thrown.",
+            key, e.getMessageKey());
         return;
       }
       Assert.fail("SearchParserException with message key " + key.getKey() + " was not thrown.");
@@ -224,23 +218,22 @@ public class SearchParserAndTokenizerTest {
     public void resultsInExpectedTerm(final String actualToken) throws SearchTokenizerException {
       try {
         resultsIn(searchQuery);
-      } catch (SearchParserException e) {
+      } catch (final SearchParserException e) {
         Assert.assertEquals(SearchParserException.MessageKeys.EXPECTED_DIFFERENT_TOKEN, e.getMessageKey());
         Assert.assertEquals("Expected PHRASE||WORD found: " + actualToken, e.getMessage());
+        return;
       }
+      Assert.fail("SearchParserException with message key "
+          + SearchParserException.MessageKeys.EXPECTED_DIFFERENT_TOKEN + " was not thrown.");
     }
 
-    private void resultsIn(String expectedSearchExpression) throws SearchTokenizerException, SearchParserException {
-      final SearchExpression searchExpression = getSearchExpression();
-      Assert.assertEquals(expectedSearchExpression, searchExpression.toString());
-    }
-
-    private SearchExpression getSearchExpression() throws SearchParserException, SearchTokenizerException {
-      SearchOption result = new SearchParser().parse(searchQuery);
+    private void resultsIn(final String expectedSearchExpression)
+        throws SearchTokenizerException, SearchParserException {
+      final SearchOption result = new SearchParser().parse(searchQuery);
       Assert.assertNotNull(result);
       final SearchExpression searchExpression = result.getSearchExpression();
       Assert.assertNotNull(searchExpression);
-      return searchExpression;
+      Assert.assertEquals(expectedSearchExpression, searchExpression.toString());
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserTest.java
index 780c209..40be4ac 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchParserTest.java
@@ -224,34 +224,34 @@ public class SearchParserTest extends SearchParser {
   private void runEx(final MessageKeys key, final Token... tokenArray) {
     try {
       run(tokenArray);
-      fail("Expected UriParserSyntaxException with key " + key);
+      fail("Expected SearchParserException with key " + key);
     } catch (SearchParserException e) {
       assertEquals(key, e.getMessageKey());
     }
   }
 
-  private SearchExpression run(final SearchQueryToken.Token... tokenArray) throws SearchParserException {
+  private SearchExpression run(final Token... tokenArray) throws SearchParserException {
     List<SearchQueryToken> tokenList = prepareTokens(tokenArray);
     SearchExpression se = parse(tokenList);
     assertNotNull(se);
     return se;
   }
 
-  public List<SearchQueryToken> prepareTokens(final SearchQueryToken.Token... tokenArray) {
+  public List<SearchQueryToken> prepareTokens(final Token... tokenArray) {
     ArrayList<SearchQueryToken> tokenList = new ArrayList<SearchQueryToken>();
     int wordNumber = 1;
     int phraseNumber = 1;
-    for (Token aTokenArray : tokenArray) {
+    for (Token aToken : tokenArray) {
       SearchQueryToken token = mock(SearchQueryToken.class);
-      when(token.getToken()).thenReturn(aTokenArray);
-      if (aTokenArray == Token.WORD) {
+      when(token.getToken()).thenReturn(aToken);
+      if (aToken == Token.WORD) {
         when(token.getLiteral()).thenReturn("word" + wordNumber);
         wordNumber++;
-      } else if (aTokenArray == Token.PHRASE) {
+      } else if (aToken == Token.PHRASE) {
         when(token.getLiteral()).thenReturn("\"phrase" + phraseNumber + "\"");
         phraseNumber++;
       }
-      when(token.toString()).thenReturn("" + aTokenArray);
+      when(token.toString()).thenReturn("" + aToken);
       tokenList.add(token);
     }
     return tokenList;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java
index a6c1375..8179027 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/parser/search/SearchTokenizerTest.java
@@ -269,7 +269,7 @@ public class SearchTokenizerTest {
     assertQuery("\"\"").resultsIn(SearchTokenizerException.MessageKeys.INVALID_TOKEN_STATE);
     assertQuery("some AND)").resultsIn(SearchTokenizerException.MessageKeys.FORBIDDEN_CHARACTER);
     assertQuery("some OR)").resultsIn(SearchTokenizerException.MessageKeys.FORBIDDEN_CHARACTER);
-    assertQuery("some NOT)").enableLogging().resultsIn(SearchTokenizerException.MessageKeys.FORBIDDEN_CHARACTER);
+    assertQuery("some NOT)").resultsIn(SearchTokenizerException.MessageKeys.FORBIDDEN_CHARACTER);
   }
 
   @Test
@@ -308,7 +308,6 @@ public class SearchTokenizerTest {
 
   private static class Validator {
     private List<Tuple> validations = new ArrayList<Tuple>();
-    private boolean log;
     private final String searchQuery;
 
     public void resultsIn(final SearchQueryToken.Token... tokens) throws SearchTokenizerException {
@@ -345,11 +344,6 @@ public class SearchTokenizerTest {
       this.searchQuery = searchQuery;
     }
 
-    private Validator enableLogging() {
-      log = true;
-      return this;
-    }
-
     private Validator addExpected(final SearchQueryToken.Token token, final String literal) {
       validations.add(new Tuple(token, literal));
       return this;
@@ -368,10 +362,6 @@ public class SearchTokenizerTest {
         validate();
       } catch (SearchTokenizerException e) {
         Assert.assertEquals("SearchTokenizerException with unexpected message was thrown.", key, e.getMessageKey());
-        if (log) {
-          System.out.println("Caught SearchTokenizerException with message key " +
-              e.getMessageKey() + " and message " + e.getMessage());
-        }
         return;
       }
       Assert.fail("No SearchTokenizerException was not thrown.");
@@ -381,9 +371,6 @@ public class SearchTokenizerTest {
       SearchTokenizer tokenizer = new SearchTokenizer();
       List<SearchQueryToken> result = tokenizer.tokenize(searchQuery);
       Assert.assertNotNull(result);
-      if (log) {
-        System.out.println(result);
-      }
       if (validations.size() != 0) {
         Assert.assertEquals(validations.size(), result.size());
 


[4/5] olingo-odata4 git commit: [OLINGO-834] URI parser shall not ignore empty path segments

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
deleted file mode 100644
index a94026f..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
+++ /dev/null
@@ -1,5900 +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.server.core.uri.antlr;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
-import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException.MessageKeys;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-import org.apache.olingo.server.core.uri.parser.search.SearchParserException;
-import org.apache.olingo.server.core.uri.testutil.FilterValidator;
-import org.apache.olingo.server.core.uri.testutil.TestUriValidator;
-import org.apache.olingo.server.core.uri.validator.UriValidationException;
-import org.apache.olingo.server.tecsvc.provider.ActionProvider;
-import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.EnumTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.FunctionProvider;
-import org.apache.olingo.server.tecsvc.provider.PropertyProvider;
-import org.apache.olingo.server.tecsvc.provider.TypeDefinitionProvider;
-import org.junit.Test;
-
-public class TestFullResourcePath {
-
-  private static final OData oData = OData.newInstance();
-  private static final Edm edm = oData.createServiceMetadata(
-      new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
-  private final TestUriValidator testUri;
-  private final FilterValidator testFilter;
-
-  public TestFullResourcePath() {
-    testUri = new TestUriValidator().setEdm(edm);
-    testFilter = new FilterValidator().setEdm(edm);
-  }
-
-  @Test
-  public void enumAndTypeDefAsKey() throws Exception {
-    testUri
-        .run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',PropertyDefString='abc')")
-        .goPath()
-        .at(0)
-        .isEntitySet("ESMixEnumDefCollComp")
-        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
-        .isKeyPredicate(1, "PropertyDefString", "'abc'");
-
-    testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has Namespace1_Alias.ENString'String1'")
-        .is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String1>>>");
-
-    testUri
-        .run("ESMixEnumDefCollComp(PropertyEnumString=Namespace1_Alias.ENString'String1',PropertyDefString='abc')")
-        .goPath()
-        .at(0)
-        .isEntitySet("ESMixEnumDefCollComp")
-        .isKeyPredicate(0, "PropertyEnumString", "Namespace1_Alias.ENString'String1'")
-        .isKeyPredicate(1, "PropertyDefString", "'abc'");
-  }
-
-  @Test
-  public void functionBound_varOverloading() throws Exception {
-    // on ESTwoKeyNav
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-        .at(1)
-        .isUriPathInfoKind(UriResourceKind.function)
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    // with string parameter
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-        .at(1)
-        .isUriPathInfoKind(UriResourceKind.function)
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    // with string parameter
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-        .at(1)
-        .isUriPathInfoKind(UriResourceKind.function)
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-  }
-
-  @Test
-  public void runBfuncBnCpropCastRtEs() throws Exception {
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isComplex("PropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp, false)
-        .n()
-        .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav");
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isComplex("PropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp, false)
-        .n()
-        .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav")
-        .isType(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isUriPathInfoKind(UriResourceKind.count);
-
-  }
-
-  @Test
-  public void runBfuncBnCpropCollRtEs() throws Exception {
-    testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isUriPathInfoKind(UriResourceKind.complexProperty)
-        .isComplex("CollPropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp, true)
-        .n()
-        .isFunction("BFCCollCTPrimCompRTESAllPrim");
-
-    testUri
-        .run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isUriPathInfoKind(UriResourceKind.complexProperty)
-        .isComplex("CollPropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp, true)
-        .n()
-        .isFunction("BFCCollCTPrimCompRTESAllPrim")
-        .isType(EntityTypeProvider.nameETAllPrim, true)
-        .n()
-        .isUriPathInfoKind(UriResourceKind.count);
-  }
-
-  @Test
-  public void runBfuncBnCpropRtEs() throws Exception {
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
-        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .n()
-        .isUriPathInfoKind(UriResourceKind.complexProperty)
-        .isComplex("PropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp, false)
-        .n()
-        .isFunction("BFCCTPrimCompRTESTwoKeyNav");
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
-        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .n()
-        .isUriPathInfoKind(UriResourceKind.complexProperty)
-        .isComplex("PropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp, false)
-        .n()
-        .isFunction("BFCCTPrimCompRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .n()
-        .isUriPathInfoKind(UriResourceKind.count);
-
-  }
-
-  @Test
-  public void runBfuncBnEntityRtEs() throws Exception {
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .n()
-        .isFunction("BFCETTwoKeyNavRTESTwoKeyNav");
-  }
-
-  @Test
-  public void runBfuncBnEntityCastRtEs() throws Exception {
-    testUri
-        .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-            + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
-
-    testUri
-        .run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='(''2'')')"
-            + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'(''2'')'")
-        .n()
-        .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
-  }
-
-  @Test
-  public void runBfuncBnEsCastRtEs() throws Exception {
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey");
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
-        + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey")
-        .isType(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
-    testUri.run("ESTwoKeyNav"
-        + "/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()"
-        + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
-        + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-  }
-
-  @Test
-  public void runBfuncBnEsRtCprop() throws Exception {
-    testUri.run("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESAllPrim")
-        .n()
-        .isFunction("BFNESAllPrimRTCTAllPrim")
-        .isType(ComplexTypeProvider.nameCTAllPrim);
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/olingo.odata.test1.CTBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTCTTwoPrim")
-        .isType(ComplexTypeProvider.nameCTTwoPrim, false)
-        .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase);
-  }
-
-  @Test
-  public void runBfuncBnEsRtCpropColl() throws Exception {
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
-        .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
-        .isType(ComplexTypeProvider.nameCTTwoPrim, true)
-        .n()
-        .isUriPathInfoKind(UriResourceKind.count);
-  }
-
-  @Test
-  public void runBfuncBnEsRtEntityPpNp() throws Exception {
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne/$ref")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
-        .n()
-        .isUriPathInfoKind(UriResourceKind.ref);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/NavPropertyETMediaOne/$value")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNav")
-        .n()
-        .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false)
-        .n()
-        .isValue();
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
-        + "/NavPropertyETTwoKeyNavOne")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNavParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
-        + "/NavPropertyETTwoKeyNavOne/PropertyComp")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNavParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-        .n()
-        .isComplex("PropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
-        + "/NavPropertyETTwoKeyNavOne/PropertyComp/PropertyComp")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNavParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-        .n()
-        .isComplex("PropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp)
-        .n()
-        .isComplex("PropertyComp")
-        .isType(ComplexTypeProvider.nameCTAllPrim);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
-        + "/NavPropertyETTwoKeyNavOne/PropertyString")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNavParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-        .n()
-        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
-        + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/PropertyString")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNavParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'")
-        .n()
-        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-    testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(WrongParameter='1')")
-        .isExSemantic(MessageKeys.UNKNOWN_PART);
-    testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString=wrong)")
-        .isExSemantic(MessageKeys.INVALID_KEY_VALUE);
-  }
-
-  @Test
-  public void runBfuncBnEsRtEntyPpNpCast() throws Exception {
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()"
-        + "/NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
-    testUri
-        .run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')"
-            + "/NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETTwoBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
-  }
-
-  @Test
-  public void runBfuncBnEsRtEntityPpCp() throws Exception {
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNav")
-        .n()
-        .isComplex("PropertyCompNav")
-        .isType(ComplexTypeProvider.nameCTNavFiveProp);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav/PropertyInt16")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNav")
-        .n()
-        .isComplex("PropertyCompNav")
-        .isType(ComplexTypeProvider.nameCTNavFiveProp)
-        .n()
-        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav/PropertyInt16/$value")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNav")
-        .n()
-        .isComplex("PropertyCompNav")
-        .isType(ComplexTypeProvider.nameCTNavFiveProp)
-        .n()
-        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
-        .n()
-        .isValue();
-
-  }
-
-  @Test
-  public void runBfuncBnEsRtEntyPpCpCast() throws Exception {
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
-        + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNavParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .n()
-        .isComplex("PropertyCompTwoPrim")
-        .isType(ComplexTypeProvider.nameCTTwoPrim)
-        .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
-        + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
-        + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNavParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'")
-        .n()
-        .isComplex("PropertyCompTwoPrim")
-        .isType(ComplexTypeProvider.nameCTTwoPrim)
-        .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
-  }
-
-  @Test
-  public void runBfuncBnEsRtEntityPpSp() throws Exception {
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNav")
-        .n()
-        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16/$value")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESKeyNavRTETKeyNav")
-        .n()
-        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
-        .n()
-        .isValue();
-
-  }
-
-  @Test
-  public void runBfuncBnEsRtEs() throws Exception {
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='2')")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
-        .isParameter(0, "ParameterString", "'2'")
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    testUri.run("ESKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='3')")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
-        .isParameter(0, "ParameterString", "'3'")
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .n()
-        .isCount();
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'");
-
-  }
-
-  @Test
-  public void runBfuncBnEsRtEsBa() throws Exception {
-
-    testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp"
-        + "/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/olingo.odata.test1.BAESAllPrimRTETAllPrim")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isComplex("CollPropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp)
-        .n()
-        .isFunction("BFCCollCTPrimCompRTESAllPrim")
-        .n()
-        .isAction("BAESAllPrimRTETAllPrim");
-
-  }
-
-  @Test
-  public void runBfuncBnEsRtPrim() throws Exception {
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTString");
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()/$value")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTString")
-        .isType(PropertyProvider.nameString)
-        .n()
-        .isValue();
-  }
-
-  @Test
-  public void runbfuncBnEsRtPrimColl() throws Exception {
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTCollString")
-        .isType(PropertyProvider.nameString, true);
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isFunction("BFCESTwoKeyNavRTCollString")
-        .isType(PropertyProvider.nameString, true)
-        .n()
-        .isCount();
-  }
-
-  @Test
-  public void runBfuncBnPpropCollRtEs() throws Exception {
-    testUri.run("ESKeyNav(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
-        .n()
-        .isFunction("BFCCollStringRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true);
-
-    testUri.run("ESKeyNav(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
-        .n()
-        .isFunction("BFCCollStringRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-        .n()
-        .isCount();
-  }
-
-  @Test
-  public void runBfuncBnPpropRtEs() throws Exception {
-
-    testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
-        .n()
-        .isFunction("BFCStringRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true);
-
-    testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
-        .n()
-        .isFunction("BFCStringRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-        .n()
-        .isCount();
-
-    testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()/$ref")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
-        .n()
-        .isFunction("BFCStringRTESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-        .n()
-        .isRef();
-  }
-
-  @Test
-  public void runBfuncBnSingleRtEs() throws Exception {
-
-    testUri.run("SINav/olingo.odata.test1.BFCSINavRTESTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isSingleton("SINav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .n()
-        .isFunction("BFCSINavRTESTwoKeyNav");
-  }
-
-  @Test
-  public void runBfuncBnSingleCastRtEs() throws Exception {
-    testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.BFCETBaseTwoKeyNavRTESBaseTwoKey()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isSingleton("SINav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isFunction("BFCETBaseTwoKeyNavRTESBaseTwoKey");
-  }
-
-  @Test
-  public void runActionBound_on_EntityEntry() throws Exception {
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .n()
-        .isAction("BAETTwoKeyNavRTETTwoKeyNav");
-
-    testUri.run("ESKeyNav(PropertyInt16=1)/olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isAction("BAETTwoKeyNavRTETTwoKeyNav");
-  }
-
-  @Test
-  public void runActionBound_on_EntityCollection() throws Exception {
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .n()
-        .isAction("BAESTwoKeyNavRTESTwoKeyNav");
-  }
-
-  @Test
-  public void runFunctionBound_on_var_Types() throws Exception {
-
-    // on primitive
-    testUri.run("ESAllPrim(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
-        .goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .isType(EntityTypeProvider.nameETAllPrim, false)
-        .at(1)
-        .isUriPathInfoKind(UriResourceKind.primitiveProperty)
-        .isType(PropertyProvider.nameString);
-
-    // on collection of primitive
-    testUri.run("ESCollAllPrim(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()")
-        .goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .isType(EntityTypeProvider.nameETCollAllPrim, false)
-        .at(1)
-        .isUriPathInfoKind(UriResourceKind.primitiveProperty)
-        .isType(PropertyProvider.nameString);
-
-    // on complex
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
-        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
-        .goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .at(1)
-        .isUriPathInfoKind(UriResourceKind.complexProperty)
-        .at(2)
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    // on collection of complex
-    testUri.run("ESKeyNav(1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
-        .goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .at(1)
-        .isType(ComplexTypeProvider.nameCTPrimComp, true)
-        .at(2)
-        .isUriPathInfoKind(UriResourceKind.function)
-        .isType(EntityTypeProvider.nameETAllPrim);
-
-    // on entity
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
-        + "/olingo.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
-        .goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .at(1)
-        .isUriPathInfoKind(UriResourceKind.function)
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    // on collection of entity
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
-        .goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-        .at(1).isUriPathInfoKind(UriResourceKind.function)
-        .isType(EntityTypeProvider.nameETTwoKeyNav);
-  }
-
-  @Test
-  public void runActionBound_on_EntityCast() throws Exception {
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/olingo.odata.test1.BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isAction("BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
-        + "/olingo.odata.test1.ETTwoBaseTwoKeyNav/olingo.odata.test1.BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
-        .n()
-        .isAction("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
-  }
-
-  @Test
-  public void crossjoin() throws Exception {
-    testUri.run("$crossjoin(ESKeyNav)")
-        .isKind(UriInfoKind.crossjoin)
-        .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
-
-    testUri.run("$crossjoin(ESKeyNav,ESTwoKeyNav)")
-        .isKind(UriInfoKind.crossjoin)
-        .isCrossJoinEntityList(Arrays.asList("ESKeyNav", "ESTwoKeyNav"));
-  }
-
-  @Test
-  public void crossjoinFilter() throws Exception {
-    testUri.run("$crossjoin(ESTwoPrim,ESMixPrimCollComp)",
-        "$filter=ESTwoPrim/PropertyString eq ESMixPrimCollComp/PropertyComp/PropertyString")
-        .goFilter()
-        .isBinary(BinaryOperatorKind.EQ)
-        .is("<<ESTwoPrim/PropertyString> eq <ESMixPrimCollComp/PropertyComp/PropertyString>>");
-  }
-
-  @Test
-  public void crossjoinError() throws Exception {
-    testUri.runEx("$crossjoin").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-    testUri.runEx("$crossjoin/error").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
-    testUri.runEx("$crossjoin()").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-    testUri.runEx("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid")
-        .isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
-    testUri.runEx("$crossjoin(ESKeyNav)/$ref")
-        .isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
-  }
-
-  @Test
-  public void runEntityId() throws Exception {
-    testUri.run("$entity", "$id=ESKeyNav(1)")
-        .isKind(UriInfoKind.entityId)
-        .isIdText("ESKeyNav(1)");
-    testUri.run("$entity/olingo.odata.test1.ETKeyNav", "$id=ESKeyNav(1)")
-        .isKind(UriInfoKind.entityId)
-        .isEntityType(EntityTypeProvider.nameETKeyNav)
-        .isIdText("ESKeyNav(1)");
-  }
-
-  @Test
-  public void runEsName() throws Exception {
-    testUri.run("ESAllPrim")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESAllPrim")
-        .isType(EntityTypeProvider.nameETAllPrim, true);
-
-    testUri.run("ESAllPrim/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESAllPrim")
-        .isType(EntityTypeProvider.nameETAllPrim, true)
-        .n()
-        .isCount();
-  }
-
-  @Test
-  public void esNameError() {
-
-    testUri.runEx("ESAllPrim/$count/$ref").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
-    testUri.runEx("ESAllPrim/$ref/$count").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
-    testUri.runEx("ESAllPrim/$ref/invalid").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
-    testUri.runEx("ESAllPrim/$count/invalid").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
-    testUri.runEx("ESAllPrim/PropertyString").isExSemantic(MessageKeys.PROPERTY_AFTER_COLLECTION);
-    testUri.runEx("ESAllPrim(1)/whatever").isExSemantic(MessageKeys.PROPERTY_NOT_IN_TYPE);
-    testUri.runEx("ESAllPrim('1')").isExSemantic(MessageKeys.INVALID_KEY_VALUE);
-    testUri.runEx("ESAllPrim(PropertyInt16)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-    testUri.runEx("ESAllPrim(PropertyInt16=)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-    testUri.runEx("ESAllPrim(PropertyInt16=1,Invalid='1')").isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
-
-    testUri.runEx("ESBase/olingo.odata.test1.ETBase/PropertyInt16")
-        .isExSemantic(MessageKeys.PROPERTY_AFTER_COLLECTION);
-
-    testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim"
-        + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim")
-        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
-
-    testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETAllKey")
-        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
-
-    testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim('1')/olingo.odata.test1.ETAllKey")
-        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
-
-    testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim"
-        + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim")
-        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
-
-    testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim"
-        + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)")
-        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
-
-    testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETAllKey").isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
-    testUri.runEx("ETBaseTwoKeyTwoPrim()").isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
-    testUri.runEx("ESAllNullable(1)/CollPropertyString/$value").isExSemantic(MessageKeys.ONLY_FOR_TYPED_PARTS);
-
-    testUri.runEx("ETMixPrimCollComp(1)/ComplexProperty/$value").isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
-  }
-
-  @Test
-  public void resourcePathWithApostrophe() throws Exception {
-    testUri.runEx("ESAllPrim'").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-    testUri.runEx("ESAllPrim'InvalidStuff").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-    testFilter.runOnETKeyNavEx("PropertyInt16' eq 0").isExSemantic(MessageKeys.TYPES_NOT_COMPATIBLE);
-    testFilter.runOnETKeyNavEx("PropertyInt16 eq' 0").isExSemantic(MessageKeys.TYPES_NOT_COMPATIBLE);
-    testFilter.runOnETKeyNavEx("PropertyInt16 eq 0'")
-        .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
-    testFilter.runOnETKeyNavEx("PropertyInt16 eq 'dsd''")
-        .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-  }
-
-  @Test
-  public void runFunctionsWithKeyPredicates() throws Exception {
-    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
-        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .isParameter(1, "ParameterInt16", "1");
-
-    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16=0)")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
-        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .isParameter(1, "ParameterInt16", "1")
-        .isKeyPredicate(0, "PropertyInt16", "0");
-
-    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(0)")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
-        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .isParameter(1, "ParameterInt16", "1")
-        .isKeyPredicate(0, "PropertyInt16", "0");
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16 eq 0)")
-        .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-
-    // PropertyInt32 does not exist
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=0)")
-        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)"
-        + "(PropertyInt16=0,PropertyInt16=1)")
-        .isExValidation(UriValidationException.MessageKeys.DOUBLE_KEY_PROPERTY);
-
-    testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTCollCTTwoPrimTwoParam")
-        .isFunction("UFCRTCollCTTwoPrimTwoParam")
-        .isParameter(0, "ParameterString", "'1'")
-        .isParameter(1, "ParameterInt16", "1");
-
-    testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16=1)")
-        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
-    testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(1)")
-        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
-    testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=1)")
-        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
-    testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=1,PropertyInt16=2)")
-        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
-    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTCollESTwoKeyNavParam")
-        .isFunction("UFCRTCollETTwoKeyNavParam")
-        .isParameter(0, "ParameterInt16", "1");
-
-    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='1')")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTCollESTwoKeyNavParam")
-        .isFunction("UFCRTCollETTwoKeyNavParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'1'");
-
-    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16 eq 1)")
-        .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-
-    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1)")
-        .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
-
-    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyInt32=1,PropertyString='1')")
-        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
-
-    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)()")
-        .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
-
-    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyInt32=1)")
-        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
-
-    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,Unkown=1)")
-        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
-
-    testUri.run("FICRTCollString()")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTCollString")
-        .isFunction("UFCRTCollString");
-
-    testUri.run("FICRTString()")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTString")
-        .isFunction("UFCRTString");
-
-    testUri.runEx("FICRTCollString()(0)")
-        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
-    testUri.runEx("FICRTString()(0)")
-        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-  }
-
-  @Test
-  public void runNonComposableFunctions() throws Exception {
-    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
-        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isParameter(1, "ParameterString", "'1'");
-
-    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')(0)")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
-        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isParameter(1, "ParameterString", "'1'");
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')(0)/PropertyInt16")
-        .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skip=1")
-        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$top=1")
-        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')",
-        "$filter=PropertyInt16 eq 1")
-        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skip=1")
-        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$count=true")
-        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skiptoken=5")
-        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
-    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$search=test")
-        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
-    testUri.run("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()")
-        .isKind(UriInfoKind.resource)
-        .goPath().first()
-        .isEntitySet("ESAllPrim")
-        .at(1)
-        .isFunction("BFNESAllPrimRTCTAllPrim");
-
-    testUri.runEx("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()"
-        + "/PropertyString")
-        .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
-  }
-
-  @Test
-  public void runEsNameCast() throws Exception {
-    testUri.run("ESTwoPrim/olingo.odata.test1.ETBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim, true)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
-
-    testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(-32768)/olingo.odata.test1.ETTwoBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim, false)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
-        .isKeyPredicate(0, "PropertyInt16", "-32768")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
-
-    testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase(-32768)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim, false)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
-        .isKeyPredicate(0, "PropertyInt16", "-32768");
-
-    testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim, false)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
-        .isKeyPredicate(0, "PropertyInt16", "-32768");
-
-  }
-
-  @Test
-  public void runEsNamePpSpCast() throws Exception {
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false);
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/PropertyComp/PropertyInt16")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isComplex("PropertyComp")
-        .n()
-        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-  }
-
-  @Test
-  public void runEsNameKey() throws Exception {
-    testUri.run("ESCollAllPrim(1)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESCollAllPrim");
-
-    testUri.run("ESCollAllPrim(PropertyInt16=1)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESCollAllPrim");
-
-    testUri.run("ESFourKeyAlias(PropertyInt16=1,KeyAlias1=2,KeyAlias2='3',KeyAlias3='4')")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESFourKeyAlias")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "KeyAlias1", "2")
-        .isKeyPredicate(2, "KeyAlias2", "'3'")
-        .isKeyPredicate(3, "KeyAlias3", "'4'");
-
-    testUri.runEx("ESTwoPrim('wrong')").isExSemantic(MessageKeys.INVALID_KEY_VALUE);
-    testUri.runEx("ESTwoPrim(PropertyInt16='wrong')").isExSemantic(MessageKeys.INVALID_KEY_VALUE);
-  }
-
-  @Test
-  public void runEsNameParaKeys() throws Exception {
-    testUri.run("ESAllKey(PropertyString='O''Neil',PropertyBoolean=true,PropertyByte=255,"
-        + "PropertySByte=-128,PropertyInt16=-32768,PropertyInt32=-2147483648,"
-        + "PropertyInt64=-9223372036854775808,PropertyDecimal=1,PropertyDate=2013-09-25,"
-        + "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00,"
-        + "PropertyDuration=duration'P50903316DT2H25M4S',"
-        + "PropertyGuid=12345678-1234-1234-1234-123456789012,"
-        + "PropertyTimeOfDay=12:34:55)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESAllKey")
-        .isKeyPredicate(0, "PropertyString", "'O''Neil'")
-        .isKeyPredicate(1, "PropertyBoolean", "true")
-        .isKeyPredicate(2, "PropertyByte", "255")
-        .isKeyPredicate(3, "PropertySByte", "-128")
-        .isKeyPredicate(4, "PropertyInt16", "-32768")
-        .isKeyPredicate(5, "PropertyInt32", "-2147483648")
-        .isKeyPredicate(6, "PropertyInt64", "-9223372036854775808")
-        .isKeyPredicate(7, "PropertyDecimal", "1")
-        .isKeyPredicate(8, "PropertyDate", "2013-09-25")
-        .isKeyPredicate(9, "PropertyDateTimeOffset", "2002-10-10T12:00:00-05:00")
-        .isKeyPredicate(10, "PropertyDuration", "duration'P50903316DT2H25M4S'")
-        .isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012")
-        .isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55");
-  }
-
-  @Test
-  public void runEsNameKeyCast() throws Exception {
-    testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBase);
-
-    testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETTwoBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
-
-    testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
-
-    testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase(1)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
-
-    testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
-
-    testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoPrim")
-        .isType(EntityTypeProvider.nameETTwoPrim)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
-
-    // Keys cannot be specified twice.
-    testUri.runEx("ESTwoPrim(1)/olingo.odata.test1.ETBase(1)")
-        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-    testUri.runEx("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase(1)")
-        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
-    testUri.runEx("ESBase/olingo.odata.test1.ETTwoPrim(1)").isExSemantic(MessageKeys.INCOMPATIBLE_TYPE_FILTER);
-  }
-
-  @Test
-  public void runEsNameParaKeysCast() throws Exception {
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
-    testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'");
-  }
-
-  @Test
-  public void run_EsNamePpCp() throws Exception {
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .n()
-        .isComplex("PropertyComp");
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp/PropertyComp")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .n()
-        .isComplex("PropertyComp")
-        .n()
-        .isComplex("PropertyComp");
-
-    testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
-        + "PropertyDefString='key1')/PropertyEnumString")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESMixEnumDefCollComp")
-        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
-        .isKeyPredicate(1, "PropertyDefString", "'key1'")
-        .n()
-        .isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false);
-
-    testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
-        + "PropertyDefString='key1')/PropertyDefString")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESMixEnumDefCollComp")
-        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
-        .isKeyPredicate(1, "PropertyDefString", "'key1'")
-        .n()
-        .isPrimitiveProperty("PropertyDefString", TypeDefinitionProvider.nameTDString, false);
-  }
-
-  @Test
-  public void runEsNamePpCpColl() throws Exception {
-    testUri.run("ESMixPrimCollComp(5)/CollPropertyComp")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESMixPrimCollComp")
-        .isKeyPredicate(0, "PropertyInt16", "5")
-        .n()
-        .isComplex("CollPropertyComp")
-        .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-        .n()
-        .isComplex("CollPropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp, true);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-        .n()
-        .isComplex("CollPropertyComp")
-        .isType(ComplexTypeProvider.nameCTPrimComp, true)
-        .n()
-        .isCount();
-
-    testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
-        + "PropertyDefString='key1')/CollPropertyEnumString")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESMixEnumDefCollComp")
-        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
-        .isKeyPredicate(1, "PropertyDefString", "'key1'")
-        .n()
-        .isPrimitiveProperty("CollPropertyEnumString", EnumTypeProvider.nameENString, true);
-
-    testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
-        + "PropertyDefString='key1')/CollPropertyDefString")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESMixEnumDefCollComp")
-        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
-        .isKeyPredicate(1, "PropertyDefString", "'key1'")
-        .n()
-        .isPrimitiveProperty("CollPropertyDefString", TypeDefinitionProvider.nameTDString, true);
-  }
-
-  @Test
-  public void runEsNamePpCpCast() throws Exception {
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/PropertyComp")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isComplex("PropertyComp");
-
-    testUri
-        .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-            + "/PropertyComp/PropertyComp")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .n()
-        .isComplex("PropertyComp")
-        .n()
-        .isComplex("PropertyComp");
-
-    testUri
-        .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-            + "/PropertyCompTwoPrim/olingo.odata.test1.CTBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isComplex("PropertyCompTwoPrim")
-        .isType(ComplexTypeProvider.nameCTTwoPrim)
-        .isTypeFilter(ComplexTypeProvider.nameCTBase);
-
-    testUri
-        .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-            + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isComplex("PropertyCompTwoPrim")
-        .isType(ComplexTypeProvider.nameCTTwoPrim)
-        .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
-  }
-
-  @Test
-  public void runNsNamePpNp() throws Exception {
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2");
-
-    testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETKeyNavMany(PropertyInt16=2)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2");
-
-    testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyInt16")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .n()
-        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyCompNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .n()
-        .isComplex("PropertyCompNav");
-
-    testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/NavPropertyETKeyNavOne")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
-        + "/NavPropertyETKeyNavMany(4)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "4");
-
-    testUri.run("ESKeyNav(1)/PropertyCompNav/NavPropertyETTwoKeyNavOne")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isComplex("PropertyCompNav")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')"
-        + "/PropertyComp/PropertyComp/PropertyInt16")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'(3)'")
-        .n()
-        .isComplex("PropertyComp")
-        .n()
-        .isComplex("PropertyComp")
-        .n()
-        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETMediaMany", EntityTypeProvider.nameETMedia, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .n()
-        .isValue();
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
-        + "/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
-        .n()
-        .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false)
-        .n()
-        .isValue();
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
-        + "/NavPropertyETKeyNavOne/$ref")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
-        .n()
-        .isRef();
-  }
-
-  @Test
-  public void runEsNamePpNpCast() throws Exception {
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/NavPropertyETKeyNavMany")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/NavPropertyETKeyNavMany(3)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "3");
-
-    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETTwoBaseTwoKeyNav(PropertyInt16=3,PropertyString='4')")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESTwoKeyNav")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "3")
-        .isKeyPredicate(1, "PropertyString", "'4'")
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
-        + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')"
-        + "/olingo.odata.test1.ETTwoBaseTwoKeyNav/NavPropertyETBaseTwoKeyNavMany")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "4")
-        .isKeyPredicate(1, "PropertyString", "'5'")
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
-        .n()
-        .isNavProperty("NavPropertyETBaseTwoKeyNavMany", EntityTypeProvider.nameETBaseTwoKeyNav, true);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/"
-        + "NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')/"
-        + "NavPropertyETKeyNavMany")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "4")
-        .isKeyPredicate(1, "PropertyString", "'5'")
-        .n()
-        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
-  }
-
-  @Test
-  public void runEsNamePpNpRc() throws Exception {
-    // checks for using referential constraints to fill missing keys
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany('2')").goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
-        .isKeyPredicate(1, "PropertyString", "'2'");
-
-    testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETTwoKeyNavMany(PropertyString='2')").goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
-        .isKeyPredicate(1, "PropertyString", "'2'");
-
-  }
-
-  @Test
-  public void runEsNamePpSp() throws Exception {
-    testUri.run("ESAllPrim(1)/PropertyByte")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESAllPrim")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false);
-
-    testUri.run("ESAllPrim(1)/PropertyByte/$value")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESAllPrim")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false)
-        .n()
-        .isValue();
-
-    testUri.run("ESMixPrimCollComp(1)/PropertyComp/PropertyString")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESMixPrimCollComp")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isComplex("PropertyComp")
-        .n()
-        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-  }
-
-  @Test
-  public void runEsNamePpSpColl() throws Exception {
-    testUri.run("ESCollAllPrim(1)/CollPropertyString")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESCollAllPrim")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .n()
-        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
-
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'")
-        .n()
-        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
-        .n()
-        .isCount();
-
-  }
-
-  @Test
-  public void runEsNameRef() throws Exception {
-    testUri.run("ESAllPrim/$ref")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESAllPrim")
-        .n()
-        .isRef();
-
-    testUri.run("ESAllPrim(-32768)/$ref")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESAllPrim")
-        .isKeyPredicate(0, "PropertyInt16", "-32768")
-        .n()
-        .isRef();
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany/$ref")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
-        .n()
-        .isRef();
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/$ref")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isEntitySet("ESKeyNav")
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .n()
-        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'2'")
-        .n()
-        .isRef();
-  }
-
-  @Test
-  public void runFunctionImpBf() throws Exception {
-
-    testUri.run("FICRTString()/olingo.odata.test1.BFCStringRTESTwoKeyNav()");
-  }
-
-  @Test
-  public void runFunctionImpCastBf() throws Exception {
-
-    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav"
-        + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTETTwoKeyNavParam")
-        .isFunction("UFCRTETTwoKeyNavParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .n()
-        .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
-
-    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)"
-        + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
-        + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTCollESTwoKeyNavParam")
-        .isFunction("UFCRTCollETTwoKeyNavParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'")
-        .n()
-        .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
-
-    testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString=null)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTCollCTTwoPrimTwoParam")
-        .isFunction("UFCRTCollCTTwoPrimTwoParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isParameter(1, "ParameterString", null);
-  }
-
-  @Test
-  public void runFunctionImpEntity() throws Exception {
-
-    testUri.run("FICRTETKeyNav()")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTETKeyNav")
-        .isFunction("UFCRTETKeyNav")
-        .isType(EntityTypeProvider.nameETKeyNav);
-
-    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTETTwoKeyNavParam")
-        .isParameter(0, "ParameterInt16", "1");
-
-    testUri.run("FICRTESMedia(ParameterInt16=1)/$value")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTESMedia")
-        .isFunction("UFCRTETMedia")
-        .n()
-        .isValue();
-
-    testUri.run("FICRTETKeyNav()/$ref")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTETKeyNav")
-        .isFunction("UFCRTETKeyNav")
-        .n()
-        .isRef();
-    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/$ref")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTETTwoKeyNavParam")
-        .isFunction("UFCRTETTwoKeyNavParam")
-        .n()
-        .isRef();
-
-    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTETTwoKeyNavParam")
-        .isFunction("UFCRTETTwoKeyNavParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
-    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTETTwoKeyNavParam")
-        .isFunction("UFCRTETTwoKeyNavParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
-    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)"
-        + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTCollESTwoKeyNavParam")
-        .isFunction("UFCRTCollETTwoKeyNavParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .isKeyPredicate(0, "PropertyInt16", "2")
-        .isKeyPredicate(1, "PropertyString", "'3'");
-  }
-
-  @Test
-  public void runFunctionImpEs() throws Exception {
-    testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
-        .isFunction("UFCRTESMixPrimCollCompTwoParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isParameter(1, "ParameterString", "'2'")
-        .isType(EntityTypeProvider.nameETMixPrimCollComp);
-
-    testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
-        .isFunction("UFCRTESMixPrimCollCompTwoParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isParameter(1, "ParameterString", "'2'")
-        .isType(EntityTypeProvider.nameETMixPrimCollComp);
-
-    testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')/$count")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
-        .isFunction("UFCRTESMixPrimCollCompTwoParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isParameter(1, "ParameterString", "'2'")
-        .isType(EntityTypeProvider.nameETMixPrimCollComp)
-        .n()
-        .isCount();
-  }
-
-  @Test
-  public void runFunctionImpError() {
-    testUri.runEx("FICRTCollCTTwoPrimTwoParam")
-        .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-    testUri.runEx("FICRTCollCTTwoPrimTwoParam()").isExSemantic(MessageKeys.FUNCTION_NOT_FOUND);
-    testUri.runEx("FICRTCollCTTwoPrimTwoParam(invalidParam=2)").isExSemantic(MessageKeys.FUNCTION_NOT_FOUND);
-  }
-
-  @Test
-  public void runFunctionImpEsAlias() throws Exception {
-
-    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=@parameterAlias)", "@parameterAlias=1");
-    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=@parameterAlias)/$count", "@parameterAlias=1");
-    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=@invalidAlias)", "@validAlias=1")
-        .isExValidation(UriValidationException.MessageKeys.MISSING_PARAMETER);
-  }
-
-  @Test
-  public void runFunctionImpEsCast() throws Exception {
-
-    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
-        .isKind(UriInfoKind.resource).goPath()
-        .first()
-        .isFunctionImport("FICRTCollESTwoKeyNavParam")
-        .isFunction("UFCRTCollETTwoKeyNavParam")
-        .isParameter(0, "ParameterInt16", "1")
-        .isType(EntityTypeProvider.nameETTwoKeyNav)
-        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav);
-
-    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav/$count")


<TRUNCATED>

[3/5] olingo-odata4 git commit: [OLINGO-834] URI parser shall not ignore empty path segments

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
deleted file mode 100644
index 6102fd8..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
+++ /dev/null
@@ -1,323 +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.server.core.uri.antlr;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.olingo.server.core.uri.parser.UriTokenizer;
-import org.apache.olingo.server.core.uri.parser.UriTokenizer.TokenKind;
-import org.junit.Test;
-
-/**
- * Tests originally written for the ANTLR lexer.
- */
-public class TestLexer {
-
-  private TokenValidator test = null;
-
-  // The last two chars are not in cPCT_ENCODED_UNESCAPED.
-  private static final String cPCT_ENCODED = "%45%46%47" + "%22" + "%5C";
-  private static final String cUNRESERVED = "ABCabc123-._~";
-  private static final String cOTHER_DELIMS = "!()*+,;";
-  private static final String cSUB_DELIMS = "$&'=" + cOTHER_DELIMS;
-
-  private static final String cPCHAR = cUNRESERVED + cPCT_ENCODED + cSUB_DELIMS + ":@";
-
-  public TestLexer() {
-    test = new TokenValidator();
-  }
-
-  @Test
-  public void unary() {
-    test.run("-a eq a").has(TokenKind.MinusOperator, TokenKind.ODataIdentifier, TokenKind.EqualsOperator,
-        TokenKind.ODataIdentifier).isInput();
-  }
-
-  @Test
-  public void uriTokens() {
-//    test.run("#").isType(TokenKind.FRAGMENT).isInput();
-    test.run("$count").has(TokenKind.COUNT).isInput();
-    test.run("$ref").has(TokenKind.REF).isInput();
-    test.run("$value").has(TokenKind.VALUE).isInput();
-  }
-
-  @Test
-  public void queryOptionsTokens() {
-    test.run("$skip=1").has(TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-    test.run("$skip=2").has(TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-    test.run("$skip=123").has(TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-
-    test.run("$top=1").has(TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-    test.run("$top=2").has(TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-    test.run("$top=123").has(TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-
-    test.run("$levels=1").has(TokenKind.LEVELS, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-    test.run("$levels=2").has(TokenKind.LEVELS, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-    test.run("$levels=123").has(TokenKind.LEVELS, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-    test.run("$levels=max").has(TokenKind.LEVELS, TokenKind.EQ, TokenKind.MAX).isInput();
-
-//    test.run("$format=atom").has(TokenKind.FORMAT, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
-//    test.run("$format=json").has(TokenKind.FORMAT, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
-//    test.run("$format=xml").has(TokenKind.FORMAT,, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
-//    test.run("$format=abc/def").has(TokenKind.FORMAT, TokenKind.EQ,
-//        TokenKind.ODataIdentifier, TokenKind.SLASH, TokenKind.ODataIdentifier).isInput();
-
-//    test.run("$id=123").has(TokenKind.ID, TokenKind.EQ, TokenKind.IntegerValue).isInput();
-//    test.run("$id=ABC").has(TokenKind.ID, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
-
-//    test.run("$skiptoken=ABC").has(TokenKind.SKIPTOKEN, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
-//    test.run("$skiptoken=ABC").has(TokenKind.SKIPTOKEN, TokenKind.EQ, TokenKind.ODataIdentifier).isInput();
-
-    test.run("$search=\"ABC\"").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase).isInput();
-    test.run("$search=ABC").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word).isInput();
-    test.run("$search=\"A%20B%20C\"").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase).isInput();
-    test.run("$search=Test Test").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word,
-        TokenKind.AndOperatorSearch, TokenKind.Word).isInput();
-    test.run("$search=Test&$filter=ABC eq 1").has(TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word);
-  }
-
-  @Test
-  public void queryOptionsDefaultMode() {
-    test.run("$expand=ABC($skip=1)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE).isInput();
-    test.run("$expand=ABC($skip=123)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE).isInput();
-    test.run("$expand=ABC($search=abc)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word, TokenKind.CLOSE).isInput();
-    test.run("$expand=ABC($search=\"123\")").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase, TokenKind.CLOSE).isInput();
-    test.run("$expand=ABC($top=1)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE).isInput();
-    test.run("$expand=ABC($top=123)").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE).isInput();
-
-    test.run("$expand=ABC($expand=DEF($skip=1))").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE, TokenKind.CLOSE)
-        .isInput();
-    test.run("$expand=ABC($expand=DEF($skip=123))").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.SKIP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE, TokenKind.CLOSE)
-        .isInput();
-
-    test.run("$expand=ABC($expand=DEF($top=1))").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE, TokenKind.CLOSE)
-        .isInput();
-    test.run("$expand=ABC($expand=DEF($top=123))").has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-        TokenKind.OPEN, TokenKind.TOP, TokenKind.EQ, TokenKind.IntegerValue, TokenKind.CLOSE, TokenKind.CLOSE)
-        .isInput();
-
-    test.run("$expand=ABC($expand=DEF($search=Test Test))")
-        .has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-            TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-            TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Word,
-            TokenKind.AndOperatorSearch, TokenKind.Word, TokenKind.CLOSE, TokenKind.CLOSE)
-        .isInput();
-    test.run("$expand=ABC($expand=DEF($search=\"Test\" \"Test\"))")
-        .has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-            TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-            TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase,
-            TokenKind.AndOperatorSearch, TokenKind.Phrase, TokenKind.CLOSE, TokenKind.CLOSE)
-        .isInput();
-    test.run("$expand=ABC($expand=DEF($search=\"Test\" \"Test\";$filter=PropertyInt16 eq 0;$orderby=PropertyInt16))")
-        .has(TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-            TokenKind.OPEN, TokenKind.EXPAND, TokenKind.EQ, TokenKind.ODataIdentifier,
-            TokenKind.OPEN, TokenKind.SEARCH, TokenKind.EQ, TokenKind.Phrase,
-            TokenKind.AndOperatorSearch, TokenKind.Phrase, TokenKind.SEMI,
-            TokenKind.FILTER, TokenKind.EQ, TokenKind.ODataIdentifier, TokenKind.EqualsOperator,
-            TokenKind.IntegerValue, TokenKind.SEMI,
-            TokenKind.ORDERBY, TokenKind.EQ, TokenKind.ODataIdentifier, TokenKind.CLOSE, TokenKind.CLOSE)
-        .isInput();
-  }
-
-  @Test
-  public void queryExpressions() {
-    test.run("$it").has(TokenKind.IT).isText("$it");
-
-    test.run("$filter=contains(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.ContainsMethod).isText("contains(");
-
-    test.run("$filter=containsabc").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.ODataIdentifier)
-        .isText("containsabc");
-
-    test.run("$filter=startswith(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.StartswithMethod)
-        .isText("startswith(");
-    test.run("$filter=endswith(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.EndswithMethod).isText("endswith(");
-    test.run("$filter=length(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.LengthMethod).isText("length(");
-    test.run("$filter=indexof(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.IndexofMethod).isText("indexof(");
-    test.run("$filter=substring(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.SubstringMethod).isText("substring(");
-    test.run("$filter=tolower(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.TolowerMethod).isText("tolower(");
-    test.run("$filter=toupper(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.ToupperMethod).isText("toupper(");
-    test.run("$filter=trim(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.TrimMethod).isText("trim(");
-    test.run("$filter=concat(").has(TokenKind.FILTER, TokenKind.EQ, TokenKind.ConcatMethod).isText("concat(");
-  }
-
-  @Test
-  public void literalDataValues() {
-    // null
-    test.run("null").has(TokenKind.NULL).isInput();
-
-    // binary
-    test.run("binary'ABCD'").has(TokenKind.BinaryValue).isInput();
-    test.run("BiNaRy'ABCD'").has(TokenKind.BinaryValue).isInput();
-
-    // boolean
-    test.run("true").has(TokenKind.BooleanValue).isInput();
-    test.run("false").has(TokenKind.BooleanValue).isInput();
-    test.run("TrUe").has(TokenKind.BooleanValue).isInput();
-    test.run("FaLsE").has(TokenKind.BooleanValue).isInput();
-
-    // Lexer rule INT
-    test.run("123").has(TokenKind.IntegerValue).isInput();
-    test.run("123456789").has(TokenKind.IntegerValue).isInput();
-    test.run("+123").has(TokenKind.IntegerValue).isInput();
-    test.run("+123456789").has(TokenKind.IntegerValue).isInput();
-    test.run("-123").has(TokenKind.IntegerValue).isInput();
-    test.run("-123456789").has(TokenKind.IntegerValue).isInput();
-
-    // Lexer rule DECIMAL
-    test.run("0.1").has(TokenKind.DecimalValue).isInput();
-    test.run("1.1").has(TokenKind.DecimalValue).isInput();
-    test.run("+0.1").has(TokenKind.DecimalValue).isInput();
-    test.run("+1.1").has(TokenKind.DecimalValue).isInput();
-    test.run("-0.1").has(TokenKind.DecimalValue).isInput();
-    test.run("-1.1").has(TokenKind.DecimalValue).isInput();
-
-    // Lexer rule EXP
-    test.run("1.1e+1").has(TokenKind.DoubleValue).isInput();
-    test.run("1.1e-1").has(TokenKind.DoubleValue).isInput();
-
-    test.run("NaN").has(TokenKind.DoubleValue).isInput();
-    test.run("-INF").has(TokenKind.DoubleValue).isInput();
-    test.run("INF").has(TokenKind.DoubleValue).isInput();
-
-    // Lexer rule GUID
-    test.run("1234ABCD-12AB-23CD-45EF-123456780ABC").has(TokenKind.GuidValue).isInput();
-    test.run("1234ABCD-12AB-23CD-45EF-123456780ABC").has(TokenKind.GuidValue).isInput();
-
-    // Lexer rule DATE
-    test.run("2013-11-15").has(TokenKind.DateValue).isInput();
-
-    // Lexer rule DATETIMEOFFSET
-    test.run("2013-11-15T13:35Z").has(TokenKind.DateTimeOffsetValue).isInput();
-    test.run("2013-11-15T13:35:10Z").has(TokenKind.DateTimeOffsetValue).isInput();
-    test.run("2013-11-15T13:35:10.1234Z").has(TokenKind.DateTimeOffsetValue).isInput();
-
-    test.run("2013-11-15T13:35:10.1234+01:30").has(TokenKind.DateTimeOffsetValue).isInput();
-    test.run("2013-11-15T13:35:10.1234-01:12").has(TokenKind.DateTimeOffsetValue).isInput();
-
-    test.run("2013-11-15T13:35Z").has(TokenKind.DateTimeOffsetValue).isInput();
-
-    // Lexer rule DURATION
-    test.run("duration'PT67S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'PT67.89S'").has(TokenKind.DurationValue).isInput();
-
-    test.run("duration'PT5M'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'PT5M67S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'PT5M67.89S'").has(TokenKind.DurationValue).isInput();
-
-    test.run("duration'PT4H'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'PT4H67S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'PT4H67.89S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'PT4H5M'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'PT4H5M67S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'PT4H5M67.89S'").has(TokenKind.DurationValue).isInput();
-
-    test.run("duration'P3D'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT67S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT67.89S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT5M'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT5M67S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT5M67.89S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT4H'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT4H67S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT4H67.89S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT4H5M'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT4H5M67S'").has(TokenKind.DurationValue).isInput();
-    test.run("duration'P3DT4H5M67.89S'").has(TokenKind.DurationValue).isInput();
-
-    test.run("DuRaTiOn'P3DT4H5M67.89S'").has(TokenKind.DurationValue).isInput();
-    test.run("DuRaTiOn'-P3DT4H5M67.89S'").has(TokenKind.DurationValue).isInput();
-
-    test.run("20:00").has(TokenKind.TimeOfDayValue).isInput();
-    test.run("20:15:01").has(TokenKind.TimeOfDayValue).isInput();
-    test.run("20:15:01.02").has(TokenKind.TimeOfDayValue).isInput();
-
-    test.run("20:15:01.02").has(TokenKind.TimeOfDayValue).isInput();
-
-    // String
-    test.run("'ABC'").has(TokenKind.StringValue).isInput();
-    test.run("'A%20C'").has(TokenKind.StringValue).isInput();
-    test.run("'%20%20%20ABC'").has(TokenKind.StringValue).isInput();
-  }
-
-  @Test
-  public void delims() {
-    final String reserved = "/";
-    // Test lexer rule UNRESERVED
-//    test.run("$format=A/" + cUNRESERVED).has(TokenKind.FORMAT).isInput();
-//    test.run("$format=A/" + cUNRESERVED + reserved).has(TokenKind.FORMAT).isText(cUNRESERVED);
-    // Test lexer rule PCT_ENCODED
-//    test.run("$format=A/" + cPCT_ENCODED).has(TokenKind.FORMAT).isInput();
-//    test.run("$format=A/" + cPCT_ENCODED + reserved).has(TokenKind.FORMAT).isText(cPCT_ENCODED);
-    // Test lexer rule SUB_DELIMS
-//    test.run("$format=A/" + cSUB_DELIMS).has(TokenKind.FORMAT).isInput();
-//    test.run("$format=A/" + cSUB_DELIMS + reserved).has(TokenKind.FORMAT).isText("$");
-    // Test lexer rule PCHAR rest
-//    test.run("$format=A/:@").has(TokenKind.FORMAT).isInput();
-//    test.run("$format=A/:@" + reserved).has(TokenKind.FORMAT).isText(":@");
-    // Test lexer rule PCHAR all
-//    test.run("$format=" + cPCHAR + "/" + cPCHAR).has(TokenKind.FORMAT).isInput();
-  }
-
-  public class TokenValidator {
-
-    private String input = null;
-    private UriTokenizer tokenizer = null;
-    private String curText = null;
-
-    public TokenValidator run(final String uri) {
-      input = uri;
-      tokenizer = new UriTokenizer(uri);
-      curText = "";
-      return this;
-    }
-
-    public TokenValidator has(final TokenKind... expected) {
-      for (final TokenKind kind : expected) {
-        assertTrue(tokenizer.next(kind));
-        curText += tokenizer.getText();
-      }
-      return this;
-    }
-
-    public TokenValidator isText(final String expected) {
-      assertEquals(expected, tokenizer.getText());
-      return this;
-    }
-
-    public TokenValidator isInput() {
-      assertEquals(input, curText);
-      assertTrue(tokenizer.next(TokenKind.EOF));
-      return this;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
deleted file mode 100644
index dd517f9..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
+++ /dev/null
@@ -1,1046 +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.server.core.uri.antlr;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.testutil.FilterValidator;
-import org.apache.olingo.server.core.uri.testutil.ResourceValidator;
-import org.apache.olingo.server.core.uri.testutil.TestUriValidator;
-import org.apache.olingo.server.core.uri.validator.UriValidationException;
-import org.apache.olingo.server.tecsvc.provider.ActionProvider;
-import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.PropertyProvider;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class TestUriParserImpl {
-  private final Edm edm = OData.newInstance().createServiceMetadata(
-      new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
-  private final TestUriValidator testUri = new TestUriValidator().setEdm(edm);
-  private final ResourceValidator testRes = new ResourceValidator().setEdm(edm);
-  private final FilterValidator testFilter = new FilterValidator().setEdm(edm);
-
-  private final String PropertyBoolean = "PropertyBoolean=true";
-  private final String PropertyByte = "PropertyByte=1";
-  private final String PropertyDate = "PropertyDate=2013-09-25";
-  private final String PropertyDateTimeOffset = "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00";
-  private final String PropertyDecimal = "PropertyDecimal=12";
-  private final String PropertyDuration = "PropertyDuration=duration'P50903316DT2H25M4S'";
-  private final String PropertyGuid = "PropertyGuid=12345678-1234-1234-1234-123456789012";
-  private final String PropertyInt16 = "PropertyInt16=1";
-  private final String PropertyInt32 = "PropertyInt32=12";
-  private final String PropertyInt64 = "PropertyInt64=64";
-  private final String PropertySByte = "PropertySByte=1";
-  private final String PropertyString = "PropertyString='ABC'";
-  private final String PropertyTimeOfDay = "PropertyTimeOfDay=12:34:55";
-
-  private final String allKeys = PropertyString + "," + PropertyInt16 + "," + PropertyBoolean + "," + PropertyByte
-      + "," + PropertySByte + "," + PropertyInt32 + "," + PropertyInt64 + "," + PropertyDecimal + "," + PropertyDate
-      + "," + PropertyDateTimeOffset + "," + PropertyDuration + "," + PropertyGuid + "," + PropertyTimeOfDay;
-
-  @Test
-  public void boundFunctionImport_VarParameters() {
-    // no input
-    testRes.run("ESKeyNav(1)/olingo.odata.test1.BFCETKeyNavRTETKeyNav()")
-    .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
-    .at(1).isUriPathInfoKind(UriResourceKind.function);
-
-    // one input
-    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')")
-    .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
-    .at(1).isUriPathInfoKind(UriResourceKind.function)
-    .isParameter(0, "ParameterString", "'ABC'");
-
-    // two input
-    testRes.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
-    .at(0)
-    .isUriPathInfoKind(UriResourceKind.function)
-    .isParameter(0, "ParameterInt16", "1")
-    .isParameter(1, "ParameterString", "'2'");
-  }
-
-  @Test
-  public void functionBound_varReturnType() {
-    final String esTwoKeyNav = "ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')";
-
-    // returning primitive
-    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()")
-    .at(0)
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-    .at(1)
-    .isUriPathInfoKind(UriResourceKind.function)
-    .isType(PropertyProvider.nameString, false);
-
-    // returning collection of primitive
-    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()")
-    .at(0)
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-    .at(1)
-    .isUriPathInfoKind(UriResourceKind.function)
-    .isType(PropertyProvider.nameString, true);
-
-    // returning single complex
-    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()")
-    .at(0)
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-    .at(1)
-    .isUriPathInfoKind(UriResourceKind.function)
-    .isType(ComplexTypeProvider.nameCTTwoPrim, false);
-
-    // returning collection of complex
-    testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
-    .at(0)
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETTwoKeyNav, true)
-    .at(1)
-    .isUriPathInfoKind(UriResourceKind.function)
-    .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
-    // returning single entity
-    testRes.run(
-        esTwoKeyNav + "/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.entitySet)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
-        .at(1)
-        .isUriPathInfoKind(UriResourceKind.function)
-        .isType(EntityTypeProvider.nameETTwoKeyNav, false);
-
-    // returning collection of entity (aka entitySet)
-    testRes.run(esTwoKeyNav + "/olingo.odata.test1.BFCSINavRTESTwoKeyNav()")
-    .at(0)
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-    .at(1)
-    .isUriPathInfoKind(UriResourceKind.function)
-    .isType(EntityTypeProvider.nameETTwoKeyNav, true);
-  }
-
-  @Test
-  public void actionImport_VarReturnType() {
-    testRes.run(ContainerProvider.AIRT_STRING).isKind(UriInfoKind.resource)
-    .first()
-    .isActionImport(ContainerProvider.AIRT_STRING)
-    .isAction(ActionProvider.nameUARTString.getName())
-    .isType(PropertyProvider.nameString, false);
-
-    testRes.run(ContainerProvider.AIRT_COLL_STRING_TWO_PARAM).isKind(UriInfoKind.resource)
-        .first()
-        .isActionImport(ContainerProvider.AIRT_COLL_STRING_TWO_PARAM)
-        .isAction(ActionProvider.nameUARTCollStringTwoParam.getName())
-        .isType(PropertyProvider.nameString, true);
-
-    testRes.run(ContainerProvider.AIRTCT_TWO_PRIM_PARAM).isKind(UriInfoKind.resource)
-    .first()
-    .isActionImport(ContainerProvider.AIRTCT_TWO_PRIM_PARAM)
-    .isAction(ActionProvider.nameUARTCTTwoPrimParam.getName())
-    .isType(ComplexTypeProvider.nameCTTwoPrim, false);
-
-    testRes.run(ContainerProvider.AIRT_COLL_CT_TWO_PRIM_PARAM).isKind(UriInfoKind.resource)
-    .first()
-    .isActionImport(ContainerProvider.AIRT_COLL_CT_TWO_PRIM_PARAM)
-    .isAction(ActionProvider.nameUARTCollCTTwoPrimParam.getName())
-    .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
-    testRes.run(ContainerProvider.AIRTET_TWO_KEY_TWO_PRIM_PARAM).isKind(UriInfoKind.resource)
-    .first()
-    .isActionImport(ContainerProvider.AIRTET_TWO_KEY_TWO_PRIM_PARAM)
-    .isAction(ActionProvider.nameUARTETTwoKeyTwoPrimParam.getName())
-    .isType(EntityTypeProvider.nameETTwoKeyTwoPrim, false);
-
-    testUri.runEx(ContainerProvider.AIRT_STRING + "/invalidElement")
-        .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
-  }
-
-  @Test
-  public void count() {
-    // count entity set
-    testRes.run("ESAllPrim/$count")
-    .at(0)
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETAllPrim, true)
-    .at(1)
-    .isUriPathInfoKind(UriResourceKind.count);
-
-    // count on collection of complex
-    testRes.run("ESKeyNav(1)/CollPropertyComp/$count")
-    .at(0)
-    .isType(EntityTypeProvider.nameETKeyNav)
-    .at(1)
-    .isType(ComplexTypeProvider.nameCTPrimComp, true)
-    .at(2)
-    .isUriPathInfoKind(UriResourceKind.count);
-
-    // count on collection of primitive
-    testRes.run("ESCollAllPrim(1)/CollPropertyString/$count")
-    .at(1)
-    .isType(PropertyProvider.nameString, true)
-    .at(2)
-    .isUriPathInfoKind(UriResourceKind.count);
-  }
-
-  @Test
-  public void crossJoin() throws Exception {
-    testUri.run("$crossjoin(ESAllKey)")
-    .isKind(UriInfoKind.crossjoin)
-    .isCrossJoinEntityList(Arrays.asList("ESAllKey"));
-
-    testUri.run("$crossjoin(ESAllKey,ESTwoPrim)")
-    .isKind(UriInfoKind.crossjoin)
-    .isCrossJoinEntityList(Arrays.asList("ESAllKey", "ESTwoPrim"));
-  }
-
-  @Test
-  public void entityFailOnValidation() throws Exception {
-    // simple entity set; with qualifiedentityTypeName; with filter
-    testUri.runEx("$entity/olingo.odata.test1.ETTwoPrim", "$filter=PropertyInt16 eq 123&$id=ESAllKey")
-        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-  }
-
-  @Test
-  public void entity() throws Exception {
-    // simple entity set
-    testUri.run("$entity", "$id=ESAllPrim").isKind(UriInfoKind.entityId)
-    .isKind(UriInfoKind.entityId)
-    .isIdText("ESAllPrim");
-
-    // simple entity set; $format before $id
-    testUri.run("$entity", "$format=xml&$id=ETAllPrim").isKind(UriInfoKind.entityId)
-    .isFormatText("xml")
-    .isIdText("ETAllPrim");
-
-    testUri.run("$entity", "$format=xml&abc=123&$id=ESAllKey").isKind(UriInfoKind.entityId)
-    .isFormatText("xml")
-    .isCustomParameter(0, "abc", "123")
-    .isIdText("ESAllKey");
-
-    // simple entity set; $format after $id
-    testUri.run("$entity", "$id=ETAllPrim&$format=xml").isKind(UriInfoKind.entityId)
-    .isIdText("ETAllPrim")
-    .isFormatText("xml");
-
-    // simple entity set; $format and custom parameter after $id
-    testUri.run("$entity", "$id=ETAllPrim&$format=xml&abc=123").isKind(UriInfoKind.entityId)
-    .isIdText("ETAllPrim")
-    .isFormatText("xml")
-    .isCustomParameter(0, "abc", "123");
-
-    // simple entity set; $format before $id and custom parameter after $id
-    testUri.run("$entity", "$format=xml&$id=ETAllPrim&abc=123").isKind(UriInfoKind.entityId)
-    .isFormatText("xml")
-    .isIdText("ETAllPrim")
-    .isCustomParameter(0, "abc", "123");
-
-    // simple entity set; with qualifiedentityTypeName
-    testUri.run("$entity/olingo.odata.test1.ETTwoPrim", "$id=ESBase")
-    .isEntityType(EntityTypeProvider.nameETTwoPrim)
-    .isIdText("ESBase");
-
-    // simple entity set; with qualifiedentityTypeName;
-    testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim")
-    .isEntityType(EntityTypeProvider.nameETBase)
-    .isKind(UriInfoKind.entityId)
-    .isIdText("ESTwoPrim");
-
-    // simple entity set; with qualifiedentityTypeName; with format
-    testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim&$format=atom")
-    .isKind(UriInfoKind.entityId)
-    .isEntityType(EntityTypeProvider.nameETBase)
-    .isIdText("ESTwoPrim")
-    .isFormatText("atom");
-
-    // simple entity set; with qualifiedentityTypeName; with select
-    testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim&$select=*")
-    .isKind(UriInfoKind.entityId)
-    .isEntityType(EntityTypeProvider.nameETBase)
-    .isIdText("ESTwoPrim")
-    .isSelectItemStar(0);
-
-    // simple entity set; with qualifiedentityTypeName; with expand
-    testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim&$expand=*")
-    .isKind(UriInfoKind.entityId)
-    .isEntityType(EntityTypeProvider.nameETBase)
-    .isIdText("ESTwoPrim")
-    .goExpand().first().isSegmentStar();
-  }
-
-  @Test
-  public void entitySet() throws Exception {
-    // plain entity set
-    testRes.run("ESAllPrim")
-    .isEntitySet("ESAllPrim")
-    .isType(EntityTypeProvider.nameETAllPrim);
-
-    // with one key; simple key notation
-    testRes.run("ESAllPrim(1)")
-    .isEntitySet("ESAllPrim")
-    .isType(EntityTypeProvider.nameETAllPrim)
-    .isKeyPredicate(0, "PropertyInt16", "1");
-
-    // with one key; name value key notation
-    testRes.run("ESAllPrim(PropertyInt16=1)")
-    .isEntitySet("ESAllPrim")
-    .isKeyPredicate(0, "PropertyInt16", "1");
-
-    // with two keys
-    testRes.run("ESTwoKeyTwoPrim(PropertyInt16=1,PropertyString='ABC')")
-    .isEntitySet("ESTwoKeyTwoPrim")
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .isKeyPredicate(1, "PropertyString", "'ABC'");
-
-    // with all keys
-    testRes.run("ESAllKey(" + allKeys + ")")
-    .isEntitySet("ESAllKey")
-    .isKeyPredicate(0, "PropertyString", "'ABC'")
-    .isKeyPredicate(1, "PropertyInt16", "1")
-    .isKeyPredicate(2, "PropertyBoolean", "true")
-    .isKeyPredicate(3, "PropertyByte", "1")
-    .isKeyPredicate(4, "PropertySByte", "1")
-    .isKeyPredicate(5, "PropertyInt32", "12")
-    .isKeyPredicate(6, "PropertyInt64", "64")
-    .isKeyPredicate(7, "PropertyDecimal", "12")
-    .isKeyPredicate(8, "PropertyDate", "2013-09-25")
-    .isKeyPredicate(9, "PropertyDateTimeOffset", "2002-10-10T12:00:00-05:00")
-    .isKeyPredicate(10, "PropertyDuration", "duration'P50903316DT2H25M4S'")
-    .isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012")
-    .isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55");
-  }
-
-  @Test
-  public void entitySet_NavigationProperty() {
-    // with navigation property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
-    .at(0)
-    .isEntitySet("ESKeyNav")
-    .isType(EntityTypeProvider.nameETKeyNav)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(1)
-    .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-    .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    // with navigation property -> property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
-    .at(0)
-    .isEntitySet("ESKeyNav")
-    .isType(EntityTypeProvider.nameETKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(1)
-    .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-    .at(2)
-    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-    // with navigation property -> navigation property -> navigation property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
-    .at(0)
-    .isEntitySet("ESKeyNav")
-    .isType(EntityTypeProvider.nameETKeyNav)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(1)
-    .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-    .isType(EntityTypeProvider.nameETTwoKeyNav)
-    .at(2)
-    .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
-    .isType(EntityTypeProvider.nameETKeyNav);
-
-    // with navigation property(key)
-    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)")
-    .at(0)
-    .isEntitySet("ESKeyNav")
-    .at(1)
-    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1");
-
-    // with navigation property(key) -> property
-    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/PropertyString").at(0)
-    .at(0)
-    .isEntitySet("ESKeyNav")
-    .at(1)
-    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(2)
-    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-    // with navigation property(key) -> navigation property
-    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne")
-    .isEntitySet("ESKeyNav")
-    .at(1)
-    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(2)
-    .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
-    // with navigation property(key) -> navigation property(key)
-    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)")
-    .isEntitySet("ESKeyNav")
-    .isType(EntityTypeProvider.nameETKeyNav)
-    .at(1)
-    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(2)
-    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1");
-
-    // with navigation property(key) -> navigation property -> property
-    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne/PropertyString")
-    .at(0)
-    .isEntitySet("ESKeyNav")
-    .isType(EntityTypeProvider.nameETKeyNav)
-    .at(1)
-    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(2)
-    .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
-    .isType(EntityTypeProvider.nameETKeyNav)
-    .at(3)
-    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-    // with navigation property(key) -> navigation property(key) -> property
-    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)/PropertyString")
-    .at(0)
-    .isEntitySet("ESKeyNav")
-    .isType(EntityTypeProvider.nameETKeyNav)
-    .at(1)
-    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(2)
-    .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(3)
-    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-  }
-
-  @Test
-  public void entitySet_Property() {
-    // with property
-    testRes.run("ESAllPrim(1)/PropertyString")
-    .at(0)
-    .isEntitySet("ESAllPrim")
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(1)
-    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-    // with complex property
-    testRes.run("ESCompAllPrim(1)/PropertyComp")
-    .at(0)
-    .isEntitySet("ESCompAllPrim")
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(1)
-    .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false);
-
-    // with two properties
-    testRes.run("ESCompAllPrim(1)/PropertyComp/PropertyString")
-    .at(0)
-    .isEntitySet("ESCompAllPrim")
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(1)
-    .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false)
-    .at(2)
-    .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-  }
-
-  @Test
-  public void entitySet_TypeFilter() {
-    // filter
-    testRes.run("ESTwoPrim/olingo.odata.test1.ETBase")
-    .at(0)
-    .isEntitySet("ESTwoPrim")
-    .isType(EntityTypeProvider.nameETTwoPrim, true)
-    .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
-    .isTypeFilterOnEntry(null);
-
-    // filter before key predicate
-    testRes.run("ESTwoPrim/olingo.odata.test1.ETBase(PropertyInt16=1)")
-    .at(0)
-    .isEntitySet("ESTwoPrim")
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETTwoPrim)
-    .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
-    .isTypeFilterOnEntry(null)
-    .at(0)
-    .isType(EntityTypeProvider.nameETTwoPrim, false)
-    .isKeyPredicate(0, "PropertyInt16", "1");
-
-    // filter before key predicate; property of sub type
-    testRes.run("ESTwoPrim/olingo.odata.test1.ETBase(PropertyInt16=1)/AdditionalPropertyString_5")
-    .at(0)
-    .isEntitySet("ESTwoPrim")
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETTwoPrim)
-    .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
-    .isTypeFilterOnEntry(null)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(1)
-    .isType(PropertyProvider.nameString)
-    .isPrimitiveProperty("AdditionalPropertyString_5", PropertyProvider.nameString, false);
-
-    // filter after key predicate
-    testRes.run("ESTwoPrim(PropertyInt16=1)/olingo.odata.test1.ETBase")
-    .at(0)
-    .isEntitySet("ESTwoPrim")
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETTwoPrim, false)
-    .isTypeFilterOnCollection(null)
-    .isTypeFilterOnEntry(EntityTypeProvider.nameETBase)
-    .isKeyPredicate(0, "PropertyInt16", "1");
-
-    // filter after key predicate; property of sub type
-    testRes.run("ESTwoPrim(PropertyInt16=1)/olingo.odata.test1.ETBase/AdditionalPropertyString_5")
-    .at(0)
-    .isEntitySet("ESTwoPrim")
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EntityTypeProvider.nameETTwoPrim)
-    .isTypeFilterOnCollection(null)
-    .isTypeFilterOnEntry(EntityTypeProvider.nameETBase)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .at(1)
-    .isPrimitiveProperty("AdditionalPropertyString_5", PropertyProvider.nameString, false)
-    .isType(PropertyProvider.nameString);
-  }
-
-  @Test
-  public void unary() throws Exception {
-    testFilter.runOnETAllPrim("not PropertyBoolean").is("<not <PropertyBoolean>>");
-    testFilter.runOnETAllPrim("-PropertyInt16 eq PropertyInt16").is("<<- <PropertyInt16>> eq <PropertyInt16>>");
-  }
-
-  @Test
-  public void filterComplexMixedPriority() throws Exception {
-    testFilter.runOnETAllPrim("PropertyBoolean or true and false")
-        .is("<<PropertyBoolean> or <<true> and <false>>>");
-    testFilter.runOnETAllPrim("PropertyBoolean or true and PropertyInt64 eq PropertyByte")
-        .is("<<PropertyBoolean> or <<true> and <<PropertyInt64> eq <PropertyByte>>>>");
-    testFilter.runOnETAllPrim("PropertyBoolean or PropertyInt32 eq PropertyInt64 and true")
-        .is("<<PropertyBoolean> or <<<PropertyInt32> eq <PropertyInt64>> and <true>>>");
-    testFilter.runOnETAllPrim("PropertyBoolean or PropertyInt32 eq PropertyInt64 and PropertyByte eq PropertySByte")
-        .is("<<PropertyBoolean> or <<<PropertyInt32> eq <PropertyInt64>> "
-            + "and <<PropertyByte> eq <PropertySByte>>>>");
-    testFilter.runOnETAllPrim("PropertyInt16 eq PropertyInt32 or PropertyBoolean and true")
-        .is("<<<PropertyInt16> eq <PropertyInt32>> or <<PropertyBoolean> and <true>>>");
-    testFilter.runOnETAllPrim("PropertyInt16 eq PropertyInt32 or PropertyBoolean and PropertyByte eq PropertySByte")
-        .is("<<<PropertyInt16> eq <PropertyInt32>> "
-            + "or <<PropertyBoolean> and <<PropertyByte> eq <PropertySByte>>>>");
-    testFilter.runOnETAllPrim("PropertyInt16 eq PropertyInt32 or PropertyInt64 eq PropertyByte and PropertyBoolean")
-        .is("<<<PropertyInt16> eq <PropertyInt32>> "
-            + "or <<<PropertyInt64> eq <PropertyByte>> and <PropertyBoolean>>>");
-    testFilter.runOnETAllPrim("PropertyInt16 eq PropertyInt32 or PropertyInt64 eq PropertyByte "
-        + "and PropertySByte eq PropertyDecimal")
-        .is("<<<PropertyInt16> eq <PropertyInt32>> or <<<PropertyInt64> eq <PropertyByte>> "
-            + "and <<PropertySByte> eq <PropertyDecimal>>>>");
-  }
-
-  @Test
-  public void filterSimpleSameBinaryBinaryBinaryPriority() throws Exception {
-    testFilter.runOnETAllPrim("1 add 2 add 3 add 4 ge 0").isCompr("<<<< <1> add   <2>> add  <3>>  add <4>> ge <0>>");
-    testFilter.runOnETAllPrim("1 add 2 add 3 div 4 ge 0").isCompr("<<<  <1> add   <2>> add <<3>   div <4>>> ge <0>>");
-    testFilter.runOnETAllPrim("1 add 2 div 3 add 4 ge 0").isCompr("<<<  <1> add  <<2>  div  <3>>> add <4>> ge <0>>");
-    testFilter.runOnETAllPrim("1 add 2 div 3 div 4 ge 0").isCompr("<<   <1> add <<<2>  div  <3>>  div <4>>> ge <0>>");
-    testFilter.runOnETAllPrim("1 div 2 add 3 add 4 ge 0").isCompr("<<<< <1> div   <2>> add  <3>>  add <4>> ge <0>>");
-    testFilter.runOnETAllPrim("1 div 2 add 3 div 4 ge 0").isCompr("<<<  <1> div   <2>> add <<3>   div <4>>> ge <0>>");
-    testFilter.runOnETAllPrim("1 div 2 div 3 add 4 ge 0").isCompr("<<<< <1> div   <2>> div  <3>>  add <4>> ge <0>>");
-    testFilter.runOnETAllPrim("1 div 2 div 3 div 4 ge 0").isCompr("<<<< <1> div   <2>> div  <3>>  div <4>> ge <0>>");
-  }
-
-  @Test
-  public void functionImport_VarParameters() {
-    // no input
-    testRes.run("FINRTInt16()")
-    .isFunctionImport("FINRTInt16")
-    .isFunction("UFNRTInt16")
-    .isType(PropertyProvider.nameInt16);
-
-    // one input
-    testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
-    .isFunctionImport("FICRTETTwoKeyNavParam")
-    .isFunction("UFCRTETTwoKeyNavParam")
-    .isType(EntityTypeProvider.nameETTwoKeyNav);
-
-    // two input
-    testRes.run("FICRTStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
-    .isFunctionImport("FICRTStringTwoParam")
-    .isFunction("UFCRTStringTwoParam")
-    .isType(PropertyProvider.nameString);
-  }
-
-  @Test
-  public void functionImport_VarReturning() {
-    // returning primitive
-    testRes.run("FINRTInt16()")
-    .isFunctionImport("FINRTInt16")
-    .isFunction("UFNRTInt16")
-    .isType(PropertyProvider.nameInt16, false);
-
-    // returning collection of primitive
-    testRes.run("FICRTCollStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
-    .isFunctionImport("FICRTCollStringTwoParam")
-    .isFunction("UFCRTCollStringTwoParam")
-    .isType(PropertyProvider.nameString, true);
-
-    // returning single complex
-    testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)")
-    .isFunctionImport("FICRTCTAllPrimTwoParam")
-    .isFunction("UFCRTCTAllPrimTwoParam")
-    .isType(ComplexTypeProvider.nameCTAllPrim, false);
-
-    // returning collection of complex
-    testRes.run("FICRTCollCTTwoPrim()")
-    .isFunctionImport("FICRTCollCTTwoPrim")
-    .isFunction("UFCRTCollCTTwoPrim")
-    .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
-    // returning single entity
-    testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
-    .isFunctionImport("FICRTETTwoKeyNavParam")
-    .isFunction("UFCRTETTwoKeyNavParam")
-    .isType(EntityTypeProvider.nameETTwoKeyNav, false);
-
-    // returning collection of entity (aka entitySet)
-    testRes.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)")
-    .isFunctionImport("FICRTCollESTwoKeyNavParam")
-    .isFunction("UFCRTCollETTwoKeyNavParam")
-    .isType(EntityTypeProvider.nameETTwoKeyNav, true);
-  }
-
-  @Test
-  public void functionImportChain() {
-    // test chain; returning single complex
-    testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)/PropertyInt16")
-    .at(0)
-    .isFunctionImport("FICRTCTAllPrimTwoParam")
-    .isFunction("UFCRTCTAllPrimTwoParam")
-    .isType(ComplexTypeProvider.nameCTAllPrim, false)
-    .isParameter(0, "ParameterString", "'ABC'")
-    .isParameter(1, "ParameterInt16", "1")
-    .at(1)
-    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
-    // test chains; returning single entity
-    testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16")
-    .at(0)
-    .isFunctionImport("FICRTETTwoKeyNavParam")
-    .isFunction("UFCRTETTwoKeyNavParam")
-    .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-    .isParameter(0, "ParameterInt16", "1")
-    .at(1)
-    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
-    // test chains; returning collection of entity (aka entitySet)
-    testRes.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')")
-    .at(0)
-    .isFunctionImport("FICRTCollESTwoKeyNavParam")
-    .isFunction("UFCRTCollETTwoKeyNavParam")
-    .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-    .isParameter(0, "ParameterInt16", "1")
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .isKeyPredicate(1, "PropertyString", "'ABC'");
-
-    // test chains; returning collection of entity (aka entitySet)
-    testRes.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')/PropertyInt16")
-    .at(0)
-    .isFunctionImport("FICRTCollESTwoKeyNavParam")
-    .isFunction("UFCRTCollETTwoKeyNavParam")
-    .isType(EntityTypeProvider.nameETTwoKeyNav, false)
-    .isParameter(0, "ParameterInt16", "1")
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .isKeyPredicate(1, "PropertyString", "'ABC'")
-    .at(1)
-    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-  }
-
-  @Test
-  public void metaData() throws Exception {
-    // Parsing the fragment may be used if a uri has to be parsed on the consumer side.
-    // On the producer side this feature is currently not supported, so the context fragment
-    // part is only available as text.
-
-    testUri.run("$metadata")
-    .isKind(UriInfoKind.metadata);
-
-    testUri.run("$metadata", "$format=atom")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom");
-
-    // with context (client usage)
-
-    testUri.run("$metadata", null, "$ref")
-    .isKind(UriInfoKind.metadata)
-    .isFragmentText("$ref");
-
-    testUri.run("$metadata", "$format=atom", "$ref")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("$ref");
-
-    testUri.run("$metadata", "$format=atom", "Collection($ref)")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("Collection($ref)");
-
-    testUri.run("$metadata", "$format=atom", "Collection(Edm.EntityType)")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("Collection(Edm.EntityType)");
-
-    testUri.run("$metadata", "$format=atom", "Collection(Edm.ComplexType)")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("Collection(Edm.ComplexType)");
-
-    testUri.run("$metadata", "$format=atom", "SINav")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("SINav");
-
-    testUri.run("$metadata", "$format=atom", "SINav/PropertyInt16")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("SINav/PropertyInt16");
-
-    testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavOne")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("SINav/NavPropertyETKeyNavOne");
-
-    testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavMany(1)")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("SINav/NavPropertyETKeyNavMany(1)");
-
-    testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavOne/PropertyInt16")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("SINav/NavPropertyETKeyNavOne/PropertyInt16");
-
-    testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavMany(1)/PropertyInt16")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("SINav/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
-    testUri.run("$metadata", "$format=atom", "SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
-
-    testUri.run("$metadata", "$format=atom",
-        "SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
-        .isKind(UriInfoKind.metadata)
-        .isFormatText("atom")
-        .isFragmentText("SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
-    testUri.run("$metadata", "$format=atom", "olingo.odata.test1.ETAllKey")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("olingo.odata.test1.ETAllKey");
-
-    testUri.run("$metadata", "$format=atom", "ESTwoPrim/$deletedEntity")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESTwoPrim/$deletedEntity");
-
-    testUri.run("$metadata", "$format=atom", "ESTwoPrim/$link")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESTwoPrim/$link");
-
-    testUri.run("$metadata", "$format=atom", "ESTwoPrim/$deletedLink")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESTwoPrim/$deletedLink");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav/PropertyInt16")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav/PropertyInt16");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavOne")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavMany(1)")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
-    testUri.run("$metadata", "$format=atom",
-        "ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
-        .isKind(UriInfoKind.metadata)
-        .isFormatText("atom")
-        .isFragmentText("ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
-
-    testUri.run(
-        "$metadata", "$format=atom", "ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
-        .isKind(UriInfoKind.metadata)
-        .isFormatText("atom")
-        .isFragmentText("ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav(PropertyInt16,PropertyString)")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav(PropertyInt16,PropertyString)");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav/$entity")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav/$entity");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav/$delta")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav/$delta");
-
-    testUri.run("$metadata", "$format=atom", "ESKeyNav/(PropertyInt16,PropertyString)/$delta")
-    .isKind(UriInfoKind.metadata)
-    .isFormatText("atom")
-    .isFragmentText("ESKeyNav/(PropertyInt16,PropertyString)/$delta");
-
-  }
-
-  @Test
-  public void ref() throws Exception {
-    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/$ref");
-  }
-
-  @Test
-  public void singleton() {
-    // plain singleton
-    testRes.run("SINav")
-    .isSingleton("SINav")
-    .isType(EntityTypeProvider.nameETTwoKeyNav);
-  }
-
-  @Test
-  public void navigationProperty() {
-    // with navigation property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
-    .at(0).isEntitySet("ESKeyNav")
-    .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
-    // with navigation property -> property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
-    .at(0).isEntitySet("ESKeyNav")
-    .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-    .at(2).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-    // with navigation property -> navigation property -> navigation property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
-    .at(0).isEntitySet("ESKeyNav")
-    .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
-    .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
-    // with navigation property(key)
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')")
-    .at(0).isEntitySet("ESKeyNav")
-    .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .isKeyPredicate(1, "PropertyString", "'1'");
-
-    // with navigation property(key) -> property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/PropertyString")
-    .at(0).isEntitySet("ESKeyNav")
-    .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .isKeyPredicate(1, "PropertyString", "'1'")
-    .at(2).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-    // with navigation property(key) -> navigation property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/NavPropertyETKeyNavOne")
-    .at(0).isEntitySet("ESKeyNav")
-    .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-    .isKeyPredicate(0, "PropertyInt16", "1")
-    .isKeyPredicate(1, "PropertyString", "'1'")
-    .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
-    // with navigation property(key) -> navigation property(key)
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
-        + "/NavPropertyETKeyNavMany(1)")
-        .at(0).isEntitySet("ESKeyNav")
-        .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'1'")
-        .at(2).isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1");
-
-    // with navigation property(key) -> navigation property -> property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
-        + "/NavPropertyETKeyNavOne/PropertyString")
-        .at(0).isEntitySet("ESKeyNav")
-        .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'1'")
-        .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
-        .at(3).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
-    // with navigation property(key) -> navigation property(key) -> property
-    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
-        + "/NavPropertyETKeyNavMany(1)/PropertyString")
-        .at(0).isEntitySet("ESKeyNav")
-        .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .isKeyPredicate(1, "PropertyString", "'1'")
-        .at(2).isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
-        .isKeyPredicate(0, "PropertyInt16", "1")
-        .at(3).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-  }
-
-  @Test
-  public void singleton_Property() {
-    // with property
-    testRes.run("SINav/PropertyInt16")
-    .at(0)
-    .isSingleton("SINav")
-    .isType(EntityTypeProvider.nameETTwoKeyNav)
-    .at(1)
-    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
-    // with complex property
-    testRes.run("SINav/PropertyComp")
-    .at(0)
-    .isSingleton("SINav")
-    .isType(EntityTypeProvider.nameETTwoKeyNav)
-    .at(1)
-    .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false);
-
-    // with two properties
-    testRes.run("SINav/PropertyComp/PropertyInt16")
-    .at(0)
-    .isSingleton("SINav")
-    .isType(EntityTypeProvider.nameETTwoKeyNav)
-    .at(1)
-    .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
-    .at(2)
-    .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
-  }
-
-  @Test
-  public void value() throws Exception {
-    testUri.run("ESAllPrim(1)/PropertyString/$value");
-  }
-
-  @Test
-  public void memberStartingWithCastFailOnValidation1() throws Exception {
-    // on EntityType entry
-    testUri.runEx("ESTwoKeyNav(Property16=1,PropertyString='ABC')",
-        "$filter=olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate")
-        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
-  }
-
-  @Test
-  public void memberStartingWithCastFailOnValidation2() throws Exception {
-    testUri.runEx("FICRTCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')",
-        "$filter=olingo.odata.test1.CTBase/AdditionalPropString")
-        .isExSemantic(UriParserSemanticException.MessageKeys.TYPES_NOT_COMPATIBLE);
-  }
-
-  @Test
-  public void memberStartingWithCast() throws Exception {
-    // on EntityType collection
-    testFilter.runOnETTwoKeyNav("olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate eq null")
-    .left()
-    .isMember()
-    .isMemberStartType(EntityTypeProvider.nameETBaseTwoKeyNav).goPath()
-    .at(0).isType(PropertyProvider.nameDate);
-
-    // on Complex collection
-    testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')",
-        "$filter=olingo.odata.test1.CTBase/AdditionalPropString eq null")
-        .goFilter().left().isMember()
-        .isMemberStartType(ComplexTypeProvider.nameCTBase).goPath()
-        .at(0).isType(PropertyProvider.nameString);
-  }
-
-  @Test
-  public void complexTypeCastFollowingAsCollection() throws Exception {
-    testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')/olingo.odata.test1.CTBase");
-  }
-
-  @Test
-  public void alias() throws Exception {
-    testFilter.runOnETAllPrim("PropertyInt16 eq @p1&@p1=1")
-        .is("<<PropertyInt16> eq <@p1>>");
-  }
-
-  @Test
-  public void lambda() throws Exception {
-    testFilter.runOnETTwoKeyNav("CollPropertyComp/all(l:true)")
-        .is("<CollPropertyComp/<ALL;<true>>>");
-
-    testFilter.runOnETTwoKeyNav("CollPropertyComp/all(x:x/PropertyInt16 eq 2)")
-        .is("<CollPropertyComp/<ALL;<<x/PropertyInt16> eq <2>>>>");
-
-    testFilter.runOnETTwoKeyNav("CollPropertyComp/any(l:true)")
-        .is("<CollPropertyComp/<ANY;<true>>>");
-    testFilter.runOnETTwoKeyNav("CollPropertyComp/any()")
-        .is("<CollPropertyComp/<ANY;>>");
-  }
-
-  @Test
-  public void customQueryOption() throws Exception {
-    testUri.run("ESTwoKeyNav", "custom")
-        .isCustomParameter(0, "custom", "");
-    testUri.run("ESTwoKeyNav", "custom=ABC")
-        .isCustomParameter(0, "custom", "ABC");
-  }
-
-  @Test
-  @Ignore("Geo types are not supported yet.")
-  public void geo() throws Exception {
-    testFilter.runOnETAllPrim("geo.distance(PropertySByte,PropertySByte)")
-        .is("<geo.distance(<PropertySByte>,<PropertySByte>)>")
-        .isMethod(MethodKind.GEODISTANCE, 2);
-    testFilter.runOnETAllPrim("geo.length(PropertySByte)")
-        .is("<geo.length(<PropertySByte>)>")
-        .isMethod(MethodKind.GEOLENGTH, 1);
-    testFilter.runOnETAllPrim("geo.intersects(PropertySByte,PropertySByte)")
-        .is("<geo.intersects(<PropertySByte>,<PropertySByte>)>")
-        .isMethod(MethodKind.GEOINTERSECTS, 2);
-  }
-}


[2/5] olingo-odata4 git commit: [OLINGO-834] URI parser shall not ignore empty path segments

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3295bcc0/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
new file mode 100644
index 0000000..828be80
--- /dev/null
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java
@@ -0,0 +1,5905 @@
+/*
+ * 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.server.core.uri.parser;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.apache.olingo.server.api.uri.UriInfoKind;
+import org.apache.olingo.server.api.uri.UriResourceKind;
+import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
+import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
+import org.apache.olingo.server.core.uri.parser.UriParserSemanticException.MessageKeys;
+import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
+import org.apache.olingo.server.core.uri.parser.search.SearchParserException;
+import org.apache.olingo.server.core.uri.testutil.FilterValidator;
+import org.apache.olingo.server.core.uri.testutil.TestUriValidator;
+import org.apache.olingo.server.core.uri.validator.UriValidationException;
+import org.apache.olingo.server.tecsvc.provider.ActionProvider;
+import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider;
+import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
+import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
+import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
+import org.apache.olingo.server.tecsvc.provider.EnumTypeProvider;
+import org.apache.olingo.server.tecsvc.provider.FunctionProvider;
+import org.apache.olingo.server.tecsvc.provider.PropertyProvider;
+import org.apache.olingo.server.tecsvc.provider.TypeDefinitionProvider;
+import org.junit.Test;
+
+public class TestFullResourcePath {
+
+  private static final OData oData = OData.newInstance();
+  private static final Edm edm = oData.createServiceMetadata(
+      new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
+  private final TestUriValidator testUri;
+  private final FilterValidator testFilter;
+
+  public TestFullResourcePath() {
+    testUri = new TestUriValidator().setEdm(edm);
+    testFilter = new FilterValidator().setEdm(edm);
+  }
+
+  @Test
+  public void enumAndTypeDefAsKey() throws Exception {
+    testUri
+        .run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',PropertyDefString='abc')")
+        .goPath()
+        .at(0)
+        .isEntitySet("ESMixEnumDefCollComp")
+        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
+        .isKeyPredicate(1, "PropertyDefString", "'abc'");
+
+    testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has Namespace1_Alias.ENString'String1'")
+        .is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String1>>>");
+
+    testUri
+        .run("ESMixEnumDefCollComp(PropertyEnumString=Namespace1_Alias.ENString'String1',PropertyDefString='abc')")
+        .goPath()
+        .at(0)
+        .isEntitySet("ESMixEnumDefCollComp")
+        .isKeyPredicate(0, "PropertyEnumString", "Namespace1_Alias.ENString'String1'")
+        .isKeyPredicate(1, "PropertyDefString", "'abc'");
+  }
+
+  @Test
+  public void functionBound_varOverloading() throws Exception {
+    // on ESTwoKeyNav
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    // with string parameter
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    // with string parameter
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+  }
+
+  @Test
+  public void runBfuncBnCpropCastRtEs() throws Exception {
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isComplex("PropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp, false)
+        .n()
+        .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav");
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isComplex("PropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp, false)
+        .n()
+        .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav")
+        .isType(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isUriPathInfoKind(UriResourceKind.count);
+
+  }
+
+  @Test
+  public void runBfuncBnCpropCollRtEs() throws Exception {
+    testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isUriPathInfoKind(UriResourceKind.complexProperty)
+        .isComplex("CollPropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp, true)
+        .n()
+        .isFunction("BFCCollCTPrimCompRTESAllPrim");
+
+    testUri
+        .run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isUriPathInfoKind(UriResourceKind.complexProperty)
+        .isComplex("CollPropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp, true)
+        .n()
+        .isFunction("BFCCollCTPrimCompRTESAllPrim")
+        .isType(EntityTypeProvider.nameETAllPrim, true)
+        .n()
+        .isUriPathInfoKind(UriResourceKind.count);
+  }
+
+  @Test
+  public void runBfuncBnCpropRtEs() throws Exception {
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isUriPathInfoKind(UriResourceKind.complexProperty)
+        .isComplex("PropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp, false)
+        .n()
+        .isFunction("BFCCTPrimCompRTESTwoKeyNav");
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isUriPathInfoKind(UriResourceKind.complexProperty)
+        .isComplex("PropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp, false)
+        .n()
+        .isFunction("BFCCTPrimCompRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .n()
+        .isUriPathInfoKind(UriResourceKind.count);
+
+  }
+
+  @Test
+  public void runBfuncBnEntityRtEs() throws Exception {
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isFunction("BFCETTwoKeyNavRTESTwoKeyNav");
+  }
+
+  @Test
+  public void runBfuncBnEntityCastRtEs() throws Exception {
+    testUri
+        .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+            + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
+
+    testUri
+        .run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='(''2'')')"
+            + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'(''2'')'")
+        .n()
+        .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
+  }
+
+  @Test
+  public void runBfuncBnEsCastRtEs() throws Exception {
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey");
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
+        + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey")
+        .isType(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
+
+    testUri.run("ESTwoKeyNav"
+        + "/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()"
+        + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+        + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
+  }
+
+  @Test
+  public void runBfuncBnEsRtCprop() throws Exception {
+    testUri.run("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESAllPrim")
+        .n()
+        .isFunction("BFNESAllPrimRTCTAllPrim")
+        .isType(ComplexTypeProvider.nameCTAllPrim);
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/olingo.odata.test1.CTBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTCTTwoPrim")
+        .isType(ComplexTypeProvider.nameCTTwoPrim, false)
+        .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase);
+  }
+
+  @Test
+  public void runBfuncBnEsRtCpropColl() throws Exception {
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+        .isType(ComplexTypeProvider.nameCTTwoPrim, true);
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+        .isType(ComplexTypeProvider.nameCTTwoPrim, true)
+        .n()
+        .isUriPathInfoKind(UriResourceKind.count);
+  }
+
+  @Test
+  public void runBfuncBnEsRtEntityPpNp() throws Exception {
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne/$ref")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+        .n()
+        .isUriPathInfoKind(UriResourceKind.ref);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/NavPropertyETMediaOne/$value")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNav")
+        .n()
+        .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false)
+        .n()
+        .isValue();
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+        + "/NavPropertyETTwoKeyNavOne")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNavParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+        + "/NavPropertyETTwoKeyNavOne/PropertyComp")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNavParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+        .n()
+        .isComplex("PropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+        + "/NavPropertyETTwoKeyNavOne/PropertyComp/PropertyComp")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNavParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+        .n()
+        .isComplex("PropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp)
+        .n()
+        .isComplex("PropertyComp")
+        .isType(ComplexTypeProvider.nameCTAllPrim);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+        + "/NavPropertyETTwoKeyNavOne/PropertyString")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNavParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+        .n()
+        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+        + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/PropertyString")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNavParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+
+    testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(WrongParameter='1')")
+        .isExSemantic(MessageKeys.UNKNOWN_PART);
+    testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString=wrong)")
+        .isExSemantic(MessageKeys.INVALID_KEY_VALUE);
+  }
+
+  @Test
+  public void runBfuncBnEsRtEntyPpNpCast() throws Exception {
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()"
+        + "/NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
+
+    testUri
+        .run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')"
+            + "/NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETTwoBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
+
+  }
+
+  @Test
+  public void runBfuncBnEsRtEntityPpCp() throws Exception {
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNav")
+        .n()
+        .isComplex("PropertyCompNav")
+        .isType(ComplexTypeProvider.nameCTNavFiveProp);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav/PropertyInt16")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNav")
+        .n()
+        .isComplex("PropertyCompNav")
+        .isType(ComplexTypeProvider.nameCTNavFiveProp)
+        .n()
+        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav/PropertyInt16/$value")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNav")
+        .n()
+        .isComplex("PropertyCompNav")
+        .isType(ComplexTypeProvider.nameCTNavFiveProp)
+        .n()
+        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
+        .n()
+        .isValue();
+
+  }
+
+  @Test
+  public void runBfuncBnEsRtEntyPpCpCast() throws Exception {
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+        + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNavParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .n()
+        .isComplex("PropertyCompTwoPrim")
+        .isType(ComplexTypeProvider.nameCTTwoPrim)
+        .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+        + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+        + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNavParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isComplex("PropertyCompTwoPrim")
+        .isType(ComplexTypeProvider.nameCTTwoPrim)
+        .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
+  }
+
+  @Test
+  public void runBfuncBnEsRtEntityPpSp() throws Exception {
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNav")
+        .n()
+        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16/$value")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESKeyNavRTETKeyNav")
+        .n()
+        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
+        .n()
+        .isValue();
+
+  }
+
+  @Test
+  public void runBfuncBnEsRtEs() throws Exception {
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='2')")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+        .isParameter(0, "ParameterString", "'2'")
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    testUri.run("ESKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='3')")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+        .isParameter(0, "ParameterString", "'3'")
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .n()
+        .isCount();
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'");
+
+  }
+
+  @Test
+  public void runBfuncBnEsRtEsBa() throws Exception {
+
+    testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp"
+        + "/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/olingo.odata.test1.BAESAllPrimRTETAllPrim")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isComplex("CollPropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp)
+        .n()
+        .isFunction("BFCCollCTPrimCompRTESAllPrim")
+        .n()
+        .isAction("BAESAllPrimRTETAllPrim");
+
+  }
+
+  @Test
+  public void runBfuncBnEsRtPrim() throws Exception {
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTString");
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()/$value")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTString")
+        .isType(PropertyProvider.nameString)
+        .n()
+        .isValue();
+  }
+
+  @Test
+  public void runbfuncBnEsRtPrimColl() throws Exception {
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTCollString")
+        .isType(PropertyProvider.nameString, true);
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isFunction("BFCESTwoKeyNavRTCollString")
+        .isType(PropertyProvider.nameString, true)
+        .n()
+        .isCount();
+  }
+
+  @Test
+  public void runBfuncBnPpropCollRtEs() throws Exception {
+    testUri.run("ESKeyNav(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
+        .n()
+        .isFunction("BFCCollStringRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true);
+
+    testUri.run("ESKeyNav(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
+        .n()
+        .isFunction("BFCCollStringRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+        .n()
+        .isCount();
+  }
+
+  @Test
+  public void runBfuncBnPpropRtEs() throws Exception {
+
+    testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
+        .n()
+        .isFunction("BFCStringRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true);
+
+    testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
+        .n()
+        .isFunction("BFCStringRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+        .n()
+        .isCount();
+
+    testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()/$ref")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
+        .n()
+        .isFunction("BFCStringRTESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+        .n()
+        .isRef();
+  }
+
+  @Test
+  public void runBfuncBnSingleRtEs() throws Exception {
+
+    testUri.run("SINav/olingo.odata.test1.BFCSINavRTESTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isSingleton("SINav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .n()
+        .isFunction("BFCSINavRTESTwoKeyNav");
+  }
+
+  @Test
+  public void runBfuncBnSingleCastRtEs() throws Exception {
+    testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.BFCETBaseTwoKeyNavRTESBaseTwoKey()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isSingleton("SINav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isFunction("BFCETBaseTwoKeyNavRTESBaseTwoKey");
+  }
+
+  @Test
+  public void runActionBound_on_EntityEntry() throws Exception {
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isAction("BAETTwoKeyNavRTETTwoKeyNav");
+
+    testUri.run("ESKeyNav(PropertyInt16=1)/olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isAction("BAETTwoKeyNavRTETTwoKeyNav");
+  }
+
+  @Test
+  public void runActionBound_on_EntityCollection() throws Exception {
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .n()
+        .isAction("BAESTwoKeyNavRTESTwoKeyNav");
+  }
+
+  @Test
+  public void runFunctionBound_on_var_Types() throws Exception {
+
+    // on primitive
+    testUri.run("ESAllPrim(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
+        .goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EntityTypeProvider.nameETAllPrim, false)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.primitiveProperty)
+        .isType(PropertyProvider.nameString);
+
+    // on collection of primitive
+    testUri.run("ESCollAllPrim(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()")
+        .goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EntityTypeProvider.nameETCollAllPrim, false)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.primitiveProperty)
+        .isType(PropertyProvider.nameString);
+
+    // on complex
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
+        + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
+        .goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.complexProperty)
+        .at(2)
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    // on collection of complex
+    testUri.run("ESKeyNav(1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
+        .goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .at(1)
+        .isType(ComplexTypeProvider.nameCTPrimComp, true)
+        .at(2)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EntityTypeProvider.nameETAllPrim);
+
+    // on entity
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
+        + "/olingo.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
+        .goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+    // on collection of entity
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+        .goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+        .at(1).isUriPathInfoKind(UriResourceKind.function)
+        .isType(EntityTypeProvider.nameETTwoKeyNav);
+  }
+
+  @Test
+  public void runActionBound_on_EntityCast() throws Exception {
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/olingo.odata.test1.BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isAction("BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+        + "/olingo.odata.test1.ETTwoBaseTwoKeyNav/olingo.odata.test1.BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
+        .n()
+        .isAction("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
+  }
+
+  @Test
+  public void crossjoin() throws Exception {
+    testUri.run("$crossjoin(ESKeyNav)")
+        .isKind(UriInfoKind.crossjoin)
+        .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
+
+    testUri.run("$crossjoin(ESKeyNav,ESTwoKeyNav)")
+        .isKind(UriInfoKind.crossjoin)
+        .isCrossJoinEntityList(Arrays.asList("ESKeyNav", "ESTwoKeyNav"));
+  }
+
+  @Test
+  public void crossjoinFilter() throws Exception {
+    testUri.run("$crossjoin(ESTwoPrim,ESMixPrimCollComp)",
+        "$filter=ESTwoPrim/PropertyString eq ESMixPrimCollComp/PropertyComp/PropertyString")
+        .goFilter()
+        .isBinary(BinaryOperatorKind.EQ)
+        .is("<<ESTwoPrim/PropertyString> eq <ESMixPrimCollComp/PropertyComp/PropertyString>>");
+  }
+
+  @Test
+  public void crossjoinError() throws Exception {
+    testUri.runEx("$crossjoin").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+    testUri.runEx("$crossjoin/error").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
+    testUri.runEx("$crossjoin()").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+    testUri.runEx("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid")
+        .isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
+    testUri.runEx("$crossjoin(ESKeyNav)/$ref")
+        .isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
+  }
+
+  @Test
+  public void runEntityId() throws Exception {
+    testUri.run("$entity", "$id=ESKeyNav(1)")
+        .isKind(UriInfoKind.entityId)
+        .isIdText("ESKeyNav(1)");
+    testUri.run("$entity/olingo.odata.test1.ETKeyNav", "$id=ESKeyNav(1)")
+        .isKind(UriInfoKind.entityId)
+        .isEntityType(EntityTypeProvider.nameETKeyNav)
+        .isIdText("ESKeyNav(1)");
+  }
+
+  @Test
+  public void runEsName() throws Exception {
+    testUri.run("ESAllPrim")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESAllPrim")
+        .isType(EntityTypeProvider.nameETAllPrim, true);
+
+    testUri.run("ESAllPrim/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESAllPrim")
+        .isType(EntityTypeProvider.nameETAllPrim, true)
+        .n()
+        .isCount();
+  }
+
+  @Test
+  public void esNameError() {
+
+    testUri.runEx("ESAllPrim/$count/$ref").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
+    testUri.runEx("ESAllPrim/$ref/$count").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
+    testUri.runEx("ESAllPrim/$ref/invalid").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
+    testUri.runEx("ESAllPrim/$count/invalid").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
+    testUri.runEx("ESAllPrim/PropertyString").isExSemantic(MessageKeys.PROPERTY_AFTER_COLLECTION);
+    testUri.runEx("ESAllPrim(1)/whatever").isExSemantic(MessageKeys.PROPERTY_NOT_IN_TYPE);
+    testUri.runEx("ESAllPrim('1')").isExSemantic(MessageKeys.INVALID_KEY_VALUE);
+    testUri.runEx("ESAllPrim(PropertyInt16)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+    testUri.runEx("ESAllPrim(PropertyInt16=)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+    testUri.runEx("ESAllPrim(PropertyInt16=1,Invalid='1')").isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
+
+    testUri.runEx("ESBase/olingo.odata.test1.ETBase/PropertyInt16")
+        .isExSemantic(MessageKeys.PROPERTY_AFTER_COLLECTION);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim"
+        + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim")
+        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETAllKey")
+        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim('1')/olingo.odata.test1.ETAllKey")
+        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim"
+        + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim")
+        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim"
+        + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)")
+        .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETAllKey").isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
+    testUri.runEx("ETBaseTwoKeyTwoPrim()").isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
+    testUri.runEx("ESAllNullable(1)/CollPropertyString/$value").isExSemantic(MessageKeys.ONLY_FOR_TYPED_PARTS);
+
+    testUri.runEx("ETMixPrimCollComp(1)/ComplexProperty/$value").isExSemantic(MessageKeys.RESOURCE_NOT_FOUND);
+  }
+
+  @Test
+  public void resourcePathWithApostrophe() throws Exception {
+    testUri.runEx("ESAllPrim'").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+    testUri.runEx("ESAllPrim'InvalidStuff").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+    testFilter.runOnETKeyNavEx("PropertyInt16' eq 0").isExSemantic(MessageKeys.TYPES_NOT_COMPATIBLE);
+    testFilter.runOnETKeyNavEx("PropertyInt16 eq' 0").isExSemantic(MessageKeys.TYPES_NOT_COMPATIBLE);
+    testFilter.runOnETKeyNavEx("PropertyInt16 eq 0'")
+        .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
+    testFilter.runOnETKeyNavEx("PropertyInt16 eq 'dsd''")
+        .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+  }
+
+  @Test
+  public void runFunctionsWithKeyPredicates() throws Exception {
+    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .isParameter(1, "ParameterInt16", "1");
+
+    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16=0)")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .isParameter(1, "ParameterInt16", "1")
+        .isKeyPredicate(0, "PropertyInt16", "0");
+
+    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(0)")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .isParameter(1, "ParameterInt16", "1")
+        .isKeyPredicate(0, "PropertyInt16", "0");
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16 eq 0)")
+        .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+
+    // PropertyInt32 does not exist
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=0)")
+        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)"
+        + "(PropertyInt16=0,PropertyInt16=1)")
+        .isExValidation(UriValidationException.MessageKeys.DOUBLE_KEY_PROPERTY);
+
+    testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTCollCTTwoPrimTwoParam")
+        .isFunction("UFCRTCollCTTwoPrimTwoParam")
+        .isParameter(0, "ParameterString", "'1'")
+        .isParameter(1, "ParameterInt16", "1");
+
+    testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16=1)")
+        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
+    testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(1)")
+        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
+    testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=1)")
+        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
+    testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=1,PropertyInt16=2)")
+        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
+    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTCollESTwoKeyNavParam")
+        .isFunction("UFCRTCollETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1");
+
+    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='1')")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTCollESTwoKeyNavParam")
+        .isFunction("UFCRTCollETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'1'");
+
+    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16 eq 1)")
+        .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+
+    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1)")
+        .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
+
+    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyInt32=1,PropertyString='1')")
+        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
+
+    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)()")
+        .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
+
+    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyInt32=1)")
+        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
+
+    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,Unkown=1)")
+        .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
+
+    testUri.run("FICRTCollString()")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTCollString")
+        .isFunction("UFCRTCollString");
+
+    testUri.run("FICRTString()")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTString")
+        .isFunction("UFCRTString");
+
+    testUri.runEx("FICRTCollString()(0)")
+        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
+    testUri.runEx("FICRTString()(0)")
+        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+  }
+
+  @Test
+  public void runNonComposableFunctions() throws Exception {
+    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isParameter(1, "ParameterString", "'1'");
+
+    testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')(0)")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+        .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isParameter(1, "ParameterString", "'1'");
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')(0)/PropertyInt16")
+        .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skip=1")
+        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$top=1")
+        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')",
+        "$filter=PropertyInt16 eq 1")
+        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skip=1")
+        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$count=true")
+        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skiptoken=5")
+        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
+    testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$search=test")
+        .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
+    testUri.run("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()")
+        .isKind(UriInfoKind.resource)
+        .goPath().first()
+        .isEntitySet("ESAllPrim")
+        .at(1)
+        .isFunction("BFNESAllPrimRTCTAllPrim");
+
+    testUri.runEx("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()"
+        + "/PropertyString")
+        .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
+  }
+
+  @Test
+  public void runEsNameCast() throws Exception {
+    testUri.run("ESTwoPrim/olingo.odata.test1.ETBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim, true)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
+
+    testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(-32768)/olingo.odata.test1.ETTwoBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim, false)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
+        .isKeyPredicate(0, "PropertyInt16", "-32768")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
+
+    testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase(-32768)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim, false)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
+        .isKeyPredicate(0, "PropertyInt16", "-32768");
+
+    testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim, false)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
+        .isKeyPredicate(0, "PropertyInt16", "-32768");
+
+  }
+
+  @Test
+  public void runEsNamePpSpCast() throws Exception {
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false);
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/PropertyComp/PropertyInt16")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isComplex("PropertyComp")
+        .n()
+        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+  }
+
+  @Test
+  public void runEsNameKey() throws Exception {
+    testUri.run("ESCollAllPrim(1)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESCollAllPrim");
+
+    testUri.run("ESCollAllPrim(PropertyInt16=1)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESCollAllPrim");
+
+    testUri.run("ESFourKeyAlias(PropertyInt16=1,KeyAlias1=2,KeyAlias2='3',KeyAlias3='4')")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESFourKeyAlias")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "KeyAlias1", "2")
+        .isKeyPredicate(2, "KeyAlias2", "'3'")
+        .isKeyPredicate(3, "KeyAlias3", "'4'");
+
+    testUri.runEx("ESTwoPrim('wrong')").isExSemantic(MessageKeys.INVALID_KEY_VALUE);
+    testUri.runEx("ESTwoPrim(PropertyInt16='wrong')").isExSemantic(MessageKeys.INVALID_KEY_VALUE);
+  }
+
+  @Test
+  public void runEsNameParaKeys() throws Exception {
+    testUri.run("ESAllKey(PropertyString='O''Neil',PropertyBoolean=true,PropertyByte=255,"
+        + "PropertySByte=-128,PropertyInt16=-32768,PropertyInt32=-2147483648,"
+        + "PropertyInt64=-9223372036854775808,PropertyDecimal=1,PropertyDate=2013-09-25,"
+        + "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00,"
+        + "PropertyDuration=duration'P50903316DT2H25M4S',"
+        + "PropertyGuid=12345678-1234-1234-1234-123456789012,"
+        + "PropertyTimeOfDay=12:34:55)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESAllKey")
+        .isKeyPredicate(0, "PropertyString", "'O''Neil'")
+        .isKeyPredicate(1, "PropertyBoolean", "true")
+        .isKeyPredicate(2, "PropertyByte", "255")
+        .isKeyPredicate(3, "PropertySByte", "-128")
+        .isKeyPredicate(4, "PropertyInt16", "-32768")
+        .isKeyPredicate(5, "PropertyInt32", "-2147483648")
+        .isKeyPredicate(6, "PropertyInt64", "-9223372036854775808")
+        .isKeyPredicate(7, "PropertyDecimal", "1")
+        .isKeyPredicate(8, "PropertyDate", "2013-09-25")
+        .isKeyPredicate(9, "PropertyDateTimeOffset", "2002-10-10T12:00:00-05:00")
+        .isKeyPredicate(10, "PropertyDuration", "duration'P50903316DT2H25M4S'")
+        .isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012")
+        .isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55");
+  }
+
+  @Test
+  public void runEsNameKeyCast() throws Exception {
+    testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBase);
+
+    testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETTwoBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
+
+    testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
+
+    testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase(1)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
+
+    testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
+
+    testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoPrim")
+        .isType(EntityTypeProvider.nameETTwoPrim)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
+
+    // Keys cannot be specified twice.
+    testUri.runEx("ESTwoPrim(1)/olingo.odata.test1.ETBase(1)")
+        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+    testUri.runEx("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase(1)")
+        .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
+    testUri.runEx("ESBase/olingo.odata.test1.ETTwoPrim(1)").isExSemantic(MessageKeys.INCOMPATIBLE_TYPE_FILTER);
+  }
+
+  @Test
+  public void runEsNameParaKeysCast() throws Exception {
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
+
+    testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'");
+  }
+
+  @Test
+  public void run_EsNamePpCp() throws Exception {
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isComplex("PropertyComp");
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp/PropertyComp")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isComplex("PropertyComp")
+        .n()
+        .isComplex("PropertyComp");
+
+    testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
+        + "PropertyDefString='key1')/PropertyEnumString")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESMixEnumDefCollComp")
+        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
+        .isKeyPredicate(1, "PropertyDefString", "'key1'")
+        .n()
+        .isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false);
+
+    testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
+        + "PropertyDefString='key1')/PropertyDefString")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESMixEnumDefCollComp")
+        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
+        .isKeyPredicate(1, "PropertyDefString", "'key1'")
+        .n()
+        .isPrimitiveProperty("PropertyDefString", TypeDefinitionProvider.nameTDString, false);
+  }
+
+  @Test
+  public void runEsNamePpCpColl() throws Exception {
+    testUri.run("ESMixPrimCollComp(5)/CollPropertyComp")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESMixPrimCollComp")
+        .isKeyPredicate(0, "PropertyInt16", "5")
+        .n()
+        .isComplex("CollPropertyComp")
+        .isType(ComplexTypeProvider.nameCTTwoPrim, true);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+        .n()
+        .isComplex("CollPropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp, true);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+        .n()
+        .isComplex("CollPropertyComp")
+        .isType(ComplexTypeProvider.nameCTPrimComp, true)
+        .n()
+        .isCount();
+
+    testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
+        + "PropertyDefString='key1')/CollPropertyEnumString")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESMixEnumDefCollComp")
+        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
+        .isKeyPredicate(1, "PropertyDefString", "'key1'")
+        .n()
+        .isPrimitiveProperty("CollPropertyEnumString", EnumTypeProvider.nameENString, true);
+
+    testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
+        + "PropertyDefString='key1')/CollPropertyDefString")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESMixEnumDefCollComp")
+        .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
+        .isKeyPredicate(1, "PropertyDefString", "'key1'")
+        .n()
+        .isPrimitiveProperty("CollPropertyDefString", TypeDefinitionProvider.nameTDString, true);
+  }
+
+  @Test
+  public void runEsNamePpCpCast() throws Exception {
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/PropertyComp")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isComplex("PropertyComp");
+
+    testUri
+        .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+            + "/PropertyComp/PropertyComp")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isComplex("PropertyComp")
+        .n()
+        .isComplex("PropertyComp");
+
+    testUri
+        .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+            + "/PropertyCompTwoPrim/olingo.odata.test1.CTBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isComplex("PropertyCompTwoPrim")
+        .isType(ComplexTypeProvider.nameCTTwoPrim)
+        .isTypeFilter(ComplexTypeProvider.nameCTBase);
+
+    testUri
+        .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+            + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isComplex("PropertyCompTwoPrim")
+        .isType(ComplexTypeProvider.nameCTTwoPrim)
+        .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
+  }
+
+  @Test
+  public void runNsNamePpNp() throws Exception {
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2");
+
+    testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETKeyNavMany(PropertyInt16=2)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2");
+
+    testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyInt16")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .n()
+        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyCompNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .n()
+        .isComplex("PropertyCompNav");
+
+    testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/NavPropertyETKeyNavOne")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+        + "/NavPropertyETKeyNavMany(4)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "4");
+
+    testUri.run("ESKeyNav(1)/PropertyCompNav/NavPropertyETTwoKeyNavOne")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isComplex("PropertyCompNav")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')"
+        + "/PropertyComp/PropertyComp/PropertyInt16")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'(3)'")
+        .n()
+        .isComplex("PropertyComp")
+        .n()
+        .isComplex("PropertyComp")
+        .n()
+        .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETMediaMany", EntityTypeProvider.nameETMedia, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .n()
+        .isValue();
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+        + "/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+        .n()
+        .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false)
+        .n()
+        .isValue();
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+        + "/NavPropertyETKeyNavOne/$ref")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+        .n()
+        .isRef();
+  }
+
+  @Test
+  public void runEsNamePpNpCast() throws Exception {
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/NavPropertyETKeyNavMany")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/NavPropertyETKeyNavMany(3)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "3");
+
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETTwoBaseTwoKeyNav(PropertyInt16=3,PropertyString='4')")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESTwoKeyNav")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "3")
+        .isKeyPredicate(1, "PropertyString", "'4'")
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+        + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')"
+        + "/olingo.odata.test1.ETTwoBaseTwoKeyNav/NavPropertyETBaseTwoKeyNavMany")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "4")
+        .isKeyPredicate(1, "PropertyString", "'5'")
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
+        .n()
+        .isNavProperty("NavPropertyETBaseTwoKeyNavMany", EntityTypeProvider.nameETBaseTwoKeyNav, true);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/"
+        + "NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')/"
+        + "NavPropertyETKeyNavMany")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "4")
+        .isKeyPredicate(1, "PropertyString", "'5'")
+        .n()
+        .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
+  }
+
+  @Test
+  public void runEsNamePpNpRc() throws Exception {
+    // checks for using referential constraints to fill missing keys
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany('2')").goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
+        .isKeyPredicate(1, "PropertyString", "'2'");
+
+    testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETTwoKeyNavMany(PropertyString='2')").goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
+        .isKeyPredicate(1, "PropertyString", "'2'");
+
+  }
+
+  @Test
+  public void runEsNamePpSp() throws Exception {
+    testUri.run("ESAllPrim(1)/PropertyByte")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESAllPrim")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false);
+
+    testUri.run("ESAllPrim(1)/PropertyByte/$value")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESAllPrim")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false)
+        .n()
+        .isValue();
+
+    testUri.run("ESMixPrimCollComp(1)/PropertyComp/PropertyString")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESMixPrimCollComp")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isComplex("PropertyComp")
+        .n()
+        .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+  }
+
+  @Test
+  public void runEsNamePpSpColl() throws Exception {
+    testUri.run("ESCollAllPrim(1)/CollPropertyString")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESCollAllPrim")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .n()
+        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
+
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
+        .n()
+        .isCount();
+
+  }
+
+  @Test
+  public void runEsNameRef() throws Exception {
+    testUri.run("ESAllPrim/$ref")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESAllPrim")
+        .n()
+        .isRef();
+
+    testUri.run("ESAllPrim(-32768)/$ref")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESAllPrim")
+        .isKeyPredicate(0, "PropertyInt16", "-32768")
+        .n()
+        .isRef();
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany/$ref")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
+        .n()
+        .isRef();
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/$ref")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isEntitySet("ESKeyNav")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isRef();
+  }
+
+  @Test
+  public void runFunctionImpBf() throws Exception {
+
+    testUri.run("FICRTString()/olingo.odata.test1.BFCStringRTESTwoKeyNav()");
+  }
+
+  @Test
+  public void runFunctionImpCastBf() throws Exception {
+
+    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav"
+        + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTETTwoKeyNavParam")
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .n()
+        .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
+
+    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)"
+        + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
+        + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTCollESTwoKeyNavParam")
+        .isFunction("UFCRTCollETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
+
+    testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString=null)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTCollCTTwoPrimTwoParam")
+        .isFunction("UFCRTCollCTTwoPrimTwoParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isParameter(1, "ParameterString", null);
+  }
+
+  @Test
+  public void runFunctionImpEntity() throws Exception {
+
+    testUri.run("FICRTETKeyNav()")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTETKeyNav")
+        .isFunction("UFCRTETKeyNav")
+        .isType(EntityTypeProvider.nameETKeyNav);
+
+    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1");
+
+    testUri.run("FICRTESMedia(ParameterInt16=1)/$value")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTESMedia")
+        .isFunction("UFCRTETMedia")
+        .n()
+        .isValue();
+
+    testUri.run("FICRTETKeyNav()/$ref")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTETKeyNav")
+        .isFunction("UFCRTETKeyNav")
+        .n()
+        .isRef();
+    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/$ref")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTETTwoKeyNavParam")
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .n()
+        .isRef();
+
+    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTETTwoKeyNavParam")
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
+
+    testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTETTwoKeyNavParam")
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
+
+    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)"
+        + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTCollESTwoKeyNavParam")
+        .isFunction("UFCRTCollETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'");
+  }
+
+  @Test
+  public void runFunctionImpEs() throws Exception {
+    testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+        .isFunction("UFCRTESMixPrimCollCompTwoParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isParameter(1, "ParameterString", "'2'")
+        .isType(EntityTypeProvider.nameETMixPrimCollComp);
+
+    testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+        .isFunction("UFCRTESMixPrimCollCompTwoParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isParameter(1, "ParameterString", "'2'")
+        .isType(EntityTypeProvider.nameETMixPrimCollComp);
+
+    testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')/$count")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+        .isFunction("UFCRTESMixPrimCollCompTwoParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isParameter(1, "ParameterString", "'2'")
+        .isType(EntityTypeProvider.nameETMixPrimCollComp)
+        .n()
+        .isCount();
+  }
+
+  @Test
+  public void runFunctionImpError() {
+    testUri.runEx("FICRTCollCTTwoPrimTwoParam")
+        .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+    testUri.runEx("FICRTCollCTTwoPrimTwoParam()").isExSemantic(MessageKeys.FUNCTION_NOT_FOUND);
+    testUri.runEx("FICRTCollCTTwoPrimTwoParam(invalidParam=2)").isExSemantic(MessageKeys.FUNCTION_NOT_FOUND);
+  }
+
+  @Test
+  public void runFunctionImpEsAlias() throws Exception {
+
+    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=@parameterAlias)", "@parameterAlias=1");
+    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=@parameterAlias)/$count", "@parameterAlias=1");
+    testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=@invalidAlias)", "@validAlias=1")
+        .isExValidation(UriValidationException.MessageKeys.MISSING_PARAMETER);
+  }
+
+  @Test
+  public void runFunctionImpEsCast() throws Exception {
+
+    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isFunctionImport("FICRTCollESTwoKeyNavParam")
+        .isFunction("UFCRTCollETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .isType(EntityTypeProvider.nameETTwoKeyNav)
+        .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav);
+
+    testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav/$count")

<TRUNCATED>