You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/02/11 16:32:06 UTC

[1/2] [OLINGO-63] Uri Parser: add testes for

Updated Branches:
  refs/heads/master 71ea12382 -> 7a3ee483b


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestFullResourcePath.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestFullResourcePath.java
index 3621a69..26ed5d4 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestFullResourcePath.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestFullResourcePath.java
@@ -18,7 +18,7 @@
  ******************************************************************************/
 package org.apache.olingo.odata4.producer.core.uri.antlr;
 
-// sync 20.1.2014
+import java.net.URISyntaxException;
 import java.util.Arrays;
 
 import org.apache.olingo.odata4.commons.api.edm.Edm;
@@ -36,6 +36,8 @@ 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.apache.olingo.odata4.producer.core.uri.UriParserSemanticException;
+import org.apache.olingo.odata4.producer.core.uri.UriParserSyntaxException;
 import org.junit.Test;
 
 public class TestFullResourcePath {
@@ -52,16 +54,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void test() {
-    testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath()
-    .at(0)
-    .isUriPathInfoKind(UriResourceKind.entitySet)
-    .isType(EdmTechProvider.nameETTwoKeyNav)
-    .isCollection(true)
-    .at(1)
-    .isUriPathInfoKind(UriResourceKind.function)
-    .isType(EdmTechProvider.nameETTwoKeyNav);
-  }
+  public void test() {}
 
   @Test
   public void testFunctionBound_varOverloading() {
@@ -96,8 +89,6 @@ public class TestFullResourcePath {
         .isType(EdmTechProvider.nameETTwoKeyNav);
   }
 
-//DONE
-
   @Test
   public void runBfuncBnCpropCastRtEs() {
 
@@ -915,11 +906,10 @@ public class TestFullResourcePath {
 
   @Test
   public void runCrossjoinError() {
-    // testUri.run("$crossjoin");
-    // testUri.run("$crossjoin/error");
-    // testUri.run("$crossjoin()");
-    // testUri.run("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid");
-    // testUri.run("$crossjoin(invalidEntitySet)");
+    testUri.runEx("$crossjoin").isExSyntax(0);
+    testUri.runEx("$crossjoin/error").isExSyntax(0);
+    testUri.runEx("$crossjoin()").isExSyntax(0);
+    testUri.runEx("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid").isExSyntax(0);
   }
 
   @Test
@@ -935,12 +925,10 @@ public class TestFullResourcePath {
 
   @Test
   public void runEntityIdError() {
-    // entity_id_error
-
-    // testUri.run("$entity");
-    // testUri.run("$entity?$idfalse=ESKeyNav(1)");
-    // testUri.run("$entity/com.sap.odata.test1.invalidType?$id=ESKeyNav(1)");
-    // testUri.run("$entity/invalid?$id=ESKeyNav(1)");
+    testUri.runEx("$entity").isExSyntax(0);
+    testUri.runEx("$entity?$idfalse=ESKeyNav(1)").isExSyntax(0);
+    testUri.runEx("$entity/com.sap.odata.test1.invalidType?$id=ESKeyNav(1)").isExSemantic(0);
+    testUri.runEx("$entity/invalid?$id=ESKeyNav(1)").isExSyntax(0);
   }
 
   @Test
@@ -963,27 +951,43 @@ public class TestFullResourcePath {
   @Test
   public void runEsNameError() {
 
-    // testUri.run("ESAllPrim/$count/$ref");
-    // testUri.run("ESAllPrim/$ref/$count");
-    // testUri.run("ESAllPrim/$ref/invalid");
-    // testUri.run("ESAllPrim/$count/invalid");
-    // testUri.run("ESAllPrim(1)/whatever");
-    // testUri.run("ESAllPrim(PropertyInt16='1')");
-    // testUri.run("ESAllPrim(PropertyInt16)");
-    // testUri.run("ESAllPrim(PropertyInt16=)");
-    // testUri.run("ESAllPrim(PropertyInt16=1,Invalid='1')");
-    // testUri.run("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
-    // +"/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim");
-    // testUri.run("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETAllKey");
-    // testUri.run("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim('1')/com.sap.odata.test1.ETAllKey");
-    // testUri.run("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
-    // +"/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim");
-    // testUri.run("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
-    // +"/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)");
-    // testUri.run("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETAllKey");
-    // testUri.run("ETBaseTwoKeyTwoPrim()");
-    // testUri.run("ESAllNullable(1)/CollPropertyString/$value");
-    // testUri.run("ETMixPrimCollComp(1)/ComplexProperty/$value");
+    testUri.runEx("ESAllPrim/$count/$ref").isExSyntax(0);
+    testUri.runEx("ESAllPrim/$ref/$count").isExSyntax(0);
+    testUri.runEx("ESAllPrim/$ref/invalid").isExSyntax(0);
+    testUri.runEx("ESAllPrim/$count/invalid").isExSyntax(0);
+    testUri.runEx("ESAllPrim(1)/whatever").isExSemantic(0);
+    testUri.runEx("ESAllPrim(PropertyInt16='1')").isExSemantic(0);
+    testUri.runEx("ESAllPrim(PropertyInt16)").isExSemantic(0);
+    testUri.runEx("ESAllPrim(PropertyInt16=)").isExSyntax(0);
+    testUri.runEx("ESAllPrim(PropertyInt16=1,Invalid='1')").isExSemantic(0);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
+        + "/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim").isExSemantic(0);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETAllKey")
+        .isExSemantic(0);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim('1')/com.sap.odata.test1.ETAllKey")
+        .isExSemantic(0);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
+        + "/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim")
+        .isExSemantic(0);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
+        + "/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)")
+        .isExSemantic(0);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETAllKey")
+        .isExSemantic(0);
+
+    testUri.runEx("ETBaseTwoKeyTwoPrim()")
+        .isExSemantic(0);
+
+    testUri.runEx("ESAllNullable(1)/CollPropertyString/$value")
+        .isExSemantic(0);
+
+    testUri.runEx("ETMixPrimCollComp(1)/ComplexProperty/$value").isExSemantic(0);
   }
 
   @Test
@@ -1107,9 +1111,15 @@ public class TestFullResourcePath {
 
   @Test
   public void runEsNameKeyCast() {
-    // testUri.run("xESTwoPrim(1)/com.sap.odata.test1.ETBase(1)");
-    // testUri.run("xESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)");
-    // testUri.run("xESBase/com.sap.odata.test1.ETTwoPrim(1)");
+
+    testUri.runEx("xESTwoPrim(1)/com.sap.odata.test1.ETBase(1)")
+        .isExSemantic(0);
+
+    testUri.runEx("xESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)")
+        .isExSemantic(0);
+
+    testUri.runEx("xESBase/com.sap.odata.test1.ETTwoPrim(1)")
+        .isExSemantic(0);
 
     testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETBase")
         .isKind(UriInfoKind.resource).goPath()
@@ -1801,11 +1811,8 @@ public class TestFullResourcePath {
 
   @Test
   public void runFunctionImpError() {
-    /*
-     * testUri.run("FICRTCollCTTwoPrimParam()");
-     * testUri.run("FICRTCollCTTwoPrimParam(invalidParam=2)");
-     * testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16='1',ParameterString='2')");
-     */
+    testUri.runEx("FICRTCollCTTwoPrimParam()").isExSemantic(0);
+    testUri.runEx("FICRTCollCTTwoPrimParam(invalidParam=2)").isExSemantic(0);
   }
 
   @Test
@@ -2244,7 +2251,8 @@ public class TestFullResourcePath {
         .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
         .isType(EdmTechProvider.nameETKeyNav, true)
         .goUpExpandValidator()
-        .isSelectText("PropertyString");
+        .isSelectText("PropertyString")
+        .goSelectItemPath(0).isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
 
     testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($expand=NavPropertyETTwoKeyNavOne)")
         .isKind(UriInfoKind.resource).goPath().goExpand()
@@ -2284,7 +2292,8 @@ public class TestFullResourcePath {
         .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
         .isType(EdmTechProvider.nameETKeyNav, true)
         .goUpExpandValidator()
-        .isSelectText("PropertyString");
+        .isSelectText("PropertyString")
+        .goSelectItemPath(0).isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
 
     testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne($levels=max)")
         .isKind(UriInfoKind.resource).goPath().goExpand()
@@ -2427,7 +2436,8 @@ public class TestFullResourcePath {
         .n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
         .isType(EdmTechProvider.nameETTwoKeyNav)
         .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav)
-        .goUpExpandValidator(); // TODO check select
+        .goUpExpandValidator()
+        .goSelectItemPath(0).isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
 
     testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($expand=NavPropertyETKeyNavMany("
         + "$expand=NavPropertyETKeyNavOne))")
@@ -2455,8 +2465,9 @@ public class TestFullResourcePath {
         .goPath().first()
         .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
         .isType(EdmTechProvider.nameETKeyNav)
-        .goUpExpandValidator();
-    // .isSelectText("PropertyInt16") //TODO check select
+        .goUpExpandValidator()
+        .isSelectText("PropertyInt16")
+        .goSelectItemPath(0).isPrimitiveProperty("PropertyInt16", EdmTechTestProvider.nameInt16, false);
 
     testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyComplex/PropertyInt16)")
         .isKind(UriInfoKind.resource)
@@ -2465,8 +2476,8 @@ public class TestFullResourcePath {
         .goPath().first()
         .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
         .isType(EdmTechProvider.nameETKeyNav)
-        .goUpExpandValidator();
-    // .isSelectText("PropertyInt16")//TODO check select
+        .goUpExpandValidator()
+        .isSelectText("PropertyComplex/PropertyInt16");
   }
 
   @Test
@@ -2517,7 +2528,8 @@ public class TestFullResourcePath {
     testUri.run("ESAllPrim?$count=false")
         .isKind(UriInfoKind.resource).goPath()
         .isInlineCountText("false");
-    // testUri.run("ESAllPrim?$count=foo");
+
+    testUri.runEx("ESAllPrim?$count=foo").isExSyntax(0);
   }
 
   @Test
@@ -2757,12 +2769,6 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void testSpecial() {
-    // testFilter.runOnETKeyNav("any()");
-
-  }
-
-  @Test
   public void testFilter() throws UriParserException {
 
     testFilter.runOnETTwoKeyNav("PropertyString")
@@ -2804,9 +2810,24 @@ public class TestFullResourcePath {
         .root().right()
         .isLiteral("1");
 
-    // testFilter
-    // .runOnETTwoKeyNav(
-    // "NavPropertyETKeyNavMany(1)/NavPropertyETTwoKeyNavMany(PropertyString='2')/PropertyString eq 'SomeString'");
+    testFilter.runOnETTwoKeyNav("NavPropertyETKeyNavMany(1)/NavPropertyETTwoKeyNavMany(PropertyString='2')/"
+        + "PropertyString eq 'SomeString'")
+        .is("<<NavPropertyETKeyNavMany/NavPropertyETTwoKeyNavMany/PropertyString> eq <'SomeString'>>")
+        .root().left()
+        .isType(EdmTechProvider.nameString)
+        .isMember().goPath()
+        .first()
+        .isNavProperty("NavPropertyETKeyNavMany", EdmTechTestProvider.nameETKeyNav, false)
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .n()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechTestProvider.nameETTwoKeyNav, false)
+        .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false)
+        .goUpFilterValidator()
+        .root().right();
+
     testFilter.runOnETTwoKeyNav("com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12")
         .is("<<com.sap.odata.test1.ETTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate> eq <2013-11-12>>")
         .root().left()
@@ -2847,16 +2868,30 @@ public class TestFullResourcePath {
         .root().right()
         .isLiteral("'SomeString'");
 
-    /*
-     * Xinvalid
-     * XPropertyComplex/invalid
-     * Xconcat('a','b')/invalid
-     * XPropertyComplex/concat('a','b')
-     * XPropertyComplexAllPrim/PropertyInt16 eq '1'
-     * XPropertyComplexAllPrim/PropertyDate eq 1
-     * XPropertyComplexAllPrim/PropertyString eq 1
-     * XPropertyComplexAllPrim/PropertyDate eq 1
-     */
+    testFilter.runOnETTwoKeyNavEx("invalid").isExSemantic(0);
+    testFilter.runOnETTwoKeyNavEx("PropertyComplex/invalid").isExSemantic(0);
+    testFilter.runOnETTwoKeyNavEx("concat('a','b')/invalid").isExSyntax(0);
+    testFilter.runOnETTwoKeyNavEx("PropertyComplex/concat('a','b')").isExSyntax(0);
+    testFilter.runOnETTwoKeyNavEx("PropertyComplexAllPrim/PropertyInt16 eq '1'").isExSemantic(0);
+    testFilter.runOnETTwoKeyNavEx("PropertyComplexAllPrim/PropertyDate eq 1").isExSemantic(0);
+    testFilter.runOnETTwoKeyNavEx("PropertyComplexAllPrim/PropertyString eq 1").isExSemantic(0);
+    testFilter.runOnETTwoKeyNavEx("PropertyComplexAllPrim/PropertyDate eq 1").isExSemantic(0);
+
+    testFilter.runOnETAllPrim("PropertySByte eq PropertySByte")
+        .is("<<PropertySByte> eq <PropertySByte>>")
+        .isBinary(SupportedBinaryOperators.EQ)
+        .root().left()
+        .isType(EdmTechProvider.nameSByte)
+        .root().right()
+        .isType(EdmTechProvider.nameSByte);
+
+    testFilter.runOnETAllPrim("PropertySByte ne PropertySByte")
+        .is("<<PropertySByte> ne <PropertySByte>>")
+        .isBinary(SupportedBinaryOperators.NE)
+        .root().left()
+        .isType(EdmTechProvider.nameSByte)
+        .root().right()
+        .isType(EdmTechProvider.nameSByte);
 
     testFilter.runOnETAllPrim("PropertySByte add PropertySByte")
         .is("<<PropertySByte> add <PropertySByte>>")
@@ -2865,7 +2900,6 @@ public class TestFullResourcePath {
         .root().right()
         .isType(EdmTechProvider.nameSByte);
 
-    /**/
     testFilter.runOnETAllPrim("PropertyByte add PropertyByte")
         .is("<<PropertyByte> add <PropertyByte>>")
         .root().left()
@@ -3173,8 +3207,13 @@ public class TestFullResourcePath {
         .isType(EdmTechProvider.nameByte)
         .root().right()
         .isType(EdmTechProvider.nameSByte);
-    // testFilter.runOnETAllPrim("PropertyByte div 0");
-    // testFilter.runOnETAllPrim("0 div 0");
+
+    testFilter.runOnETAllPrim("PropertyByte div 0")
+        .is("<<PropertyByte> div <0>>");
+
+    testFilter.runOnETAllPrim("0 div 0")
+        .is("<<0> div <0>>");
+
     testFilter.runOnETAllPrim("PropertySByte mod PropertySByte")
         .is("<<PropertySByte> mod <PropertySByte>>")
         .root().left()
@@ -3223,54 +3262,187 @@ public class TestFullResourcePath {
         .isType(EdmTechProvider.nameDecimal)
         .root().right()
         .isType(EdmTechProvider.nameDecimal);
+
+    // DODO not synced
+    testFilter.runOnETAllPrim("PropertyDecimal ge PropertyDecimal")
+        .is("<<PropertyDecimal> ge <PropertyDecimal>>")
+        .isBinary(SupportedBinaryOperators.GE)
+        .root().left()
+        .isType(EdmTechProvider.nameDecimal)
+        .root().right()
+        .isType(EdmTechProvider.nameDecimal);
+    testFilter.runOnETAllPrim("PropertyDecimal lt PropertyDecimal")
+        .is("<<PropertyDecimal> lt <PropertyDecimal>>")
+        .isBinary(SupportedBinaryOperators.LT)
+        .root().left()
+        .isType(EdmTechProvider.nameDecimal)
+        .root().right()
+        .isType(EdmTechProvider.nameDecimal);
+    testFilter.runOnETAllPrim("PropertyDecimal le PropertyDecimal")
+        .is("<<PropertyDecimal> le <PropertyDecimal>>")
+        .isBinary(SupportedBinaryOperators.LE)
+        .root().left()
+        .isType(EdmTechProvider.nameDecimal)
+        .root().right()
+        .isType(EdmTechProvider.nameDecimal);
   }
 
   @Test
   public void testFilterProperties() throws UriParserException {
-    // testFilter.runOnETAllPrim("XPropertyByte mod 0");
-    // testFilter.runOnETAllPrim("com.sap.odata.test1.UFCRTETTwoKeyNavParamCTTwoPrim(ParameterCTTwoPrim=@ParamAlias)");
+    testFilter.runOnETAllPrim("PropertyByte mod 0")
+        .is("<<PropertyByte> mod <0>>");
 
-    testFilter
-        .runOnETTwoKeyNav("PropertyComplex"
-            + "/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNavParam"
-            + "(ParameterString=PropertyComplex/PropertyComplex/PropertyString)(PropertyInt16=1,PropertyString='2')"
-            + "/PropertyString eq 'SomeString'");
-    testFilter
-        .runOnETTwoKeyNav("PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTETTwoKeyNavParam(ParameterString=null)"
-            + "/PropertyString eq 'SomeString'");
-    testFilter
-        .runOnETTwoKeyNav("NavPropertyETTwoKeyNavMany/com.sap.odata.test1.BFCESTwoKeyNavRTString() eq 'SomeString'");
-    testFilter.runOnETTwoKeyNav("$it/com.sap.odata.test1.BFCETTwoKeyNavRTETTwoKeyNav()/PropertyString eq 'SomeString'"
-        );
-    // testFilter.runOnETTwoKeyNav("com.sap.odata.test1.BFCETTwoKeyNavRTETTwoKeyNav()/PropertyString eq 'SomeString'");
-    testFilter
-        .runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/com.sap.odata.test1.BFCETTwoKeyNavRTETTwoKeyNav()"
-            + "/PropertyComplex/PropertyComplex/PropertyString eq 'Walldorf'");
-    testFilter
-        .runOnETTwoKeyNav("PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNavParam(ParameterString='1')"
-            + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
-            + "/PropertyString eq 'SomeString'");
-    testFilter
-        .runOnETTwoKeyNav("PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNavParam(ParameterString='a=1')"
-            + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
-            + "/PropertyString eq 'SomeString'");
-    testFilter
-        .runOnETTwoKeyNav("$it/com.sap.odata.test1.BFCETTwoKeyNavRTCTTwoPrim()/com.sap.odata.test1.CTBase"
-            + "/PropertyString eq 'SomeString'");
+    testFilter.runOnETAllPrim("com.sap.odata.test1.UFCRTETTwoKeyNavParamCTTwoPrim(ParameterCTTwoPrim=@ParamAlias)")
+        .is("<UFCRTETTwoKeyNavParamCTTwoPrim>")
+        .goPath()
+        .first()
+        .isFunction("UFCRTETTwoKeyNavParamCTTwoPrim")
+        .isParameterAlias(0, "ParameterCTTwoPrim", "ParamAlias");
 
-    testFilter.runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16 eq 2");
+    testFilter.runOnETTwoKeyNav("PropertyComplex"
+        + "/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNavParam"
+        + "(ParameterString=PropertyComplex/PropertyComplex/PropertyString)(PropertyInt16=1,PropertyString='2')"
+        + "/PropertyString eq 'SomeString'")
+        .is("<<PropertyComplex/BFCCTPrimCompRTESTwoKeyNavParam/PropertyString> eq <'SomeString'>>")
+        .root().left().goPath()
+        .first()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+        .n()
+        .isFunction("BFCCTPrimCompRTESTwoKeyNavParam")
+        .isParameter(0, "ParameterString", "PropertyComplex/PropertyComplex/PropertyString")
+        // TODO go into parameter
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
 
-    testFilter
-        .runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=@Param1Alias)/PropertyInt16 eq 2");
-    testFilter
-        .runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=1)/PropertyComplex"
-            + "/PropertyComplex/PropertyString eq 'SomeString'");
+    testFilter.runOnETTwoKeyNav("PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTETTwoKeyNavParam"
+        + "(ParameterString=null)/PropertyString eq 'SomeString'")
+        .is("<<PropertyComplex/BFCCTPrimCompRTETTwoKeyNavParam/PropertyString> eq <'SomeString'>>")
+        .root().left().goPath()
+        .first()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+        .n()
+        .isFunction("BFCCTPrimCompRTETTwoKeyNavParam")
+        // TODO go into parameter
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
 
-    testFilter
-        .runOnETTwoKeyNav(
-        "com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=PropertyInt16)/PropertyComplex"
-            + "/PropertyComplex/PropertyString eq 'SomeString'"
-        );
+    testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavMany/com.sap.odata.test1.BFCESTwoKeyNavRTString()"
+        + " eq 'SomeString'")
+        .is("<<NavPropertyETTwoKeyNavMany/BFCESTwoKeyNavRTString> eq <'SomeString'>>")
+        .root().left().goPath()
+        .first()
+        .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechTestProvider.nameETTwoKeyNav, true)
+        .n()
+        .isFunction("BFCESTwoKeyNavRTString");
+
+    testFilter.runOnETTwoKeyNav("$it/com.sap.odata.test1.BFCETTwoKeyNavRTETTwoKeyNav()/PropertyString eq 'SomeString'")
+        .is("<<$it/BFCETTwoKeyNavRTETTwoKeyNav/PropertyString> eq <'SomeString'>>")
+        .root().left().goPath()
+        .first()
+        .isIt()
+        .n()
+        .isFunction("BFCETTwoKeyNavRTETTwoKeyNav")
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
+
+    testFilter.runOnETTwoKeyNav("com.sap.odata.test1.BFCETTwoKeyNavRTETTwoKeyNav()/PropertyString eq 'SomeString'")
+        .is("<<BFCETTwoKeyNavRTETTwoKeyNav/PropertyString> eq <'SomeString'>>")
+        .root().left().goPath()
+        .first()
+        .isFunction("BFCETTwoKeyNavRTETTwoKeyNav")
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
+
+    testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/com.sap.odata.test1.BFCETTwoKeyNavRTETTwoKeyNav()"
+        + "/PropertyComplex/PropertyComplex/PropertyString eq 'Walldorf'")
+        .is("<<NavPropertyETTwoKeyNavOne/BFCETTwoKeyNavRTETTwoKeyNav/PropertyComplex/PropertyComplex/PropertyString> "
+            + "eq <'Walldorf'>>")
+        .root().left().goPath()
+        .first()
+        .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechTestProvider.nameETTwoKeyNav, false)
+        .n()
+        .isFunction("BFCETTwoKeyNavRTETTwoKeyNav")
+        .n()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+        .n()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTAllPrim, false)
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
+
+    testFilter.runOnETTwoKeyNav("PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNavParam"
+        + "(ParameterString='1')"
+        + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
+        + "/PropertyString eq 'SomeString'")
+        .is("<<PropertyComplex/BFCCTPrimCompRTESTwoKeyNavParam/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyString> "
+            + "eq <'SomeString'>>")
+        .root().left().goPath()
+        .first()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+        .n()
+        .isFunction("BFCCTPrimCompRTESTwoKeyNavParam")
+        .isTypeFilterOnCollection(EdmTechTestProvider.nameETBaseTwoKeyNav)
+        .isKeyPredicate(0, "PropertyInt16", "2")
+        .isKeyPredicate(1, "PropertyString", "'3'")
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
+
+    testFilter.runOnETTwoKeyNav("$it/com.sap.odata.test1.BFCETTwoKeyNavRTCTTwoPrim()/com.sap.odata.test1.CTBase"
+        + "/PropertyString eq 'SomeString'")
+        .is("<<$it/BFCETTwoKeyNavRTCTTwoPrim/com.sap.odata.test1.CTBase/PropertyString> eq <'SomeString'>>")
+        .root().left().goPath()
+        .first()
+        .isIt()
+        .n()
+        .isFunction("BFCETTwoKeyNavRTCTTwoPrim")
+        .isTypeFilterOnEntry(EdmTechTestProvider.nameCTBase)
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
+
+    testFilter.runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16 eq 2")
+        .is("<<UFCRTETTwoKeyNavParam/PropertyInt16> eq <2>>")
+        .root().left().goPath()
+        .first()
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .n()
+        .isPrimitiveProperty("PropertyInt16", EdmTechTestProvider.nameInt16, false);
+
+    testFilter.runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=@Param1Alias)"
+        + "/PropertyInt16 eq 2")
+        .root().left().goPath()
+        .first()
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isParameterAlias(0, "ParameterInt16", "Param1Alias")
+        .n()
+        .isPrimitiveProperty("PropertyInt16", EdmTechTestProvider.nameInt16, false);
+
+    testFilter.runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=1)"
+        + "/PropertyComplex/PropertyComplex/PropertyString eq 'SomeString'")
+        .root().left().goPath()
+        .first()
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "1")
+        .n()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+        .n()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTAllPrim, false)
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
+
+    testFilter.runOnETTwoKeyNav("com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=PropertyInt16)"
+        + "/PropertyComplex/PropertyComplex/PropertyString eq 'SomeString'")
+        .root().left().goPath()
+        .first()
+        .isFunction("UFCRTETTwoKeyNavParam")
+        .isParameter(0, "ParameterInt16", "PropertyInt16") // TODO
+        .n()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+        .n()
+        .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTAllPrim, false)
+        .n()
+        .isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
 
   }
 
