http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/554c795e/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
----------------------------------------------------------------------
diff --git 
a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
 
b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
new file mode 100644
index 0000000..9005080
--- /dev/null
+++ 
b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.uri.testutil;
+
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.Token;
+import org.apache.olingo.server.core.uri.antlr.UriLexer;
+
+public class UriLexerWithTrace extends UriLexer {
+  int logLevel = 0;
+
+  public UriLexerWithTrace(final ANTLRInputStream antlrInputStream, final int 
logLevel) {
+    super(antlrInputStream);
+    this.logLevel = logLevel;
+  }
+
+  public UriLexerWithTrace(final ANTLRInputStream antlrInputStream, final int 
logLevel, final int mode) {
+    super(antlrInputStream);
+    super.mode(mode);
+    this.logLevel = logLevel;
+  }
+
+  @Override
+  public void emit(final Token token) {
+    if (logLevel > 1) {
+      String out = String.format("%1$-" + 20 + "s", token.getText());
+
+      int tokenType = token.getType();
+      if (tokenType == -1) {
+        out += "-1/EOF";
+      } else {
+        out += UriLexer.tokenNames[tokenType];
+      }
+      System.out.println("Lexer.emit(...):" + out);
+    }
+
+    super.emit(token);
+  }
+
+  @Override
+  public void pushMode(final int m) {
+
+    String out = UriLexer.modeNames[_mode] + "-->";
+
+    super.pushMode(m);
+
+    out += UriLexer.modeNames[_mode];
+
+    if (logLevel > 1) {
+      System.out.println(out + "            ");
+    }
+  }
+
+  @Override
+  public int popMode() {
+
+    String out = UriLexer.modeNames[_mode] + "-->";
+
+    int m = super.popMode();
+
+    out += UriLexer.modeNames[_mode];
+
+    if (logLevel > 1) {
+      System.out.println(out + "            ");
+    }
+
+    return m;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/554c795e/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
----------------------------------------------------------------------
diff --git 
a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
 
b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
new file mode 100644
index 0000000..0374b25
--- /dev/null
+++ 
b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
@@ -0,0 +1,378 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.uri.validator;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.server.core.testutil.techprovider.EdmTechProvider;
+import org.apache.olingo.server.core.uri.parser.Parser;
+import org.apache.olingo.server.core.uri.parser.UriParserException;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class UriValidatorTest {
+
+  private static final String URI_ALL = "$all";
+  private static final String URI_BATCH = "$batch";
+  private static final String URI_CROSSJOIN = "$crossjoin(ESAllPrim)";
+  private static final String URI_ENTITY_ID = "/$entity";
+  private static final String URI_METADATA = "$metadata";
+  private static final String URI_SERVICE = "";
+  private static final String URI_ENTITY_SET = "/ESAllPrim";
+  private static final String URI_ENTITY_SET_COUNT = "/ESAllPrim/$count";
+  private static final String URI_ENTITY = "/ESAllPrim(1)";
+  private static final String URI_MEDIA_STREAM = "/ESMedia(1)/$value";
+  private static final String URI_REFERENCES = "/ESAllPrim/$ref";
+  private static final String URI_REFERENCE = "/ESAllPrim(1)/$ref";
+  private static final String URI_PROPERTY_COMPLEX = 
"/ESCompComp(1)/PropertyComplex";
+  private static final String URI_PROPERTY_COMPLEX_COLLECTION =
+      "/ESCompCollComp(1)/PropertyComplex/CollPropertyComplex";
+  private static final String URI_PROPERTY_COMPLEX_COLLECTION_COUNT =
+      "/ESCompCollComp(1)/PropertyComplex/CollPropertyComplex/$count";
+  private static final String URI_PROPERTY_PRIMITIVE = 
"/ESAllPrim(1)/PropertyString";
+  private static final String URI_PROPERTY_PRIMITIVE_COLLECTION = 
"/ESCollAllPrim/CollPropertyString";
+  private static final String URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT =
+      "/ESCollAllPrim/CollPropertyString/$count";
+  private static final String URI_PROPERTY_PRIMITIVE_VALUE = 
"/ESAllPrim(1)/PropertyString/$value";
+  private static final String URI_SINGLETON = "/SI";
+  private static final String URI_NAV_ENTITY = 
"/ESKeyNav/NavPropertyETKeyNavOne";
+  private static final String URI_NAV_ENTITY_SET = 
"/ESKeyNav/NavPropertyETKeyNavMany";
+
+  private static final String QO_FILTER = "$filter='1' eq '1'";
+  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_ORDERBY = "$orderby=true";
+//  private static final String QO_SEARCH = "$search='bla'";
+  private static final String QO_SELECT = "$select=*";
+  private static final String QO_SKIP = "$skip=3";
+  private static final String QO_SKIPTOKEN = "$skiptoken=123";
+  private static final String QO_LEVELS = "$expand=*($levels=1)";
+  private static final String QO_TOP = "$top=1";
+
+  private String[][] urisWithValidSystemQueryOptions = {
+      { URI_ALL, QO_FILTER, }, { URI_ALL, QO_FORMAT }, { URI_ALL, QO_EXPAND }, 
{ URI_ALL, QO_COUNT },
+      { URI_ALL, QO_ORDERBY }, /* { URI_ALL, QO_SEARCH }, */{ URI_ALL, 
QO_SELECT }, { URI_ALL, QO_SKIP },
+      { URI_ALL, QO_SKIPTOKEN }, { URI_ALL, QO_LEVELS },
+
+      { URI_CROSSJOIN, QO_FILTER, }, { URI_CROSSJOIN, QO_FORMAT },
+      { URI_CROSSJOIN, QO_EXPAND }, { URI_CROSSJOIN, QO_COUNT }, { 
URI_CROSSJOIN, QO_ORDERBY },
+      /* { URI_CROSSJOIN, QO_SEARCH }, */{ URI_CROSSJOIN, QO_SELECT }, { 
URI_CROSSJOIN, QO_SKIP },
+      { URI_CROSSJOIN, QO_SKIPTOKEN }, { URI_CROSSJOIN, QO_LEVELS }, { 
URI_CROSSJOIN, QO_TOP },
+
+      { URI_ENTITY_ID, QO_ID, QO_FORMAT }, { URI_ENTITY_ID, QO_ID, }, { 
URI_ENTITY_ID, QO_ID, QO_EXPAND },
+      { URI_ENTITY_ID, QO_ID, QO_SELECT }, { URI_ENTITY_ID, QO_ID, QO_LEVELS },
+
+      { URI_METADATA, QO_FORMAT },
+
+      { URI_SERVICE, QO_FORMAT },
+
+      { URI_ENTITY_SET, QO_FILTER, }, { URI_ENTITY_SET, QO_FORMAT }, { 
URI_ENTITY_SET, QO_EXPAND },
+      { URI_ENTITY_SET, QO_COUNT }, { URI_ENTITY_SET, QO_ORDERBY }, /* { 
URI_ENTITY_SET, QO_SEARCH }, */
+      { URI_ENTITY_SET, QO_SELECT },
+      { URI_ENTITY_SET, QO_SKIP }, { URI_ENTITY_SET, QO_SKIPTOKEN }, { 
URI_ENTITY_SET, QO_LEVELS },
+      { URI_ENTITY_SET, QO_TOP },
+
+      { URI_ENTITY_SET_COUNT, QO_FILTER }, /* { URI_ENTITY_SET_COUNT, 
QO_SEARCH }, */
+
+      { URI_ENTITY, QO_FORMAT }, { URI_ENTITY, QO_EXPAND }, { URI_ENTITY, 
QO_SELECT }, { URI_ENTITY, QO_LEVELS },
+
+      { URI_MEDIA_STREAM, QO_FORMAT },
+
+      { URI_REFERENCES, QO_FILTER }, { URI_REFERENCES, QO_FORMAT }, { 
URI_REFERENCES, QO_ORDERBY },
+      /* { URI_REFERENCES, QO_SEARCH }, */{ URI_REFERENCES, QO_SKIP }, { 
URI_REFERENCES, QO_SKIPTOKEN },
+      { URI_REFERENCES, QO_TOP },
+
+      { URI_REFERENCE, QO_FORMAT },
+
+      { URI_PROPERTY_COMPLEX, QO_FORMAT }, { URI_PROPERTY_COMPLEX, QO_SELECT 
}, { URI_PROPERTY_COMPLEX, QO_EXPAND },
+      { URI_PROPERTY_COMPLEX, QO_LEVELS },
+
+      { URI_PROPERTY_COMPLEX_COLLECTION, QO_FILTER }, { 
URI_PROPERTY_COMPLEX_COLLECTION, QO_FORMAT },
+      { URI_PROPERTY_COMPLEX_COLLECTION, QO_EXPAND }, { 
URI_PROPERTY_COMPLEX_COLLECTION, QO_COUNT },
+      { URI_PROPERTY_COMPLEX_COLLECTION, QO_SKIP }, { 
URI_PROPERTY_COMPLEX_COLLECTION, QO_SKIPTOKEN },
+      { URI_PROPERTY_COMPLEX_COLLECTION, QO_LEVELS }, { 
URI_PROPERTY_COMPLEX_COLLECTION, QO_TOP },
+      { URI_PROPERTY_COMPLEX_COLLECTION, QO_ORDERBY },
+
+      { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_FILTER }, /* { 
URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_SEARCH }, */
+
+      { URI_PROPERTY_PRIMITIVE, QO_FORMAT },
+
+      { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_FILTER }, { 
URI_PROPERTY_PRIMITIVE_COLLECTION, QO_FORMAT },
+      { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_ORDERBY }, { 
URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SKIP },
+      { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SKIPTOKEN }, { 
URI_PROPERTY_PRIMITIVE_COLLECTION, QO_TOP },
+
+      { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_FILTER },
+      /* { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_SEARCH }, */
+
+      { URI_PROPERTY_PRIMITIVE_VALUE, QO_FORMAT },
+
+      { URI_SINGLETON, QO_FORMAT }, { URI_SINGLETON, QO_EXPAND }, { 
URI_SINGLETON, QO_SELECT },
+      { URI_SINGLETON, QO_LEVELS },
+
+      { URI_NAV_ENTITY, QO_FORMAT }, { URI_NAV_ENTITY, QO_EXPAND }, { 
URI_NAV_ENTITY, QO_SELECT },
+      { URI_NAV_ENTITY, QO_LEVELS },
+
+      { URI_NAV_ENTITY_SET, QO_FILTER, }, { URI_NAV_ENTITY_SET, QO_FORMAT }, { 
URI_NAV_ENTITY_SET, QO_EXPAND },
+      { URI_NAV_ENTITY_SET, QO_COUNT }, { URI_NAV_ENTITY_SET, QO_ORDERBY },
+      /* { URI_NAV_ENTITY_SET, QO_SEARCH }, */{ URI_NAV_ENTITY_SET, QO_SELECT 
}, { URI_NAV_ENTITY_SET, QO_SKIP },
+      { URI_NAV_ENTITY_SET, QO_SKIPTOKEN }, { URI_NAV_ENTITY_SET, QO_LEVELS }, 
{ URI_NAV_ENTITY_SET, QO_TOP },
+
+      { "FINRTInt16()" },
+      { "FICRTETKeyNav()" },
+      { "FICRTESTwoKeyNavParam(ParameterInt16=1)" },
+      { "FICRTCollString()" },
+      { "FICRTCTTwoPrim()" },
+      { "FICRTCollCTTwoPrim()" },
+      { "FICRTETMedia()" },
+
+      { "ESTwoKeyNav/com.sap.odata.test1.BAESTwoKeyNavRTESTwoKeyNav" },
+      { "ESAllPrim/com.sap.odata.test1.BAESAllPrimRTETAllPrim" },
+      { "AIRTPrimCollParam" },
+      { "AIRTETParam" },
+      { "AIRTPrimParam" },
+
+  };
+
+  private String[][] urisWithNonValidSystemQueryOptions = {
+      { URI_ALL, QO_ID, }, { URI_ALL, QO_TOP },
+
+      { URI_BATCH, QO_FILTER, }, { URI_BATCH, QO_FORMAT }, { URI_BATCH, QO_ID, 
}, { URI_BATCH, QO_EXPAND },
+      { URI_BATCH, QO_COUNT }, { URI_BATCH, QO_ORDERBY }, /* { URI_BATCH, 
QO_SEARCH }, */{ URI_BATCH, QO_SELECT },
+      { URI_BATCH, QO_SKIP }, { URI_BATCH, QO_SKIPTOKEN }, { URI_BATCH, 
QO_LEVELS }, { URI_BATCH, QO_TOP },
+
+      { URI_CROSSJOIN, QO_ID, },
+
+      { URI_ENTITY_ID, QO_ID, QO_FILTER, },
+      { URI_ENTITY_ID, QO_ID, QO_COUNT }, { URI_ENTITY_ID, QO_ORDERBY }, /* { 
URI_ENTITY_ID, QO_SEARCH }, */
+
+      { URI_ENTITY_ID, QO_ID, QO_SKIP }, { URI_ENTITY_ID, QO_ID, QO_SKIPTOKEN 
}, { URI_ENTITY_ID, QO_ID, QO_TOP },
+
+      { URI_METADATA, QO_FILTER, }, { URI_METADATA, QO_ID, }, { URI_METADATA, 
QO_EXPAND },
+      { URI_METADATA, QO_COUNT }, { URI_METADATA, QO_ORDERBY }, /* { 
URI_METADATA, QO_SEARCH }, */
+      { URI_METADATA, QO_SELECT }, { URI_METADATA, QO_SKIP }, { URI_METADATA, 
QO_SKIPTOKEN },
+      { URI_METADATA, QO_LEVELS }, { URI_METADATA, QO_TOP },
+
+      { URI_SERVICE, QO_FILTER }, { URI_SERVICE, QO_ID }, { URI_SERVICE, 
QO_EXPAND }, { URI_SERVICE, QO_COUNT },
+      { URI_SERVICE, QO_ORDERBY }, /* { URI_SERVICE, QO_SEARCH }, */{ 
URI_SERVICE, QO_SELECT },
+      { URI_SERVICE, QO_SKIP }, { URI_SERVICE, QO_SKIPTOKEN }, { URI_SERVICE, 
QO_LEVELS }, { URI_SERVICE, QO_TOP },
+
+      { URI_ENTITY_SET, QO_ID },
+
+      { URI_ENTITY_SET_COUNT, QO_FORMAT }, { URI_ENTITY_SET_COUNT, QO_ID },
+      { URI_ENTITY_SET_COUNT, QO_EXPAND }, { URI_ENTITY_SET_COUNT, QO_COUNT },
+      { URI_ENTITY_SET_COUNT, QO_ORDERBY },
+      { URI_ENTITY_SET_COUNT, QO_SELECT }, { URI_ENTITY_SET_COUNT, QO_SKIP }, 
{ URI_ENTITY_SET_COUNT, QO_SKIPTOKEN },
+      { URI_ENTITY_SET_COUNT, QO_LEVELS }, { URI_ENTITY_SET_COUNT, QO_TOP },
+
+      { URI_ENTITY, QO_FILTER }, { URI_ENTITY, QO_ID }, { URI_ENTITY, QO_COUNT 
}, /* { URI_ENTITY, QO_ORDERBY }, */
+      /* { URI_ENTITY, QO_SEARCH }, */{ URI_ENTITY, QO_SKIP }, { URI_ENTITY, 
QO_SKIPTOKEN }, { URI_ENTITY, QO_TOP },
+
+      { URI_MEDIA_STREAM, QO_FILTER }, { URI_MEDIA_STREAM, QO_ID, }, { 
URI_MEDIA_STREAM, QO_EXPAND },
+      { URI_MEDIA_STREAM, QO_COUNT }, { URI_MEDIA_STREAM, QO_ORDERBY }, /* { 
URI_MEDIA_STREAM, QO_SEARCH }, */
+      { URI_MEDIA_STREAM, QO_SELECT }, { URI_MEDIA_STREAM, QO_SKIP }, { 
URI_MEDIA_STREAM, QO_SKIPTOKEN },
+      { URI_MEDIA_STREAM, QO_LEVELS }, { URI_MEDIA_STREAM, QO_TOP },
+
+      { URI_REFERENCES, QO_ID, }, { URI_REFERENCES, QO_EXPAND }, { 
URI_REFERENCES, QO_COUNT },
+      { URI_REFERENCES, QO_SELECT }, { URI_REFERENCES, QO_LEVELS },
+
+      { URI_REFERENCE, QO_FILTER }, { URI_REFERENCE, QO_ID, }, { 
URI_REFERENCE, QO_EXPAND },
+      { URI_REFERENCE, QO_COUNT }, { URI_REFERENCE, QO_ORDERBY }, /* { 
URI_REFERENCE, QO_SEARCH }, */
+      { URI_REFERENCE, QO_SELECT }, { URI_REFERENCE, QO_SKIP }, { 
URI_REFERENCE, QO_SKIPTOKEN },
+      { URI_REFERENCE, QO_LEVELS }, { URI_REFERENCE, QO_TOP },
+
+      { URI_PROPERTY_COMPLEX, QO_FILTER }, { URI_PROPERTY_COMPLEX, QO_ID, }, { 
URI_PROPERTY_COMPLEX, QO_COUNT },
+      { URI_PROPERTY_COMPLEX, QO_ORDERBY }, /* { URI_PROPERTY_COMPLEX, 
QO_SEARCH }, */
+      { URI_PROPERTY_COMPLEX, QO_SKIP }, { URI_PROPERTY_COMPLEX, QO_SKIPTOKEN 
}, { URI_PROPERTY_COMPLEX, QO_TOP },
+
+      { URI_PROPERTY_COMPLEX_COLLECTION, QO_ID, },
+      /* { URI_PROPERTY_COMPLEX_COLLECTION, QO_SEARCH }, */{ 
URI_PROPERTY_COMPLEX_COLLECTION, QO_SELECT },
+
+      { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_FORMAT },
+      { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_ID, }, { 
URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_EXPAND },
+      { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_COUNT }, { 
URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_ORDERBY },
+      { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_SELECT },
+      { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_SKIP }, { 
URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_SKIPTOKEN },
+      { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_LEVELS }, { 
URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_TOP },
+
+      { URI_PROPERTY_PRIMITIVE, QO_FILTER }, { URI_PROPERTY_PRIMITIVE, QO_ID, 
}, { URI_PROPERTY_PRIMITIVE, QO_EXPAND },
+      { URI_PROPERTY_PRIMITIVE, QO_COUNT }, { URI_PROPERTY_PRIMITIVE, 
QO_ORDERBY },
+      /* { URI_PROPERTY_PRIMITIVE, QO_SEARCH }, */{ URI_PROPERTY_PRIMITIVE, 
QO_SELECT },
+      { URI_PROPERTY_PRIMITIVE, QO_SKIP }, { URI_PROPERTY_PRIMITIVE, 
QO_SKIPTOKEN },
+      { URI_PROPERTY_PRIMITIVE, QO_LEVELS }, { URI_PROPERTY_PRIMITIVE, QO_TOP 
},
+
+      { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_ID, }, { 
URI_PROPERTY_PRIMITIVE_COLLECTION, QO_EXPAND },
+      { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_COUNT }, /* { 
URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SEARCH }, */
+      { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SELECT }, { 
URI_PROPERTY_PRIMITIVE_COLLECTION, QO_LEVELS },
+
+      { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_FORMAT },
+      { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_ID, }, { 
URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_EXPAND },
+      { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_COUNT },
+      { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_ORDERBY },
+      { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_SELECT }, { 
URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_SKIP },
+      { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_SKIPTOKEN },
+      { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_LEVELS }, { 
URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_TOP },
+
+      { URI_PROPERTY_PRIMITIVE_VALUE, QO_FILTER }, { 
URI_PROPERTY_PRIMITIVE_VALUE, QO_ID, },
+      { URI_PROPERTY_PRIMITIVE_VALUE, QO_EXPAND }, { 
URI_PROPERTY_PRIMITIVE_VALUE, QO_COUNT },
+      { URI_PROPERTY_PRIMITIVE_VALUE, QO_ORDERBY },/* { 
URI_PROPERTY_PRIMITIVE_VALUE, QO_SEARCH }, */
+      { URI_PROPERTY_PRIMITIVE_VALUE, QO_SELECT }, { 
URI_PROPERTY_PRIMITIVE_VALUE, QO_SKIP },
+      { URI_PROPERTY_PRIMITIVE_VALUE, QO_SKIPTOKEN }, { 
URI_PROPERTY_PRIMITIVE_VALUE, QO_LEVELS },
+      { URI_PROPERTY_PRIMITIVE_VALUE, QO_TOP },
+
+      { URI_SINGLETON, QO_FILTER }, { URI_SINGLETON, QO_ID }, { URI_SINGLETON, 
QO_COUNT },
+      { URI_SINGLETON, QO_ORDERBY }, /* { URI_SINGLETON, QO_SEARCH }, */{ 
URI_SINGLETON, QO_SKIP },
+      { URI_SINGLETON, QO_SKIPTOKEN }, { URI_SINGLETON, QO_TOP },
+
+      { URI_NAV_ENTITY, QO_FILTER }, { URI_NAV_ENTITY, QO_ID }, { 
URI_NAV_ENTITY, QO_COUNT },
+      { URI_NAV_ENTITY, QO_ORDERBY }, /* { URI_NAV_ENTITY, QO_SEARCH }, */{ 
URI_NAV_ENTITY, QO_SKIP },
+      { URI_NAV_ENTITY, QO_SKIPTOKEN }, { URI_SINGLETON, QO_TOP },
+
+      { URI_NAV_ENTITY_SET, QO_ID },
+
+  };
+
+  private Parser parser;
+  private Edm edm;
+
+  @Before
+  public void before() {
+    parser = new Parser();
+    edm = new EdmProviderImpl(new EdmTechProvider());
+  }
+
+  @Test
+  public void validateSelect() throws Exception {
+    String[] uris = { "/ESAllPrim(1)?$select=PropertyString" };
+    for (String uri : uris) {
+      parseAndValidate(uri, "GET");
+    }
+  }
+
+  @Test(expected = UriValidationException.class)
+  public void validateForHttpMethodsFail()  throws Exception {
+    String uri = URI_ENTITY;
+    parseAndValidate(uri, "xyz");
+  }
+  
+  @Test
+  public void validateForHttpMethods()  throws Exception {
+    String uri = URI_ENTITY;
+    parseAndValidate(uri, "GET");
+    parseAndValidate(uri, "POST");
+    parseAndValidate(uri, "PUT");
+    parseAndValidate(uri, "DELETE");
+    parseAndValidate(uri, "PATCH");
+    parseAndValidate(uri, "MERGE");
+  }
+  
+  @Test
+  public void validateOrderBy() throws Exception {
+    String[] uris = { "/ESAllPrim?$orderby=PropertyString" };
+    for (String uri : uris) {
+      parseAndValidate(uri, "GET");
+    }
+  }
+
+  @Test(expected = UriValidationException.class)
+  @Ignore("uri parser doen't support orderby yet")
+  public void validateOrderByInvalid() throws Exception {
+    String uri = "/ESAllPrim(1)?$orderBy=XXXX";
+    parseAndValidate(uri, "GET");
+  }
+
+  @Test(expected = UriValidationException.class)
+  public void validateKeyPredicatesWrongKey() throws Exception {
+    String uri = "ESTwoKeyNav(xxx=1, yyy='abc')";
+    parseAndValidate(uri, "GET");
+  }
+
+  @Test
+  public void validateKeyPredicates() throws Exception {
+    String uri = "ESTwoKeyNav(PropertyInt16=1, PropertyString='abc')";
+    parseAndValidate(uri, "GET");
+  }
+
+  @Test(expected = UriValidationException.class)
+  public void validateKeyPredicatesWrongValueType() throws Exception {
+    String uri = "ESTwoKeyNav(PropertyInt16='abc', PropertyString=1)";
+    parseAndValidate(uri, "GET");
+  }
+
+  @Test
+  public void checkValidSystemQueryOption() throws Exception {
+    String[] uris = constructUri(urisWithValidSystemQueryOptions);
+
+    for (String uri : uris) {
+      try {
+        parseAndValidate(uri, "GET");
+      } catch (Exception e) {
+        throw new Exception("Faild for uri: " + uri, e);
+      }
+    }
+  }
+
+  @Test
+  public void checkNonValidSystemQueryOption() throws Exception {
+    String[] uris = constructUri(urisWithNonValidSystemQueryOptions);
+
+    for (String uri : uris) {
+      try {
+        parseAndValidate(uri, "GET");
+        fail("Validation Exception not thrown: " + uri);
+      } catch (UriValidationException e) {
+        assertTrue(e instanceof UriValidationException);
+      }
+    }
+  }
+
+  private String[] constructUri(final String[][] uriParameterMatrix) {
+    ArrayList<String> uris = new ArrayList<String>();
+    for (String[] uriParameter : uriParameterMatrix) {
+      String uri = uriParameter[0];
+      if (uriParameter.length > 1) {
+        uri += "?";
+      }
+      for (int i = 1; i < uriParameter.length; i++) {
+        uri += uriParameter[i];
+        if (i < (uriParameter.length - 1)) {
+          uri += "&";
+        }
+      }
+      uris.add(uri);
+    }
+    return uris.toArray(new String[0]);
+  }
+
+  private void parseAndValidate(final String uri, String method) throws 
UriParserException, UriValidationException {
+    UriInfo uriInfo = parser.parseUri(uri.trim(), edm);
+    UriValidator validator = new UriValidator();
+
+    validator.validate(uriInfo, method);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/554c795e/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java
 
b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java
deleted file mode 100644
index 4bf5a99..0000000
--- 
a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.server.core.serializer.json;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.server.api.ODataServer;
-import org.apache.olingo.server.api.serializer.ODataFormat;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.core.testutil.StringUtils;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ServiceDocumentTest {
-
-  private Edm edm;
-
-  @Before
-  public void before() {
-
-    EdmEntitySet edmEntitySet1 = mock(EdmEntitySet.class);
-    when(edmEntitySet1.getName()).thenReturn("entitySetName1");
-    when(edmEntitySet1.isIncludeInServiceDocument()).thenReturn(true);
-
-    EdmEntitySet edmEntitySet2 = mock(EdmEntitySet.class);
-    when(edmEntitySet2.getName()).thenReturn("entitySetName2");
-    when(edmEntitySet2.isIncludeInServiceDocument()).thenReturn(true);
-
-    EdmEntitySet edmEntitySet3 = mock(EdmEntitySet.class);
-    when(edmEntitySet3.getName()).thenReturn("entitySetName3");
-    when(edmEntitySet3.isIncludeInServiceDocument()).thenReturn(false);
-
-    List<EdmEntitySet> entitySets = new ArrayList<EdmEntitySet>();
-    entitySets.add(edmEntitySet1);
-    entitySets.add(edmEntitySet2);
-    entitySets.add(edmEntitySet3);
-
-    EdmFunctionImport functionImport1 = mock(EdmFunctionImport.class);
-    when(functionImport1.getName()).thenReturn("functionImport1");
-    when(functionImport1.isIncludeInServiceDocument()).thenReturn(true);
-
-    EdmFunctionImport functionImport2 = mock(EdmFunctionImport.class);
-    when(functionImport2.getName()).thenReturn("functionImport2");
-    when(functionImport2.isIncludeInServiceDocument()).thenReturn(true);
-
-    EdmFunctionImport functionImport3 = mock(EdmFunctionImport.class);
-    when(functionImport3.getName()).thenReturn("functionImport3");
-    when(functionImport3.isIncludeInServiceDocument()).thenReturn(false);
-
-    List<EdmFunctionImport> functionImports = new 
ArrayList<EdmFunctionImport>();
-    functionImports.add(functionImport1);
-    functionImports.add(functionImport2);
-    functionImports.add(functionImport3);
-
-    EdmSingleton singleton1 = mock(EdmSingleton.class);
-    when(singleton1.getName()).thenReturn("singleton1");
-
-    EdmSingleton singleton2 = mock(EdmSingleton.class);
-    when(singleton2.getName()).thenReturn("singleton2");
-
-    EdmSingleton singleton3 = mock(EdmSingleton.class);
-    when(singleton3.getName()).thenReturn("singleton3");
-
-    List<EdmSingleton> singletons = new ArrayList<EdmSingleton>();
-    singletons.add(singleton1);
-    singletons.add(singleton2);
-    singletons.add(singleton3);
-
-    EdmEntityContainer edmEntityContainer = mock(EdmEntityContainer.class);
-    when(edmEntityContainer.getEntitySets()).thenReturn(entitySets);
-    when(edmEntityContainer.getFunctionImports()).thenReturn(functionImports);
-    when(edmEntityContainer.getSingletons()).thenReturn(singletons);
-
-    edm = mock(Edm.class);
-    when(edm.getEntityContainer(null)).thenReturn(edmEntityContainer);
-  }
-
-  @Test
-  public void writeServiceDocumentJson() throws Exception {
-    String serviceRoot = "http://localhost:8080/odata.svc";;
-
-    ODataServer server = ODataServer.newInstance();
-    assertNotNull(server);
-
-    ODataSerializer serializer = server.getSerializer(ODataFormat.JSON);
-    assertNotNull(serializer);
-
-    InputStream result = serializer.serviceDocument(edm, serviceRoot);
-    assertNotNull(result);
-    String jsonString = StringUtils.inputStreamToString(result, true);
-
-    assertTrue(jsonString.contains("entitySetName1"));
-    assertTrue(jsonString.contains("entitySetName2"));
-    assertFalse(jsonString.contains("entitySetName3"));
-
-    assertTrue(jsonString.contains("functionImport1"));
-    assertTrue(jsonString.contains("functionImport2"));
-    assertFalse(jsonString.contains("functionImport3"));
-
-    assertTrue(jsonString.contains("singleton1"));
-    assertTrue(jsonString.contains("singleton2"));
-    assertTrue(jsonString.contains("singleton3"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/554c795e/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
 
b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
deleted file mode 100644
index 6a19364..0000000
--- 
a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.server.core.serializer.xml;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.Target;
-import org.apache.olingo.server.api.ODataServer;
-import org.apache.olingo.server.api.edm.provider.Action;
-import org.apache.olingo.server.api.edm.provider.ActionImport;
-import org.apache.olingo.server.api.edm.provider.ComplexType;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.EntityContainer;
-import org.apache.olingo.server.api.edm.provider.EntitySet;
-import org.apache.olingo.server.api.edm.provider.EntityType;
-import org.apache.olingo.server.api.edm.provider.EnumMember;
-import org.apache.olingo.server.api.edm.provider.EnumType;
-import org.apache.olingo.server.api.edm.provider.Function;
-import org.apache.olingo.server.api.edm.provider.FunctionImport;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-import org.apache.olingo.server.api.edm.provider.Property;
-import org.apache.olingo.server.api.edm.provider.ReturnType;
-import org.apache.olingo.server.api.edm.provider.Schema;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.apache.olingo.server.api.serializer.ODataFormat;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.server.core.testutil.StringUtils;
-import org.apache.olingo.server.core.testutil.techprovider.EdmTechProvider;
-import org.junit.Test;
-
-public class MetadataDocumentTest {
-
-  @Test(expected = ODataRuntimeException.class)
-  public void metadataOnJsonResultsInException() {
-    ODataSerializer serializer = 
ODataServer.newInstance().getSerializer(ODataFormat.JSON);
-    serializer.metadataDocument(mock(Edm.class));
-  }
-
-  @Test
-  public void writeMetadataWithEmptyMockedEdm() {
-    ODataSerializer serializer = 
ODataServer.newInstance().getSerializer(ODataFormat.XML);
-    Edm edm = mock(Edm.class);
-    serializer.metadataDocument(edm);
-  }
-
-  @Test
-  public void writeMetadataWithLocalTestEdm() {
-    ODataSerializer serializer = 
ODataServer.newInstance().getSerializer(ODataFormat.XML);
-    Edm edm = new EdmProviderImpl(new TestMetadataProvider());
-    InputStream metadata = serializer.metadataDocument(edm);
-    assertNotNull(metadata);
-    String metadataString = StringUtils.inputStreamToString(metadata, false);
-    assertTrue(metadataString
-        .contains("<edmx:Edmx Version=\"4.0\" 
xmlns:edmx=\"http://docs.oasis-open.org/odata/ns/edmx\";>"));
-
-    assertTrue(metadataString
-        .contains("<Schema xmlns=\"http://docs.oasis-open.org/odata/ns/edm\"; " 
+
-            "Namespace=\"namespace\" Alias=\"alias\">"));
-
-    assertTrue(metadataString
-        .contains("<EntityType Name=\"ETBaseName\"><Property Name=\"P1\" 
Type=\"Edm.Int16\"/><NavigationProperty " +
-            "Name=\"N1\" Type=\"namespace.ETBaseName\" Nullable=\"true\" 
Partner=\"N1\"/></EntityType>"));
-
-    assertTrue(metadataString
-        .contains("<EntityType Name=\"ETDerivedName\" 
BaseType=\"namespace.ETBaseName\"><Property Name=\"P2\" " +
-            "Type=\"Edm.Int16\"/><NavigationProperty Name=\"N2\" 
Type=\"namespace.ETDerivedName\" Nullable=\"true\" " +
-            "Partner=\"N2\"/></EntityType>"));
-
-    assertTrue(metadataString
-        .contains("<ComplexType Name=\"CTBaseName\"><Property Name=\"P1\" 
Type=\"Edm.Int16\"/><NavigationProperty " +
-            "Name=\"N1\" Type=\"namespace.ETBaseName\" Nullable=\"true\" 
Partner=\"N1\"/></ComplexType>"));
-
-    assertTrue(metadataString
-        .contains("<ComplexType Name=\"CTDerivedName\" 
BaseType=\"namespace.CTBaseName\"><Property Name=\"P2\" " +
-            "Type=\"Edm.Int16\"/><NavigationProperty Name=\"N2\" 
Type=\"namespace.ETDerivedName\" Nullable=\"true\" " +
-            "Partner=\"N2\"/></ComplexType>"));
-
-    assertTrue(metadataString.contains("<TypeDefinition Name=\"typeDef\" 
Type=\"Edm.Int16\"/>"));
-
-    assertTrue(metadataString.contains("<Action Name=\"ActionWOParameter\" 
IsBound=\"false\"/>"));
-
-    assertTrue(metadataString
-        .contains("<Action Name=\"ActionName\" IsBound=\"true\"><Parameter 
Name=\"param\" Type=\"Edm.Int16\"/>" +
-            "<Parameter Name=\"param2\" 
Type=\"Collection(Edm.Int16)\"/><ReturnType Type=\"namespace.CTBaseName\"/>" +
-            "</Action>"));
-
-    assertTrue(metadataString
-        .contains("<Function Name=\"FunctionWOParameter\" IsBound=\"false\" 
IsComposable=\"false\"><ReturnType " +
-            "Type=\"namespace.CTBaseName\"/></Function>"));
-
-    assertTrue(metadataString
-        .contains("<Function Name=\"FunctionName\" IsBound=\"true\" 
IsComposable=\"false\"><Parameter Name=\"param\" " +
-            "Type=\"Edm.Int16\"/><Parameter Name=\"param2\" 
Type=\"Collection(Edm.Int16)\"/><ReturnType " +
-            "Type=\"namespace.CTBaseName\"/></Function>"));
-
-    assertTrue(metadataString.contains("<EntityContainer 
Name=\"container\">"));
-
-    assertTrue(metadataString
-        .contains("<EntitySet Name=\"EntitySetName\" 
EntityType=\"namespace.ETBaseName\"><NavigationPropertyBinding " +
-            "Path=\"N1\" 
Target=\"namespace.container/EntitySetName\"/></EntitySet>"));
-    assertTrue(metadataString
-        .contains("<Singleton Name=\"SingletonName\" 
EntityType=\"namespace.ETBaseName\"><NavigationPropertyBinding " +
-            "Path=\"N1\" 
Target=\"namespace.container/EntitySetName\"/></Singleton>"));
-
-    assertTrue(metadataString.contains("<ActionImport Name=\"actionImport\" 
Action=\"namespace.ActionWOParameter\"/>"));
-
-    assertTrue(metadataString
-        .contains("<FunctionImport Name=\"actionImport\" 
Function=\"namespace.FunctionName\" " +
-            "EntitySet=\"namespace.EntitySetName\" 
IncludeInServiceDocument=\"false\"/>"));
-
-    
assertTrue(metadataString.contains("</EntityContainer></Schema></edmx:DataServices></edmx:Edmx>"));
-  }
-
-  @Test
-  public void writeMetadataWithTechnicalScenario() {
-    ODataSerializer serializer = 
ODataServer.newInstance().getSerializer(ODataFormat.XML);
-    EdmProviderImpl edm = new EdmProviderImpl(new EdmTechProvider());
-    InputStream metadata = serializer.metadataDocument(edm);
-    assertNotNull(metadata);
-    // The technical scenario is too big to verify. We are content for now to 
make sure we can serialize it.
-    // System.out.println(StringUtils.inputStreamToString(metadata, false));
-  }
-
-  private class TestMetadataProvider extends EdmProvider {
-
-    @Override
-    public List<Schema> getSchemas() throws ODataException {
-      Property p1 = new 
Property().setName("P1").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName());
-      String ns = "namespace";
-      NavigationProperty n1 = new NavigationProperty().setName("N1")
-          .setType(new FullQualifiedName(ns, 
"ETBaseName")).setNullable(true).setPartner("N1");
-      Property p2 = new 
Property().setName("P2").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName());
-      NavigationProperty n2 = new NavigationProperty().setName("N2")
-          .setType(new FullQualifiedName(ns, 
"ETDerivedName")).setNullable(true).setPartner("N2");
-      Schema schema = new Schema().setNamespace(ns).setAlias("alias");
-      List<ComplexType> complexTypes = new ArrayList<ComplexType>();
-      schema.setComplexTypes(complexTypes);
-      ComplexType ctBase =
-          new 
ComplexType().setName("CTBaseName").setProperties(Arrays.asList(p1)).setNavigationProperties(
-              Arrays.asList(n1));
-      complexTypes.add(ctBase);
-      ComplexType ctDerived =
-          new ComplexType().setName("CTDerivedName").setBaseType(new 
FullQualifiedName(ns, "CTBaseName"))
-              
.setProperties(Arrays.asList(p2)).setNavigationProperties(Arrays.asList(n2));
-      complexTypes.add(ctDerived);
-
-      List<EntityType> entityTypes = new ArrayList<EntityType>();
-      schema.setEntityTypes(entityTypes);
-      EntityType etBase =
-          new 
EntityType().setName("ETBaseName").setProperties(Arrays.asList(p1)).setNavigationProperties(
-              Arrays.asList(n1));
-      entityTypes.add(etBase);
-      EntityType etDerived =
-          new EntityType().setName("ETDerivedName").setBaseType(new 
FullQualifiedName(ns, "ETBaseName"))
-              
.setProperties(Arrays.asList(p2)).setNavigationProperties(Arrays.asList(n2));
-      entityTypes.add(etDerived);
-
-      List<Action> actions = new ArrayList<Action>();
-      schema.setActions(actions);
-      // TODO:EntitySetPath
-      actions.add((new Action().setName("ActionWOParameter")));
-      List<Parameter> parameters = new ArrayList<Parameter>();
-      parameters.add(new 
Parameter().setName("param").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()));
-      parameters.add(new 
Parameter().setName("param2").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
-          .setCollection(true));
-      actions.add(new 
Action().setName("ActionName").setBound(true).setParameters(parameters).setReturnType(
-          new ReturnType().setType(new FullQualifiedName(ns, "CTBaseName"))));
-
-      List<Function> functions = new ArrayList<Function>();
-      schema.setFunctions(functions);
-      functions.add((new Function().setName("FunctionWOParameter")
-          .setReturnType(new ReturnType().setType(new FullQualifiedName(ns, 
"CTBaseName")))));
-      functions.add(new 
Function().setName("FunctionName").setBound(true).setParameters(parameters).setReturnType(
-          new ReturnType().setType(new FullQualifiedName(ns, "CTBaseName"))));
-
-      List<EnumType> enumTypes = new ArrayList<EnumType>();
-      schema.setEnumTypes(enumTypes);
-      List<EnumMember> members = new ArrayList<EnumMember>();
-      members.add(new EnumMember().setName("member").setValue("1"));
-      enumTypes.add(new 
EnumType().setName("EnumName").setFlags(true).setMembers(members));
-
-      List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>();
-      schema.setTypeDefinitions(typeDefinitions);
-      typeDefinitions.add(new TypeDefinition().setName("typeDef")
-          
.setUnderlyingType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()));
-
-      EntityContainer container = new EntityContainer().setName("container");
-      schema.setEntityContainer(container);
-
-      List<ActionImport> actionImports = new ArrayList<ActionImport>();
-      container.setActionImports(actionImports);
-      actionImports.add(new ActionImport().setName("actionImport").setAction(
-          new FullQualifiedName(ns, "ActionWOParameter")).setEntitySet(
-          new Target().setEntityContainer(new FullQualifiedName(ns, 
"container")).setTargetName("EntitySetName")));
-
-      List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
-      container.setFunctionImports(functionImports);
-      functionImports.add(new 
FunctionImport().setName("actionImport").setFunction(
-          new FullQualifiedName(ns, "FunctionName")).setEntitySet(
-          new Target().setEntityContainer(new FullQualifiedName(ns, 
"container")).setTargetName("EntitySetName")));
-
-      List<EntitySet> entitySets = new ArrayList<EntitySet>();
-      container.setEntitySets(entitySets);
-      List<NavigationPropertyBinding> nPB = new 
ArrayList<NavigationPropertyBinding>();
-      nPB.add(new NavigationPropertyBinding().setPath("N1").setTarget(
-          new Target().setEntityContainer(new FullQualifiedName(ns, 
"container")).setTargetName("EntitySetName")));
-      entitySets.add(new EntitySet().setName("EntitySetName").setType(new 
FullQualifiedName(ns, "ETBaseName"))
-          .setNavigationPropertyBindings(nPB));
-
-      List<Singleton> singletons = new ArrayList<Singleton>();
-      container.setSingletons(singletons);
-      singletons.add(new Singleton().setName("SingletonName").setType(new 
FullQualifiedName(ns, "ETBaseName"))
-          .setNavigationPropertyBindings(nPB));
-
-      List<Schema> schemas = new ArrayList<Schema>();
-      schemas.add(schema);
-      return schemas;
-    }
-  }
-}

Reply via email to