You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/07/10 13:05:39 UTC

git commit: [OLINGO-317] Fixed NFE for query options

Repository: olingo-odata4
Updated Branches:
  refs/heads/master 13d8d36f9 -> 88cfce7e7


[OLINGO-317] Fixed NFE for query options


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

Branch: refs/heads/master
Commit: 88cfce7e7f235e94a9ee787696f0831956144202
Parents: 13d8d36
Author: Michael Bolz <mi...@sap.com>
Authored: Thu Jul 10 13:00:30 2014 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Thu Jul 10 13:00:30 2014 +0200

----------------------------------------------------------------------
 .../olingo/server/core/uri/parser/Parser.java   |  24 ++-
 .../core/uri/antlr/TestFullResourcePath.java    | 149 +++++++++----------
 .../core/uri/antlr/TestUriParserImpl.java       |  42 +++---
 .../core/uri/queryoption/QueryOptionTest.java   |   2 +-
 .../core/uri/testutil/TestUriValidator.java     |  12 +-
 .../core/uri/validator/UriValidatorTest.java    |  41 +++--
 6 files changed, 140 insertions(+), 130 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/88cfce7e/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
index 313aba4..b2e23ea 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
@@ -35,7 +35,6 @@ import org.apache.olingo.server.api.uri.UriInfoKind;
 import org.apache.olingo.server.api.uri.UriResource;
 import org.apache.olingo.server.api.uri.UriResourcePartTyped;
 import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.UriResourceImpl;
 import org.apache.olingo.server.core.uri.antlr.UriLexer;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllEOFContext;
@@ -72,8 +71,7 @@ public class Parser {
     return this;
   }
 