@@ -3886,25 +4058,26 @@ public class TestFullResourcePath {
         .goUpFilterValidator().root()
         .goParameter(1).isTypedLiteral(EdmTechProvider.nameETKeyPrimNav);
 
-    // testFilter.runOnETKeyNav("Xcast(NavPropertyETKeyPrimNavOne,com.sap.odata.test1.ETKeyNav)");
-    // testFilter.runOnETKeyNav("any()");
+    testFilter.runOnETKeyNavEx("cast(NavPropertyETKeyPrimNavOne,com.sap.odata.test1.ETKeyNav)").isExSemantic(0);
+    testFilter.runOnETKeyNav("any()")
+        .isMember().goPath().first().isUriPathInfoKind(UriResourceKind.lambdaAny);
 
   }
 
   @Test
   public void runLamdbaFunctions() throws ExceptionVisitExpression, ODataApplicationException, UriParserException {
-    /*
-     * testFilter.runOnETKeyNav("any(d:d/PropertyInt16 eq 1)")
-     * .is("<<ANY;<<d/PropertyInt16> eq <1>>>>")
-     * .root().goPath()
-     * .first().isUriPathInfoKind(UriResourceKind.lambdaAny)
-     * .goLambdaExpression()
-     * .isBinary(SupportedBinaryOperators.EQ)
-     * .left().goPath()
-     * .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
-     * .isType(EdmTechProvider.nameETKeyNav, false)
-     * .n().isSimple("PropertyInt16");
-     */
+
+    testFilter.runOnETKeyNav("any(d:d/PropertyInt16 eq 1)")
+        .is("<<ANY;<<d/PropertyInt16> eq <1>>>>")
+        .root().goPath()
+        .first().isUriPathInfoKind(UriResourceKind.lambdaAny)
+        .goLambdaExpression()
+        .isBinary(SupportedBinaryOperators.EQ)
+        .left().goPath()
+        .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
+        .isType(EdmTechProvider.nameETKeyNav, false)
+        .n().isPrimitiveProperty("PropertyInt16", EdmTechTestProvider.nameInt16, false);
+
     testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyString eq 'SomeString')")
         .is("<NavPropertyETTwoKeyNavMany/<ANY;<<d/PropertyString> eq <'SomeString'>>>>")
         .root().goPath()
