olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chri...@apache.org
Subject [01/29] [OLINGO-161] Refactored module names
Date Mon, 17 Feb 2014 15:35:48 GMT
Repository: incubator-olingo-odata4
Updated Branches:
  refs/heads/master 3381ef70a -> c49ff8033


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
new file mode 100644
index 0000000..1781e96
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
@@ -0,0 +1,1141 @@
+/*******************************************************************************
+ * 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.odata4.producer.core.uri.antlr;
+
+// TODO after adding the external API to the URI processing class this unit test require a mayor rework
+
+import java.util.Arrays;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.producer.core.testutil.FilterValidator;
+import org.apache.olingo.odata4.producer.core.testutil.UriResourceValidator;
+import org.apache.olingo.odata4.producer.core.testutil.UriValidator;
+import org.apache.olingo.odata4.producer.core.uri.UriParserException;
+import org.junit.Test;
+
+public class TestUriParserImpl {
+  Edm edm = null;
+  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'P10DT5H34M21.123456789012S'";
+  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.123456789012";
+
+  private final String allKeys = PropertyString + "," + PropertyInt16 + "," + PropertyBoolean + "," + PropertyByte
+      + "," + PropertySByte + "," + PropertyInt32 + "," + PropertyInt64 + "," + PropertyDecimal + "," + PropertyDate
+      + "," + PropertyDateTimeOffset + "," + PropertyDuration + "," + PropertyGuid + "," + PropertyTimeOfDay;
+
+  UriValidator testUri = null;
+  UriResourceValidator testRes = null;
+  FilterValidator testFilter = null;
+
+  public TestUriParserImpl() {
+    edm = new EdmProviderImpl(new EdmTechTestProvider());
+    testUri = new UriValidator().setEdm(edm);
+    testRes = new UriResourceValidator().setEdm(edm);
+    testFilter = new FilterValidator().setEdm(edm);
+  }
+
+  @Test
+  public void testBoundFunctionImport_VarParameters() {
+
+    // no input
+    testRes.run("ESKeyNav(1)/com.sap.odata.test1.BFCETKeyNavRTETKeyNav()")
+        .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
+        .at(1).isUriPathInfoKind(UriResourceKind.function);
+
+    // one input
+    testRes.run("ESTwoKeyNav/com.sap.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 testFunctionBound_varReturnType() {
+
+    String esTwoKeyNav = "ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')";
+
+    // returning primitive
+    testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()")
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .isCollection(true)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EdmTechProvider.nameString)
+        .isCollection(false);
+
+    // returning collection of primitive
+    testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()")
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .isCollection(true)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EdmTechProvider.nameString)
+        .isCollection(true);
+
+    // returning single complex
+    testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()")
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .isCollection(true)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EdmTechProvider.nameCTTwoPrim)
+        .isCollection(false);
+
+    // returning collection of complex
+    testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .isCollection(true)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EdmTechProvider.nameCTTwoPrim)
+        .isCollection(true);
+
+    // returning single entity
+    testRes.run(
+        esTwoKeyNav + "/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+        .isCollection(false)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .isCollection(false);
+
+    // returning collection of entity (aka entitySet)
+    testRes.run(esTwoKeyNav + "/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()")
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .isCollection(false)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.function)
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .isCollection(true);
+  }
+
+  @Test
+  public void runActionImport_VarReturnType() {
+
+    testRes.run("AIRTPrimParam").isKind(UriInfoKind.resource)
+        .first()
+        .isActionImport("AIRTPrimParam")
+        .isAction("UARTPrimParam")
+        .isType(EdmTechProvider.nameString, false);
+
+    testRes.run("AIRTPrimCollParam").isKind(UriInfoKind.resource)
+        .first()
+        .isActionImport("AIRTPrimCollParam")
+        .isAction("UARTPrimCollParam")
+        .isType(EdmTechProvider.nameString, true);
+
+    testRes.run("AIRTCompParam").isKind(UriInfoKind.resource)
+        .first()
+        .isActionImport("AIRTCompParam")
+        .isAction("UARTCompParam")
+        .isType(EdmTechProvider.nameCTTwoPrim, false);
+
+    testRes.run("AIRTCompCollParam").isKind(UriInfoKind.resource)
+        .first()
+        .isActionImport("AIRTCompCollParam")
+        .isAction("UARTCompCollParam")
+        .isType(EdmTechProvider.nameCTTwoPrim, true);
+
+    testRes.run("AIRTETParam").isKind(UriInfoKind.resource)
+        .first()
+        .isActionImport("AIRTETParam")
+        .isAction("UARTETParam")
+        .isType(EdmTechProvider.nameETTwoKeyTwoPrim, false);
+
+    // TODO add error test
+    // testUri.run("AIRTPrimParam/invalidElement").isKind(UriInfoKind.resource).goPath().
+    // isUriPathInfoKind(UriResourceKind.action);
+    // testUri.run("InvalidAction");
+  }
+
+  @Test
+  public void runCount() {
+
+    // count entity set
+    testRes.run("ESAllPrim/$count")
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETAllPrim)
+        .isCollection(true)
+        .at(1)
+        .isUriPathInfoKind(UriResourceKind.count);
+
+    // count on collection of complex
+    testRes.run("ESKeyNav(1)/CollPropertyComplex/$count")
+        .at(0)
+        .isType(EdmTechProvider.nameETKeyNav)
+        .at(1)
+        .isType(EdmTechProvider.nameCTPrimComp, true)
+        .at(2)
+        .isUriPathInfoKind(UriResourceKind.count);
+
+    // count on collection of primitive
+    testRes.run("ESCollAllPrim(1)/CollPropertyString/$count")
+        .at(1)
+        .isType(EdmTechProvider.nameString, true)
+        .at(2)
+        .isUriPathInfoKind(UriResourceKind.count);
+  }
+
+  @Test
+  public void runCrossJoin() {
+    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 testEntity() {
+
+    // 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/com.sap.odata.test1.ETTwoPrim?$id=ESBase")
+        .isEntityType(EdmTechProvider.nameETTwoPrim)
+        .isIdText("ESBase");
+
+    // simple entity set; with qualifiedentityTypeName; with filter
+    testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?$filter=PropertyInt16 eq 123&$id=ESAllKey")
+        .isIdText("ESAllKey")
+        .goFilter().is("<<PropertyInt16> eq <123>>");
+
+    // simple entity set; with qualifiedentityTypeName;
+    testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim")
+        .isEntityType(EdmTechProvider.nameETBase)
+        .isKind(UriInfoKind.entityId)
+        .isIdText("ESTwoPrim");
+
+    // simple entity set; with qualifiedentityTypeName; with format
+    testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$format=atom")
+        .isKind(UriInfoKind.entityId)
+        .isEntityType(EdmTechProvider.nameETBase)
+        .isIdText("ESTwoPrim")
+        .isFormatText("atom");
+
+    // simple entity set; with qualifiedentityTypeName; with select
+    testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$select=*")
+        .isKind(UriInfoKind.entityId)
+        .isEntityType(EdmTechProvider.nameETBase)
+        .isIdText("ESTwoPrim")
+        .isSelectItemStar(0);
+
+    // simple entity set; with qualifiedentityTypeName; with expand
+    testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$expand=*")
+        .isKind(UriInfoKind.entityId)
+        .isEntityType(EdmTechProvider.nameETBase)
+        .isIdText("ESTwoPrim")
+        .isExpandText("*")
+        .goExpand().first().isSegmentStar(0);
+
+    // simple entity set; with qualifiedentityTypeName; with 2xformat(before and after), expand, filter
+    testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?"
+        + "$format=xml&$expand=*&abc=123&$id=ESBase&xyz=987&$filter=PropertyInt16 eq 123&$format=atom&$select=*")
+        .isFormatText("atom")
+        .isCustomParameter(0, "abc", "123")
+        .isIdText("ESBase")
+        .isCustomParameter(1, "xyz", "987")
+        .isSelectItemStar(0);
+  }
+
+  @Test
+  public void testEntitySet() {
+
+    // plain entity set
+    testRes.run("ESAllPrim")
+        .isEntitySet("ESAllPrim")
+        .isType(EdmTechProvider.nameETAllPrim);
+
+    // with one key; simple key notation
+    testRes.run("ESAllPrim(1)")
+        .isEntitySet("ESAllPrim")
+        .isType(EdmTechProvider.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'P10DT5H34M21.123456789012S'")
+        .isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012")
+        .isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55.123456789012");
+  }
+
+  @Test
+  public void testEntitySet_NavigationPropperty() {
+
+    // plain entity set ...
+
+    // with navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
+        .at(0)
+        .isEntitySet("ESKeyNav")
+        .isType(EdmTechProvider.nameETKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(1)
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+        .isType(EdmTechProvider.nameETTwoKeyNav);
+
+    // with navigation property -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
+        .at(0)
+        .isEntitySet("ESKeyNav")
+        .isType(EdmTechProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(1)
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+        .at(2)
+        .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+    // with navigation property -> navigation property -> navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
+        .at(0)
+        .isEntitySet("ESKeyNav")
+        .isType(EdmTechProvider.nameETKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(1)
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .at(2)
+        .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+        .isType(EdmTechProvider.nameETKeyNav);
+
+    // with navigation property(key)
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)")
+        .at(0)
+        .isEntitySet("ESKeyNav")
+        .at(1)
+        .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.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", EdmTechProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(2)
+        .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+    // with navigation property(key) -> navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne")
+        .isEntitySet("ESKeyNav")
+        .at(1)
+        .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(2)
+        .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
+
+    // with navigation property(key) -> navigation property(key)
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)")
+        .isEntitySet("ESKeyNav")
+        .isType(EdmTechProvider.nameETKeyNav)
+        .at(1)
+        .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(2)
+        .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.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(EdmTechProvider.nameETKeyNav)
+        .at(1)
+        .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(2)
+        .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+        .isType(EdmTechProvider.nameETKeyNav)
+        .at(3)
+        .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+    // with navigation property(key) -> navigation property(key) -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)/PropertyString")
+        .at(0)
+        .isEntitySet("ESKeyNav")
+        .isType(EdmTechProvider.nameETKeyNav)
+        .at(1)
+        .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(2)
+        .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(3)
+        .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+  }
+
+  @Test
+  public void testEntitySet_Property() {
+
+    // plain entity set ...
+
+    // with property
+    testRes.run("ESAllPrim(1)/PropertyString")
+        .at(0)
+        .isEntitySet("ESAllPrim")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(1)
+        .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+    // with complex property
+    testRes.run("ESCompAllPrim(1)/PropertyComplex")
+        .at(0)
+        .isEntitySet("ESCompAllPrim")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(1)
+        .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false);
+
+    // with two properties
+    testRes.run("ESCompAllPrim(1)/PropertyComplex/PropertyString")
+        .at(0)
+        .isEntitySet("ESCompAllPrim")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(1)
+        .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false)
+        .at(2)
+        .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+  }
+
+  @Test
+  public void testEntitySet_TypeFilter() {
+
+    // filter
+    testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase")
+        .at(0)
+        .isEntitySet("ESTwoPrim")
+        .isType(EdmTechProvider.nameETTwoPrim)
+        .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
+        .isTypeFilterOnEntry(null)
+        .isCollection(true);
+
+    // filter before key predicate
+    testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)")
+        .at(0)
+        .isEntitySet("ESTwoPrim")
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoPrim)
+        .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
+        .isTypeFilterOnEntry(null)
+        .at(0)
+        .isType(EdmTechProvider.nameETTwoPrim)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isCollection(false);
+
+    // filter before key predicate; property of sub type
+    testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)/AdditionalPropertyString_5")
+        .at(0)
+        .isEntitySet("ESTwoPrim")
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoPrim)
+        .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
+        .isTypeFilterOnEntry(null)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(1)
+        .isType(EdmTechProvider.nameString)
+        .isPrimitiveProperty("AdditionalPropertyString_5", EdmTechProvider.nameString, false);
+
+    // filter after key predicate
+    testRes.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase")
+        .at(0)
+        .isEntitySet("ESTwoPrim")
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoPrim)
+        .isTypeFilterOnCollection(null)
+        .isTypeFilterOnEntry(EdmTechProvider.nameETBase)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isCollection(false);
+
+    // filter after key predicate; property of sub type
+    testRes.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase/AdditionalPropertyString_5")
+        .at(0)
+        .isEntitySet("ESTwoPrim")
+        .isUriPathInfoKind(UriResourceKind.entitySet)
+        .isType(EdmTechProvider.nameETTwoPrim)
+        .isTypeFilterOnCollection(null)
+        .isTypeFilterOnEntry(EdmTechProvider.nameETBase)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(1)
+        .isPrimitiveProperty("AdditionalPropertyString_5", EdmTechProvider.nameString, false)
+        .isType(EdmTechProvider.nameString);
+
+  }
+
+  @Test
+  public void testFilterComplexMixedPriority() throws UriParserException {
+    testFilter.runESabc("a      or c      and e     ").isCompr("< <a>         or < <c>         and  <e>      >>");
+    testFilter.runESabc("a      or c      and e eq f").isCompr("< <a>         or < <c>         and <<e> eq <f>>>>");
+    testFilter.runESabc("a      or c eq d and e     ").isCompr("< <a>         or <<<c> eq <d>> and  <e>      >>");
+    testFilter.runESabc("a      or c eq d and e eq f").isCompr("< <a>         or <<<c> eq <d>> and <<e> eq <f>>>>");
+    testFilter.runESabc("a eq b or c      and e     ").isCompr("<<<a> eq <b>> or < <c>         and  <e>      >>");
+    testFilter.runESabc("a eq b or c      and e eq f").isCompr("<<<a> eq <b>> or < <c>         and <<e> eq <f>>>>");
+    testFilter.runESabc("a eq b or c eq d and e     ").isCompr("<<<a> eq <b>> or <<<c> eq <d>> and  <e>      >>");
+    testFilter.runESabc("a eq b or c eq d and e eq f").isCompr("<<<a> eq <b>> or <<<c> eq <d>> and <<e> eq <f>>>>");
+  }
+
+  @Test
+  public void testFilterSimpleSameBinaryBinaryBinaryPriority() throws UriParserException {
+
+    testFilter.runESabc("1 add 2 add 3 add 4").isCompr("<<< <1> add   <2>> add  <3>>  add <4>>");
+    testFilter.runESabc("1 add 2 add 3 div 4").isCompr("<<  <1> add   <2>> add <<3>   div <4>>>");
+    testFilter.runESabc("1 add 2 div 3 add 4").isCompr("<<  <1> add  <<2>  div  <3>>> add <4>>");
+    testFilter.runESabc("1 add 2 div 3 div 4").isCompr("<   <1> add <<<2>  div  <3>>  div <4>>>");
+    testFilter.runESabc("1 div 2 add 3 add 4").isCompr("<<< <1> div   <2>> add  <3>>  add <4>>");
+    testFilter.runESabc("1 div 2 add 3 div 4").isCompr("<<  <1> div   <2>> add <<3>   div <4>>>");
+    testFilter.runESabc("1 div 2 div 3 add 4").isCompr("<<< <1> div   <2>> div  <3>>  add <4>>");
+    testFilter.runESabc("1 div 2 div 3 div 4").isCompr("<<< <1> div   <2>> div  <3>>  div <4>>");
+
+  }
+
+  @Test
+  public void testFunctionImport_VarParameters() {
+
+    // no input
+    testRes.run("FINRTInt16()")
+        .isFunctionImport("FINRTInt16")
+        .isFunction("UFNRTInt16")
+        .isType(EdmTechProvider.nameString);
+
+    // one input
+    testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
+        .isFunctionImport("FICRTETTwoKeyNavParam")
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isType(EdmTechProvider.nameETTwoKeyNav);
+
+    // two input
+    testRes.run("FICRTStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
+        .isFunctionImport("FICRTStringTwoParam")
+        .isFunction("UFCRTStringTwoParam")
+        .isType(EdmTechProvider.nameString);
+  }
+
+  @Test
+  public void testFunctionImport_VarRetruning() {
+    // returning primitive
+    testRes.run("FINRTInt16()")
+        .isFunctionImport("FINRTInt16")
+        .isFunction("UFNRTInt16")
+        .isType(EdmTechProvider.nameString, false);
+
+    // returning collection of primitive
+    testRes.run("FICRTCollStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
+        .isFunctionImport("FICRTCollStringTwoParam")
+        .isFunction("UFCRTCollStringTwoParam")
+        .isType(EdmTechProvider.nameString, true);
+
+    // returning single complex
+    testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)")
+        .isFunctionImport("FICRTCTAllPrimTwoParam")
+        .isFunction("UFCRTCTAllPrimTwoParam")
+        .isType(EdmTechProvider.nameCTAllPrim, false);
+
+    // returning collection of complex
+    testRes.run("FICRTCollCTTwoPrim()")
+        .isFunctionImport("FICRTCollCTTwoPrim")
+        .isFunction("UFCRTCollCTTwoPrim")
+        .isType(EdmTechProvider.nameCTTwoPrim, true);
+
+    // returning single entity
+    testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
+        .isFunctionImport("FICRTETTwoKeyNavParam")
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isType(EdmTechProvider.nameETTwoKeyNav, false);
+
+    // returning collection of entity (aka entitySet)
+    testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)")
+        .isFunctionImport("FICRTESTwoKeyNavParam")
+        .isFunction("UFCRTESTwoKeyNavParam")
+        .isType(EdmTechProvider.nameETTwoKeyNav, true);
+  }
+
+  @Test
+  public void testFunctionImportChain() {
+
+    // test chain; returning single complex
+    testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)/PropertyInt16")
+        .at(0)
+        .isFunctionImport("FICRTCTAllPrimTwoParam")
+        .isFunction("UFCRTCTAllPrimTwoParam")
+        .isType(EdmTechProvider.nameCTAllPrim, false)
+        .isParameter(0, "ParameterString", "'ABC'")
+        .isParameter(1, "ParameterInt16", "1")
+        .at(1)
+        .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+    // test chains; returning single entity
+    testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16")
+        .at(0)
+        .isFunctionImport("FICRTETTwoKeyNavParam")
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isType(EdmTechProvider.nameETTwoKeyNav, false)
+        .isParameter(0, "ParameterInt16", "1")
+        .at(1)
+        .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+    // test chains; returning collection of entity (aka entitySet)
+    testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')")
+        .at(0)
+        .isFunctionImport("FICRTESTwoKeyNavParam")
+        .isFunction("UFCRTESTwoKeyNavParam")
+        .isType(EdmTechProvider.nameETTwoKeyNav, false)
+        .isParameter(0, "ParameterInt16", "1")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'ABC'");
+
+    // test chains; returning collection of entity (aka entitySet)
+    testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')/PropertyInt16")
+        .at(0)
+        .isFunctionImport("FICRTESTwoKeyNavParam")
+        .isFunction("UFCRTESTwoKeyNavParam")
+        .isType(EdmTechProvider.nameETTwoKeyNav, false)
+        .isParameter(0, "ParameterInt16", "1")
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'ABC'")
+        .at(1)
+        .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+  }
+
+  @Test
+  public void testMetaData() {
+
+    // 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#$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/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
+        .isKind(UriInfoKind.metadata)
+        .isFormatText("atom")
+        .isFragmentText("SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
+
+    testUri.run("$metadata?$format=atom#SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
+        .isKind(UriInfoKind.metadata)
+        .isFormatText("atom")
+        .isFragmentText("SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
+
+    testUri.run("$metadata?$format=atom#com.sap.odata.test1.ETAllKey")
+        .isKind(UriInfoKind.metadata)
+        .isFormatText("atom")
+        .isFragmentText("com.sap.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/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
+        .isKind(UriInfoKind.metadata)
+        .isFormatText("atom")
+        .isFragmentText("ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
+
+    testUri.run(
+        "$metadata?$format=atom#ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
+        .isKind(UriInfoKind.metadata)
+        .isFormatText("atom")
+        .isFragmentText("ESKeyNav/com.sap.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 testRef() {
+    testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/$ref");
+  }
+
+  @Test
+  public void testSingleton() {
+    // plain singleton
+    testRes.run("SINav")
+        .isSingleton("SINav")
+        .isType(EdmTechProvider.nameETTwoKeyNav);
+  }
+
+  @Test
+  public void testNavigationProperty() {
+
+    // plain entity set ...
+
+    // with navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
+        .at(0).isEntitySet("ESKeyNav")
+        .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false);
+
+    // with navigation property -> property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
+        .at(0).isEntitySet("ESKeyNav")
+        .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+        .at(2).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+    // with navigation property -> navigation property -> navigation property
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
+        .at(0).isEntitySet("ESKeyNav")
+        .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+        .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
+
+    // with navigation property(key)
+    testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')")
+        .at(0).isEntitySet("ESKeyNav")
+        .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.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", EdmTechProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'1'")
+        .at(2).isPrimitiveProperty("PropertyString", EdmTechProvider.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", EdmTechProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'1'")
+        .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.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", EdmTechProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'1'")
+        .at(2).isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.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", EdmTechProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'1'")
+        .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+        .at(3).isPrimitiveProperty("PropertyString", EdmTechProvider.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", EdmTechProvider.nameETTwoKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'1'")
+        .at(2).isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .at(3).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+  }
+
+  @Test
+  public void testSingleton_Property() {
+
+    // plain singleton ...
+
+    // with property
+    testRes.run("SINav/PropertyInt16")
+        .at(0)
+        .isSingleton("SINav")
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .at(1)
+        .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+    // with complex property
+    testRes.run("SINav/PropertyComplex")
+        .at(0)
+        .isSingleton("SINav")
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .at(1)
+        .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false);
+
+    // with two properties
+    testRes.run("SINav/PropertyComplex/PropertyInt16")
+        .at(0)
+        .isSingleton("SINav")
+        .isType(EdmTechProvider.nameETTwoKeyNav)
+        .at(1)
+        .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false)
+        .at(2)
+        .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+  }
+
+  @Test
+  public void testValue() {
+    testUri.run("ESAllPrim(1)/PropertyString/$value");
+  }
+
+  @Test
+  public void testMemberStartingWithCast() {
+    // on EntityType entry
+    // TODO inform OTTO
+    testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')?"
+        + "$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
+        .goFilter().root().isMember().goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        .isType(EdmTechTestProvider.nameETTwoKeyNav, false)
+        .isTypeFilterOnEntry(EdmTechTestProvider.nameETBaseTwoKeyNav)
+        .at(1).isType(EdmTechTestProvider.nameDate);
+
+    // on EntityType collection
+    testUri.run("ESTwoKeyNav?$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
+        .goFilter().root().isMember().goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        .isType(EdmTechTestProvider.nameETTwoKeyNav, true)
+        .isTypeFilterOnCollection(EdmTechTestProvider.nameETBaseTwoKeyNav)
+        .at(1).isType(EdmTechTestProvider.nameDate);
+
+    testUri.run("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?"
+        + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
+        .goFilter().root().isMember().goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        .isType(EdmTechTestProvider.nameCTTwoPrim, false)
+        .isTypeFilterOnEntry(EdmTechTestProvider.nameCTBase)
+        .at(1).isType(EdmTechTestProvider.nameString);
+
+// on Complex collection
+    testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?"
+        + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
+        .goFilter().root().isMember().goPath()
+        .at(0)
+        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        .isType(EdmTechTestProvider.nameCTTwoPrim, true)
+        .isTypeFilterOnCollection(EdmTechTestProvider.nameCTBase)
+        .at(1).isType(EdmTechTestProvider.nameString);
+
+  }
+
+  @Test
+  public void testComplexTypeCastFollowingAsCollection() {
+    // TODO inform OTTO
+    testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')/com.sap.odata.test1.CTBase");
+
+  }
+
+  @Test
+  public void testLambda() {
+    testUri.run("ESTwoKeyNav?$filter=CollPropertyComplex/all( l : true )")
+        .goFilter().is("<CollPropertyComplex/<ALL;<true>>>");
+
+    testUri.run("ESTwoKeyNav?$filter=CollPropertyComplex/any( l : true )")
+        .goFilter().is("<CollPropertyComplex/<ANY;<true>>>");
+    testUri.run("ESTwoKeyNav?$filter=CollPropertyComplex/any( )")
+        .goFilter().is("<CollPropertyComplex/<ANY;>>");
+
+    testUri.run("ESTwoKeyNav?$filter=all( l : true )")
+        .goFilter().is("<<ALL;<true>>>");
+    testUri.run("ESTwoKeyNav?$filter=any( l : true )")
+        .goFilter().is("<<ANY;<true>>>");
+    testUri.run("ESTwoKeyNav?$filter=any( )")
+        .goFilter().is("<<ANY;>>");
+  }
+
+  @Test
+  public void testCustomQueryOption() {
+    testUri.run("ESTwoKeyNav?custom")
+        .isCustomParameter(0, "custom", null);
+    testUri.run("ESTwoKeyNav?custom=ABC")
+        .isCustomParameter(0, "custom", "ABC");
+  }
+
+  @Test
+  public void testGeo() throws UriParserException {
+    // TODO sync
+    testFilter.runOnETAllPrim("geo.distance(PropertySByte,PropertySByte)")
+        .is("<geo.distance(<PropertySByte>,<PropertySByte>)>")
+        .isMethod(SupportedMethodCalls.GEODISTANCE, 2);
+    testFilter.runOnETAllPrim("geo.length(PropertySByte)")
+        .is("<geo.length(<PropertySByte>)>")
+        .isMethod(SupportedMethodCalls.GEOLENGTH, 1);
+    testFilter.runOnETAllPrim("geo.intersects(PropertySByte,PropertySByte)")
+        .is("<geo.intersects(<PropertySByte>,<PropertySByte>)>")
+        .isMethod(SupportedMethodCalls.GEOINTERSECTS, 2);
+  }
+
+  @Test
+  public void testSelect() {
+    testUri.run("ESTwoKeyNav?$select=*")
+        .isSelectItemStar(0);
+
+    testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.*")
+        .isSelectItemAllOp(0, new FullQualifiedName("com.sap.odata.test1", "*"));
+
+    testUri.run("ESTwoKeyNav?$select=PropertyString")
+        .goSelectItemPath(0).isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
+
+    testUri.run("ESTwoKeyNav?$select=PropertyComplex")
+        .goSelectItemPath(0).isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false);
+
+    testUri.run("ESTwoKeyNav?$select=PropertyComplex/PropertyInt16")
+        .goSelectItemPath(0)
+        .first()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+        .n()
+        .isPrimitiveProperty("PropertyInt16", EdmTechTestProvider.nameInt16, false);
+
+    testUri.run("ESTwoKeyNav?$select=PropertyComplex/PropertyComplex")
+        .goSelectItemPath(0)
+        .first()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+        .n()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTAllPrim, false);
+
+    testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.ETBaseTwoKeyNav")
+        .goSelectItemPath(0)
+        .first()
+        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        .isTypeFilterOnCollection(EdmTechTestProvider.nameETBaseTwoKeyNav);
+
+    testUri.run("ESTwoKeyNav/PropertyComplexNav?$select=com.sap.odata.test1.CTTwoBasePrimCompNav")
+        .goSelectItemPath(0)
+        .first()
+        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        .isTypeFilterOnCollection(EdmTechTestProvider.nameCTTwoBasePrimCompNav);
+
+    testUri.run("ESTwoKeyNav?$select=PropertyComplexNav/com.sap.odata.test1.CTTwoBasePrimCompNav")
+        .goSelectItemPath(0)
+        .first()
+        .isComplexProperty("PropertyComplexNav", EdmTechTestProvider.nameCTBasePrimCompNav, false)
+        .n()
+        .isTypeFilterOnCollection(EdmTechTestProvider.nameCTTwoBasePrimCompNav);
+    ;
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
new file mode 100644
index 0000000..3ab5110
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * 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.odata4.producer.core.uri.queryoption;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.AliasImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LiteralImpl;
+import org.junit.Test;
+
+//TOOD add getKind check to all
+public class QueryOptionTest {
+
+  Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
+
+  @Test
+  public void testAliasQueryOption() {
+    AliasQueryOptionImpl option = new AliasQueryOptionImpl();
+
+    ExpressionImpl expression = new LiteralImpl();
+
+    option.setAliasValue(expression);
+    assertEquals(expression, option.getValue());
+  }
+
+  @Test
+  public void testExandItemImpl() {
+    ExpandItemImpl option = new ExpandItemImpl();
+
+    // input options
+    ExpandOptionImpl expand = new ExpandOptionImpl();
+    FilterOptionImpl filter = new FilterOptionImpl();
+    InlineCountOptionImpl inlinecount = new InlineCountOptionImpl();
+    OrderByOptionImpl orderby = new OrderByOptionImpl();
+    SearchOptionImpl search = new SearchOptionImpl();
+    SelectOptionImpl select = new SelectOptionImpl();
+    SkipOptionImpl skip = new SkipOptionImpl();
+    TopOptionImpl top = new TopOptionImpl();
+    LevelsOptionImpl levels = new LevelsOptionImpl();
+
+    option.setSystemQueryOption(expand);
+    option.setSystemQueryOption(filter);
+    option.setSystemQueryOption(inlinecount);
+    option.setSystemQueryOption(orderby);
+    option.setSystemQueryOption(search);
+    option.setSystemQueryOption(select);
+    option.setSystemQueryOption(skip);
+    option.setSystemQueryOption(top);
+    option.setSystemQueryOption(levels);
+
+    assertEquals(expand, option.getExpandOption());
+    assertEquals(filter, option.getFilterOption());
+    assertEquals(inlinecount, option.getInlineCountOption());
+    assertEquals(orderby, option.getOrderByOption());
+    assertEquals(search, option.getSearchOption());
+    assertEquals(select, option.getSelectOption());
+    assertEquals(skip, option.getSkipOption());
+    assertEquals(top, option.getTopOption());
+    assertEquals(levels, option.getLevelsOption());
+
+    // just for completeness
+    option = new ExpandItemImpl();
+    option.setSystemQueryOption(new IdOptionImpl());
+
+    option = new ExpandItemImpl();
+    List<SystemQueryOptionImpl> list = new ArrayList<SystemQueryOptionImpl>();
+    list.add(expand);
+    list.add(filter);
+    option.setSystemQueryOptions(list);
+    assertEquals(expand, option.getExpandOption());
+    assertEquals(filter, option.getFilterOption());
+
+    option = new ExpandItemImpl();
+    assertEquals(false, option.isRef());
+    option.setIsRef(true);
+    assertEquals(true, option.isRef());
+
+    option = new ExpandItemImpl();
+    assertEquals(false, option.isStar());
+    option.setIsStar(true);
+    assertEquals(true, option.isStar());
+
+    option = new ExpandItemImpl();
+    UriInfoResource resource = new UriInfoImpl().asUriInfoResource();
+    option.setResourceInfo(resource);
+    assertEquals(resource, option.getResourceInfo());
+
+  }
+
+  @Test
+  public void testExpandOptionImpl() {
+    ExpandOptionImpl option = new ExpandOptionImpl();
+    assertEquals(SupportedQueryOptions.EXPAND, option.getKind());
+
+    ExpandItemImpl item1 = new ExpandItemImpl();
+    ExpandItemImpl item2 = new ExpandItemImpl();
+    option.addExpandItem(item1);
+    option.addExpandItem(item2);
+    assertEquals(item1, option.getExpandItems().get(0));
+    assertEquals(item2, option.getExpandItems().get(1));
+  }
+
+  @Test
+  public void testFilterOptionImpl() {
+    FilterOptionImpl option = new FilterOptionImpl();
+    assertEquals(SupportedQueryOptions.FILTER, option.getKind());
+
+    AliasImpl expression = new AliasImpl();
+
+    option.setExpression(expression);
+    assertEquals(expression, option.getExpression());
+  }
+
+  @Test
+  public void testFormatOptionImpl() {
+    FormatOptionImpl option = new FormatOptionImpl();
+    assertEquals(SupportedQueryOptions.FORMAT, option.getKind());
+
+    option.setFormat("A");
+
+    assertEquals("A", option.getFormat());
+  }
+
+  @Test
+  public void testIdOptionImpl() {
+    IdOptionImpl option = new IdOptionImpl();
+    assertEquals(SupportedQueryOptions.ID, option.getKind());
+
+    option.setValue("A");
+
+    assertEquals("A", option.getValue());
+  }
+
+  @Test
+  public void testInlineCountImpl() {
+    InlineCountOptionImpl option = new InlineCountOptionImpl();
+    assertEquals(SupportedQueryOptions.INLINECOUNT, option.getKind());
+
+    assertEquals(false, option.getValue());
+    option.setValue(true);
+    assertEquals(true, option.getValue());
+  }
+
+  @Test
+  public void testLevelsExpandOptionImpl() {
+    LevelsOptionImpl option = new LevelsOptionImpl();
+    assertEquals(SupportedQueryOptions.LEVELS, option.getKind());
+
+    assertEquals(0, option.getLevel());
+    option.setLevel(1);
+    assertEquals(1, option.getLevel());
+
+    option = new LevelsOptionImpl();
+    option.setMax();
+    assertEquals(true, option.isMax());
+  }
+
+  @Test
+  public void testOrderByItemImpl() {
+    OrderByItemImpl option = new OrderByItemImpl();
+
+    AliasImpl expression = new AliasImpl();
+    option.setExpression(expression);
+    assertEquals(expression, option.getExpression());
+
+    assertEquals(false, option.isDescending());
+    option.setDescending(true);
+    assertEquals(true, option.isDescending());
+  }
+
+  @Test
+  public void testOrderByOptionImpl() {
+    OrderByOptionImpl option = new OrderByOptionImpl();
+
+    OrderByItemImpl order0 = new OrderByItemImpl();
+    OrderByItemImpl order1 = new OrderByItemImpl();
+    option.addOrder(order0);
+    option.addOrder(order1);
+
+    assertEquals(order0, option.getOrders().get(0));
+    assertEquals(order1, option.getOrders().get(1));
+  }
+
+  @Test
+  public void testQueryOptionImpl() {
+    QueryOptionImpl option = new AliasQueryOptionImpl();
+
+    option.setName("A");
+    option.setText("B");
+    assertEquals("A", option.getName());
+    assertEquals("B", option.getText());
+  }
+
+  @Test
+  public void testSearchOptionImpl() {
+    SearchOptionImpl option = new SearchOptionImpl();
+    assertEquals(SupportedQueryOptions.SEARCH, option.getKind());
+    // TODO $search not supported yet
+  }
+
+  @Test
+  public void testSelectItemImpl() {
+    SelectItemImpl option = new SelectItemImpl();
+
+    EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+
+    // no typed collection else case ( e.g. if not path is added)
+    option = new SelectItemImpl();
+
+    option = new SelectItemImpl();
+    assertEquals(false, option.isStar());
+    option.setStar(true);
+    assertEquals(true, option.isStar());
+
+    option = new SelectItemImpl();
+    assertEquals(false, option.isAllOperationsInSchema());
+    FullQualifiedName fqName = new FullQualifiedName("Namespace", "Name");
+    option.addAllOperationsInSchema(fqName);
+    assertEquals(true, option.isAllOperationsInSchema());
+    assertEquals(fqName, option.getAllOperationsInSchemaNameSpace());
+
+  }
+
+  @Test
+  public void testSelectOptionImpl() {
+    SelectOptionImpl option = new SelectOptionImpl();
+    assertEquals(SupportedQueryOptions.SELECT, option.getKind());
+
+    SelectItemImpl item0 = new SelectItemImpl();
+    SelectItemImpl item1 = new SelectItemImpl();
+
+    ArrayList<SelectItemImpl> list = new ArrayList<SelectItemImpl>();
+    list.add(item0);
+    list.add(item1);
+    option.setSelectItems(list);
+
+    assertEquals(item0, option.getSelectItems().get(0));
+    assertEquals(item1, option.getSelectItems().get(1));
+
+  }
+
+  @Test
+  public void testSkipOptionImpl() {
+    SkipOptionImpl option = new SkipOptionImpl();
+    assertEquals(SupportedQueryOptions.SKIP, option.getKind());
+
+    option.setValue("A");
+    assertEquals("A", option.getValue());
+  }
+
+  @Test
+  public void testSkipTokenOptionImpl() {
+    SkipTokenOptionImpl option = new SkipTokenOptionImpl();
+    assertEquals(SupportedQueryOptions.SKIPTOKEN, option.getKind());
+
+    option.setValue("A");
+    assertEquals("A", option.getValue());
+  }
+
+  @Test
+  public void testSystemQueryOptionImpl() {
+    SystemQueryOptionImpl option = new SystemQueryOptionImpl();
+
+    option.setKind(SupportedQueryOptions.EXPAND);
+    assertEquals(SupportedQueryOptions.EXPAND, option.getKind());
+
+    assertEquals("$expand", option.getName());
+  }
+
+  @Test
+  public void testTopOptionImpl() {
+    TopOptionImpl option = new TopOptionImpl();
+    assertEquals(SupportedQueryOptions.TOP, option.getKind());
+
+    option.setValue("A");
+    assertEquals("A", option.getValue());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java
new file mode 100644
index 0000000..c3e8e2d
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java
@@ -0,0 +1,282 @@
+/*******************************************************************************
+ * 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.odata4.producer.core.uri.queryoption.expression;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Arrays;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedConstants;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.producer.core.testutil.FilterTreeToText;
+import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceFunctionImpl;
+import org.junit.Test;
+
+public class ExpressionTest {
+  Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
+  
+  @Test
+  public void testSupportedOperators() {
+    assertEquals(SupportedUnaryOperators.MINUS, SupportedUnaryOperators.get("-") );
+    assertEquals(null, SupportedUnaryOperators.get("XXX") );
+    
+    assertEquals(SupportedBinaryOperators.MOD, SupportedBinaryOperators.get("mod") );
+    assertEquals(null, SupportedBinaryOperators.get("XXX") );
+    
+    assertEquals(SupportedMethodCalls.CONCAT, SupportedMethodCalls.get("concat") );
+    assertEquals(null, SupportedMethodCalls.get("XXX") );
+    
+    assertEquals(SupportedConstants.TRUE, SupportedConstants.get("true") );
+    assertEquals(null, SupportedConstants.get("XXX") );
+  }
+
+  @Test
+  public void testAliasExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    AliasImpl expression = new AliasImpl();
+
+    expression.setParameter("Test");
+
+    assertEquals("Test", expression.getParameterName());
+
+    String output = expression.accept(new FilterTreeToText());
+    assertEquals("<Test>", output);
+
+  }
+
+  @Test
+  public void testBinaryExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    BinaryImpl expression = new BinaryImpl();
+
+    ExpressionImpl expressionLeft = new LiteralImpl().setText("A");
+    ExpressionImpl expressionRight = new LiteralImpl().setText("B");
+
+    expression.setLeftOperand(expressionLeft);
+    expression.setRightOperand(expressionRight);
+    expression.setOperator(SupportedBinaryOperators.SUB);
+
+    assertEquals(expressionLeft, expression.getLeftOperand());
+    assertEquals(expressionRight, expression.getRightOperand());
+    assertEquals(SupportedBinaryOperators.SUB, expression.getOperator());
+
+    String output = expression.accept(new FilterTreeToText());
+    assertEquals("<<A> sub <B>>", output);
+  }
+
+  @Test
+  public void testConstantExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    ConstantImpl expression = new ConstantImpl();
+    EdmType type = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+    assertNotNull(type);
+    expression.setType(type);
+    assertEquals(type, expression.getType());
+
+    expression.setKind(SupportedConstants.FALSE);
+    assertEquals(SupportedConstants.FALSE, expression.getKind());
+    assertEquals(true, expression.isFalse());
+    assertEquals(false, expression.isTrue());
+    assertEquals(false, expression.isNull());
+    assertEquals("<false>", expression.accept(new FilterTreeToText()));
+
+    expression.setKind(SupportedConstants.TRUE);
+    assertEquals(SupportedConstants.TRUE, expression.getKind());
+    assertEquals(false, expression.isFalse());
+    assertEquals(true, expression.isTrue());
+    assertEquals(false, expression.isNull());
+    assertEquals("<true>", expression.accept(new FilterTreeToText()));
+
+    expression.setKind(SupportedConstants.NULL);
+    assertEquals(SupportedConstants.NULL, expression.getKind());
+    assertEquals(false, expression.isFalse());
+    assertEquals(false, expression.isTrue());
+    assertEquals(true, expression.isNull());
+    assertEquals("<null>", expression.accept(new FilterTreeToText()));
+  }
+
+  @Test
+  public void testEnumerationExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    EnumerationImpl expression = new EnumerationImpl();
+    EdmEnumType type = (EdmEnumType) edm.getEnumType(EdmTechProvider.nameENString);
+    assertNotNull(type);
+    expression.setType(type);
+
+    assertEquals(type, expression.getType());
+
+    expression.addValue("A");
+    expression.addValue("B");
+    assertEquals("A", expression.getValues().get(0));
+    assertEquals("B", expression.getValues().get(1));
+    assertEquals("<com.sap.odata.test1.ENString<A,B>>", expression.accept(new FilterTreeToText()));
+  }
+
+  @Test
+  public void testLambdaRefExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    LambdaRefImpl expression = new LambdaRefImpl();
+    expression.setVariableText("A");
+    assertEquals("A", expression.getVariableName());
+
+    assertEquals("<A>", expression.accept(new FilterTreeToText()));
+
+  }
+
+  @Test
+  public void testLiteralExpresion() throws ExceptionVisitExpression, ODataApplicationException {
+    LiteralImpl expression = new LiteralImpl();
+    expression.setText("A");
+    assertEquals("A", expression.getText());
+
+    assertEquals("<A>", expression.accept(new FilterTreeToText()));
+  }
+
+  @Test
+  public void testMemberExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    MemberImpl expression = new MemberImpl();
+    EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+
+    // UriResourceImplTyped
+    UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    EdmAction action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
+    UriInfoResource uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+        new UriResourceActionImpl().setAction(action)).asUriInfoResource();
+    expression.setPath(uriInfo);
+    assertEquals(action.getReturnType().getType(), expression.getType());
+
+    // check accept and path
+    assertEquals(uriInfo, expression.getPath());
+    assertEquals("<UARTPrimParam>", expression.accept(new FilterTreeToText()));
+
+    // UriResourceImplTyped check collection = false case
+    assertEquals(false, expression.isCollection());
+
+    // UriResourceImplTyped check collection = true case
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    action = edm.getAction(EdmTechProvider.nameUARTPrimCollParam, null, null);
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+        new UriResourceActionImpl().setAction(action))
+        .asUriInfoResource());
+    assertEquals(true, expression.isCollection());
+
+    // UriResourceImplTyped with filter
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+        new UriResourceActionImpl().setAction(action).setTypeFilter(entityType))
+        .asUriInfoResource());
+    assertEquals(entityType, expression.getType());
+
+    // UriResourceImplKeyPred
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    EdmFunction function = edm.getFunction(EdmTechProvider.nameUFCRTETKeyNav, null, null, null);
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+        new UriResourceFunctionImpl().setFunction(function))
+        .asUriInfoResource());
+    assertEquals(function.getReturnType().getType(), expression.getType());
+
+    // UriResourceImplKeyPred typeFilter on entry
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+    function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
+        Arrays.asList(("ParameterInt16")));
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+        new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityBaseType))
+        .asUriInfoResource());
+    assertEquals(entityBaseType, expression.getType());
+
+    // UriResourceImplKeyPred typeFilter on entry
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+    function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
+        Arrays.asList(("ParameterInt16")));
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+        new UriResourceFunctionImpl().setFunction(function).setCollectionTypeFilter(entityBaseType))
+        .asUriInfoResource());
+    assertEquals(entityBaseType, expression.getType());
+
+    // no typed
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+    function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
+        Arrays.asList(("ParameterInt16")));
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.all));
+    assertEquals(null, expression.getType());
+
+    // no typed collection else case
+    assertEquals(false, expression.isCollection());
+  }
+
+  @Test
+  public void testMethodCallExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    MethodCallImpl expression = new MethodCallImpl();
+    expression.setMethod(SupportedMethodCalls.CONCAT);
+
+    ExpressionImpl p0 = new LiteralImpl().setText("A");
+    ExpressionImpl p1 = new LiteralImpl().setText("B");
+    expression.addParameter(p0);
+    expression.addParameter(p1);
+
+    assertEquals(SupportedMethodCalls.CONCAT, expression.getMethod());
+    assertEquals("<concat(<A>,<B>)>", expression.accept(new FilterTreeToText()));
+
+    assertEquals(p0, expression.getParameters().get(0));
+    assertEquals(p1, expression.getParameters().get(1));
+  }
+  
+  @Test
+  public void testTypeLiteralExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    TypeLiteralImpl expression = new TypeLiteralImpl();
+    EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+    expression.setType(entityBaseType);
+        
+    assertEquals(entityBaseType, expression.getType());
+    assertEquals("<com.sap.odata.test1.ETBaseTwoKeyNav>", expression.accept(new FilterTreeToText()));
+  }
+  
+  @Test
+  public void testUnaryExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    UnaryImpl expression = new UnaryImpl();
+    expression.setOperator(SupportedUnaryOperators.MINUS);
+    
+    ExpressionImpl operand = new LiteralImpl().setText("A");
+    expression.setOperand(operand);
+        
+    assertEquals(SupportedUnaryOperators.MINUS, expression.getOperator());
+    assertEquals(operand, expression.getOperand());
+    
+    assertEquals("<- <A>>", expression.accept(new FilterTreeToText()));
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/pom.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/pom.xml b/odata4-lib/pom.xml
index 4c8bcb5..625b65c 100644
--- a/odata4-lib/pom.xml
+++ b/odata4-lib/pom.xml
@@ -36,10 +36,10 @@
   </parent>
 
   <modules>
-    <module>odata4-producer-api</module>
-    <module>odata4-producer-core</module>
-    <module>odata4-consumer-api</module>
-    <module>odata4-consumer-core</module>
+    <module>odata4-server-api</module>
+    <module>odata4-server-core</module>
+    <module>odata4-client-api</module>
+    <module>odata4-client-core</module>
     <module>odata4-commons-api</module>
     <module>odata4-commons-core</module>
     <module>odata4-fit</module>


Mime
View raw message