-  public UriInfo parseUri(final String input, final Edm edm)
-      throws UriParserException {
+  public UriInfo parseUri(final String input, final Edm edm) throws UriParserException {
 
     boolean readQueryParameter = false;
     boolean readFragment = false;
@@ -148,7 +146,7 @@ public class Parser {
         if (lastSegment instanceof UriResourcePartTyped) {
           UriResourcePartTyped typed = (UriResourcePartTyped) lastSegment;
 
-          UriParseTreeVisitor.TypeInformation myType = uriParseTreeVisitor.getTypeInformation((UriResourceImpl) typed);
+          UriParseTreeVisitor.TypeInformation myType = uriParseTreeVisitor.getTypeInformation(typed);
           UriParseTreeVisitor.TypeInformation typeInfo =
               uriParseTreeVisitor.new TypeInformation(myType.type, typed.isCollection());
           context.contextTypes.push(typeInfo);
@@ -220,7 +218,11 @@ public class Parser {
             SkipOptionImpl inlineCountOption = new SkipOptionImpl();
             inlineCountOption.setName(option.name);
             inlineCountOption.setText(option.value);
-            inlineCountOption.setValue(Integer.parseInt(option.value));
+            try {
+              inlineCountOption.setValue(Integer.parseInt(option.value));
+            } catch (final NumberFormatException e) {
+              throw new UriParserSemanticException("Illegal value of $skip option!", e);
+            }
             context.contextUriInfo.setSystemQueryOption(inlineCountOption);
           } else if (option.name.equals("$skiptoken")) {
             SkipTokenOptionImpl inlineCountOption = new SkipTokenOptionImpl();
@@ -232,14 +234,22 @@ public class Parser {
             TopOptionImpl inlineCountOption = new TopOptionImpl();
             inlineCountOption.setName(option.name);
             inlineCountOption.setText(option.value);
-            inlineCountOption.setValue(Integer.parseInt(option.value));
+            try {
+              inlineCountOption.setValue(Integer.parseInt(option.value));
+            } catch (final NumberFormatException e) {
+              throw new UriParserSemanticException("Illegal value of $top option!", e);
+            }
             context.contextUriInfo.setSystemQueryOption(inlineCountOption);
           } else if (option.name.equals("$count")) {
             // todo create CountOption
             CountOptionImpl inlineCountOption = new CountOptionImpl();
             inlineCountOption.setName(option.name);
             inlineCountOption.setText(option.value);
-            inlineCountOption.setValue(option.value.equals("true") ? true : false);
+            if (option.value.equals("true") || option.value.equals("false")) {
+              inlineCountOption.setValue(Boolean.parseBoolean(option.value));
+            } else {
+              throw new UriParserSemanticException("Illegal value of $count option!");
+            }
             context.contextUriInfo.setSystemQueryOption(inlineCountOption);
           }
         }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/88cfce7e/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
index 0508bb4..4eb475e 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
@@ -39,6 +39,7 @@ import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider;
 import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
 import org.apache.olingo.server.tecsvc.provider.EnumTypeProvider;
 import org.apache.olingo.server.tecsvc.provider.PropertyProvider;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class TestFullResourcePath {
@@ -55,12 +56,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void test() throws UriParserException {
-
-  }
-
-  @Test
-  public void testFunctionBound_varOverloading() {
+  public void testFunctionBound_varOverloading() throws Exception {
     // on ESTwoKeyNav
     testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
         .at(0)
@@ -90,7 +86,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnCpropCastRtEs() {
+  public void runBfuncBnCpropCastRtEs() throws Exception {
 
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
         + "/PropertyComp/com.sap.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()")
@@ -128,7 +124,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnCpropCollRtEs() {
+  public void runBfuncBnCpropCollRtEs() throws Exception {
     testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -159,7 +155,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnCpropRtEs() {
+  public void runBfuncBnCpropRtEs() throws Exception {
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
         + "/PropertyComp/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
         .isKind(UriInfoKind.resource).goPath()
@@ -194,7 +190,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEntityRtEs() {
+  public void runBfuncBnEntityRtEs() throws Exception {
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -206,7 +202,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEntityCastRtEs() {
+  public void runBfuncBnEntityCastRtEs() throws Exception {
     testUri
         .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
             + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
@@ -235,7 +231,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsCastRtEs() {
+  public void runBfuncBnEsCastRtEs() throws Exception {
     testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav"
         + "/com.sap.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()")
         .isKind(UriInfoKind.resource).goPath()
@@ -276,7 +272,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtCprop() {
+  public void runBfuncBnEsRtCprop() throws Exception {
     testUri.run("ESAllPrim/com.sap.odata.test1.BFCESAllPrimRTCTAllPrim()")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -296,7 +292,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtCpropColl() {
+  public void runBfuncBnEsRtCpropColl() throws Exception {
     testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -317,7 +313,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtEntityPpNp() {
+  public void runBfuncBnEsRtEntityPpNp() throws Exception {
     testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -421,7 +417,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtEntyPpNpCast() {
+  public void runBfuncBnEsRtEntyPpNpCast() throws Exception {
     testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()"
         + "/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETBaseTwoKeyNav")
         .isKind(UriInfoKind.resource).goPath()
@@ -453,7 +449,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtEntityPpCp() {
+  public void runBfuncBnEsRtEntityPpCp() throws Exception {
 
     testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComp")
         .isKind(UriInfoKind.resource).goPath()
@@ -494,7 +490,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtEntyPpCpCast() {
+  public void runBfuncBnEsRtEntyPpCpCast() throws Exception {
 
     testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
         + "/PropertyCompTwoPrim/com.sap.odata.test1.CTTwoBase")
@@ -529,7 +525,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtEntityPpSp() {
+  public void runBfuncBnEsRtEntityPpSp() throws Exception {
     testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -553,7 +549,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtEs() {
+  public void runBfuncBnEsRtEs() throws Exception {
 
     testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
         .isKind(UriInfoKind.resource).goPath()
@@ -611,7 +607,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtEsBa() {
+  public void runBfuncBnEsRtEsBa() throws Exception {
 
     testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp"
         + "/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()/com.sap.odata.test1.BAESAllPrimRTETAllPrim")
@@ -630,7 +626,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnEsRtPrim() {
+  public void runBfuncBnEsRtPrim() throws Exception {
     testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -650,7 +646,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runbfuncBnEsRtPrimColl() {
+  public void runbfuncBnEsRtPrimColl() throws Exception {
     testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -671,7 +667,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnPpropCollRtEs() {
+  public void runBfuncBnPpropCollRtEs() throws Exception {
     testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -698,7 +694,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnPpropRtEs() {
+  public void runBfuncBnPpropRtEs() throws Exception {
 
     testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()")
         .isKind(UriInfoKind.resource).goPath()
@@ -739,7 +735,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnSingleRtEs() {
+  public void runBfuncBnSingleRtEs() throws Exception {
 
     testUri.run("SINav/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()")
         .isKind(UriInfoKind.resource).goPath()
@@ -751,7 +747,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runBfuncBnSingleCastRtEs() {
+  public void runBfuncBnSingleCastRtEs() throws Exception {
     testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESBaseTwoKey()")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -763,7 +759,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runActionBound_on_EntityEntry() {
+  public void runActionBound_on_EntityEntry() throws Exception {
 
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
         .isKind(UriInfoKind.resource).goPath()
@@ -784,7 +780,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runActionBound_on_EntityCollection() {
+  public void runActionBound_on_EntityCollection() throws Exception {
     testUri.run("ESTwoKeyNav/com.sap.odata.test1.BAESTwoKeyNavRTESTwoKeyNav")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -794,7 +790,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runFunctionBound_on_var_Types() {
+  public void runFunctionBound_on_var_Types() throws Exception {
 
     // on primitive
     testUri.run("ESAllPrim(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()")
@@ -861,7 +857,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runActionBound_on_EntityCast() {
+  public void runActionBound_on_EntityCast() throws Exception {
 
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
         + "/com.sap.odata.test1.BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
@@ -888,7 +884,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runCrossjoin() {
+  public void runCrossjoin() throws Exception {
     testUri.run("$crossjoin(ESKeyNav)")
         .isKind(UriInfoKind.crossjoin)
         .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
@@ -899,7 +895,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runCrossjoinError() {
+  public void runCrossjoinError() throws Exception {
     testUri.runEx("$crossjoin").isExSyntax(0);
     testUri.runEx("$crossjoin/error").isExSyntax(0);
     testUri.runEx("$crossjoin()").isExSyntax(0);
@@ -907,7 +903,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEntityId() {
+  public void runEntityId() throws Exception {
     testUri.run("$entity?$id=ESKeyNav(1)")
         .isKind(UriInfoKind.entityId)
         .isIdText("ESKeyNav(1)");
@@ -927,7 +923,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsName() {
+  public void runEsName() throws Exception {
     testUri.run("ESAllPrim")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -986,7 +982,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNameCast() {
+  public void runEsNameCast() throws Exception {
     testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1022,7 +1018,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNamePpSpCast() {
+  public void runEsNamePpSpCast() throws Exception {
 
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
         .isKind(UriInfoKind.resource).goPath()
@@ -1051,7 +1047,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNameKey() {
+  public void runEsNameKey() throws Exception {
     testUri.run("ESCollAllPrim(1)")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1078,7 +1074,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNameParaKeys() throws UnsupportedEncodingException {
+  public void runEsNameParaKeys() throws Exception {
     testUri.run(encode("ESAllKey(PropertyString='O''Neil',PropertyBoolean=true,PropertyByte=255,"
         + "PropertySByte=-128,PropertyInt16=-32768,PropertyInt32=-2147483648,"
         + "PropertyInt64=-9223372036854775808,PropertyDecimal=0.1,PropertyDate=2013-09-25,"
@@ -1105,7 +1101,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNameKeyCast() {
+  public void runEsNameKeyCast() throws Exception {
     /*
      * testUri.runEx("ESTwoPrim(1)/com.sap.odata.test1.ETBase(1)")
      * .isExSemantic(0);
@@ -1166,7 +1162,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNameParaKeysCast() {
+  public void runEsNameParaKeysCast() throws Exception {
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1187,7 +1183,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void run_EsNamePpCp() {
+  public void run_EsNamePpCp() throws Exception {
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1210,7 +1206,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNamePpCpColl() {
+  public void runEsNamePpCpColl() throws Exception {
     testUri.run("ESMixPrimCollComp(5)/CollPropertyComp")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1244,7 +1240,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNamePpCpCast() {
+  public void runEsNamePpCpCast() throws Exception {
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComp")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1304,7 +1300,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runNsNamePpNp() {
+  public void runNsNamePpNp() throws Exception {
     testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1450,7 +1446,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNamePpNpCast() {
+  public void runEsNamePpNpCast() throws Exception {
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
         + "/NavPropertyETKeyNavMany")
         .isKind(UriInfoKind.resource).goPath()
@@ -1533,7 +1529,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNamePpNpRc() {
+  public void runEsNamePpNpRc() throws Exception {
     // checks for using referential constrains to fill missing keys
     testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany('2')").goPath()
         .first()
@@ -1556,7 +1552,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNamePpSp() {
+  public void runEsNamePpSp() throws Exception {
     testUri.run("ESAllPrim(1)/PropertyByte")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1587,7 +1583,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNamePpSpColl() {
+  public void runEsNamePpSpColl() throws Exception {
     testUri.run("ESCollAllPrim(1)/CollPropertyString")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1623,7 +1619,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runEsNameRef() {
+  public void runEsNameRef() throws Exception {
     testUri.run("ESAllPrim/$ref")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1661,13 +1657,13 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runFunctionImpBf() {
+  public void runFunctionImpBf() throws Exception {
 
     testUri.run("FICRTString()/com.sap.odata.test1.BFCStringRTESTwoKeyNav()");
   }
 
   @Test
-  public void runFunctionImpCastBf() {
+  public void runFunctionImpCastBf() throws Exception {
 
     testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav"
         + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
@@ -1698,7 +1694,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runFunctionImpEntity() {
+  public void runFunctionImpEntity() throws Exception {
 
     testUri.run("FICRTETKeyNav()")
         .isKind(UriInfoKind.resource).goPath()
@@ -1773,7 +1769,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runFunctionImpEs() {
+  public void runFunctionImpEs() throws Exception {
     /**/
     testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
         .isKind(UriInfoKind.resource).goPath()
@@ -1812,7 +1808,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runFunctionImpEsAlias() {
+  public void runFunctionImpEsAlias() throws Exception {
 
     testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)?@parameterAlias=1");
     testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)/$count?@parameterAlias=1");
@@ -1820,7 +1816,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runFunctionImpEsCast() {
+  public void runFunctionImpEsCast() throws Exception {
 
     testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav")
         .isKind(UriInfoKind.resource).goPath()
@@ -1871,7 +1867,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runSingletonEntityValue() {
+  public void runSingletonEntityValue() throws Exception {
     testUri.run("SIMedia/$value")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1880,7 +1876,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runSingletonPpNpCast() {
+  public void runSingletonPpNpCast() throws Exception {
     testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1903,7 +1899,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runSingletonPpCpCast() {
+  public void runSingletonPpCpCast() throws Exception {
     testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComp")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1938,7 +1934,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runSingletonPpSpCast() {
+  public void runSingletonPpSpCast() throws Exception {
     testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyInt16")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1961,7 +1957,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runSingletonEntityPpNp() {
+  public void runSingletonEntityPpNp() throws Exception {
     testUri.run("SINav/NavPropertyETKeyNavMany")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -1981,7 +1977,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runSingletonEntityPpCp() {
+  public void runSingletonEntityPpCp() throws Exception {
     testUri.run("SINav/PropertyComp")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -2001,7 +1997,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runSingletonEntityPpCpColl() {
+  public void runSingletonEntityPpCpColl() throws Exception {
     testUri.run("SINav/CollPropertyComp")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -2022,7 +2018,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runSingletonEntityPpSp() {
+  public void runSingletonEntityPpSp() throws Exception {
     testUri.run("SINav/PropertyString")
         .isKind(UriInfoKind.resource).goPath()
         .first()
@@ -2032,7 +2028,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runSingletonEntityPpSpColl() {
+  public void runSingletonEntityPpSpColl() throws Exception {
     testUri.run("SINav/CollPropertyString")
 
         .isKind(UriInfoKind.resource).goPath()
@@ -2051,7 +2047,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runExpand() {
+  public void runExpand() throws Exception {
 
     testUri.run("ESKeyNav(1)?$expand=*")
         .isKind(UriInfoKind.resource).goPath().goExpand()
@@ -2499,7 +2495,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runTop() {
+  public void runTop() throws Exception {
     // top
     testUri.run("ESKeyNav?$top=1")
         .isKind(UriInfoKind.resource).goPath()
@@ -2518,7 +2514,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runFormat() {
+  public void runFormat() throws Exception {
     // format
     testUri.run("ESKeyNav(1)?$format=atom")
         .isKind(UriInfoKind.resource).goPath()
@@ -2538,7 +2534,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void runCount() {
+  public void runCount() throws Exception {
     // count
     testUri.run("ESAllPrim?$count=true")
         .isKind(UriInfoKind.resource).goPath()
@@ -2546,13 +2542,10 @@ public class TestFullResourcePath {
     testUri.run("ESAllPrim?$count=false")
         .isKind(UriInfoKind.resource).goPath()
         .isInlineCountText("false");
-
-    // TODO planned: move to validator
-    // testUri.runEx("ESAllPrim?$count=foo").isExSyntax(0);
   }
 
   @Test
-  public void skip() {
+  public void skip() throws Exception {
     // skip
     testUri.run("ESAllPrim?$skip=3")
         .isKind(UriInfoKind.resource).goPath()
@@ -2566,7 +2559,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void skiptoken() {
+  public void skiptoken() throws Exception {
 
     testUri.run("ESAllPrim?$skiptoken=foo")
         .isKind(UriInfoKind.resource).goPath()
@@ -2574,7 +2567,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void misc() {
+  public void misc() throws Exception {
 
     testUri.run("")
         .isKind(UriInfoKind.service);
@@ -5016,7 +5009,9 @@ public class TestFullResourcePath {
     testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 asc, PropertyInt32 PropertyDuration desc").isExSyntax(0);
   }
 
-  public void testSearch() {
+  @Test
+  @Ignore("$search currently not implemented")
+  public void testSearch() throws Exception {
 
     testUri.run("ESTwoKeyNav?$search=abc");
     testUri.run("ESTwoKeyNav?$search=NOT abc");
@@ -5093,7 +5088,7 @@ public class TestFullResourcePath {
   }
 
   @Test
-  public void testAlias() {
+  public void testAlias() throws Exception {
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString=@A)?@A='2'").goPath()
         .isKeyPredicate(0, "PropertyInt16", "1")
         .isKeyPredicateAlias(1, "PropertyString", "A")

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/88cfce7e/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
index f3b6c70..27b18fc 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
@@ -33,6 +33,7 @@ import org.apache.olingo.server.core.uri.testutil.EdmTechTestProvider;
 import org.apache.olingo.server.core.uri.testutil.FilterValidator;
 import org.apache.olingo.server.core.uri.testutil.ResourceValidator;
 import org.apache.olingo.server.core.uri.testutil.TestUriValidator;
+import org.apache.olingo.server.core.uri.validator.UriValidationException;
 import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider;
 import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
 import org.apache.olingo.server.tecsvc.provider.PropertyProvider;
@@ -71,11 +72,6 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void test() throws UriParserException, UnsupportedEncodingException {
-
-  }
-
-  @Test
   public void testBoundFunctionImport_VarParameters() {
 
     // no input
@@ -224,7 +220,7 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void runCrossJoin() {
+  public void runCrossJoin() throws Exception {
     testUri.run("$crossjoin(ESAllKey)")
         .isKind(UriInfoKind.crossjoin)
         .isCrossJoinEntityList(Arrays.asList("ESAllKey"));
@@ -234,16 +230,16 @@ public class TestUriParserImpl {
         .isCrossJoinEntityList(Arrays.asList("ESAllKey", "ESTwoPrim"));
   }
 
-  @Test(expected = Exception.class)
-  public void testEntityFailOnValidation1() {
+  @Test(expected = UriValidationException.class)
+  public void testEntityFailOnValidation1() throws Exception {
     // simple entity set; with qualifiedentityTypeName; with filter
     testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?$filter=PropertyInt16 eq 123&$id=ESAllKey")
         .isIdText("ESAllKey")
         .goFilter().is("<<PropertyInt16> eq <123>>");
   }
 
-  @Test(expected = Exception.class)
-  public void testEntityFailOnValidation2() {
+  @Test(expected = UriValidationException.class)
+  public void testEntityFailOnValidation2() throws Exception {
     // simple entity set; with qualifiedentityTypeName; with 2xformat(before and after), expand, filter
     testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?"
         + "$format=xml&$expand=*&abc=123&$id=ESBase&xyz=987&$filter=PropertyInt16 eq 123&$format=atom&$select=*")
@@ -255,7 +251,7 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void testEntity() {
+  public void testEntity() throws Exception {
 
     // simple entity set
     testUri.run("$entity?$id=ESAllPrim").isKind(UriInfoKind.entityId)
@@ -703,7 +699,7 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void testMetaData() {
+  public void testMetaData() throws Exception {
 
     // Parsing the fragment may be used if a uri has to be parsed on the consumer side.
     // On the producer side this feature is currently not supported, so the context fragment
@@ -866,7 +862,7 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void testRef() {
+  public void testRef() throws Exception {
     testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/$ref");
   }
 
@@ -989,12 +985,12 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void testValue() {
+  public void testValue() throws Exception {
     testUri.run("ESAllPrim(1)/PropertyString/$value");
   }
 
-  @Test(expected = Exception.class)
-  public void testMemberStartingWithCastFailOnValidation1() {
+  @Test(expected = UriValidationException.class)
+  public void testMemberStartingWithCastFailOnValidation1() throws Exception {
     // on EntityType entry
     testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')?"
         + "$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
@@ -1007,8 +1003,8 @@ public class TestUriParserImpl {
         .at(0).isType(PropertyProvider.nameDate);
   }
 
-  @Test(expected = Exception.class)
-  public void testMemberStartingWithCastFailOnValidation2() {
+  @Test(expected = UriValidationException.class)
+  public void testMemberStartingWithCastFailOnValidation2() throws Exception {
     testUri.run("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?"
         + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
         .goFilter().root().isMember()
@@ -1021,7 +1017,7 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void testMemberStartingWithCast() {
+  public void testMemberStartingWithCast() throws Exception {
 
     // on EntityType collection
     testUri.run("ESTwoKeyNav?$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
@@ -1047,12 +1043,12 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void testComplexTypeCastFollowingAsCollection() {
+  public void testComplexTypeCastFollowingAsCollection() throws Exception {
     testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')/com.sap.odata.test1.CTBase");
   }
 
   @Test
-  public void testLambda() {
+  public void testLambda() throws Exception {
     testUri.run("ESTwoKeyNav?$filter=CollPropertyComp/all( l : true )")
         .goFilter().is("<CollPropertyComp/<ALL;<true>>>");
 
@@ -1070,7 +1066,7 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void testCustomQueryOption() {
+  public void testCustomQueryOption() throws Exception {
     testUri.run("ESTwoKeyNav?custom")
         .isCustomParameter(0, "custom", "");
     testUri.run("ESTwoKeyNav?custom=ABC")
@@ -1092,7 +1088,7 @@ public class TestUriParserImpl {
   }
 
   @Test
-  public void testSelect() {
+  public void testSelect() throws Exception {
     testUri.run("ESTwoKeyNav?$select=*")
         .isSelectItemStar(0);
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/88cfce7e/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
index 7dcf5a5..29abba7 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
@@ -51,7 +51,7 @@ public class QueryOptionTest {
   }
 
   @Test
-  public void testExandItemImpl() {
+  public void testExpandItemImpl() {
     ExpandItemImpl option = new ExpandItemImpl();
 
     // input options

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/88cfce7e/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java
index 47dd0ba..1f08440 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java
@@ -40,6 +40,7 @@ import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
 import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
+import org.apache.olingo.server.core.uri.validator.UriValidationException;
 import org.apache.olingo.server.core.uri.validator.UriValidator;
 
 public class TestUriValidator implements TestValidator {
@@ -55,18 +56,13 @@ public class TestUriValidator implements TestValidator {
   }
 
   // Execution
-  public TestUriValidator run(final String uri) {
+  public TestUriValidator run(final String uri) throws UriParserException, UriValidationException {
     Parser parser = new Parser();
     UriValidator validator = new UriValidator();
 
     uriInfo = null;
-    try {
-      uriInfo = (UriInfoImpl) parser.parseUri(uri, edm);
-      validator.validate(uriInfo, HttpMethod.GET);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-
+    uriInfo = (UriInfoImpl) parser.parseUri(uri, edm);
+    validator.validate(uriInfo, HttpMethod.GET);
     return this;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/88cfce7e/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
index b16af80..f1bca61 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.olingo.server.core.uri.validator;
 
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
@@ -29,9 +28,9 @@ import org.apache.olingo.server.api.uri.UriInfo;
 import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
 import org.apache.olingo.server.core.uri.parser.Parser;
 import org.apache.olingo.server.core.uri.parser.UriParserException;
+import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
 import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class UriValidatorTest {
@@ -66,7 +65,7 @@ public class UriValidatorTest {
   private static final String QO_FORMAT = "$format=bla";
   private static final String QO_EXPAND = "$expand=*";
   private static final String QO_ID = "$id=Products(0)";
-  private static final String QO_COUNT = "$count";
+  private static final String QO_COUNT = "$count=true";
   private static final String QO_ORDERBY = "$orderby=true";
 //  private static final String QO_SEARCH = "$search='bla'";
   private static final String QO_SELECT = "$select=*";
@@ -293,13 +292,27 @@ public class UriValidatorTest {
     }
   }
 
-  @Test(expected = UriValidationException.class)
-  @Ignore("uri parser doen't support orderby yet")
+  @Test(expected = UriParserSemanticException.class)
   public void validateOrderByInvalid() throws Exception {
-    String uri = "/ESAllPrim(1)?$orderBy=XXXX";
+    String uri = "/ESAllPrim(1)?$orderby=XXXX";
     parseAndValidate(uri, HttpMethod.GET);
   }
 
+  @Test(expected = UriParserSemanticException.class)
+  public void validateCountInvalid() throws Exception {
+    parseAndValidate("ESAllPrim?$count=foo", HttpMethod.GET);
+  }
+
+  @Test(expected = UriParserSemanticException.class)
+  public void validateTopInvalid() throws Exception {
+    parseAndValidate("ESAllPrim?$top=foo", HttpMethod.GET);
+  }
+
+  @Test(expected = UriParserSemanticException.class)
+  public void validateSkipInvalid() throws Exception {
+    parseAndValidate("ESAllPrim?$skip=foo", HttpMethod.GET);
+  }
+
   @Test(expected = UriValidationException.class)
   public void validateKeyPredicatesWrongKey() throws Exception {
     String uri = "ESTwoKeyNav(xxx=1, yyy='abc')";
@@ -325,8 +338,10 @@ public class UriValidatorTest {
     for (String uri : uris) {
       try {
         parseAndValidate(uri, HttpMethod.GET);
-      } catch (Exception e) {
-        throw new Exception("Faild for uri: " + uri, e);
+      } catch (final UriParserException e) {
+        fail("Failed for uri: " + uri);
+      } catch (final UriValidationException e) {
+        fail("Failed for uri: " + uri);
       }
     }
   }
@@ -339,8 +354,8 @@ public class UriValidatorTest {
       try {
         parseAndValidate(uri, HttpMethod.GET);
         fail("Validation Exception not thrown: " + uri);
+      } catch (UriParserSemanticException e) {
       } catch (UriValidationException e) {
-        assertTrue(e instanceof UriValidationException);
       }
     }
   }
@@ -363,12 +378,10 @@ public class UriValidatorTest {
     return uris.toArray(new String[0]);
   }
 
-  private void parseAndValidate(final String uri, final HttpMethod method) throws UriParserException,
-      UriValidationException {
+  private void parseAndValidate(final String uri, final HttpMethod method)
+      throws UriParserException, UriValidationException {
     UriInfo uriInfo = parser.parseUri(uri.trim(), edm);
-    UriValidator validator = new UriValidator();
-
-    validator.validate(uriInfo, method);
+    new UriValidator().validate(uriInfo, method);
   }
 
 }