@@ -3917,7 +4090,8 @@ public class TestFullResourcePath {
         .isType(EdmTechProvider.nameETTwoKeyNav, false)
         .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
 
-    // testFilter.runOnETKeyNav("XNavPropertyETTwoKeyNavOne/any(d:d/PropertyString eq 'SomeString')");
+    // TODO lambda does not check if the previous path segment is a collection
+    // testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavOne/any(d:d/PropertyString eq 'SomeString')");
 
     testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any()")
         .is("<NavPropertyETTwoKeyNavMany/<ANY;>>");
@@ -3949,51 +4123,43 @@ public class TestFullResourcePath {
         .n().isComplex("PropertyComplex")
         .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
 
-    // should throw an error
-    /*
-     * testFilter
-     * .runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyInt16 eq 1 or d/any"
-     * + "(e:e/CollPropertyString eq 'SomeString'))")
-     * .is("<NavPropertyETTwoKeyNavMany/<ANY;<<<d/PropertyInt16> eq <1>> or "
-     * + "<d/<ANY;<<e/CollPropertyString> eq <'SomeString'>>>>>>>")
-     * .root().goPath()
-     * .first().isNavProperty("NavPropertyETTwoKeyNavMany")
-     * .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
-     * 
-     * .goLambdaExpression()
-     * 
-     * .root().isBinary(SupportedBinaryOperators.OR)
-     * .root().left()
-     * .isBinary(SupportedBinaryOperators.EQ)
-     * .left()
-     * .goPath()
-     * .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
-     * .isType(EdmTechProvider.nameETTwoKeyNav, false)
-     * .n().isSimple("PropertyInt16")
-     * .goUpFilterValidator()
-     * 
-     * .root().right()
-     * .goPath()
-     * .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
-     * .isType(EdmTechProvider.nameETTwoKeyNav, false)
-     * .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
-     * .goLambdaExpression()
-     * .root().left().goPath()
-     * .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
-     * .isType(EdmTechProvider.nameETTwoKeyNav, false)
-     * .n().isSimple("CollPropertyString").isCollection(true);
-     */
-    testFilter
-        .runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyInt16 eq 1 or d/CollPropertyString/any"
-            + "(e:e eq 'SomeString'))")
+    // TODO lambda does not check if the previous path segment is a collection
+    testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyInt16 eq 1 or d/any"
+        + "(e:e/CollPropertyString eq 'SomeString'))")
+        .is("<NavPropertyETTwoKeyNavMany/<ANY;<<<d/PropertyInt16> eq <1>> or "
+            + "<d/<ANY;<<e/CollPropertyString> eq <'SomeString'>>>>>>>")
+        .root().goPath()
+        .first().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechTestProvider.nameETTwoKeyNav, true)
+        .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
+        .goLambdaExpression()
+        .root().isBinary(SupportedBinaryOperators.OR)
+        .root().left()
+        .isBinary(SupportedBinaryOperators.EQ)
+        .left()
+        .goPath()
+        .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
+        .isType(EdmTechProvider.nameETTwoKeyNav, false)
+        .n().isPrimitiveProperty("PropertyInt16", EdmTechTestProvider.nameInt16, false)
+        .goUpFilterValidator()
+        .root().right()
+        .goPath()
+        .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
+        .isType(EdmTechProvider.nameETTwoKeyNav, false)
+        .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
+        .goLambdaExpression()
+        .root().left().goPath()
+        .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
+        .isType(EdmTechProvider.nameETTwoKeyNav, false)
+        .n().isPrimitiveProperty("CollPropertyString", EdmTechTestProvider.nameString, true);
+
+    testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyInt16 eq 1 or d/CollPropertyString/any"
+        + "(e:e eq 'SomeString'))")
         .is("<NavPropertyETTwoKeyNavMany/<ANY;<<<d/PropertyInt16> eq <1>> or "
             + "<d/CollPropertyString/<ANY;<<e> eq <'SomeString'>>>>>>>")
         .root().goPath()
         .first().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
         .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
-
         .goLambdaExpression()
-
         .root().isBinary(SupportedBinaryOperators.OR)
         .root().left()
         .isBinary(SupportedBinaryOperators.EQ)
@@ -4003,7 +4169,6 @@ public class TestFullResourcePath {
         .isType(EdmTechProvider.nameETTwoKeyNav, false)
         .n().isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false)
         .goUpFilterValidator()
-
         .root().right()
         .goPath()
         .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
@@ -4023,9 +4188,7 @@ public class TestFullResourcePath {
         .root().goPath()
         .first().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
         .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
-
         .goLambdaExpression()
-
         .root().isBinary(SupportedBinaryOperators.AND)
         .root().left()
         .isBinary(SupportedBinaryOperators.EQ)
@@ -4035,7 +4198,6 @@ public class TestFullResourcePath {
         .isType(EdmTechProvider.nameETTwoKeyNav, false)
         .n().isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false)
         .goUpFilterValidator()
-
         .root().right()
         .goPath()
         .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
@@ -4045,7 +4207,6 @@ public class TestFullResourcePath {
         .goLambdaExpression()
         .root().left().goPath()
         .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
-
         .isType(EdmTechProvider.nameString, false)
         .goUpFilterValidator()
         .root().right().goPath()
@@ -4188,54 +4349,54 @@ public class TestFullResourcePath {
 
   @Test
   public void testHas() throws ExceptionVisitExpression, ODataApplicationException, UriParserException {
-    /*
-     * testFilter.runOnETTwoKeyNav("PropertyEnumString has com.sap.odata.test1.ENString'String1'")
-     * .is("<<PropertyEnumString> has <com.sap.odata.test1.ENString<String1>>>")
-     * .isBinary(SupportedBinaryOperators.HAS)
-     * .root().left().goPath().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
-     * .goUpFilterValidator()
-     * .root().right().isEnumLiteral(EdmTechProvider.nameENString, Arrays.asList("String1"));
-     * 
-     * testFilter.runOnETTwoKeyNav("PropertyComplexEnum/PropertyEnumString has com.sap.odata.test1.ENString'String2'")
-     * .is("<<PropertyComplexEnum/PropertyEnumString> has <com.sap.odata.test1.ENString<String2>>>")
-     * .isBinary(SupportedBinaryOperators.HAS)
-     * .root().left().goPath()
-     * .first().isComplex("PropertyComplexEnum")
-     * .n().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
-     * .isType(EdmTechProvider.nameENString)
-     * .goUpFilterValidator()
-     * .root().right().isEnumLiteral(EdmTechProvider.nameENString, Arrays.asList("String2"));
-     * 
-     * testFilter.runOnETTwoKeyNav(
-     * "PropertyComplexEnum/PropertyEnumString has com.sap.odata.test1.ENString'String2' eq true")
-     * .is("<<<PropertyComplexEnum/PropertyEnumString> has <com.sap.odata.test1.ENString<String2>>> eq <true>>")
-     * .isBinary(SupportedBinaryOperators.EQ)
-     * .root().left()
-     * .isBinary(SupportedBinaryOperators.HAS)
-     * .root().left().left().goPath()
-     * .first().isComplex("PropertyComplexEnum")
-     * .n().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
-     * .goUpFilterValidator()
-     * .root().left().right().isEnumLiteral(EdmTechProvider.nameENString, Arrays.asList("String2"));
-     * 
-     * testFilter.runOnETTwoKeyNav("PropertyEnumString has com.sap.odata.test1.ENString'String3'")
-     * .is("<<PropertyEnumString> has <com.sap.odata.test1.ENString<String3>>>")
-     * .isBinary(SupportedBinaryOperators.HAS)
-     * .root().left().goPath()
-     * .first().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
-     * .isType(EdmTechProvider.nameENString)
-     * .goUpFilterValidator()
-     * .root().right().isEnumLiteral(EdmTechProvider.nameENString, Arrays.asList("String3"));
-     * 
-     * testFilter.runOnETTwoKeyNav("PropertyEnumString has com.sap.odata.test1.ENString'String,String3'")
-     * .is("<<PropertyEnumString> has <com.sap.odata.test1.ENString<String,String3>>>")
-     * .isBinary(SupportedBinaryOperators.HAS)
-     * .root().left().goPath()
-     * .first().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
-     * .isType(EdmTechProvider.nameENString)
-     * .goUpFilterValidator()
-     * .root().right().isEnumLiteral(EdmTechProvider.nameENString, Arrays.asList("String","String3"));
-     */
+
+    testFilter.runOnETTwoKeyNav("PropertyEnumString has com.sap.odata.test1.ENString'String1'")
+        .is("<<PropertyEnumString> has <com.sap.odata.test1.ENString<String1>>>")
+        .isBinary(SupportedBinaryOperators.HAS)
+        .root().left().goPath().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
+        .goUpFilterValidator()
+        .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String1"));
+
+    testFilter.runOnETTwoKeyNav("PropertyComplexEnum/PropertyEnumString has com.sap.odata.test1.ENString'String2'")
+        .is("<<PropertyComplexEnum/PropertyEnumString> has <com.sap.odata.test1.ENString<String2>>>")
+        .isBinary(SupportedBinaryOperators.HAS)
+        .root().left().goPath()
+        .first().isComplex("PropertyComplexEnum")
+        .n().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
+        .isType(EdmTechProvider.nameENString)
+        .goUpFilterValidator()
+        .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String2"));
+
+    testFilter.runOnETTwoKeyNav(
+        "PropertyComplexEnum/PropertyEnumString has com.sap.odata.test1.ENString'String2' eq true")
+        .is("<<<PropertyComplexEnum/PropertyEnumString> has <com.sap.odata.test1.ENString<String2>>> eq <true>>")
+        .isBinary(SupportedBinaryOperators.EQ)
+        .root().left()
+        .isBinary(SupportedBinaryOperators.HAS)
+        .root().left().left().goPath()
+        .first().isComplex("PropertyComplexEnum")
+        .n().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
+        .goUpFilterValidator()
+        .root().left().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String2"));
+
+    testFilter.runOnETTwoKeyNav("PropertyEnumString has com.sap.odata.test1.ENString'String3'")
+        .is("<<PropertyEnumString> has <com.sap.odata.test1.ENString<String3>>>")
+        .isBinary(SupportedBinaryOperators.HAS)
+        .root().left().goPath()
+        .first().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
+        .isType(EdmTechProvider.nameENString)
+        .goUpFilterValidator()
+        .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String3"));
+
+    testFilter.runOnETTwoKeyNav("PropertyEnumString has com.sap.odata.test1.ENString'String,String3'")
+        .is("<<PropertyEnumString> has <com.sap.odata.test1.ENString<String,String3>>>")
+        .isBinary(SupportedBinaryOperators.HAS)
+        .root().left().goPath()
+        .first().isComplex("PropertyEnumString").isType(EdmTechProvider.nameENString)
+        .isType(EdmTechProvider.nameENString)
+        .goUpFilterValidator()
+        .root().right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String", "String3"));
+
     testFilter.runOnETTwoKeyNav("PropertyEnumString has null")
         .is("<<PropertyEnumString> has <null>>")
         .root()
@@ -4337,7 +4498,12 @@ public class TestFullResourcePath {
         .left().isMethod(SupportedMethodCalls.CONTAINS, 2)
         .goParameter(0).isLiteral("'Walldorf'")
         .root().left().goParameter(1).isLiteral("'Wall'");
-    // testFilter.runOnETAllPrim("com.sap.odata.test1.UFCRTCTTwoPrimParam(ParameterInt16=null,ParameterString=null)");
+
+    testFilter.runOnETAllPrim("com.sap.odata.test1.UFCRTCTTwoPrimParam(ParameterInt16=null,ParameterString=null)")
+        .goPath()
+        .isFunction("UFCRTCTTwoPrimParam")
+        .isParameter(0, "ParameterInt16", "null")
+        .isParameter(1, "ParameterString", "null");
 
     testFilter.runOnETAllPrim("PropertyBoolean eq true")
         .is("<<PropertyBoolean> eq <true>>")
@@ -4346,7 +4512,9 @@ public class TestFullResourcePath {
         .goUpFilterValidator()
         .root().right().isConstant(SupportedConstants.TRUE);
 
-    // testFilter.runOnETAllPrim("XPropertyBoolean eq 2");
+    testFilter.runOnETAllPrim("PropertyBoolean eq 2")
+        .is("<<PropertyBoolean> eq <2>>");
+
     testFilter.runOnETAllPrim("PropertyDecimal eq 1.25")
         .is("<<PropertyDecimal> eq <1.25>>")
         .isBinary(SupportedBinaryOperators.EQ)
@@ -4482,28 +4650,28 @@ public class TestFullResourcePath {
 
   @Test
   public void testOrderby() throws UriParserException {
-    /*
-     * testFilter.runOrderByOnETTwoKeyNav("com.sap.odata.test1.UFCRTETAllPrimTwoParam("
-     * + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString'")
-     * .isSortOrder(0, false)
-     * .goOrder(0).isBinary(SupportedBinaryOperators.EQ).left().goPath()
-     * .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
-     * .goOrder(0).right().isLiteral("'SomeString'");
-     * 
-     * testFilter.runOrderByOnETTwoKeyNav("com.sap.odata.test1.UFCRTETAllPrimTwoParam("
-     * + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString' asc")
-     * .isSortOrder(0, false)
-     * .goOrder(0).isBinary(SupportedBinaryOperators.EQ).left().goPath()
-     * .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
-     * .goOrder(0).right().isLiteral("'SomeString'");
-     * 
-     * testFilter.runOrderByOnETTwoKeyNav("com.sap.odata.test1.UFCRTETAllPrimTwoParam("
-     * + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString' desc")
-     * .isSortOrder(0, true)
-     * .goOrder(0).isBinary(SupportedBinaryOperators.EQ).left().goPath()
-     * .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
-     * .goOrder(0).right().isLiteral("'SomeString'");
-     */
+
+    testFilter.runOrderByOnETTwoKeyNav("com.sap.odata.test1.UFCRTETAllPrimTwoParam("
+        + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString'")
+        .isSortOrder(0, false)
+        .goOrder(0).isBinary(SupportedBinaryOperators.EQ).left().goPath()
+        .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
+        .goOrder(0).right().isLiteral("'SomeString'");
+
+    testFilter.runOrderByOnETTwoKeyNav("com.sap.odata.test1.UFCRTETAllPrimTwoParam("
+        + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString' asc")
+        .isSortOrder(0, false)
+        .goOrder(0).isBinary(SupportedBinaryOperators.EQ).left().goPath()
+        .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
+        .goOrder(0).right().isLiteral("'SomeString'");
+
+    testFilter.runOrderByOnETTwoKeyNav("com.sap.odata.test1.UFCRTETAllPrimTwoParam("
+        + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString' desc")
+        .isSortOrder(0, true)
+        .goOrder(0).isBinary(SupportedBinaryOperators.EQ).left().goPath()
+        .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
+        .goOrder(0).right().isLiteral("'SomeString'");
+
     testFilter.runOrderByOnETTwoKeyNav("com.sap.odata.test1.UFCRTETAllPrimTwoParam("
         + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString' desc"
         + ", PropertyString eq '1'")
@@ -4625,17 +4793,19 @@ public class TestFullResourcePath {
         .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBoolean", EdmTechProvider.nameBoolean, false)
         .goUpFilterValidator()
         .goOrder(0).right().isConstant(SupportedConstants.TRUE);
-
     /*
      * testFilter.runOrderByOnETAllPrim("PropertyDouble eq 3.5E+38")
      * .isSortOrder(0, false)
-     * .goOrder(0).left().goPath().isSimple("PropertyDouble").goUpFilterValidator()
+     * .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDouble", EdmTechProvider.nameDouble, false)
+     * .goUpFilterValidator()
      * .goOrder(0).right().isLiteral("3.5E+38");
      * 
      * testFilter.runOrderByOnETAllPrim("PropertyDouble eq 3.5E+38 desc").isSortOrder(0, true)
-     * .goOrder(0).left().goPath().isSimple("PropertyDouble").goUpFilterValidator()
+     * .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDouble", EdmTechProvider.nameDouble, false)
+     * .goUpFilterValidator()
      * .goOrder(0).right().isLiteral("3.5E+38");
      */
+
     testFilter.runOrderByOnETAllPrim("PropertySingle eq 1.5")
         .isSortOrder(0, false)
         .goOrder(0).left().goPath().isPrimitiveProperty("PropertySingle", EdmTechProvider.nameSingle, false)
@@ -4804,10 +4974,9 @@ public class TestFullResourcePath {
         .goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator()
         .goOrder(0).right().isEnum(EdmTechProvider.nameENString, Arrays.asList("String1"));
 
-    // XPropertyInt16 1
-    // XPropertyInt16, PropertyInt32 PropertyDuration
-    // XPropertyInt16 PropertyInt32, PropertyDuration desc
-    // XPropertyInt16 asc, PropertyInt32 PropertyDuration desc
-
+    testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 1").isExSyntax(0);
+    testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16, PropertyInt32 PropertyDuration").isExSyntax(0);
+    testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 PropertyInt32, PropertyDuration desc").isExSyntax(0);
+    testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 asc, PropertyInt32 PropertyDuration desc").isExSyntax(0);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
index 536bc4e..8bf5352 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
@@ -937,7 +937,7 @@ public class TestParser {
             + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
             + "queryOption(systemQueryOption("
             + "filter($filter = commonExpr(methodCallExpr("
-            + "distanceMethodCallExpr("
+            + "geoDistanceMethodCallExpr("
             + "geo.distance( "
             + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
             + "pointLiteral(Point pointData(( positionLiteral(142.1   64.1) )))) '))) , "
@@ -1108,15 +1108,6 @@ public class TestParser {
         + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
         + "le   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
 
-    test.aAM().aFC().aCS().run("ODI?$filter=ODI isof Model.Employee").isText("odataRelativeUriEOF(odataRelativeUri("
-        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
-        + "queryOption(systemQueryOption("
-        + "filter($filter = commonExpr(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))   "
-        + "isof   commonExpr(memberExpr("
-        + "pathSegments(pathSegment("
-        + "namespace(odataIdentifier(Model) .) "
-        + "odataIdentifier(Employee))))))))))) <EOF>)");
-
     test.aAM().aFC().aCS().run("ODI?$filter=true and false").isText("odataRelativeUriEOF(odataRelativeUri("
         + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
         + "queryOption(systemQueryOption("

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
index f093e9a..6632f69 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
@@ -23,9 +23,12 @@ package org.apache.olingo.odata4.producer.core.uri.antlr;
 import java.util.Arrays;
 
 import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+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;
@@ -304,14 +307,15 @@ public class TestUriParserImpl {
         .isKind(UriInfoKind.entityId)
         .isEntityType(EdmTechProvider.nameETBase)
         .isIdText("ESTwoPrim")
-        .isSelectText("*");
+        .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("*");
+        .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?"
@@ -319,7 +323,8 @@ public class TestUriParserImpl {
         .isFormatText("atom")
         .isCustomParameter(0, "abc", "123")
         .isIdText("ESBase")
-        .isCustomParameter(1, "xyz", "987");
+        .isCustomParameter(1, "xyz", "987")
+        .isSelectItemStar(0);
   }
 
   @Test
@@ -1062,4 +1067,76 @@ public class TestUriParserImpl {
         .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/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
index 9d9a4fc..f5cee3e 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
@@ -239,53 +239,8 @@ public class QueryOptionTest {
 
     EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
 
-    // UriResourceImplTyped
-    UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource);
-    EdmAction action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
-    option = new SelectItemImpl();
-    UriInfoImpl infoImpl = (UriInfoImpl) option.getResourceInfo();
-    infoImpl.addResourcePart(new UriResourceActionImpl().setAction(action)).asUriInfoResource();
-    assertEquals(action.getReturnType().getType(), option.getType());
-
-    // UriResourceImplTyped with filter
-    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
-    action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
-    option = new SelectItemImpl();
-    infoImpl = (UriInfoImpl) option.getResourceInfo();
-    infoImpl.addResourcePart(new UriResourceActionImpl().setAction(action).setTypeFilter(entityType));
-    assertEquals(entityType, option.getType());
-
-    // UriResourceImplKeyPred
-    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
-    EdmFunction function = edm.getFunction(EdmTechProvider.nameUFCRTETKeyNav, null, null, null);
-    option = new SelectItemImpl();
-    infoImpl = (UriInfoImpl) option.getResourceInfo();
-    infoImpl.addResourcePart(new UriResourceFunctionImpl().setFunction(function));
-    assertEquals(function.getReturnType().getType(), option.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")));
-    option = new SelectItemImpl();
-    infoImpl = (UriInfoImpl) option.getResourceInfo();
-    infoImpl.addResourcePart(new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityBaseType));
-    assertEquals(entityBaseType, option.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")));
-    infoImpl = (UriInfoImpl) option.getResourceInfo();
-    infoImpl.addResourcePart(new UriResourceFunctionImpl()
-        .setFunction(function).setCollectionTypeFilter(entityBaseType));
-    assertEquals(entityBaseType, option.getType());
-
     // no typed collection else case ( e.g. if not path is added)
     option = new SelectItemImpl();
-    assertEquals(null, option.getType());
 
     option = new SelectItemImpl();
     assertEquals(false, option.isStar());
@@ -299,11 +254,6 @@ public class QueryOptionTest {
     assertEquals(true, option.isAllOperationsInSchema());
     assertEquals(fqName, option.getAllOperationsInSchemaNameSpace());
 
-    option = new SelectItemImpl();
-    entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
-    option.setEntityTypeCast(entityBaseType);
-    assertEquals(entityBaseType, option.getEntityTypeCast());
-
   }
 
   @Test


[2/2] git commit: [OLINGO-63] Uri Parser: add testes for

Posted by ko...@apache.org.
[OLINGO-63] Uri Parser: add testes for


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

Branch: refs/heads/master
Commit: 7a3ee483baa5dcbbd1f05ec2dac0036b1ad97530
Parents: 71ea123
Author: Sven Kobler <sv...@sap.com>
Authored: Tue Feb 11 16:30:37 2014 +0100
Committer: Sven Kobler <sv...@sap.com>
Committed: Tue Feb 11 16:30:37 2014 +0100

----------------------------------------------------------------------
 .../api/uri/queryoption/SelectItem.java         |   3 -
 .../expression/SupportedBinaryOperators.java    |   2 -
 .../expression/SupportedMethodCalls.java        |   3 +-
 .../odata4/producer/core/uri/antlr/UriParser.g4 |  10 +-
 .../producer/core/uri/ErrorCollector.java       | 147 ----
 .../olingo/odata4/producer/core/uri/Parser.java |  51 +-
 .../producer/core/uri/UriParseTreeVisitor.java  | 237 ++++---
 .../core/uri/queryoption/SelectItemImpl.java    |  50 +-
 .../producer/core/testutil/ExpandValidator.java |  35 +
 .../producer/core/testutil/FilterValidator.java |  79 ++-
 .../producer/core/testutil/ParserTest.java      |  53 ++
 .../producer/core/testutil/TestErrorLogger.java | 174 +++++
 .../core/testutil/UriResourceValidator.java     |  49 +-
 .../producer/core/testutil/UriValidator.java    |  98 ++-
 .../core/uri/antlr/TestFullResourcePath.java    | 693 ++++++++++++-------
 .../producer/core/uri/antlr/TestParser.java     |  11 +-
 .../core/uri/antlr/TestUriParserImpl.java       |  83 ++-
 .../core/uri/queryoption/QueryOptionTest.java   |  50 --
 18 files changed, 1196 insertions(+), 632 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
index 14640b6..5616b52 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
@@ -30,9 +30,6 @@ public interface SelectItem {
 
   FullQualifiedName getAllOperationsInSchemaNameSpace();
 
-  EdmEntityType getEntityTypeCast();
-
-
   UriInfoResource getResourceInfo();
   
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
index 7d16673..ce52f76 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
@@ -28,8 +28,6 @@ public enum SupportedBinaryOperators {
   ADD("add"), SUB("sub"),
   // comparism
   GT("gt"), GE("ge"), LT("lt"), LE("le"),
-  // isof
-  ISOF("isof"),
   // equality
   EQ("eq"), NE("ne"),
   // and/or

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
index f8228cc..b3e7804 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
@@ -29,7 +29,8 @@ public enum SupportedMethodCalls {
 
   ROUND("round"), FLOOR("floor"),
 
-  CEILING("ceiling"), DISTANCE("distance"), GEOLENGTH("geolength"), INTERSECTS("intersects"), CAST("cast"),
+  CEILING("ceiling"), GEODISTANCE("geo.distance"), GEOLENGTH("geo.length"), GEOINTERSECTS("geo.intersects"),
+  CAST("cast"),
   ISOF("isof");
 
   private String syntax;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
index c0f0fe8..82d2d60 100644
--- a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
+++ b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
@@ -268,7 +268,7 @@ commonExpr          : OPEN commonExpr CLOSE
                     | vE1=commonExpr (WSP vO=MUL WSP | WSP vO=DIV WSP | WSP vO=MOD WSP ) vE2=commonExpr  #altMult
                     | vE1=commonExpr (WSP vO=ADD WSP | WSP vO=SUB WSP) vE2=commonExpr           #altAdd
                     | vE1=commonExpr (WSP vO=GT WSP | WSP vO=GE WSP | WSP vO=LT WSP 
-                                     | WSP vO=LE WSP | WSP vO=ISOF WSP) vE2=commonExpr          #altComparism
+                                     | WSP vO=LE WSP ) vE2=commonExpr          #altComparism
                     | vE1=commonExpr (WSP vO=EQ_ALPHA WSP | WSP vO=NE WSP) vE2=commonExpr       #altEquality
                     | vE1=commonExpr (WSP AND WSP) vE2=commonExpr                               #altAnd
                     | vE1=commonExpr (WSP OR WSP) vE2=commonExpr                                #altOr
@@ -307,7 +307,7 @@ methodCallExpr      : indexOfMethodCallExpr
                     | roundMethodCallExpr
                     | floorMethodCallExpr
                     | ceilingMethodCallExpr
-                    | distanceMethodCallExpr
+                    | geoDistanceMethodCallExpr
                     | geoLengthMethodCallExpr
                     | totalOffsetMinutesMethodCallExpr
                     | minDateTimeMethodCallExpr
@@ -319,7 +319,7 @@ methodCallExpr      : indexOfMethodCallExpr
                     | endsWithMethodCallExpr
                     | startsWithMethodCallExpr
                     | containsMethodCallExpr
-                    | intersectsMethodCallExpr
+                    | geoIntersectsMethodCallExpr
                     ;
 
 
@@ -354,9 +354,9 @@ roundMethodCallExpr               : ROUND_WORD   WSP? vE1=commonExpr WSP? CLOSE;
 floorMethodCallExpr               : FLOOR_WORD   WSP? vE1=commonExpr WSP? CLOSE;
 ceilingMethodCallExpr             : CEILING_WORD WSP? vE1=commonExpr WSP? CLOSE;
 
-distanceMethodCallExpr            : GEO_DISTANCE_WORD   WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
+geoDistanceMethodCallExpr         : GEO_DISTANCE_WORD   WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
 geoLengthMethodCallExpr           : GEO_LENGTH_WORD     WSP? vE1=commonExpr WSP? CLOSE;
-intersectsMethodCallExpr          : GEO_INTERSECTS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
+geoIntersectsMethodCallExpr       : GEO_INTERSECTS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
 
 isofExpr                          : ISOF_WORD  WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;
 castExpr                          : CAST_WORD  WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorCollector.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorCollector.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorCollector.java
deleted file mode 100644
index 834e743..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorCollector.java
+++ /dev/null
@@ -1,147 +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.odata4.producer.core.uri;
-
-import java.util.ArrayList;
-import java.util.BitSet;
-import java.util.Collections;
-import java.util.List;
-
-import org.antlr.v4.runtime.ANTLRErrorListener;
-import org.antlr.v4.runtime.Parser;
-import org.antlr.v4.runtime.RecognitionException;
-import org.antlr.v4.runtime.Recognizer;
-import org.antlr.v4.runtime.atn.ATNConfigSet;
-import org.antlr.v4.runtime.dfa.DFA;
-
-class ErrorCollector implements ANTLRErrorListener {
-
-  private List<Exception> exceptions = new ArrayList<Exception>();
-
-  // private ParserValidator tokenValidator;
-
-  @Override
-  public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
-      final int charPositionInLine,
-      final String msg, final RecognitionException e) {
-
-    // Collect the exception
-    // TODO needs to be improved
-    exceptions.add(e);
-    System.out.println("syntaxError");
-    trace(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
-
-    // fail("syntaxError");
-  }
-
-  @Override
-  public void reportAmbiguity(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex,
-      final boolean exact,
-      final BitSet ambigAlts, final ATNConfigSet configs) {
-
-    /*
-     * if (tokenValidator.logLevel > 0) {
-     * System.out.println("reportAmbiguity: ");
-     * System.out.println(" ambigAlts: " + ambigAlts);
-     * System.out.println(" configs: " + configs);
-     * System.out.println(" input: " + recognizer.getTokenStream().getText(Interval.of(startIndex, stopIndex)));
-     * }
-     */
-    /*
-     * if (!tokenValidator.allowAmbiguity) {
-     * printStack(recognizer);
-     * fail("reportAmbiguity");
-     * }
-     */
-  }
-
-  @Override
-  public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
-      final int stopIndex,
-      final BitSet conflictingAlts, final ATNConfigSet configs) {
-    /*
-     * // The grammar should be written in order to avoid attempting a full context parse because its negative
-     * // impact on the performance, so trace and stop here
-     * if (tokenValidator.logLevel > 0) {
-     * System.out.println("allowed AttemptingFullContext");
-     * }
-     * 
-     * if (!tokenValidator.allowFullContext) {
-     * printStack(recognizer);
-     * fail("reportAttemptingFullContext");
-     * }
-     */
-  }
-
-  @Override
-  public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
-      final int stopIndex, final int prediction,
-      final ATNConfigSet configs) {
-    /*
-     * if (tokenValidator.logLevel > 0) {
-     * System.out.println("allowed ContextSensitivity");
-     * }
-     * 
-     * if (!tokenValidator.allowContextSensitifity) {
-     * printStack(recognizer);
-     * fail("reportContextSensitivity");
-     * }
-     */
-  }
-
-  /*
-   * private void printStack(final Parser recognizer) {
-   * List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
-   * Collections.reverse(stack);
-   * 
-   * System.out.println(" Rule stack: " + stack);
-   * }
-   */
-  private void printStack(final Recognizer<?, ?> recognizer) {
-    List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
-    Collections.reverse(stack);
-    System.out.println(" rule stack: " + stack);
-  }
-
-  public void trace(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
-      final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
-
-    System.err.println("-");
-    // TODO check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
-
-    printStack(recognizer);
-
-    if (e != null && e.getOffendingToken() != null) {
-
-      // String lexerTokenName = TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
-      String lexerTokenName = "";
-      try {
-        // TODO check how the Lexer is accessed in the new package structure
-        // lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
-      } catch (ArrayIndexOutOfBoundsException es) {
-        lexerTokenName = "token error";
-      }
-      System.err.println(" line " + line + ":" + charPositionInLine + " at " +
-          offendingSymbol + "/" + lexerTokenName + ": " + msg);
-    } else {
-      System.err.println(" line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
-    }
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/Parser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/Parser.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/Parser.java
index e170869..6319148 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/Parser.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/Parser.java
@@ -18,6 +18,7 @@
  ******************************************************************************/
 package org.apache.olingo.odata4.producer.core.uri;
 
+import org.antlr.v4.runtime.ANTLRErrorListener;
 import org.antlr.v4.runtime.ANTLRInputStream;
 import org.antlr.v4.runtime.BailErrorStrategy;
 import org.antlr.v4.runtime.CommonTokenStream;
@@ -30,27 +31,29 @@ import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
 
 public class Parser {
-  static public UriInfo parseUri(final String input, final UriParseTreeVisitor uriParseTreeVisitor)
+  public UriInfo parseUri(final String input, final UriParseTreeVisitor uriParseTreeVisitor)
       throws UriParserException {
 
     try {
       OdataRelativeUriEOFContext parseTree = parseInput(input, true);
-      //reset visitor
+
+      // reset visitor
       uriParseTreeVisitor.init();
       parseTree.accept(uriParseTreeVisitor);
       UriInfoImpl uriInput = uriParseTreeVisitor.getUriInfo();
+
       return uriInput;
+
     } catch (ParseCancellationException e) {
       Throwable cause = e.getCause();
       if (cause instanceof UriParserException) {
         throw (UriParserException) cause;
       }
     }
-    return null;
+    throw new UriParserSyntaxException("unknown syntax error");
   }
 
-
-  static private OdataRelativeUriEOFContext parseInput(final String input, boolean onResource)
+  private OdataRelativeUriEOFContext parseInput(final String input, boolean onResource)
       throws UriParserSyntaxException {
     UriParserParser parser = null;
     UriLexer lexer = null;
@@ -65,11 +68,11 @@ public class Parser {
       lexer = new UriLexer(new ANTLRInputStream(input));
       parser = new UriParserParser(new CommonTokenStream(lexer));
 
-      // TODO create better error collector
-      parser.addErrorListener(new ErrorCollector());
+      // Set error strategy
+      addStage1ErrorStategy(parser);
 
-      // bail out of parser at first syntax error. --> proceeds in catch block with step 2
-      parser.setErrorHandler(new BailErrorStrategy());
+      // Set error collector
+      addStage1ErrorListener(parser);
 
       // user the faster LL parsing
       parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
@@ -80,13 +83,16 @@ public class Parser {
     } catch (ParseCancellationException hardException) {
       // stage = 2
       try {
-        
+
         // create parser
         lexer = new UriLexer(new ANTLRInputStream(input));
         parser = new UriParserParser(new CommonTokenStream(lexer));
 
-        // Used default error strategy
-        parser.setErrorHandler(new DefaultErrorStrategy());
+        // Set error strategy
+        addStage2ErrorStategy(parser);
+
+        // Set error collector
+        addStage2ErrorListener(parser);
 
         // Use the slower SLL parsing
         parser.getInterpreter().setPredictionMode(PredictionMode.LL);
@@ -106,4 +112,25 @@ public class Parser {
     return ret;
   }
 
+  protected void addStage1ErrorStategy(UriParserParser parser) {
+    // Throw exception at first syntax error
+    parser.setErrorHandler(new BailErrorStrategy());
+
+  }
+
+  protected void addStage2ErrorStategy(UriParserParser parser) {
+    // Throw exception at first syntax error
+    parser.setErrorHandler(new BailErrorStrategy());
+  }
+
+  protected void addStage1ErrorListener(UriParserParser parser) {
+    // No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
+    parser.removeErrorListeners();
+  }
+
+  protected void addStage2ErrorListener(UriParserParser parser) {
+    // No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
+    parser.removeErrorListeners();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
index 1e6c794..a66b711 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
@@ -80,7 +80,6 @@ import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.Crossjoi
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CustomQueryOptionContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.DateMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.DayMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.DistanceMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EndsWithMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionCastContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionContext;
@@ -98,12 +97,13 @@ import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FilterCo
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FloorMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FormatContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FractionalsecondsMethodCallExprContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.GeoDistanceMethodCallExprContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.GeoIntersectsMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.GeoLengthMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.HourMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IdContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IndexOfMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.InlinecountContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IntersectsMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IsofExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.LengthMethodCallExprContext;
 import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.LevelsContext;
@@ -186,9 +186,8 @@ import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.TypeLit
  * - Whenever it is possible to move edm validation to the AST classes then
  * this should be done ( see visit {@link #visitSelectSegment} for example)
  * 
- * Not supported (TODO)
+ * Not supported
  * <li>Parsing the context of $metadata
- * <li>Evaluation of referential constrains for key predicates
  * 
  * TODO
  * <li>clean up
@@ -382,6 +381,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     UriResourcePart lastResource1 = contextUriInfo.getLastResourcePart();
 
     if (lastResource1 == null) {
+      if (contextTypes.size() == 0) {
+        throw wrap(new UriParserSemanticException("Invalid path segment"));
+      }
       source = contextTypes.peek();
       // sourceType = this.contextTypes.peek().type;
       // sourceCollection = this.contextTypes.peek().isCollection;
@@ -735,8 +737,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       binary.setOperator(SupportedBinaryOperators.LT);
     } else if (tokenIndex == UriLexer.LE) {
       binary.setOperator(SupportedBinaryOperators.LE);
-    } else if (tokenIndex == UriLexer.ISOF) {
-      binary.setOperator(SupportedBinaryOperators.ISOF);
     }
 
     binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
@@ -785,7 +785,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     if (tokenIndex == UriLexer.EQ_ALPHA) {
       binary.setOperator(SupportedBinaryOperators.EQ);
-    } else if (tokenIndex == UriLexer.NE) {
+    } else {
       binary.setOperator(SupportedBinaryOperators.NE);
     }
 
@@ -830,7 +830,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       binary.setOperator(SupportedBinaryOperators.MUL);
     } else if (tokenIndex == UriLexer.DIV) {
       binary.setOperator(SupportedBinaryOperators.DIV);
-    } else if (tokenIndex == UriLexer.MOD) {
+    } else {
       binary.setOperator(SupportedBinaryOperators.MOD);
     }
 
@@ -1061,9 +1061,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   }
 
   @Override
-  public ExpressionImpl visitDistanceMethodCallExpr(final DistanceMethodCallExprContext ctx) {
+  public ExpressionImpl visitGeoDistanceMethodCallExpr(final GeoDistanceMethodCallExprContext ctx) {
     return new MethodCallImpl()
-        .setMethod(SupportedMethodCalls.DISTANCE)
+        .setMethod(SupportedMethodCalls.GEODISTANCE)
         .addParameter((ExpressionImpl) ctx.vE1.accept(this))
         .addParameter((ExpressionImpl) ctx.vE2.accept(this));
   }
@@ -1349,9 +1349,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   }
 
   @Override
-  public ExpressionImpl visitIntersectsMethodCallExpr(final IntersectsMethodCallExprContext ctx) {
+  public ExpressionImpl visitGeoIntersectsMethodCallExpr(final GeoIntersectsMethodCallExprContext ctx) {
     return new MethodCallImpl()
-        .setMethod(SupportedMethodCalls.GEOLENGTH)
+        .setMethod(SupportedMethodCalls.GEOINTERSECTS)
         .addParameter((ExpressionImpl) ctx.vE1.accept(this))
         .addParameter((ExpressionImpl) ctx.vE2.accept(this));
   }
@@ -1470,12 +1470,17 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
       // is single key predicate without a name
       String valueText = ctx.vVO.vV.getText();
-      ExpressionImpl expression = (ExpressionImpl) ctx.vVO.vV.accept(this);
+      ExpressionImpl expression = null;
+      try {
+        expression = (ExpressionImpl) ctx.vVO.vV.accept(this);
+      } catch (Exception ex) {
+        throw wrap(new UriParserSemanticException("Invalid key value: " + valueText));
+      }
 
       // get type of last resource part
       UriResourcePart last = contextUriInfo.getLastResourcePart();
       if (!(last instanceof UriResourceImplTyped)) {
-        throw wrap(new UriParserSyntaxException("Paramterslist on untyped resource path segement not allowed"));
+        throw wrap(new UriParserSemanticException("Paramterslist on untyped resource path segement not allowed"));
       }
       EdmEntityType lastType = (EdmEntityType) ((UriResourceImplTyped) last).getType();
 
@@ -1497,14 +1502,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
       // for using referential constrains the last resource part must be a navigation property
       if (!(contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
-        throw wrap(new UriParserSyntaxException("Not enougth keyproperties defined"));
+        throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
       }
       UriResourceNavigationPropertyImpl lastNav = (UriResourceNavigationPropertyImpl) last;
 
       // get the partner of the navigation property
       EdmNavigationProperty partner = lastNav.getProperty().getPartner();
       if (partner == null) {
-        throw wrap(new UriParserSyntaxException("Not enougth keyproperties defined"));
+        throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
       }
 
       // create the keylist
@@ -1522,7 +1527,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
             missedKey = item;
           } else {
             // two of more keys are missing
-            throw wrap(new UriParserSyntaxException("Not enougth referntial contrains defined"));
+            throw wrap(new UriParserSemanticException("Not enougth referntial contrains defined"));
           }
         }
       }
@@ -1538,23 +1543,25 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       for (ParseTree c : ctx.vNVL.vlNVP) {
         list.add((UriParameterImpl) c.accept(this));
       }
-      
-      if (contextReadingFunctionParameters){ 
+
+      if (contextReadingFunctionParameters) {
         return list;
-    }
+      }
 
       UriResourcePart last = contextUriInfo.getLastResourcePart();
       // if the last resource part is a function
-      /*if (last instanceof UriResourceFunctionImpl) {
-        UriResourceFunctionImpl function = (UriResourceFunctionImpl) last;
-        if (!function.isParameterListFilled()) {
-          return list;
-        }
-      }*/
+      /*
+       * if (last instanceof UriResourceFunctionImpl) {
+       * UriResourceFunctionImpl function = (UriResourceFunctionImpl) last;
+       * if (!function.isParameterListFilled()) {
+       * return list;
+       * }
+       * }
+       */
 
       // get type of last resource part
       if (!(last instanceof UriResourceImplTyped)) {
-        throw wrap(new UriParserSyntaxException("Parameterslist on untyped resource path segement not allowed"));
+        throw wrap(new UriParserSemanticException("Parameterslist on untyped resource path segement not allowed"));
       }
       EdmEntityType lastType = (EdmEntityType) ((UriResourceImplTyped) last).getType();
 
@@ -1570,14 +1577,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
       // for using referential constrains the last resource part must be a navigation property
       if (!(contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
-        throw wrap(new UriParserSyntaxException("Not enougth keyproperties defined"));
+        throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
       }
       UriResourceNavigationPropertyImpl lastNav = (UriResourceNavigationPropertyImpl) last;
 
       // get the partner of the navigation property
       EdmNavigationProperty partner = lastNav.getProperty().getPartner();
       if (partner == null) {
-        throw wrap(new UriParserSyntaxException("Not enougth keyproperties defined"));
+        throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
       }
 
       // fill missing keys from referential constrains
@@ -1604,7 +1611,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
         return list;
       }
 
-      throw wrap(new UriParserSyntaxException("Not enougth keyproperties defined"));
+      throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
     }
     return new ArrayList<String>();
   }
@@ -1836,13 +1843,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     String odi = ctx.vODI.getText();
     if (ctx.vNS == null) {
 
-      EdmType prevType = contextSelectItem.getType();
-      if (prevType == null) {
+      EdmType prevType = null;
+      if (contextSelectItem.getResourceInfo() == null) {
         prevType = contextTypes.peek().type;
-        // add It to selectItem
-        // UriResourceItImpl it = new UriResourceItImpl();
-        // it.setType(prevType);
-        // it.setCollection(this.contextTypes.peek().isCollection);
+      } else {
+        UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+        UriResourcePart last = uriInfo.getLastResourcePart();
+        if (!(last instanceof UriResourceImplTyped)) {
+          throw wrap(new UriParserSemanticException("prev segement typed"));
+        }
+        prevType = getLastType((UriResourceImplTyped) last);
       }
 
       if (!(prevType instanceof EdmStructuralType)) {
@@ -1861,23 +1871,37 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       if (element instanceof EdmProperty) {
         EdmProperty property = (EdmProperty) element;
         if (property.isPrimitive()) {
+          
           UriResourcePrimitivePropertyImpl simple = new UriResourcePrimitivePropertyImpl();
           simple.setProperty(property);
-
-          UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
-          resourcePath.addResourcePart(simple);
+          
+          UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+          if (uriInfo== null) {
+            uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+            uriInfo.addResourcePart(simple);
+            contextSelectItem.setResourceInfo(uriInfo);
+          } else {
+            uriInfo.addResourcePart(simple);
+          }
+          return this;
         } else {
+          UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+          
           UriResourceComplexPropertyImpl complex = new UriResourceComplexPropertyImpl();
           complex.setProperty(property);
-
-          UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
-          resourcePath.addResourcePart(complex);
+          
+          if (uriInfo== null) {
+            uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+            uriInfo.addResourcePart(complex);
+            contextSelectItem.setResourceInfo(uriInfo);
+          } else {
+            uriInfo.addResourcePart(complex);
+          }
+          return this ;
         }
       } else {
         throw wrap(new UriParserSemanticException("Only Simple and Complex properties within select allowed"));
       }
-      return this;
-
     } else {
       String namespace = ctx.vNS.getText();
       namespace = namespace.substring(0, namespace.length() - 1);
@@ -1885,63 +1909,112 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       FullQualifiedName fullName = new FullQualifiedName(namespace, odi);
       // contextSelectItem.addQualifiedThing(fullName);
 
-      EdmType prevType = contextSelectItem.getType();
-      if (prevType != null) { // context types required at least one property
+      if (contextSelectItem.getResourceInfo() == null) {
+        EdmType prevType = contextTypes.peek().type;
+
+        // check for complex type cast
         if (prevType instanceof EdmComplexType) {
           EdmComplexType ct = edm.getComplexType(fullName);
           if (ct != null) {
-            if (((EdmStructuralType) prevType).compatibleTo(ct)) {
-              UriResourcePart lastSegment = ((UriInfoImpl) contextSelectItem.getResourceInfo()).getLastResourcePart();
-              if (lastSegment instanceof UriResourceImplKeyPred) {
-                UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastSegment;
-                lastKeyPred.setCollectionTypeFilter(ct);
-              } else if (lastSegment instanceof UriResourceImplTyped) {
-                {
-                  UriResourceImplTyped lastTyped = (UriResourceImplTyped) lastSegment;
-                  lastTyped.setTypeFilter(ct);
-                }
+            if ((ct.compatibleTo((EdmStructuralType) prevType))) {
+              UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
+              resourcePart.setCollectionTypeFilter(ct);
 
-                return this;
-              }
+              UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+              uriInfo.addResourcePart(resourcePart);
+              contextSelectItem.setResourceInfo(uriInfo);
+              return this;
             }
           }
-        } else {
-          prevType = contextTypes.peek().type;
-          if (prevType instanceof EdmEntityType) {
-            EdmEntityType et = edm.getEntityType(fullName);
-            if (((EdmStructuralType) prevType).compatibleTo(et)) {
-              contextSelectItem.setEntityTypeCast(et);
+        } else if (prevType instanceof EdmEntityType) {
+          EdmEntityType et = edm.getEntityType(fullName);
+          if (et != null) {
+            if ((et.compatibleTo((EdmStructuralType) prevType))) {
+              UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
+              resourcePart.setCollectionTypeFilter(et);
+
+              UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+              uriInfo.addResourcePart(resourcePart);
+              contextSelectItem.setResourceInfo(uriInfo);
               return this;
             }
           }
+        } else {
+          throw wrap(new UriParserSemanticException("prev segement must be comlex of entity type"));
         }
 
-        FullQualifiedName finalTypeName = new FullQualifiedName(prevType.getNamespace(), prevType.getName());
+      } else {
+        UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+        UriResourcePart last = uriInfo.getLastResourcePart();
+        if (!(last instanceof UriResourceImplTyped)) {
+          throw wrap(new UriParserSemanticException("prev segement typed"));
+        }
+        EdmType prevType = getLastType((UriResourceImplTyped) last);
 
-        // check for action
-        EdmAction action = edm.getAction(fullName, finalTypeName, null);
-        // TODO verify that null ignores if it is a collection
+        if (prevType instanceof EdmComplexType) {
+          EdmComplexType ct = edm.getComplexType(fullName);
+          if (ct != null) {
+            if ((ct.compatibleTo((EdmStructuralType) prevType))) {
+              UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
+              resourcePart.setCollectionTypeFilter(ct);
 
-        if (action != null) {
-          UriResourceActionImpl uriAction = new UriResourceActionImpl();
-          uriAction.setAction(action);
+              uriInfo.addResourcePart(resourcePart);
+              return this;
+            }
+          }
+        } else if (prevType instanceof EdmEntityType) {
+          throw wrap(new UriParserSemanticException("Error"));
+          /*EdmEntityType et = edm.getEntityType(fullName);
+          if (et != null) {
+            if ((et.compatibleTo((EdmStructuralType) prevType))) {
+              UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
+              resourcePart.setEntryTypeFilter(et);
+
+              uriInfo.addResourcePart(resourcePart);
+              return this;
+            }
+          }*/
+        } else {
+          throw wrap(new UriParserSemanticException("prev segement must be comlex of entity type"));
+        }
+      }
 
-          UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
-          resourcePath.addResourcePart(uriAction);
+      EdmType prevType = null;
+      if (contextSelectItem.getResourceInfo() == null) {
+        prevType = contextTypes.peek().type;
+      } else {
+        UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+        UriResourcePart last = uriInfo.getLastResourcePart();
+        if (!(last instanceof UriResourceImplTyped)) {
+          throw wrap(new UriParserSemanticException("prev segement typed"));
         }
+        prevType = getLastType((UriResourceImplTyped) last);
+      }
 
-        // check for function
-        EdmFunction function = edm.getFunction(fullName, finalTypeName, null, null);
-        // TODO verify that null ignores if it is a collection
+      FullQualifiedName finalTypeName = new FullQualifiedName(prevType.getNamespace(), prevType.getName());
 
-        if (function != null) {
-          UriResourceFunctionImpl uriFunction = new UriResourceFunctionImpl();
-          uriFunction.setFunction(function);
+      // check for action
+      EdmAction action = edm.getAction(fullName, finalTypeName, null);
+      // TODO verify that null ignores if it is a collection
 
-          UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
-          resourcePath.addResourcePart(uriFunction);
-        }
+      if (action != null) {
+        UriResourceActionImpl uriAction = new UriResourceActionImpl();
+        uriAction.setAction(action);
+
+        UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
+        resourcePath.addResourcePart(uriAction);
+      }
+
+      // check for function
+      EdmFunction function = edm.getFunction(fullName, finalTypeName, null, null);
+      // TODO verify that null ignores if it is a collection
+
+      if (function != null) {
+        UriResourceFunctionImpl uriFunction = new UriResourceFunctionImpl();
+        uriFunction.setFunction(function);
 
+        UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
+        resourcePath.addResourcePart(uriFunction);
       }
     }
     return null;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemImpl.java
index d7c8c7f..5bdd0c0 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemImpl.java
@@ -18,7 +18,6 @@
  ******************************************************************************/
 package org.apache.olingo.odata4.producer.core.uri.queryoption;
 
- 
 import java.util.ArrayList;
 import java.util.List;
 
@@ -37,44 +36,18 @@ public class SelectItemImpl implements SelectItem {
 
   private UriInfoResource path;
 
-  private List<UriResourcePartImpl> parts = new ArrayList<UriResourcePartImpl>();
   private boolean isStar;
   private FullQualifiedName addOperationsInSchemaNameSpace;
-  private EdmEntityType entityTypeCast;
 
-  public EdmType getType() {
-    UriInfoImpl uriInfo = (UriInfoImpl) path;
-    UriResourcePartImpl lastResourcePart = null;
-    if (uriInfo != null) {
-      lastResourcePart = (UriResourcePartImpl) uriInfo.getLastResourcePart();
-    }
+    @Override
+  public UriInfoResource getResourceInfo() {
 
-    if (lastResourcePart instanceof UriResourceImplKeyPred) {
-      UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastResourcePart;
-      if (lastKeyPred.getTypeFilterOnEntry() != null) {
-        return lastKeyPred.getTypeFilterOnEntry();
-      } else if (lastKeyPred.getTypeFilterOnCollection() != null) {
-        return lastKeyPred.getTypeFilterOnCollection();
-      }
-      return lastKeyPred.getType();
-    } else if (lastResourcePart instanceof UriResourceImplTyped) {
-      UriResourceImplTyped lastTyped = (UriResourceImplTyped) lastResourcePart;
-      EdmType type = lastTyped.getTypeFilter();
-      if (type != null) {
-        return type;
-      }
-      return lastTyped.getType();
-    } else {
-      return null;
-    }
+    return path;
   }
 
-  @Override
-  public UriInfoResource getResourceInfo() {
-    if (this.path == null) {
-      this.path = new UriInfoImpl().setKind(UriInfoKind.resource);
-    }
-    return path;
+  public SelectItemImpl setResourceInfo(UriInfoResource path) {
+    this.path = path;
+    return this;
   }
 
   @Override
@@ -104,15 +77,6 @@ public class SelectItemImpl implements SelectItem {
   public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchemaNameSpace) {
     this.addOperationsInSchemaNameSpace = addOperationsInSchemaNameSpace;
   }
-
-  @Override
-  public EdmEntityType getEntityTypeCast() {
-    return entityTypeCast;
-  }
-
-  public SelectItemImpl setEntityTypeCast(final EdmEntityType entityTypeCast) {
-    this.entityTypeCast = entityTypeCast;
-    return this;
-  }
+ 
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
index 0cd86f7..a6cb095 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
@@ -23,14 +23,17 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 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.api.exception.ODataApplicationException;
 import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
 import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.QueryOptionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
 
 public class ExpandValidator implements Validator {
   private Edm edm;
@@ -73,6 +76,21 @@ public class ExpandValidator implements Validator {
         .setUriInfoImplPath(uriInfo);
 
   }
+  
+  public UriResourceValidator goSelectItemPath(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+    
+    SelectItem item = select.getSelectItems().get(index);
+    UriInfoImpl uriInfo = (UriInfoImpl) item.getResourceInfo();
+
+    return new UriResourceValidator()
+        .setUpValidator(this)
+        .setEdm(edm)
+        .setUriInfoImplPath(uriInfo);
+
+  }
+  
+    
 
   public ExpandValidator goExpand() {
     ExpandValidator val = new ExpandValidator();
@@ -147,6 +165,23 @@ public class ExpandValidator implements Validator {
     return this;
   }
   
+  public ExpandValidator isSelectItemStar(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+    
+    SelectItem item = select.getSelectItems().get(index);
+    assertEquals(true, item.isStar());
+    return this;
+  }
+  
+  public ExpandValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
+    SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+    
+    SelectItem item = select.getSelectItems().get(index);
+    assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+    return this;
+  }
+  
+  
   public ExpandValidator isFilterText(final String text) {
     QueryOptionImpl option = (QueryOptionImpl) expandItem.getFilterOption();
     assertEquals(text, option.getText());

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
index e4919e7..9325634 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
@@ -29,6 +29,7 @@ import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
 import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
 import org.apache.olingo.odata4.producer.api.uri.UriInfo;
 import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.UriParameter;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Member;
@@ -39,6 +40,9 @@ import org.apache.olingo.odata4.producer.core.uri.Parser;
 import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
 import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
 import org.apache.olingo.odata4.producer.core.uri.UriParserException;
+import org.apache.olingo.odata4.producer.core.uri.UriParserSemanticException;
+import org.apache.olingo.odata4.producer.core.uri.UriParserSyntaxException;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceFunctionImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.OrderByOptionImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.BinaryImpl;
@@ -60,6 +64,8 @@ public class FilterValidator implements Validator {
 
   private OrderByOptionImpl orderBy;
 
+  private UriParserException exception;
+
   // --- Setup ---
   public FilterValidator setUriResourcePathValidator(final UriResourceValidator uriResourcePathValidator) {
     invokedByValidator = uriResourcePathValidator;
@@ -108,6 +114,11 @@ public class FilterValidator implements Validator {
     String uri = "ESTwoKeyNav?$orderby=" + orderBy.trim();
     return runUriOrderBy(uri);
   }
+  
+  public FilterValidator runOrderByOnETTwoKeyNavEx(final String orderBy) throws UriParserException {
+    String uri = "ESTwoKeyNav?$orderby=" + orderBy.trim();
+    return runUriOrderByEx(uri);
+  }
 
   public FilterValidator runOnETTwoKeyNav(final String filter) throws UriParserException {
     // TODO change to ESTwoKeyNav
@@ -115,6 +126,12 @@ public class FilterValidator implements Validator {
     return runUri(uri);
   }
 
+  public FilterValidator runOnETTwoKeyNavEx(final String filter) throws UriParserException {
+    // TODO change to ESTwoKeyNav
+    String uri = "SINav?$filter=" + filter.trim();
+    return runUriEx(uri);
+  }
+
   public FilterValidator runOnETAllPrim(final String filter) throws UriParserException {
     String uri = "ESAllPrim(1)?$filter=" + filter.trim();
     return runUri(uri);
@@ -124,6 +141,11 @@ public class FilterValidator implements Validator {
     String uri = "ESKeyNav(1)?$filter=" + filter.trim();
     return runUri(uri);
   }
+  
+  public FilterValidator runOnETKeyNavEx(final String filter) throws UriParserException {
+    String uri = "ESKeyNav(1)?$filter=" + filter.trim();
+    return runUriEx(uri);
+  }
 
   public FilterValidator runOnCTTwoPrim(final String filter) throws UriParserException {
     String uri = "SINav/PropertyComplexTwoPrim?$filter=" + filter.trim();
@@ -161,9 +183,30 @@ public class FilterValidator implements Validator {
   }
 
   public FilterValidator runUri(final String uri) throws UriParserException {
+    Parser parser = new Parser();
+    UriInfo uriInfo = null;
+
+    uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
+
+    if (uriInfo.getKind() != UriInfoKind.resource) {
+      fail("Filtervalidator can only be used on resourcePaths");
+    }
+
+    setFilter((FilterOptionImpl) uriInfo.getFilterOption());
+    curExpression = filter.getExpression();
+    return this;
+  }
+
+  public FilterValidator runUriEx(final String uri) {
+    Parser parser = new Parser();
     UriInfo uriInfo = null;
 
-    uriInfo = Parser.parseUri(uri, new UriParseTreeVisitor(edm));
+    try {
+      uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
+    } catch (UriParserException e) {
+      this.exception = e;
+      return this;
+    }
 
     if (uriInfo.getKind() != UriInfoKind.resource) {
       fail("Filtervalidator can only be used on resourcePaths");
@@ -175,9 +218,10 @@ public class FilterValidator implements Validator {
   }
 
   public FilterValidator runUriOrderBy(final String uri) throws UriParserException {
+    Parser parser = new Parser();
     UriInfo uriInfo = null;
 
-    uriInfo = Parser.parseUri(uri, new UriParseTreeVisitor(edm));
+    uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
 
     if (uriInfo.getKind() != UriInfoKind.resource) {
       fail("Filtervalidator can only be used on resourcePaths");
@@ -186,6 +230,26 @@ public class FilterValidator implements Validator {
     setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
     return this;
   }
+  
+  public FilterValidator runUriOrderByEx(final String uri) {
+    Parser parser = new Parser();
+    UriInfo uriInfo = null;
+
+    try {
+      uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
+    } catch (UriParserException e) {
+      this.exception = e;
+      return this;
+    }
+
+    if (uriInfo.getKind() != UriInfoKind.resource) {
+      fail("Filtervalidator can only be used on resourcePaths");
+    }
+
+    setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
+    return this;
+  }
+
 
   // --- Navigation ---
 
@@ -327,6 +391,7 @@ public class FilterValidator implements Validator {
     return this;
   }
 
+  
   public FilterValidator isParameterText(final int parameterIndex, final String parameterText)
       throws ExceptionVisitExpression, ODataApplicationException {
 
@@ -415,4 +480,14 @@ public class FilterValidator implements Validator {
     return this;
   }
 
+  public FilterValidator isExSyntax(long errorID) {
+    assertEquals(UriParserSyntaxException.class, exception.getClass());
+    return this;
+  }
+
+  public FilterValidator isExSemantic(long errorID) {
+    assertEquals(UriParserSemanticException.class, exception.getClass());
+    return this;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserTest.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserTest.java
new file mode 100644
index 0000000..622bce7
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.testutil;
+
+import org.antlr.v4.runtime.DefaultErrorStrategy;
+import org.apache.olingo.odata4.producer.core.uri.Parser;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser;
+
+public class ParserTest extends Parser {
+  TestErrorLogger errorCollector1;
+  TestErrorLogger errorCollector2;
+
+  public ParserTest() {
+    errorCollector1 = new TestErrorLogger("Stage 1", 1);
+    errorCollector2 = new TestErrorLogger("Stage 2", 1);
+  }
+
+  @Override
+  protected void addStage2ErrorStategy(UriParserParser parser) {
+    // Don't throw an at first syntax error, so the error listener will be called
+    parser.setErrorHandler(new DefaultErrorStrategy());
+  }
+
+  @Override
+  protected void addStage1ErrorListener(UriParserParser parser) {
+    // Log error to console
+    parser.removeErrorListeners();
+    parser.addErrorListener(errorCollector1);
+  }
+
+  @Override
+  protected void addStage2ErrorListener(UriParserParser parser) {
+    // Log error to console
+    parser.removeErrorListeners();
+    parser.addErrorListener(errorCollector2);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorLogger.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorLogger.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorLogger.java
new file mode 100644
index 0000000..8e40072
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorLogger.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * 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.testutil;
+
+import java.util.BitSet;
+import java.util.Collections;
+import java.util.List;
+
+import org.antlr.v4.runtime.ANTLRErrorListener;
+import org.antlr.v4.runtime.Parser;
+import org.antlr.v4.runtime.RecognitionException;
+import org.antlr.v4.runtime.Recognizer;
+import org.antlr.v4.runtime.atn.ATNConfigSet;
+import org.antlr.v4.runtime.dfa.DFA;
+
+class TestErrorLogger implements ANTLRErrorListener {
+
+  private String prefix;
+  private int logLevel = 0;
+
+  public TestErrorLogger(String prefix, int logLevel) {
+    this.prefix = prefix;
+    this.logLevel = logLevel;
+  }
+
+  @Override
+  public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
+      final int charPositionInLine,
+      final String msg, final RecognitionException e) {
+
+    // Collect the exception
+    if (logLevel > 0) {
+      System.out.println("\n" + prefix + " -- SyntaxError");
+      trace(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
+    }
+    
+  }
+
+  @Override
+  public void reportAmbiguity(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex,
+      final boolean exact,
+      final BitSet ambigAlts, final ATNConfigSet configs) {
+
+    /*
+     * if (tokenValidator.logLevel > 0) {
+     * System.out.println("reportAmbiguity: ");
+     * System.out.println(" ambigAlts: " + ambigAlts);
+     * System.out.println(" configs: " + configs);
+     * System.out.println(" input: " + recognizer.getTokenStream().getText(Interval.of(startIndex, stopIndex)));
+     * }
+     */
+    /*
+     * if (!tokenValidator.allowAmbiguity) {
+     * printStack(recognizer);
+     * fail("reportAmbiguity");
+     * }
+     */
+  }
+
+  @Override
+  public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
+      final int stopIndex,
+      final BitSet conflictingAlts, final ATNConfigSet configs) {
+    /*
+     * // The grammar should be written in order to avoid attempting a full context parse because its negative
+     * // impact on the performance, so trace and stop here
+     * if (tokenValidator.logLevel > 0) {
+     * System.out.println("allowed AttemptingFullContext");
+     * }
+     * 
+     * if (!tokenValidator.allowFullContext) {
+     * printStack(recognizer);
+     * fail("reportAttemptingFullContext");
+     * }
+     */
+  }
+
+  @Override
+  public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
+      final int stopIndex, final int prediction,
+      final ATNConfigSet configs) {
+    /*
+     * if (tokenValidator.logLevel > 0) {
+     * System.out.println("allowed ContextSensitivity");
+     * }
+     * 
+     * if (!tokenValidator.allowContextSensitifity) {
+     * printStack(recognizer);
+     * fail("reportContextSensitivity");
+     * }
+     */
+  }
+
+  /*
+   * private void printStack(final Parser recognizer) {
+   * List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
+   * Collections.reverse(stack);
+   * 
+   * System.out.println(" Rule stack: " + stack);
+   * }
+   */
+  private void printStack(final Recognizer<?, ?> recognizer) {
+    List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
+    Collections.reverse(stack);
+    System.out.println(" rule stack: " + stack);
+  }
+
+  public void trace(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
+      final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
+
+    System.out.println("Error message: " +  msg);
+    // TODO check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
+
+    printStack(recognizer);
+
+    if (e != null && e.getOffendingToken() != null) {
+
+      // String lexerTokenName = TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
+      String lexerTokenName = "";
+      try {
+        // TODO check how the Lexer is accessed in the new package structure
+        // lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+      } catch (ArrayIndexOutOfBoundsException es) {
+        lexerTokenName = "token error";
+      }
+      System.out.println(" line " + line + ":" + charPositionInLine + " at " +
+          offendingSymbol + "/" + lexerTokenName + ": " + msg);
+    } else {
+      System.out.println(" line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
+    }
+  }
+  
+  public static int getDecisionRule(Recognizer<?, ?> recognizer, int decision) {
+    if (recognizer == null || decision < 0) {
+        return -1;
+    }
+
+    if (decision >= recognizer.getATN().decisionToState.size()) {
+        return -1;
+    }
+
+    return recognizer.getATN().decisionToState.get(decision).ruleIndex;
+}
+
+public static String getRuleDisplayName(Recognizer<?, ?> recognizer, int ruleIndex) {
+    if (recognizer == null || ruleIndex < 0) {
+        return Integer.toString(ruleIndex);
+    }
+
+    String[] ruleNames = recognizer.getRuleNames();
+    if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
+        return Integer.toString(ruleIndex);
+    }
+
+    return ruleNames[ruleIndex];
+}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
index 30cb6a7..1df0a0b 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
@@ -34,8 +34,8 @@ import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
 import org.apache.olingo.odata4.producer.api.uri.UriParameter;
 import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.core.uri.Parser;
 import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
 import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
 import org.apache.olingo.odata4.producer.core.uri.UriParserException;
@@ -53,6 +53,7 @@ import org.apache.olingo.odata4.producer.core.uri.UriResourcePrimitivePropertyIm
 import org.apache.olingo.odata4.producer.core.uri.UriResourceSingletonImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
 
 public class UriResourceValidator implements Validator {
@@ -84,10 +85,11 @@ public class UriResourceValidator implements Validator {
   // --- Execution ---
 
   public UriResourceValidator run(final String uri) {
+    ParserTest testParser = new ParserTest(); 
     UriInfoImpl uriInfoTmp = null;
     uriPathInfo = null;
     try {
-      uriInfoTmp = (UriInfoImpl) Parser.parseUri(uri, new UriParseTreeVisitor(edm));
+      uriInfoTmp = (UriInfoImpl) testParser.parseUri(uri, new UriParseTreeVisitor(edm));
     } catch (UriParserException e) {
       fail("Exception occured while parsing the URI: " + uri + "\n"
           + " Exception: " + e.getMessage());
@@ -146,6 +148,19 @@ public class UriResourceValidator implements Validator {
     assertEquals(var, actualVar);
     return this;
   }
+  
+  public UriResourceValidator goSelectItemPath(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+    
+    SelectItem item = select.getSelectItems().get(index);
+    UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo();
+
+    return new UriResourceValidator()
+        .setUpValidator(this)
+        .setEdm(edm)
+        .setUriInfoImplPath(uriInfo1);
+
+  }
 
   public ExpandValidator goExpand() {
     ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
@@ -369,6 +384,20 @@ public class UriResourceValidator implements Validator {
     return this;
 
   }
+  
+  public UriResourceValidator isParameterAlias(final int index, final String name, final String alias) {
+    if (!(uriPathInfo instanceof UriResourceFunctionImpl)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    UriResourceFunctionImpl info = (UriResourceFunctionImpl) uriPathInfo;
+    List<UriParameter> keyPredicates = info.getParameters();
+    assertEquals(name, keyPredicates.get(index).getName());
+    assertEquals(alias, keyPredicates.get(index).getAlias());
+    return this;
+
+  }
+
 
   public UriResourceValidator isKind(final UriInfoKind kind) {
     assertEquals(kind, uriInfo.getKind());
@@ -513,5 +542,21 @@ public class UriResourceValidator implements Validator {
     assertEquals(skipTokenText, uriInfo.getSkipTokenOption().getText());
     return this;
   }
+  
+  public UriResourceValidator isSelectItemStar(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+    
+    SelectItem item = select.getSelectItems().get(index);
+    assertEquals(true, item.isStar());
+    return this;
+  }
+  
+  public UriResourceValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+    
+    SelectItem item = select.getSelectItems().get(index);
+    assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+    return this;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7a3ee483/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
index 455a5df..5e71770 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
@@ -28,17 +28,23 @@ import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
 import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
 import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
 import org.apache.olingo.odata4.producer.core.uri.Parser;
 import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
 import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
 import org.apache.olingo.odata4.producer.core.uri.UriParserException;
+import org.apache.olingo.odata4.producer.core.uri.UriParserSemanticException;
+import org.apache.olingo.odata4.producer.core.uri.UriParserSyntaxException;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
 
 public class UriValidator implements Validator {
   private Edm edm;
 
   private UriInfoImpl uriInfo;
+  private Exception exception;
 
   // Setup
   public UriValidator setEdm(final Edm edm) {
@@ -48,10 +54,40 @@ public class UriValidator implements Validator {
 
   // Execution
   public UriValidator run(final String uri) {
+    Parser parser = new Parser();
     uriInfo = null;
     try {
       // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
-      uriInfo = (UriInfoImpl) Parser.parseUri(uri, new UriParseTreeVisitor(edm));
+      uriInfo = (UriInfoImpl) parser.parseUri(uri, new UriParseTreeVisitor(edm));
+    } catch (UriParserException e) {
+      fail("Exception occured while parsing the URI: " + uri + "\n"
+          + " Exception: " + e.getMessage());
+    }
+
+    return this;
+  }
+
+  public UriValidator runEx(final String uri) {
+    Parser parser = new Parser();
+    uriInfo = null;
+    try {
+      // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
+      uriInfo = (UriInfoImpl) parser.parseUri(uri, new UriParseTreeVisitor(edm));
+
+    } catch (UriParserException e) {
+      exception = e;
+    }
+
+    return this;
+  }
+
+  public UriValidator log(final String uri) {
+    ParserTest parserTest = new ParserTest();
+    uriInfo = null;
+    try {
+      // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
+      uriInfo = (UriInfoImpl) parserTest.parseUri(uri, new UriParseTreeVisitor(edm));
+      fail("Exception expected");
     } catch (UriParserException e) {
       fail("Exception occured while parsing the URI: " + uri + "\n"
           + " Exception: " + e.getMessage());
@@ -80,6 +116,29 @@ public class UriValidator implements Validator {
     return new FilterValidator().setUriValidator(this).setFilter(filter);
 
   }
+  
+  public ExpandValidator goExpand() {
+    ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
+    if (expand == null) {
+      fail("invalid resource kind: " + uriInfo.getKind().toString());
+    }
+
+    return new ExpandValidator().setGoUpValidator(this).setExpand(expand);
+  }
+  
+  
+  public UriResourceValidator goSelectItemPath(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+    
+    SelectItem item = select.getSelectItems().get(index);
+    UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo();
+
+    return new UriResourceValidator()
+        .setUpValidator(this)
+        .setEdm(edm)
+        .setUriInfoImplPath(uriInfo1);
+
+  }
 
   // Validation
   public UriValidator isKind(final UriInfoKind kind) {
@@ -116,36 +175,43 @@ public class UriValidator implements Validator {
 
   }
 
+  public UriValidator isExSyntax(long errorID) {
+    assertEquals(UriParserSyntaxException.class, exception.getClass());
+    return this;
+  }
+
+  public UriValidator isExSemantic(long errorID) {
+    assertEquals(UriParserSemanticException.class, exception.getClass());
+    return this;
+  }
+
   public UriValidator isIdText(final String text) {
     assertEquals(text, uriInfo.getIdOption().getText());
     return this;
   }
 
-  
   public UriValidator isExpandText(final String text) {
     assertEquals(text, uriInfo.getExpandOption().getText());
     return this;
   }
-  
+
   public UriValidator isSelectText(final String text) {
     assertEquals(text, uriInfo.getSelectOption().getText());
     return this;
   }
 
-  
   public UriValidator isFormatText(final String text) {
     assertEquals(text, uriInfo.getFormatOption().getText());
     return this;
   }
-  
+
   public UriValidator isFragmentText(final String text) {
     if (uriInfo.getKind() != UriInfoKind.metadata) {
       fail("invalid resource kind: " + uriInfo.getKind().toString());
     }
-    
+
     assertEquals(text, uriInfo.getFragment());
-    
-    
+
     return this;
   }
 
@@ -161,5 +227,21 @@ public class UriValidator implements Validator {
   private String fullName(final EdmEntityType type) {
     return type.getNamespace() + "." + type.getName();
   }
+  
+  public UriValidator isSelectItemStar(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+    
+    SelectItem item = select.getSelectItems().get(index);
+    assertEquals(true, item.isStar());
+    return this;
+  }
+  
+  public UriValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+    
+    SelectItem item = select.getSelectItems().get(index);
+    assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+    return this;
+  }
 
 }