You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/02/20 14:28:27 UTC

[1/9] [OLINGO-63] Uri Parser: add special handling for leading type filter in member, expand, select

Repository: incubator-olingo-odata4
Updated Branches:
  refs/heads/olingo169 e6728fdd9 -> f094e109d


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java
new file mode 100644
index 0000000..b5478bf
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * 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.server.core.uri.testutil;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.parser.Parser;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserSemanticException;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserSyntaxException;
+import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.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) {
+    this.edm = edm;
+    return this;
+  }
+
+  // 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, 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, edm);
+      fail("Exception expected");
+    } catch (UriParserException e) {
+      exception = e;
+    }
+
+    return this;
+  }
+
+  public UriValidator log(final String uri) {
+    ParserWithLogging parserTest = new ParserWithLogging();
+    parserTest.setLogLevel(1);
+    uriInfo = null;
+    try {
+      // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
+      uriInfo = (UriInfoImpl) parserTest.parseUri(uri, edm);
+    } catch (UriParserException e) {
+      fail("Exception occured while parsing the URI: " + uri + "\n"
+          + " Exception: " + e.getMessage());
+    }
+
+    return this;
+  }
+
+  // Navigation
+  public ResourceValidator goPath() {
+    if (uriInfo.getKind() != UriInfoKind.resource) {
+      fail("invalid resource kind: " + uriInfo.getKind().toString());
+    }
+
+    return new ResourceValidator()
+        .setUpValidator(this)
+        .setEdm(edm)
+        .setUriInfoImplPath(uriInfo);
+  }
+
+  public FilterValidator goFilter() {
+    FilterOptionImpl filter = (FilterOptionImpl) uriInfo.getFilterOption();
+    if (filter == null) {
+      fail("no filter found");
+    }
+    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().setUpValidator(this).setExpand(expand);
+  }
+
+  public ResourceValidator goSelectItemPath(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+    SelectItem item = select.getSelectItems().get(index);
+    UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourcePath();
+
+    return new ResourceValidator()
+        .setUpValidator(this)
+        .setEdm(edm)
+        .setUriInfoImplPath(uriInfo1);
+
+  }
+  
+  public UriValidator isSelectStartType(int index, final FullQualifiedName fullName) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+    SelectItem item = select.getSelectItems().get(index);
+    EdmType actualType = item.getStartTypeFilter();
+    
+    FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+    assertEquals(fullName, actualName);
+    return this;
+ 
+  
+}
+
+  // Validation
+  public UriValidator isKind(final UriInfoKind kind) {
+    assertEquals(kind, uriInfo.getKind());
+    return this;
+  }
+
+  public UriValidator isCustomParameter(final int index, final String name, final String value) {
+    if (uriInfo == null) {
+      fail("hasQueryParameter: uriInfo == null");
+    }
+
+    List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
+    if (list.size() <= index) {
+      fail("not enought queryParameters");
+    }
+
+    CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
+    assertEquals(name, option.getName());
+    assertEquals(value, option.getText());
+    return this;
+  }
+
+  public void isCrossJoinEntityList(final List<String> entitySets) {
+    if (uriInfo.getKind() != UriInfoKind.crossjoin) {
+      fail("invalid resource kind: " + uriInfo.getKind().toString());
+    }
+
+    int i = 0;
+    for (String entitySet : entitySets) {
+      assertEquals(entitySet, uriInfo.getEntitySetNames().get(i));
+      i++;
+    }
+
+  }
+
+  public UriValidator isExSyntax(final long errorID) {
+    assertEquals(UriParserSyntaxException.class, exception.getClass());
+    return this;
+  }
+
+  public UriValidator isExSemantic(final 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;
+  }
+
+  public UriValidator isEntityType(final FullQualifiedName fullName) {
+    if (uriInfo.getKind() != UriInfoKind.entityId) {
+      fail("invalid resource kind: " + uriInfo.getKind().toString());
+    }
+
+    assertEquals(fullName.toString(), fullName(uriInfo.getEntityTypeCast()));
+    return this;
+  }
+
+  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, final 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/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java
new file mode 100644
index 0000000..a7acc69
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.core.uri.testutil;
+
+public interface Validator {
+
+}


[2/9] [OLINGO-63] Uri Parser: add special handling for leading type filter in member, expand, select

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java
new file mode 100644
index 0000000..e46ef82
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java
@@ -0,0 +1,233 @@
+/*******************************************************************************
+ * 
+ * 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.server.core.uri.testutil;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+
+public class ExpandValidator implements Validator {
+  private Edm edm;
+  private Validator invokedByValidator;
+
+  private int expandItemIndex;
+  private ExpandOptionImpl expandOption;
+  private ExpandItem expandItem;
+
+  // --- Setup ---
+
+  public ExpandValidator setUpValidator(final Validator validator) {
+    invokedByValidator = validator;
+    return this;
+  }
+
+  public ExpandValidator setExpand(final ExpandOptionImpl expand) {
+    expandOption = expand;
+    first();
+    return this;
+  }
+
+  public ExpandValidator setEdm(final Edm edm) {
+    this.edm = edm;
+    return this;
+  }
+
+  // --- Navigation ---
+
+  public ExpandValidator goUpToExpandValidator() {
+    return (ExpandValidator) invokedByValidator;
+  }
+
+  public ResourceValidator goUpToUriResourceValidator() {
+    return (ResourceValidator) invokedByValidator;
+  }
+
+  public ResourceValidator goPath() {
+    UriInfoImpl uriInfo = (UriInfoImpl) expandItem.getResourcePath();
+
+    if (uriInfo.getKind() != UriInfoKind.resource) {
+      fail("goPath() can only be used on UriInfoKind.resource");
+    }
+
+    return new ResourceValidator()
+        .setUpValidator(this)
+        .setEdm(edm)
+        .setUriInfoImplPath(uriInfo);
+
+  }
+
+  public FilterValidator goOrder(final int index) {
+    OrderByOptionImpl orderBy = (OrderByOptionImpl) expandItem.getOrderByOption();
+
+    return new FilterValidator()
+        .setValidator(this)
+        .setEdm(edm)
+        .setExpression(orderBy.getOrders().get(index).getExpression());
+  }
+
+  public ResourceValidator goSelectItem(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+
+    SelectItem item = select.getSelectItems().get(index);
+    UriInfoImpl uriInfo = (UriInfoImpl) item.getResourcePath();
+
+    return new ResourceValidator()
+        .setUpValidator(this)
+        .setEdm(edm)
+        .setUriInfoImplPath(uriInfo);
+
+  }
+
+  public ExpandValidator goExpand() {
+    ExpandValidator val = new ExpandValidator()
+        .setExpand((ExpandOptionImpl) expandItem.getExpandOption())
+        .setUpValidator(this);
+    return val;
+  }
+
+  public ExpandValidator first() {
+    expandItemIndex = 0;
+    expandItem = expandOption.getExpandItems().get(expandItemIndex);
+    return this;
+  }
+
+  public ExpandValidator next() {
+    expandItemIndex++;
+
+    try {
+      expandItem = expandOption.getExpandItems().get(expandItemIndex);
+    } catch (IndexOutOfBoundsException ex) {
+      fail("not enought segments");
+    }
+    return this;
+
+  }
+
+  public ExpandValidator isSegmentStar(final int index) {
+    assertEquals(true, expandItem.isStar());
+    return this;
+  }
+
+  public ExpandValidator isSegmentRef(final int index) {
+    assertEquals(true, expandItem.isRef());
+    return this;
+  }
+
+  public ExpandValidator isLevelText(final String text) {
+    QueryOptionImpl option = (QueryOptionImpl) expandItem.getLevelsOption();
+    assertEquals(text, option.getText());
+    return this;
+  }
+
+  public ExpandValidator isSkipText(final String text) {
+    QueryOptionImpl option = (QueryOptionImpl) expandItem.getSkipOption();
+    assertEquals(text, option.getText());
+    return this;
+  }
+
+  public ExpandValidator isTopText(final String text) {
+    QueryOptionImpl option = (QueryOptionImpl) expandItem.getTopOption();
+    assertEquals(text, option.getText());
+    return this;
+  }
+
+  public ExpandValidator isInlineCountText(final String text) {
+    QueryOptionImpl option = (QueryOptionImpl) expandItem.getInlineCountOption();
+    assertEquals(text, option.getText());
+    return this;
+  }
+
+  public ExpandValidator isSelectText(final String text) {
+    QueryOptionImpl option = (QueryOptionImpl) expandItem.getSelectOption();
+    assertEquals(text, option.getText());
+    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 isSelectItemAllOperations(final int index, final FullQualifiedName fqn) {
+    SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+
+    SelectItem item = select.getSelectItems().get(index);
+    assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+    return this;
+  }
+
+  public ExpandValidator isFilterOptionText(final String text) {
+    QueryOptionImpl option = (QueryOptionImpl) expandItem.getFilterOption();
+    assertEquals(text, option.getText());
+    return this;
+  }
+
+  public ExpandValidator isFilterSerialized(final String serialized) {
+    FilterOptionImpl filter = (FilterOptionImpl) expandItem.getFilterOption();
+
+    try {
+      String tmp = FilterTreeToText.Serialize(filter);
+      assertEquals(serialized, tmp);
+    } catch (ExpressionVisitException e) {
+      fail("Exception occured while converting the filterTree into text" + "\n"
+          + " Exception: " + e.getMessage());
+    } catch (ODataApplicationException e) {
+      fail("Exception occured while converting the filterTree into text" + "\n"
+          + " Exception: " + e.getMessage());
+    }
+
+    return this;
+  }
+
+  public ExpandValidator isSortOrder(final int index, final boolean descending) {
+    OrderByOptionImpl orderBy = (OrderByOptionImpl) expandItem.getOrderByOption();
+    assertEquals(descending, orderBy.getOrders().get(index).isDescending());
+    return this;
+  }
+
+  public ExpandValidator isExpandStartType(final FullQualifiedName fullName) {
+      EdmType actualType = expandItem.getStartTypeFilter();
+      
+      FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+      assertEquals(fullName, actualName);
+      return this;
+   
+    
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java
new file mode 100644
index 0000000..cbf0c33
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * 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.server.core.uri.testutil;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.UriResource;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAll;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAny;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCallKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.UnaryOperatorKind;
+
+public class FilterTreeToText implements ExpressionVisitor<String> {
+
+  public static String Serialize(final FilterOption filter)
+      throws ExpressionVisitException, ODataApplicationException {
+
+    Expression expression = filter.getExpression();
+    return expression.accept(new FilterTreeToText());
+  }
+
+  public static String Serialize(final Expression expression)
+      throws ExpressionVisitException, ODataApplicationException {
+
+    return expression.accept(new FilterTreeToText());
+  }
+
+  @Override
+  public String visitBinaryOperator(final BinaryOperatorKind operator, final String left, final String right)
+      throws ExpressionVisitException {
+
+    return "<" + left + " " + operator.toString() + " " + right + ">";
+  }
+
+  @Override
+  public String visitUnaryOperator(final UnaryOperatorKind operator, final String operand)
+      throws ExpressionVisitException {
+
+    return "<" + operator + " " + operand.toString() + ">";
+  }
+
+  @Override
+  public String visitMethodCall(final MethodCallKind methodCall, final List<String> parameters)
+      throws ExpressionVisitException {
+
+    String text = "<" + methodCall + "(";
+    int i = 0;
+    while (i < parameters.size()) {
+      if (i > 0) {
+        text += ",";
+      }
+      text += parameters.get(i);
+      i++;
+    }
+    return text + ")>";
+  }
+
+  @Override
+  public String visitLiteral(final String literal) throws ExpressionVisitException {
+    return "<" + literal + ">";
+  }
+
+  @Override
+  public String visitMember(final UriInfoResource resource) throws ExpressionVisitException, ODataApplicationException {
+    String ret = "";
+
+    UriInfoResource path = resource;
+
+    for (UriResource item : path.getUriResourceParts()) {
+      String tmp = "";
+      if (item instanceof UriResourceLambdaAll) {
+        UriResourceLambdaAll all = (UriResourceLambdaAll) item;
+        tmp = visitLambdaExpression("ALL", all.getLamdaVariable(), all.getExpression());
+      } else if (item instanceof UriResourceLambdaAny) {
+        UriResourceLambdaAny any = (UriResourceLambdaAny) item;
+        tmp = visitLambdaExpression("ANY", any.getLamdaVariable(), any.getExpression());
+      } else if (item instanceof UriResourcePartTyped) {
+        UriResourcePartTyped typed = (UriResourcePartTyped) item;
+        tmp = typed.toString(true);
+      }
+
+      if (ret.length() != 0) {
+        ret += "/";
+      }
+      ret += tmp;
+
+    }
+    return "<" + ret + ">";
+  }
+
+  @Override
+  public String visitAlias(final String referenceName) throws ExpressionVisitException {
+    return "<" + referenceName + ">";
+  }
+
+  @Override
+  public String visitLambdaExpression(final String functionText, final String string, final Expression expression)
+      throws ExpressionVisitException, ODataApplicationException {
+
+    return "<" + functionText + ";" + ((expression == null) ? "" : expression.accept(this)) + ">";
+  }
+
+  @Override
+  public String visitTypeLiteral(final EdmType type) {
+    return "<" + type.getNamespace() + "." + type.getName() + ">";
+  }
+
+  @Override
+  public String visitLambdaReference(final String variableText) {
+    return "<" + variableText + ">";
+  }
+
+  @Override
+  public String visitEnum(final EdmEnumType type, final List<String> enumValues)
+      throws ExpressionVisitException, ODataApplicationException {
+    String tmp = "";
+
+    for (String item : enumValues) {
+      if (tmp.length() > 0) {
+        tmp += ",";
+      }
+      tmp += item;
+    }
+
+    return "<" + type.getNamespace() + "." + type.getName() + "<" + tmp + ">>";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java
new file mode 100644
index 0000000..ed2fcff
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java
@@ -0,0 +1,534 @@
+/*******************************************************************************
+ * 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.server.core.uri.testutil;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriInfo;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Member;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCallKind;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.parser.Parser;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserSemanticException;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserSyntaxException;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.BinaryImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.EnumerationImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MethodCallImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.TypeLiteralImpl;
+
+public class FilterValidator implements Validator {
+  private Edm edm;
+
+  private Validator invokedByValidator;
+  private FilterOptionImpl filter;
+
+  private Expression curExpression;
+  private Expression rootExpression;
+
+  private OrderByOptionImpl orderBy;
+
+  private UriParserException exception;
+
+  // --- Setup ---
+  public FilterValidator setUriResourcePathValidator(final ResourceValidator uriResourcePathValidator) {
+    invokedByValidator = uriResourcePathValidator;
+    return this;
+  }
+
+  public FilterValidator setUriValidator(final UriValidator uriValidator) {
+    invokedByValidator = uriValidator;
+    return this;
+  }
+
+  public FilterValidator setValidator(final Validator uriValidator) {
+    invokedByValidator = uriValidator;
+    return this;
+  }
+
+  public FilterValidator setEdm(final Edm edm) {
+    this.edm = edm;
+    return this;
+  }
+
+  public FilterValidator setFilter(final FilterOptionImpl filter) {
+    this.filter = filter;
+
+    if (filter.getExpression() == null) {
+      fail("FilterValidator: no filter found");
+    }
+    setExpression(filter.getExpression());
+    return this;
+  }
+
+  public FilterValidator setOrderBy(final OrderByOptionImpl orderBy) {
+    this.orderBy = orderBy;
+
+    return this;
+  }
+
+  public FilterValidator setExpression(final Expression expression) {
+    rootExpression = curExpression = expression;
+    return this;
+  }
+
+  // --- Execution ---
+
+  public FilterValidator runOrderByOnETAllPrim(final String orderBy) throws UriParserException {
+    String uri = "ESAllPrim?$orderby=" + orderBy.trim();
+    return runUriOrderBy(uri);
+  }
+
+  public FilterValidator runOrderByOnETTwoKeyNav(final String orderBy) throws UriParserException {
+    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 {
+    String uri = "ESTwoKeyNav?$filter=" + filter.trim();
+    return runUri(uri);
+  }
+
+  public FilterValidator runOnETTwoKeyNavSingle(final String filter) throws UriParserException {
+    String uri = "SINav?$filter=" + filter.trim();
+    return runUri(uri);
+  }
+
+  public FilterValidator runOnETTwoKeyNavEx(final String filter) throws UriParserException {
+    String uri = "ESTwoKeyNav?$filter=" + filter.trim();
+    return runUriEx(uri);
+  }
+
+  public FilterValidator runOnETAllPrim(final String filter) throws UriParserException {
+    String uri = "ESAllPrim(1)?$filter=" + filter.trim();
+    return runUri(uri);
+  }
+
+  public FilterValidator runOnETKeyNav(final String filter) throws UriParserException {
+    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();
+    return runUri(uri);
+  }
+
+  public FilterValidator runOnString(final String filter) throws UriParserException {
+    String uri = "SINav/PropertyString?$filter=" + filter.trim();
+    return runUri(uri);
+  }
+
+  public FilterValidator runOnInt32(final String filter) throws UriParserException {
+    String uri = "ESCollAllPrim(1)/CollPropertyInt32?$filter=" + filter.trim();
+    return runUri(uri);
+  }
+
+  public FilterValidator runOnDateTimeOffset(final String filter) throws UriParserException {
+    String uri = "ESCollAllPrim(1)/CollPropertyDateTimeOffset?$filter=" + filter.trim();
+    return runUri(uri);
+  }
+
+  public FilterValidator runOnDuration(final String filter) throws UriParserException {
+    String uri = "ESCollAllPrim(1)/CollPropertyDuration?$filter=" + filter.trim();
+    return runUri(uri);
+  }
+
+  public FilterValidator runOnTimeOfDay(final String filter) throws UriParserException {
+    String uri = "ESCollAllPrim(1)/CollPropertyTimeOfDay?$filter=" + filter.trim();
+    return runUri(uri);
+  }
+
+  public FilterValidator runESabc(final String filter) throws UriParserException {
+    String uri = "ESabc?$filter=" + filter.trim();
+    return runUri(uri);
+  }
+
+  public FilterValidator runUri(final String uri) throws UriParserException {
+    Parser parser = new Parser();
+    UriInfo uriInfo = null;
+
+    uriInfo = parser.parseUri(uri, 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;
+
+    try {
+      uriInfo = parser.parseUri(uri, edm);
+    } catch (UriParserException e) {
+      exception = e;
+      return this;
+    }
+
+    if (uriInfo.getKind() != UriInfoKind.resource) {
+      fail("Filtervalidator can only be used on resourcePaths");
+    }
+
+    setFilter((FilterOptionImpl) uriInfo.getFilterOption());
+    curExpression = filter.getExpression();
+    return this;
+  }
+
+  public FilterValidator runUriOrderBy(final String uri) throws UriParserException {
+    Parser parser = new Parser();
+    UriInfo uriInfo = null;
+
+    uriInfo = parser.parseUri(uri, edm);
+
+    if (uriInfo.getKind() != UriInfoKind.resource) {
+      fail("Filtervalidator can only be used on resourcePaths");
+    }
+
+    setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
+    return this;
+  }
+
+  public FilterValidator runUriOrderByEx(final String uri) {
+    Parser parser = new Parser();
+    UriInfo uriInfo = null;
+
+    try {
+      uriInfo = parser.parseUri(uri, edm);
+    } catch (UriParserException e) {
+      exception = e;
+      return this;
+    }
+
+    if (uriInfo.getKind() != UriInfoKind.resource) {
+      fail("Filtervalidator can only be used on resourcePaths");
+    }
+
+    setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
+    return this;
+  }
+
+  // --- Navigation ---
+
+  public ExpandValidator goUpToExpandValidator() {
+    return (ExpandValidator) invokedByValidator;
+  }
+
+  public ResourceValidator goUpToResourceValidator() {
+    return (ResourceValidator) invokedByValidator;
+  }
+
+  public ResourceValidator goPath() {
+    if (!(curExpression instanceof MemberImpl)) {
+      fail("Current expression not a member");
+    }
+
+    MemberImpl member = (MemberImpl) curExpression;
+
+    return new ResourceValidator()
+        .setEdm(edm)
+        .setUriInfoImplPath((UriInfoImpl) member.getResourcePath())
+        .setUpValidator(this);
+
+  }
+
+  public FilterValidator goParameter(final int parameterIndex) {
+    if (curExpression instanceof MethodCallImpl) {
+      MethodCallImpl methodCall = (MethodCallImpl) curExpression;
+      curExpression = methodCall.getParameters().get(parameterIndex);
+    } else {
+      fail("Current expression not a methodCall");
+    }
+    return this;
+  }
+
+  // --- Validation ---
+
+  /**
+   * Validates the serialized filterTree against a given filterString
+   * The given expected filterString is compressed before to allow better readable code in the unit tests
+   * @param toBeCompr
+   * @return
+   */
+  public FilterValidator isCompr(final String toBeCompr) {
+    return is(compress(toBeCompr));
+  }
+
+  public FilterValidator is(final String expectedFilterAsString) {
+    try {
+      String actualFilterAsText = FilterTreeToText.Serialize((FilterOptionImpl) filter);
+      assertEquals(expectedFilterAsString, actualFilterAsText);
+    } catch (ExpressionVisitException e) {
+      fail("Exception occured while converting the filterTree into text" + "\n"
+          + " Exception: " + e.getMessage());
+    } catch (ODataApplicationException e) {
+      fail("Exception occured while converting the filterTree into text" + "\n"
+          + " Exception: " + e.getMessage());
+    }
+
+    return this;
+  }
+
+  // --- Helper ---
+
+  private String compress(final String expected) {
+    String ret = expected.replaceAll("\\s+", " ");
+    ret = ret.replaceAll("< ", "<");
+    ret = ret.replaceAll(" >", ">");
+    return ret;
+  }
+
+  public FilterValidator isType(final FullQualifiedName fullName) {
+    EdmType actualType = null;
+
+    if (curExpression instanceof MemberImpl) {
+      Member member = (Member) curExpression;
+      actualType = member.getType();
+    } else if (curExpression instanceof TypeLiteralImpl) {
+      TypeLiteralImpl typeLiteral = (TypeLiteralImpl) curExpression;
+      actualType = typeLiteral.getType();
+    } else if (curExpression instanceof LiteralImpl) {
+      LiteralImpl typeLiteral = (LiteralImpl) curExpression;
+      actualType = typeLiteral.getType();
+    }
+
+    if (actualType == null) {
+      fail("Current expression not typed");
+    }
+
+    FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+    assertEquals(fullName, actualName);
+    return this;
+  }
+
+  public FilterValidator left() {
+    if (!(curExpression instanceof BinaryImpl)) {
+      fail("Current expression not a binary operator");
+    }
+
+    curExpression = ((BinaryImpl) curExpression).getLeftOperand();
+
+    return this;
+  }
+
+  public FilterValidator root() {
+    if (filter != null) {
+      curExpression = filter.getExpression();
+    } else {
+      curExpression = rootExpression;
+    }
+
+    return this;
+  }
+
+  public FilterValidator right() {
+    if (!(curExpression instanceof BinaryImpl)) {
+      fail("Current expression is not a binary operator");
+    }
+
+    curExpression = ((BinaryImpl) curExpression).getRightOperand();
+
+    return this;
+
+  }
+
+  public FilterValidator isLiteral(final String literalText) {
+    if (!(curExpression instanceof LiteralImpl)) {
+      fail("Current expression is not a literal");
+    }
+
+    String actualLiteralText = ((LiteralImpl) curExpression).getText();
+    assertEquals(literalText, actualLiteralText);
+
+    return this;
+  }
+
+  public FilterValidator isMethod(final MethodCallKind methodKind, final int parameterCount) {
+    if (!(curExpression instanceof MethodCallImpl)) {
+      fail("Current expression is not a methodCall");
+    }
+
+    MethodCallImpl methodCall = (MethodCallImpl) curExpression;
+    assertEquals(methodKind, methodCall.getMethod());
+    assertEquals(parameterCount, methodCall.getParameters().size());
+
+    return this;
+  }
+
+  public FilterValidator isParameterText(final int parameterIndex, final String parameterText)
+      throws ExpressionVisitException, ODataApplicationException {
+
+    if (!(curExpression instanceof MethodCallImpl)) {
+      fail("Current expression is not a method");
+    }
+
+    MethodCallImpl methodCall = (MethodCallImpl) curExpression;
+
+    Expression parameter = methodCall.getParameters().get(parameterIndex);
+    String actualParameterText = FilterTreeToText.Serialize(parameter);
+    assertEquals(parameterText, actualParameterText);
+
+    return this;
+  }
+
+  public FilterValidator isBinary(final BinaryOperatorKind binaryOperator) {
+    if (!(curExpression instanceof BinaryImpl)) {
+      fail("Current expression is not a binary operator");
+    }
+
+    BinaryImpl binary = (BinaryImpl) curExpression;
+    assertEquals(binaryOperator, binary.getOperator());
+
+    return this;
+  }
+
+  public FilterValidator isTypedLiteral(final FullQualifiedName fullName) {
+    if (!(curExpression instanceof TypeLiteralImpl)) {
+      fail("Current expression not a typeLiteral");
+    }
+
+    isType(fullName);
+
+    return this;
+  }
+
+  public FilterValidator isMember() {
+    if (!(curExpression instanceof MemberImpl)) {
+      fail("Current expression not a member");
+    }
+
+    return this;
+  }
+  
+  public FilterValidator isMemberStartType(final FullQualifiedName fullName) {
+    if (!(curExpression instanceof MemberImpl)) {
+      fail("Current expression not a member");
+    }
+    
+    MemberImpl member = (MemberImpl) curExpression;
+    EdmType actualType = member.getStartTypeFilter();
+    
+    FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+    assertEquals(fullName, actualName);
+    return this;
+  }
+
+  public FilterValidator isEnum(final FullQualifiedName nameenstring, final List<String> enumValues) {
+    if (!(curExpression instanceof EnumerationImpl)) {
+      fail("Current expression not a enumeration");
+    }
+
+    EnumerationImpl enumeration = (EnumerationImpl) curExpression;
+
+    FullQualifiedName actualName =
+        new FullQualifiedName(enumeration.getType().getNamespace(), enumeration.getType().getName());
+
+    // check name
+    assertEquals(nameenstring.toString(), actualName.toString());
+
+    // check values
+    int i = 0;
+    for (String item : enumValues) {
+      assertEquals(item, enumeration.getValues().get(i));
+      i++;
+    }
+
+    return this;
+  }
+
+  public FilterValidator isSortOrder(final int index, final boolean descending) {
+    assertEquals(descending, orderBy.getOrders().get(index).isDescending());
+    return this;
+  }
+
+  public FilterValidator goOrder(final int index) {
+    curExpression = orderBy.getOrders().get(index).getExpression();
+    return this;
+  }
+
+  public FilterValidator isExSyntax(final long errorID) {
+    assertEquals(UriParserSyntaxException.class, exception.getClass());
+    return this;
+  }
+
+  public FilterValidator isExSemantic(final long errorID) {
+    assertEquals(UriParserSemanticException.class, exception.getClass());
+    return this;
+  }
+
+  public FilterValidator isNull() {
+    if (!(curExpression instanceof LiteralImpl)) {
+      fail("Current expression is not a literal");
+    }
+
+    String actualLiteralText = ((LiteralImpl) curExpression).getText();
+    assertEquals("null", actualLiteralText);
+    return this;
+  }
+
+  public FilterValidator isTrue() {
+    if (!(curExpression instanceof LiteralImpl)) {
+      fail("Current expression is not a literal");
+    }
+
+    String actualLiteralText = ((LiteralImpl) curExpression).getText();
+    assertEquals("true", actualLiteralText);
+    return this;
+  }
+
+  public FilterValidator isFalse() {
+    if (!(curExpression instanceof LiteralImpl)) {
+      fail("Current expression is not a literal");
+    }
+
+    String actualLiteralText = ((LiteralImpl) curExpression).getText();
+    assertEquals("false", actualLiteralText);
+    return this;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java
new file mode 100644
index 0000000..d484020
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.server.core.uri.testutil;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.antlr.v4.runtime.Token;
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.misc.Nullable;
+import org.antlr.v4.runtime.misc.Utils;
+import org.antlr.v4.runtime.tree.ErrorNode;
+import org.antlr.v4.runtime.tree.RuleNode;
+import org.antlr.v4.runtime.tree.TerminalNode;
+import org.antlr.v4.runtime.tree.Tree;
+
+public class ParseTreeToText {
+
+  public static String getTreeAsText(final Tree contextTree, final String[] ruleNames) {
+    return toStringTree(contextTree, Arrays.asList(ruleNames));
+  }
+
+  private static String toStringTree(final Tree t, @Nullable final List<String> ruleNames) {
+
+    if (t.getChildCount() == 0) {
+      return Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
+    }
+
+    StringBuilder buf = new StringBuilder();
+    String s = Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
+    buf.append(s);
+    buf.append("(");
+
+    for (int i = 0; i < t.getChildCount(); i++) {
+      if (i > 0) {
+        buf.append(' ');
+      }
+      buf.append(toStringTree(t.getChild(i), ruleNames));
+    }
+    buf.append(")");
+    return buf.toString();
+  }
+
+  private static String getNodeText(@NotNull final Tree t, @Nullable final List<String> ruleNames) {
+    if (ruleNames != null) {
+      if (t instanceof RuleNode) {
+        int ruleIndex = ((RuleNode) t).getRuleContext().getRuleIndex();
+        return ruleNames.get(ruleIndex);
+      } else if (t instanceof ErrorNode) {
+        return t.toString();
+      } else if (t instanceof TerminalNode) {
+        Token symbol = ((TerminalNode) t).getSymbol();
+        if (symbol != null) {
+          String s = symbol.getText();
+          return s;
+        }
+      }
+    }
+    // no recog for rule names
+    Object payload = t.getPayload();
+    if (payload instanceof Token) {
+      return ((Token) payload).getText();
+    }
+    return t.getPayload().toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
new file mode 100644
index 0000000..280f0a1
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * 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.server.core.uri.testutil;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
+
+// TODO extend to test also exception which can occure while paring
+public class ParserValidator {
+
+  private String input = null;
+  private ParserRuleContext root;
+
+  int logLevel = 0;
+  private int lexerLogLevel = 0;
+
+  boolean allowFullContext;
+  boolean allowContextSensitifity;
+  boolean allowAmbiguity;
+
+  List<Exception> exceptions = new ArrayList<Exception>();
+  private Exception curException = null;
+
+  // --- Setup ---
+
+  public ParserValidator log(final int logLevel) {
+    this.logLevel = logLevel;
+    return this;
+  }
+
+  public ParserValidator lexerLog(final int logLevel) {
+    lexerLogLevel = logLevel;
+    return this;
+  }
+
+  /**
+   * TODO verify
+   * Used in fast LL Parsing:
+   * Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is
+   * required
+   * @return
+   */
+  public ParserValidator aFC() {
+    allowFullContext = true;
+    return this;
+  }
+
+  /**
+   * 
+   * TODO verify
+   * Used in fast LL Parsing:
+   * Allows ContextSensitifity Errors which occur often when using the slower full context parsing
+   * and indicate that there is a context sensitivity ( which may not be an error).
+   * @return
+   */
+  public ParserValidator aCS() {
+    allowContextSensitifity = true;
+    return this;
+  }
+
+  /**
+   * TODO verify
+   * Used in fast LL Parsing:
+   * Allows ambiguities
+   * @return
+   */
+  public ParserValidator aAM() {
+    allowAmbiguity = true;
+    return this;
+  }
+
+  // --- Execution ---
+
+  public ParserValidator run(final String uri) {
+    input = uri;
+
+    // just run a short lexer step. E.g. to print the tokens
+    if (lexerLogLevel > 0) {
+      (new TokenValidator()).log(lexerLogLevel).run(input);
+    }
+
+    /**/// root = parseInput(uri);
+
+    // if LOG > 0 - Write serialized tree
+    if (logLevel > 0) {
+      if (root != null) {
+        System.out.println(ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames()));
+      } else {
+        System.out.println("root == null");
+      }
+    }
+
+    // reset for next test
+    allowFullContext = false;
+    allowContextSensitifity = false;
+    allowAmbiguity = false;
+    logLevel = 0;
+
+    return this;
+  }
+
+  // --- Navigation ---
+
+  public ParserValidator exFirst() {
+    try {
+      // curWeakException = exceptions.get(0);
+    } catch (IndexOutOfBoundsException ex) {
+      // curWeakException = null;
+    }
+    return this;
+
+  }
+
+  public ParserValidator exLast() {
+    // curWeakException = exceptions.get(exceptions.size() - 1);
+    return this;
+  }
+
+  public ParserValidator exAt(final int index) {
+    try {
+      // curWeakException = exceptions.get(index);
+    } catch (IndexOutOfBoundsException ex) {
+      // curWeakException = null;
+    }
+    return this;
+  }
+
+  // --- Validation ---
+
+  public ParserValidator isText(final String expected) {
+
+    assertEquals(null, curException);
+    assertEquals(0, exceptions.size());
+
+    String actualTreeAsText = ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames());
+
+    assertEquals(expected, actualTreeAsText);
+    return this;
+  }
+
+  public ParserValidator isExeptionType(final Class<?> exClass) {
+    assertEquals(exClass, curException.getClass());
+    return this;
+  }
+
+  // --- Helper ---
+  /*
+   * private OdataRelativeUriEOFContext parseInput(final String input) {
+   * UriParserParser parser = null;
+   * UriLexerWithTrace lexer = null;
+   * OdataRelativeUriEOFContext ret = null;
+   * 
+   * // Use 2 stage approach to improve performance
+   * // see https://github.com/antlr/antlr4/issues/192
+   * // TODO verify this
+   * 
+   * // stage= 1
+   * try {
+   * curException = null;
+   * exceptions.clear();
+   * 
+   * // create parser
+   * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
+   * parser = new UriParserParser(new CommonTokenStream(lexer));
+   * 
+   * // write always a error message in case of syntax errors
+   * // parser.addErrorListener(new TestErrorHandler<Object>());
+   * // check error message if whether they are allowed or not
+   * // parser.addErrorListener(new ErrorCollector());
+   * 
+   * // bail out of parser at first syntax error. --> proceed in catch block with step 2
+   * parser.setErrorHandler(new BailErrorStrategy());
+   * 
+   * // user the faster SLL parsing
+   * parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
+   * 
+   * // parse
+   * if (logLevel > 0) {
+   * System.out.println("Step 1");
+   * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode());
+   * }
+   * ret = parser.odataRelativeUriEOF();
+   * 
+   * } catch (Exception exception) {
+   * curException = exception;
+   * try {
+   * // clear status
+   * curException = null;
+   * exceptions.clear();
+   * 
+   * // create parser
+   * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
+   * parser = new UriParserParser(new CommonTokenStream(lexer));
+   * 
+   * // write always a error message in case of syntax errors
+   * // parser.addErrorListener(new ErrorCollector(this));
+   * // check error message if whether they are allowed or not
+   * // parser.addErrorListener(new ErrorCollector(this));
+   * 
+   * // Used default error strategy
+   * parser.setErrorHandler(new DefaultErrorStrategy());
+   * 
+   * // User the slower SLL parsing
+   * parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+   * 
+   * // parse
+   * if (logLevel > 1) {
+   * System.out.println("Step 2");
+   * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
+   * }
+   * ret = parser.odataRelativeUriEOF();
+   * 
+   * } catch (Exception exception1) {
+   * curException = exception1;
+   * // exceptionOnStage = 2;
+   * }
+   * }
+   * 
+   * return ret;
+   * }
+   */
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java
new file mode 100644
index 0000000..147bae6
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.server.core.uri.testutil;
+
+import org.antlr.v4.runtime.DefaultErrorStrategy;
+import org.antlr.v4.runtime.DiagnosticErrorListener;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
+import org.apache.olingo.odata4.server.core.uri.parser.Parser;
+
+public class ParserWithLogging extends Parser {
+  TestErrorLogger errorCollector1;
+  TestErrorLogger errorCollector2;
+
+  public ParserWithLogging() {
+    errorCollector1 = new TestErrorLogger("Stage 1", 1);
+    errorCollector2 = new TestErrorLogger("Stage 2", 1);
+  }
+
+  @Override
+  protected void addStage2ErrorStategy(final 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(final UriParserParser parser) {
+    // Log error to console
+    parser.removeErrorListeners();
+    parser.addErrorListener(errorCollector1);
+    parser.addErrorListener(new DiagnosticErrorListener());
+  }
+
+  @Override
+  protected void addStage2ErrorListener(final UriParserParser parser) {
+    // Log error to console
+    parser.removeErrorListeners();
+    parser.addErrorListener(errorCollector2);
+    parser.addErrorListener(new DiagnosticErrorListener());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
new file mode 100644
index 0000000..ff090fd
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
@@ -0,0 +1,583 @@
+/*******************************************************************************
+ * 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.server.core.uri.testutil;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmElement;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriInfo;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.UriParameter;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceComplexPropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceEntitySetImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAllImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAnyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceNavigationPropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourcePrimitivePropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceSingletonImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+
+public class ResourceValidator implements Validator {
+  private Edm edm;
+  private Validator invokedBy;
+  private UriInfo uriInfo = null;
+
+  private UriResourceImpl uriPathInfo = null;
+  private int uriResourceIndex;
+
+  // --- Setup ---
+
+  public ResourceValidator setUpValidator(final Validator uriValidator) {
+    invokedBy = uriValidator;
+    return this;
+  }
+
+  public ResourceValidator setEdm(final Edm edm) {
+    this.edm = edm;
+    return this;
+  }
+
+  public ResourceValidator setUriInfoImplPath(final UriInfoImpl uriInfoPath) {
+    uriInfo = uriInfoPath;
+    last();
+    return this;
+  }
+
+  // --- Execution ---
+
+  public ResourceValidator run(final String uri) {
+    ParserWithLogging testParser = new ParserWithLogging();
+
+    UriInfoImpl uriInfoTmp = null;
+    uriPathInfo = null;
+    try {
+      uriInfoTmp = (UriInfoImpl) testParser.parseUri(uri, edm);
+    } catch (UriParserException e) {
+      fail("Exception occured while parsing the URI: " + uri + "\n"
+          + " Message: " + e.getMessage());
+    }
+
+    if (uriInfoTmp.getKind() != UriInfoKind.resource) {
+      fail("Invalid UriInfoKind: " + uriInfoTmp.getKind().toString());
+    }
+    uriInfo = uriInfoTmp;
+
+    first();
+    return this;
+  }
+
+  // --- Navigation ---
+
+  public UriValidator goUpUriValidator() {
+    return (UriValidator) invokedBy;
+  }
+
+  public ExpandValidator goUpExpandValidator() {
+    return (ExpandValidator) invokedBy;
+  }
+
+  public FilterValidator goUpFilterValidator() {
+    return (FilterValidator) invokedBy;
+  }
+
+  public FilterValidator goParameter(final int index) {
+    assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+    UriResourceFunctionImpl function = (UriResourceFunctionImpl) uriPathInfo;
+
+    return new FilterValidator()
+        .setEdm(edm)
+        .setExpression(function.getParameters().get(index).getExression())
+        .setValidator(this);
+  }
+
+  public FilterValidator goLambdaExpression() {
+    if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
+      return new FilterValidator()
+          .setEdm(edm)
+          .setExpression(((UriResourceLambdaAllImpl) uriPathInfo).getExpression());
+
+    } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
+      return new FilterValidator()
+          .setEdm(edm)
+          .setExpression(((UriResourceLambdaAnyImpl) uriPathInfo).getExpression());
+    } else {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+    return null;
+  }
+
+  public ResourceValidator goSelectItem(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+    SelectItem item = select.getSelectItems().get(index);
+    UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourcePath();
+
+    return new ResourceValidator()
+        .setUpValidator(this)
+        .setEdm(edm)
+        .setUriInfoImplPath(uriInfo1);
+
+  }
+
+  public ExpandValidator goExpand() {
+    ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
+    if (expand == null) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    return new ExpandValidator().setUpValidator(this).setExpand(expand);
+  }
+
+  public ResourceValidator first() {
+    uriResourceIndex = 0;
+    uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(0);
+    return this;
+  }
+
+  public ResourceValidator last() {
+    uriResourceIndex = 0;
+
+    try {
+      uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
+      uriResourceIndex = uriInfo.getUriResourceParts().size() - 1;
+    } catch (IndexOutOfBoundsException ex) {
+      fail("not enough segments");
+    }
+
+    return this;
+  }
+
+  public ResourceValidator n() {
+    uriResourceIndex++;
+
+    try {
+      uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriResourceIndex);
+    } catch (IndexOutOfBoundsException ex) {
+      fail("not enough segments");
+    }
+
+    return this;
+  }
+
+  public ResourceValidator at(final int index) {
+    uriResourceIndex = index;
+    try {
+      uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(index);
+    } catch (IndexOutOfBoundsException ex) {
+      fail("not enough segments");
+    }
+    return this;
+  }
+
+  // --- Validation ---
+
+  public ResourceValidator isLambdaVar(final String var) {
+    String actualVar = null;
+    if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
+      actualVar = ((UriResourceLambdaAllImpl) uriPathInfo).getLamdaVariable();
+    } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
+      actualVar = ((UriResourceLambdaAnyImpl) uriPathInfo).getLamdaVariable();
+    } else {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    assertEquals(var, actualVar);
+    return this;
+  }
+
+  public ResourceValidator isTypeFilter(final FullQualifiedName expectedType) {
+
+    if (uriPathInfo.getKind() != UriResourceKind.complexProperty &&
+        uriPathInfo.getKind() != UriResourceKind.singleton &&
+        uriPathInfo.getKind() != UriResourceKind.startingTypeFilter) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    EdmType actualType = null;
+    if (uriPathInfo instanceof UriResourceComplexPropertyImpl) {
+      actualType = ((UriResourceComplexPropertyImpl) uriPathInfo).getComplexTypeFilter();
+    } else if (uriPathInfo instanceof UriResourceSingletonImpl) {
+      actualType = ((UriResourceSingletonImpl) uriPathInfo).getEntityTypeFilter();
+    }
+
+    if (actualType == null) {
+      fail("type information not set");
+    }
+
+    FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+
+    assertEquals(expectedType.toString(), actualName.toString());
+    return this;
+  }
+
+  public ResourceValidator isType(final FullQualifiedName type) {
+    if (!(uriPathInfo instanceof UriResourcePartTyped)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+    UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
+
+    EdmType actualType = uriPathInfoTyped.getType();
+    if (actualType == null) {
+      fail("type information not set");
+    }
+
+    FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+
+    assertEquals(type.toString(), actualName.toString());
+
+    return this;
+  }
+
+  public ResourceValidator isType(final FullQualifiedName type, final boolean isFinallyACollection) {
+    isType(type);
+    assertEquals(isFinallyACollection, ((UriResourcePartTyped) uriPathInfo).isCollection());
+    return this;
+  }
+
+  public ResourceValidator isTypeFilterOnEntry(final FullQualifiedName type) {
+    if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
+
+    // input parameter type may be null in order to assert that the singleTypeFilter is not set
+    EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry();
+    if (type == null) {
+      assertEquals(type, actualType);
+    } else {
+      assertEquals(type.toString(), new FullQualifiedName(actualType.getNamespace(), actualType.getName()).toString());
+    }
+
+    return this;
+  }
+
+  public ResourceValidator isTypeFilterOnCollection(final FullQualifiedName expectedType) {
+    if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+    UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
+
+    // input parameter type may be null in order to assert that the collectionTypeFilter is not set
+    EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection();
+    if (expectedType == null) {
+      assertEquals(expectedType, actualType);
+    } else {
+      FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+      assertEquals(expectedType.toString(), actualName.toString());
+    }
+
+    return this;
+  }
+
+  // other functions
+  public ResourceValidator checkCustomParameter(final int index, final String name, final String value) {
+    if (uriInfo == null) {
+      fail("hasQueryParameter: uriInfo == null");
+    }
+
+    List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
+    if (list.size() <= index) {
+      fail("not enough queryParameters");
+    }
+
+    CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
+    assertEquals(name, option.getName());
+    assertEquals(value, option.getText());
+    return this;
+  }
+
+  // TODO remove
+  public ResourceValidator isCollection(final boolean isCollection) {
+    if (!(uriPathInfo instanceof UriResourcePartTyped)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+    UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
+
+    EdmType type = uriPathInfoTyped.getType();
+    if (type == null) {
+      fail("isCollection: type == null");
+    }
+    assertEquals(isCollection, uriPathInfoTyped.isCollection());
+    return this;
+  }
+
+  public ResourceValidator isFilterString(final String expectedFilterTreeAsString) {
+
+    ExpressionImpl filterTree = (ExpressionImpl) uriInfo.getFilterOption().getExpression();
+    try {
+      String filterTreeAsString = filterTree.accept(new FilterTreeToText());
+      assertEquals(expectedFilterTreeAsString, filterTreeAsString);
+    } catch (ExpressionVisitException e) {
+      fail("isFilterString: Exception " + e.getMessage() + " occured");
+    } catch (ODataApplicationException e) {
+      fail("isFilterString: Exception " + e.getMessage() + " occured");
+    }
+
+    return this;
+  }
+
+  public ResourceValidator isKeyPredicateRef(final int index, final String name, final String refencedProperty) {
+    if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
+    List<UriParameter> keyPredicates = info.getKeyPredicates();
+    assertEquals(name, keyPredicates.get(index).getName());
+    assertEquals(refencedProperty, keyPredicates.get(index).getRefencedProperty());
+    return this;
+
+  }
+
+  public ResourceValidator isKeyPredicate(final int index, final String name, final String text) {
+    if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
+    List<UriParameter> keyPredicates = info.getKeyPredicates();
+    assertEquals(name, keyPredicates.get(index).getName());
+    assertEquals(text, keyPredicates.get(index).getText());
+    return this;
+
+  }
+
+  public ResourceValidator isParameter(final int index, final String name, final String text) {
+    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(text, keyPredicates.get(index).getText());
+    return this;
+
+  }
+
+  public ResourceValidator 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 ResourceValidator isKind(final UriInfoKind kind) {
+    assertEquals(kind, uriInfo.getKind());
+    return this;
+  }
+
+  public ResourceValidator isPrimitiveProperty(final String name,
+      final FullQualifiedName type, final boolean isCollection) {
+    if (!(uriPathInfo instanceof UriResourcePrimitivePropertyImpl)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    UriResourcePrimitivePropertyImpl uriPathInfoProp = (UriResourcePrimitivePropertyImpl) uriPathInfo;
+
+    EdmElement property = uriPathInfoProp.getProperty();
+
+    assertEquals(name, property.getName());
+    assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+    assertEquals(isCollection, property.isCollection());
+    return this;
+  }
+
+  public ResourceValidator
+      isComplexProperty(final String name, final FullQualifiedName type, final boolean isCollection) {
+    if (!(uriPathInfo instanceof UriResourceComplexPropertyImpl)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    UriResourceComplexPropertyImpl uriPathInfoProp = (UriResourceComplexPropertyImpl) uriPathInfo;
+
+    EdmElement property = uriPathInfoProp.getProperty();
+
+    assertEquals(name, property.getName());
+    assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+    assertEquals(isCollection, property.isCollection());
+    return this;
+  }
+
+  public ResourceValidator isNavProperty(final String name, final FullQualifiedName type, final boolean isCollection) {
+    if (!(uriPathInfo instanceof UriResourceNavigationPropertyImpl)) {
+      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+    }
+
+    UriResourceNavigationPropertyImpl uriPathInfoProp = (UriResourceNavigationPropertyImpl) uriPathInfo;
+
+    EdmElement property = uriPathInfoProp.getProperty();
+
+    assertEquals(name, property.getName());
+    assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+    assertEquals(isCollection, uriPathInfoProp.isCollection());
+    return this;
+  }
+
+  public ResourceValidator isUriPathInfoKind(final UriResourceKind infoType) {
+    assertNotNull(uriPathInfo);
+    assertEquals(infoType, uriPathInfo.getKind());
+    return this;
+  }
+
+  public ResourceValidator isAction(final String name) {
+    assertEquals(UriResourceKind.action, uriPathInfo.getKind());
+    assertEquals(name, ((UriResourceActionImpl) uriPathInfo).getAction().getName());
+    return this;
+  }
+
+  public ResourceValidator isFunction(final String name) {
+    assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+    assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunction().getName());
+    return this;
+  }
+
+  public ResourceValidator isFunctionImport(final String name) {
+    assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+    assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunctionImport().getName());
+    return this;
+  }
+
+  public ResourceValidator isEntitySet(final String name) {
+    assertEquals(UriResourceKind.entitySet, uriPathInfo.getKind());
+    assertEquals(name, ((UriResourceEntitySetImpl) uriPathInfo).getEntitySet().getName());
+    return this;
+  }
+
+  public ResourceValidator isComplex(final String name) {
+    assertEquals(UriResourceKind.complexProperty, uriPathInfo.getKind());
+    assertEquals(name, ((UriResourceComplexPropertyImpl) uriPathInfo).getProperty().getName());
+    return this;
+  }
+
+  public ResourceValidator isSingleton(final String name) {
+    assertEquals(UriResourceKind.singleton, uriPathInfo.getKind());
+    assertEquals(name, ((UriResourceSingletonImpl) uriPathInfo).getSingleton().getName());
+    return this;
+  }
+
+  public ResourceValidator isValue() {
+    assertEquals(UriResourceKind.value, uriPathInfo.getKind());
+    return this;
+  }
+
+  public ResourceValidator isCount() {
+    assertEquals(UriResourceKind.count, uriPathInfo.getKind());
+    return this;
+  }
+
+  public ResourceValidator isRef() {
+    assertEquals(UriResourceKind.ref, uriPathInfo.getKind());
+    return this;
+  }
+
+  public ResourceValidator isActionImport(final String actionName) {
+    assertEquals(UriResourceKind.action, uriPathInfo.getKind());
+    assertEquals(actionName, ((UriResourceActionImpl) uriPathInfo).getActionImport().getName());
+    return this;
+  }
+
+  public ResourceValidator isIt() {
+    assertEquals(UriResourceKind.it, uriPathInfo.getKind());
+    return this;
+  }
+
+  public ResourceValidator isTopText(final String topText) {
+    assertEquals(topText, uriInfo.getTopOption().getText());
+    return this;
+  }
+
+  public ResourceValidator isFormatText(final String formatText) {
+    assertEquals(formatText, uriInfo.getFormatOption().getText());
+    return this;
+  }
+
+  public ResourceValidator isInlineCountText(final String inlineCountText) {
+    assertEquals(inlineCountText, uriInfo.getInlineCountOption().getText());
+    return this;
+  }
+
+  public ResourceValidator isSkipText(final String skipText) {
+    assertEquals(skipText, uriInfo.getSkipOption().getText());
+    return this;
+  }
+
+  public ResourceValidator isSkipTokenText(final String skipTokenText) {
+    assertEquals(skipTokenText, uriInfo.getSkipTokenOption().getText());
+    return this;
+  }
+
+  public ResourceValidator isSelectItemStar(final int index) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+    SelectItem item = select.getSelectItems().get(index);
+    assertEquals(true, item.isStar());
+    return this;
+  }
+
+  public ResourceValidator isSelectItemAllOp(final int index, final FullQualifiedName fqn) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+    SelectItem item = select.getSelectItems().get(index);
+    assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+    return this;
+  }
+
+  public ResourceValidator isSelectStartType(final int index, FullQualifiedName fullName) {
+    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+    SelectItem item = select.getSelectItems().get(index);
+
+    EdmType actualType = item.getStartTypeFilter();
+    
+    FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+    assertEquals(fullName, actualName);
+    return this;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java
new file mode 100644
index 0000000..c634790
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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.server.core.uri.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;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
+
+class TestErrorLogger implements ANTLRErrorListener {
+
+  private String prefix;
+  private int logLevel = 0;
+
+  public TestErrorLogger(final String prefix, final 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) {
+
+    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) {
+
+  }
+
+  @Override
+  public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
+      final int stopIndex,
+      final BitSet conflictingAlts, final ATNConfigSet configs) {
+
+  }
+
+  @Override
+  public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
+      final int stopIndex, final int prediction,
+      final ATNConfigSet configs) {
+
+  }
+
+  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);
+
+    printStack(recognizer);
+
+    System.out.println(" line/char :" + line + " / " + charPositionInLine);
+    System.out.println(" sym       :" + offendingSymbol);
+    if (e != null && e.getOffendingToken() != null) {
+
+      String lexerTokenName = "";
+      try {
+        lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+      } catch (ArrayIndexOutOfBoundsException es) {
+        lexerTokenName = "token error";
+      }
+
+      System.out.println(" tokenname:" + lexerTokenName);
+    }
+
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java
new file mode 100644
index 0000000..9a56c7f
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * 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.server.core.uri.testutil;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.Token;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
+
+//TODO extend to test also exception which can occure while paring
+public class TokenValidator {
+
+  private String input = null;
+
+  private List<? extends Token> tokens = null;
+  private Token curToken = null;
+  private Exception curException = null;
+
+  private int startMode;
+  private int logLevel = 0;
+
+  // --- Setup ---
+
+  public TokenValidator log(final int logLevel) {
+    this.logLevel = logLevel;
+    return this;
+  }
+
+  // --- Execution ---
+
+  public TokenValidator run(final String uri) {
+    input = uri;
+
+    tokens = parseInput(uri);
+    if (logLevel > 0) {
+      showTokens();
+    }
+
+    first();
+    exFirst();
+    logLevel = 0;
+
+    return this;
+  }
+
+  // --- Navigation ---
+
+  // navigate within the tokenlist
+  public TokenValidator first() {
+    try {
+      curToken = tokens.get(0);
+    } catch (IndexOutOfBoundsException ex) {
+      curToken = null;
+    }
+    return this;
+  }
+
+  public TokenValidator last() {
+    curToken = tokens.get(tokens.size() - 1);
+    return this;
+  }
+
+  public TokenValidator at(final int index) {
+    try {
+      curToken = tokens.get(index);
+    } catch (IndexOutOfBoundsException ex) {
+      curToken = null;
+    }
+    return this;
+  }
+
+  public TokenValidator exLast() {
+    // curException = exceptions.get(exceptions.size() - 1);
+    return this;
+  }
+
+  // navigate within the exception list
+  public TokenValidator exFirst() {
+    try {
+      // curException = exceptions.get(0);
+    } catch (IndexOutOfBoundsException ex) {
+      curException = null;
+    }
+    return this;
+
+  }
+
+  public TokenValidator exAt(final int index) {
+    try {
+      // curException = exceptions.get(index);
+    } catch (IndexOutOfBoundsException ex) {
+      curException = null;
+    }
+    return this;
+  }
+
+  // --- Validation ---
+
+  public TokenValidator isText(final String expected) {
+    assertEquals(expected, curToken.getText());
+    return this;
+  }
+
+  public TokenValidator isAllText(final String expected) {
+    String actual = "";
+
+    for (Token curToken : tokens) {
+      actual += curToken.getText();
+    }
+    assertEquals(expected, actual);
+    return this;
+  }
+
+  public TokenValidator isAllInput() {
+    String actual = "";
+
+    for (Token curToken : tokens) {
+      actual += curToken.getText();
+    }
+    assertEquals(input, actual);
+    return this;
+  }
+
+  public TokenValidator isInput() {
+    assertEquals(input, curToken.getText());
+    return this;
+  }
+
+  public TokenValidator isType(final int expected) {
+    assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
+    return this;
+  }
+
+  public TokenValidator isExType(final Class<?> exClass) {
+    assertEquals(exClass, curException.getClass());
+    return this;
+  }
+
+  public void globalMode(final int mode) {
+    startMode = mode;
+  }
+
+  // --- Helper ---
+
+  private List<? extends Token> parseInput(final String input) {
+    ANTLRInputStream inputStream = new ANTLRInputStream(input);
+
+    UriLexer lexer = new UriLexerWithTrace(inputStream, logLevel, startMode);
+    // lexer.addErrorListener(new ErrorCollector(this));
+    return lexer.getAllTokens();
+  }
+
+  public TokenValidator showTokens() {
+    boolean first = true;
+    System.out.println("input: " + input);
+    String nL = "\n";
+    String out = "[" + nL;
+    for (Token token : tokens) {
+      if (!first) {
+        out += ",";
+        first = false;
+      }
+      int index = token.getType();
+      if (index != -1) {
+        out += "\"" + token.getText() + "\"" + "     " + UriLexer.tokenNames[index] + nL;
+      } else {
+        out += "\"" + token.getText() + "\"" + "     " + index + nL;
+      }
+    }
+    out += ']';
+    System.out.println("tokens: " + out);
+    return this;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java
new file mode 100644
index 0000000..60d5b68
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/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.odata4.server.core.uri.testutil;
+
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.Token;
+import org.apache.olingo.odata4.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;
+  }
+}


[3/9] [OLINGO-63] Uri Parser: add special handling for leading type filter in member, expand, select

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ResourceValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ResourceValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ResourceValidator.java
deleted file mode 100644
index c19b2ae..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ResourceValidator.java
+++ /dev/null
@@ -1,571 +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.server.core.testutil;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.ODataApplicationException;
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.odata4.server.api.uri.UriInfo;
-import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.server.api.uri.UriParameter;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
-import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.odata4.server.core.uri.UriParserException;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceComplexPropertyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceEntitySetImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceFunctionImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAllImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAnyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceNavigationPropertyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourcePrimitivePropertyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceSingletonImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class ResourceValidator implements Validator {
-  private Edm edm;
-  private Validator invokedBy;
-  private UriInfo uriInfo = null;
-
-  private UriResourceImpl uriPathInfo = null;
-  private int uriResourceIndex;
-
-  // --- Setup ---
-
-  public ResourceValidator setUpValidator(final Validator uriValidator) {
-    invokedBy = uriValidator;
-    return this;
-  }
-
-  public ResourceValidator setEdm(final Edm edm) {
-    this.edm = edm;
-    return this;
-  }
-
-  public ResourceValidator setUriInfoImplPath(final UriInfoImpl uriInfoPath) {
-    uriInfo = uriInfoPath;
-    last();
-    return this;
-  }
-
-  // --- Execution ---
-
-  public ResourceValidator run(final String uri) {
-    ParserWithLogging testParser = new ParserWithLogging();
-
-    UriInfoImpl uriInfoTmp = null;
-    uriPathInfo = null;
-    try {
-      uriInfoTmp = (UriInfoImpl) testParser.parseUri(uri, edm);
-    } catch (UriParserException e) {
-      fail("Exception occured while parsing the URI: " + uri + "\n"
-          + " Message: " + e.getMessage());
-    }
-
-    if (uriInfoTmp.getKind() != UriInfoKind.resource) {
-      fail("Invalid UriInfoKind: " + uriInfoTmp.getKind().toString());
-    }
-    uriInfo = uriInfoTmp;
-
-    first();
-    return this;
-  }
-
-  // --- Navigation ---
-
-  public UriValidator goUpUriValidator() {
-    return (UriValidator) invokedBy;
-  }
-
-  public ExpandValidator goUpExpandValidator() {
-    return (ExpandValidator) invokedBy;
-  }
-
-  public FilterValidator goUpFilterValidator() {
-    return (FilterValidator) invokedBy;
-  }
-
-  public FilterValidator goParameter(final int index) {
-    assertEquals(UriResourceKind.function, uriPathInfo.getKind());
-    UriResourceFunctionImpl function = (UriResourceFunctionImpl) uriPathInfo;
-
-    return new FilterValidator()
-        .setEdm(edm)
-        .setExpression(function.getParameters().get(index).getExression())
-        .setValidator(this);
-  }
-
-  public FilterValidator goLambdaExpression() {
-    if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
-      return new FilterValidator()
-          .setEdm(edm)
-          .setExpression(((UriResourceLambdaAllImpl) uriPathInfo).getExpression());
-
-    } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
-      return new FilterValidator()
-          .setEdm(edm)
-          .setExpression(((UriResourceLambdaAnyImpl) uriPathInfo).getExpression());
-    } else {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-    return null;
-  }
-
-  public ResourceValidator goSelectItem(final int index) {
-    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
-    SelectItem item = select.getSelectItems().get(index);
-    UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo();
-
-    return new ResourceValidator()
-        .setUpValidator(this)
-        .setEdm(edm)
-        .setUriInfoImplPath(uriInfo1);
-
-  }
-
-  public ExpandValidator goExpand() {
-    ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
-    if (expand == null) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-
-    return new ExpandValidator().setUpValidator(this).setExpand(expand);
-  }
-
-  public ResourceValidator first() {
-    uriResourceIndex = 0;
-    uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(0);
-    return this;
-  }
-
-  public ResourceValidator last() {
-    uriResourceIndex = 0;
-
-    try {
-      uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
-      uriResourceIndex = uriInfo.getUriResourceParts().size() - 1;
-    } catch (IndexOutOfBoundsException ex) {
-      fail("not enough segments");
-    }
-
-    return this;
-  }
-
-  public ResourceValidator n() {
-    uriResourceIndex++;
-
-    try {
-      uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriResourceIndex);
-    } catch (IndexOutOfBoundsException ex) {
-      fail("not enough segments");
-    }
-
-    return this;
-  }
-
-  public ResourceValidator at(final int index) {
-    uriResourceIndex = index;
-    try {
-      uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(index);
-    } catch (IndexOutOfBoundsException ex) {
-      fail("not enough segments");
-    }
-    return this;
-  }
-
-  // --- Validation ---
-
-  public ResourceValidator isLambdaVar(final String var) {
-    String actualVar = null;
-    if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
-      actualVar = ((UriResourceLambdaAllImpl) uriPathInfo).getLamdaVariable();
-    } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
-      actualVar = ((UriResourceLambdaAnyImpl) uriPathInfo).getLamdaVariable();
-    } else {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-
-    assertEquals(var, actualVar);
-    return this;
-  }
-
-  public ResourceValidator isTypeFilter(final FullQualifiedName expectedType) {
-
-    if (uriPathInfo.getKind() != UriResourceKind.complexProperty &&
-        uriPathInfo.getKind() != UriResourceKind.singleton &&
-        uriPathInfo.getKind() != UriResourceKind.startingTypeFilter) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-
-    EdmType actualType = null;
-    if (uriPathInfo instanceof UriResourceComplexPropertyImpl) {
-      actualType = ((UriResourceComplexPropertyImpl) uriPathInfo).getComplexTypeFilter();
-    } else if (uriPathInfo instanceof UriResourceSingletonImpl) {
-      actualType = ((UriResourceSingletonImpl) uriPathInfo).getEntityTypeFilter();
-    }
-
-    if (actualType == null) {
-      fail("type information not set");
-    }
-
-    FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-
-    assertEquals(expectedType.toString(), actualName.toString());
-    return this;
-  }
-
-  public ResourceValidator isType(final FullQualifiedName type) {
-    if (!(uriPathInfo instanceof UriResourcePartTyped)) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-    UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
-
-    EdmType actualType = uriPathInfoTyped.getType();
-    if (actualType == null) {
-      fail("type information not set");
-    }
-
-    FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-
-    assertEquals(type.toString(), actualName.toString());
-
-    return this;
-  }
-
-  public ResourceValidator isType(final FullQualifiedName type, final boolean isFinallyACollection) {
-    isType(type);
-    assertEquals(isFinallyACollection, ((UriResourcePartTyped) uriPathInfo).isCollection());
-    return this;
-  }
-
-  public ResourceValidator isTypeFilterOnEntry(final FullQualifiedName type) {
-    if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-
-    UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
-
-    // input parameter type may be null in order to assert that the singleTypeFilter is not set
-    EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry();
-    if (type == null) {
-      assertEquals(type, actualType);
-    } else {
-      assertEquals(type.toString(), new FullQualifiedName(actualType.getNamespace(), actualType.getName()).toString());
-    }
-
-    return this;
-  }
-
-  public ResourceValidator isTypeFilterOnCollection(final FullQualifiedName expectedType) {
-    if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-    UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
-
-    // input parameter type may be null in order to assert that the collectionTypeFilter is not set
-    EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection();
-    if (expectedType == null) {
-      assertEquals(expectedType, actualType);
-    } else {
-      FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-      assertEquals(expectedType.toString(), actualName.toString());
-    }
-
-    return this;
-  }
-
-  // other functions
-  public ResourceValidator checkCustomParameter(final int index, final String name, final String value) {
-    if (uriInfo == null) {
-      fail("hasQueryParameter: uriInfo == null");
-    }
-
-    List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
-    if (list.size() <= index) {
-      fail("not enough queryParameters");
-    }
-
-    CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
-    assertEquals(name, option.getName());
-    assertEquals(value, option.getText());
-    return this;
-  }
-
-  // TODO remove
-  public ResourceValidator isCollection(final boolean isCollection) {
-    if (!(uriPathInfo instanceof UriResourcePartTyped)) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-    UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
-
-    EdmType type = uriPathInfoTyped.getType();
-    if (type == null) {
-      fail("isCollection: type == null");
-    }
-    assertEquals(isCollection, uriPathInfoTyped.isCollection());
-    return this;
-  }
-
-  public ResourceValidator isFilterString(final String expectedFilterTreeAsString) {
-
-    ExpressionImpl filterTree = (ExpressionImpl) uriInfo.getFilterOption().getExpression();
-    try {
-      String filterTreeAsString = filterTree.accept(new FilterTreeToText());
-      assertEquals(expectedFilterTreeAsString, filterTreeAsString);
-    } catch (ExpressionVisitException e) {
-      fail("isFilterString: Exception " + e.getMessage() + " occured");
-    } catch (ODataApplicationException e) {
-      fail("isFilterString: Exception " + e.getMessage() + " occured");
-    }
-
-    return this;
-  }
-
-  public ResourceValidator isKeyPredicateRef(final int index, final String name, final String refencedProperty) {
-    if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-
-    UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
-    List<UriParameter> keyPredicates = info.getKeyPredicates();
-    assertEquals(name, keyPredicates.get(index).getName());
-    assertEquals(refencedProperty, keyPredicates.get(index).getRefencedProperty());
-    return this;
-
-  }
-
-  public ResourceValidator isKeyPredicate(final int index, final String name, final String text) {
-    if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-
-    UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
-    List<UriParameter> keyPredicates = info.getKeyPredicates();
-    assertEquals(name, keyPredicates.get(index).getName());
-    assertEquals(text, keyPredicates.get(index).getText());
-    return this;
-
-  }
-
-  public ResourceValidator isParameter(final int index, final String name, final String text) {
-    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(text, keyPredicates.get(index).getText());
-    return this;
-
-  }
-
-  public ResourceValidator 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 ResourceValidator isKind(final UriInfoKind kind) {
-    assertEquals(kind, uriInfo.getKind());
-    return this;
-  }
-
-  public ResourceValidator isPrimitiveProperty(final String name,
-      final FullQualifiedName type, final boolean isCollection) {
-    if (!(uriPathInfo instanceof UriResourcePrimitivePropertyImpl)) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-
-    UriResourcePrimitivePropertyImpl uriPathInfoProp = (UriResourcePrimitivePropertyImpl) uriPathInfo;
-
-    EdmElement property = uriPathInfoProp.getProperty();
-
-    assertEquals(name, property.getName());
-    assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
-    assertEquals(isCollection, property.isCollection());
-    return this;
-  }
-
-  public ResourceValidator
-      isComplexProperty(final String name, final FullQualifiedName type, final boolean isCollection) {
-    if (!(uriPathInfo instanceof UriResourceComplexPropertyImpl)) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-
-    UriResourceComplexPropertyImpl uriPathInfoProp = (UriResourceComplexPropertyImpl) uriPathInfo;
-
-    EdmElement property = uriPathInfoProp.getProperty();
-
-    assertEquals(name, property.getName());
-    assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
-    assertEquals(isCollection, property.isCollection());
-    return this;
-  }
-
-  public ResourceValidator isNavProperty(final String name, final FullQualifiedName type, final boolean isCollection) {
-    if (!(uriPathInfo instanceof UriResourceNavigationPropertyImpl)) {
-      fail("invalid resource kind: " + uriPathInfo.getKind().toString());
-    }
-
-    UriResourceNavigationPropertyImpl uriPathInfoProp = (UriResourceNavigationPropertyImpl) uriPathInfo;
-
-    EdmElement property = uriPathInfoProp.getProperty();
-
-    assertEquals(name, property.getName());
-    assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
-    assertEquals(isCollection, uriPathInfoProp.isCollection());
-    return this;
-  }
-
-  public ResourceValidator isUriPathInfoKind(final UriResourceKind infoType) {
-    assertNotNull(uriPathInfo);
-    assertEquals(infoType, uriPathInfo.getKind());
-    return this;
-  }
-
-  public ResourceValidator isAction(final String name) {
-    assertEquals(UriResourceKind.action, uriPathInfo.getKind());
-    assertEquals(name, ((UriResourceActionImpl) uriPathInfo).getAction().getName());
-    return this;
-  }
-
-  public ResourceValidator isFunction(final String name) {
-    assertEquals(UriResourceKind.function, uriPathInfo.getKind());
-    assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunction().getName());
-    return this;
-  }
-
-  public ResourceValidator isFunctionImport(final String name) {
-    assertEquals(UriResourceKind.function, uriPathInfo.getKind());
-    assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunctionImport().getName());
-    return this;
-  }
-
-  public ResourceValidator isEntitySet(final String name) {
-    assertEquals(UriResourceKind.entitySet, uriPathInfo.getKind());
-    assertEquals(name, ((UriResourceEntitySetImpl) uriPathInfo).getEntitySet().getName());
-    return this;
-  }
-
-  public ResourceValidator isComplex(final String name) {
-    assertEquals(UriResourceKind.complexProperty, uriPathInfo.getKind());
-    assertEquals(name, ((UriResourceComplexPropertyImpl) uriPathInfo).getProperty().getName());
-    return this;
-  }
-
-  public ResourceValidator isSingleton(final String name) {
-    assertEquals(UriResourceKind.singleton, uriPathInfo.getKind());
-    assertEquals(name, ((UriResourceSingletonImpl) uriPathInfo).getSingleton().getName());
-    return this;
-  }
-
-  public ResourceValidator isValue() {
-    assertEquals(UriResourceKind.value, uriPathInfo.getKind());
-    return this;
-  }
-
-  public ResourceValidator isCount() {
-    assertEquals(UriResourceKind.count, uriPathInfo.getKind());
-    return this;
-  }
-
-  public ResourceValidator isRef() {
-    assertEquals(UriResourceKind.ref, uriPathInfo.getKind());
-    return this;
-  }
-
-  public ResourceValidator isActionImport(final String actionName) {
-    assertEquals(UriResourceKind.action, uriPathInfo.getKind());
-    assertEquals(actionName, ((UriResourceActionImpl) uriPathInfo).getActionImport().getName());
-    return this;
-  }
-
-  public ResourceValidator isIt() {
-    assertEquals(UriResourceKind.it, uriPathInfo.getKind());
-    return this;
-  }
-
-  public ResourceValidator isTopText(final String topText) {
-    assertEquals(topText, uriInfo.getTopOption().getText());
-    return this;
-  }
-
-  public ResourceValidator isFormatText(final String formatText) {
-    assertEquals(formatText, uriInfo.getFormatOption().getText());
-    return this;
-  }
-
-  public ResourceValidator isInlineCountText(final String inlineCountText) {
-    assertEquals(inlineCountText, uriInfo.getInlineCountOption().getText());
-    return this;
-  }
-
-  public ResourceValidator isSkipText(final String skipText) {
-    assertEquals(skipText, uriInfo.getSkipOption().getText());
-    return this;
-  }
-
-  public ResourceValidator isSkipTokenText(final String skipTokenText) {
-    assertEquals(skipTokenText, uriInfo.getSkipTokenOption().getText());
-    return this;
-  }
-
-  public ResourceValidator isSelectItemStar(final int index) {
-    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
-    SelectItem item = select.getSelectItems().get(index);
-    assertEquals(true, item.isStar());
-    return this;
-  }
-
-  public ResourceValidator isSelectItemAllOp(final int index, final 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/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
deleted file mode 100644
index 46a86ee..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
+++ /dev/null
@@ -1,105 +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.server.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;
-import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
-
-class TestErrorLogger implements ANTLRErrorListener {
-
-  private String prefix;
-  private int logLevel = 0;
-
-  public TestErrorLogger(final String prefix, final 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) {
-
-    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) {
-
-  }
-
-  @Override
-  public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
-      final int stopIndex,
-      final BitSet conflictingAlts, final ATNConfigSet configs) {
-
-  }
-
-  @Override
-  public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
-      final int stopIndex, final int prediction,
-      final ATNConfigSet configs) {
-
-  }
-
-  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);
-
-    printStack(recognizer);
-
-    System.out.println(" line/char :" + line + " / " + charPositionInLine);
-    System.out.println(" sym       :" + offendingSymbol);
-    if (e != null && e.getOffendingToken() != null) {
-
-      String lexerTokenName = "";
-      try {
-        lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
-      } catch (ArrayIndexOutOfBoundsException es) {
-        lexerTokenName = "token error";
-      }
-
-      System.out.println(" tokenname:" + lexerTokenName);
-    }
-
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java
deleted file mode 100644
index 5961421..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java
+++ /dev/null
@@ -1,194 +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.server.core.testutil;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.Token;
-import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
-
-//TODO extend to test also exception which can occure while paring
-public class TokenValidator {
-
-  private String input = null;
-
-  private List<? extends Token> tokens = null;
-  private Token curToken = null;
-  private Exception curException = null;
-
-  private int startMode;
-  private int logLevel = 0;
-
-  // --- Setup ---
-
-  public TokenValidator log(final int logLevel) {
-    this.logLevel = logLevel;
-    return this;
-  }
-
-  // --- Execution ---
-
-  public TokenValidator run(final String uri) {
-    input = uri;
-
-    tokens = parseInput(uri);
-    if (logLevel > 0) {
-      showTokens();
-    }
-
-    first();
-    exFirst();
-    logLevel = 0;
-
-    return this;
-  }
-
-  // --- Navigation ---
-
-  // navigate within the tokenlist
-  public TokenValidator first() {
-    try {
-      curToken = tokens.get(0);
-    } catch (IndexOutOfBoundsException ex) {
-      curToken = null;
-    }
-    return this;
-  }
-
-  public TokenValidator last() {
-    curToken = tokens.get(tokens.size() - 1);
-    return this;
-  }
-
-  public TokenValidator at(final int index) {
-    try {
-      curToken = tokens.get(index);
-    } catch (IndexOutOfBoundsException ex) {
-      curToken = null;
-    }
-    return this;
-  }
-
-  public TokenValidator exLast() {
-    // curException = exceptions.get(exceptions.size() - 1);
-    return this;
-  }
-
-  // navigate within the exception list
-  public TokenValidator exFirst() {
-    try {
-      // curException = exceptions.get(0);
-    } catch (IndexOutOfBoundsException ex) {
-      curException = null;
-    }
-    return this;
-
-  }
-
-  public TokenValidator exAt(final int index) {
-    try {
-      // curException = exceptions.get(index);
-    } catch (IndexOutOfBoundsException ex) {
-      curException = null;
-    }
-    return this;
-  }
-
-  // --- Validation ---
-
-  public TokenValidator isText(final String expected) {
-    assertEquals(expected, curToken.getText());
-    return this;
-  }
-
-  public TokenValidator isAllText(final String expected) {
-    String actual = "";
-
-    for (Token curToken : tokens) {
-      actual += curToken.getText();
-    }
-    assertEquals(expected, actual);
-    return this;
-  }
-
-  public TokenValidator isAllInput() {
-    String actual = "";
-
-    for (Token curToken : tokens) {
-      actual += curToken.getText();
-    }
-    assertEquals(input, actual);
-    return this;
-  }
-
-  public TokenValidator isInput() {
-    assertEquals(input, curToken.getText());
-    return this;
-  }
-
-  public TokenValidator isType(final int expected) {
-    assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
-    return this;
-  }
-
-  public TokenValidator isExType(final Class<?> exClass) {
-    assertEquals(exClass, curException.getClass());
-    return this;
-  }
-
-  public void globalMode(final int mode) {
-    startMode = mode;
-  }
-
-  // --- Helper ---
-
-  private List<? extends Token> parseInput(final String input) {
-    ANTLRInputStream inputStream = new ANTLRInputStream(input);
-
-    UriLexer lexer = new UriLexerWithTrace(inputStream, logLevel, startMode);
-    // lexer.addErrorListener(new ErrorCollector(this));
-    return lexer.getAllTokens();
-  }
-
-  public TokenValidator showTokens() {
-    boolean first = true;
-    System.out.println("input: " + input);
-    String nL = "\n";
-    String out = "[" + nL;
-    for (Token token : tokens) {
-      if (!first) {
-        out += ",";
-        first = false;
-      }
-      int index = token.getType();
-      if (index != -1) {
-        out += "\"" + token.getText() + "\"" + "     " + UriLexer.tokenNames[index] + nL;
-      } else {
-        out += "\"" + token.getText() + "\"" + "     " + index + nL;
-      }
-    }
-    out += ']';
-    System.out.println("tokens: " + out);
-    return this;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java
deleted file mode 100644
index 91622ca..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java
+++ /dev/null
@@ -1,85 +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.server.core.testutil;
-
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.Token;
-import org.apache.olingo.odata4.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/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
deleted file mode 100644
index 23294a8..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
+++ /dev/null
@@ -1,245 +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.server.core.testutil;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.odata4.server.core.uri.UriParserException;
-import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException;
-import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
-import org.apache.olingo.odata4.server.core.uri.parser.Parser;
-import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.server.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) {
-    this.edm = edm;
-    return this;
-  }
-
-  // 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, 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, edm);
-      fail("Exception expected");
-    } catch (UriParserException e) {
-      exception = e;
-    }
-
-    return this;
-  }
-
-  public UriValidator log(final String uri) {
-    ParserWithLogging parserTest = new ParserWithLogging();
-    parserTest.setLogLevel(1);
-    uriInfo = null;
-    try {
-      // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
-      uriInfo = (UriInfoImpl) parserTest.parseUri(uri, edm);
-    } catch (UriParserException e) {
-      fail("Exception occured while parsing the URI: " + uri + "\n"
-          + " Exception: " + e.getMessage());
-    }
-
-    return this;
-  }
-
-  // Navigation
-  public ResourceValidator goPath() {
-    if (uriInfo.getKind() != UriInfoKind.resource) {
-      fail("invalid resource kind: " + uriInfo.getKind().toString());
-    }
-
-    return new ResourceValidator()
-        .setUpValidator(this)
-        .setEdm(edm)
-        .setUriInfoImplPath(uriInfo);
-  }
-
-  public FilterValidator goFilter() {
-    FilterOptionImpl filter = (FilterOptionImpl) uriInfo.getFilterOption();
-    if (filter == null) {
-      fail("no filter found");
-    }
-    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().setUpValidator(this).setExpand(expand);
-  }
-
-  public ResourceValidator goSelectItemPath(final int index) {
-    SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
-    SelectItem item = select.getSelectItems().get(index);
-    UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo();
-
-    return new ResourceValidator()
-        .setUpValidator(this)
-        .setEdm(edm)
-        .setUriInfoImplPath(uriInfo1);
-
-  }
-
-  // Validation
-  public UriValidator isKind(final UriInfoKind kind) {
-    assertEquals(kind, uriInfo.getKind());
-    return this;
-  }
-
-  public UriValidator isCustomParameter(final int index, final String name, final String value) {
-    if (uriInfo == null) {
-      fail("hasQueryParameter: uriInfo == null");
-    }
-
-    List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
-    if (list.size() <= index) {
-      fail("not enought queryParameters");
-    }
-
-    CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
-    assertEquals(name, option.getName());
-    assertEquals(value, option.getText());
-    return this;
-  }
-
-  public void isCrossJoinEntityList(final List<String> entitySets) {
-    if (uriInfo.getKind() != UriInfoKind.crossjoin) {
-      fail("invalid resource kind: " + uriInfo.getKind().toString());
-    }
-
-    int i = 0;
-    for (String entitySet : entitySets) {
-      assertEquals(entitySet, uriInfo.getEntitySetNames().get(i));
-      i++;
-    }
-
-  }
-
-  public UriValidator isExSyntax(final long errorID) {
-    assertEquals(UriParserSyntaxException.class, exception.getClass());
-    return this;
-  }
-
-  public UriValidator isExSemantic(final 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;
-  }
-
-  public UriValidator isEntityType(final FullQualifiedName fullName) {
-    if (uriInfo.getKind() != UriInfoKind.entityId) {
-      fail("invalid resource kind: " + uriInfo.getKind().toString());
-    }
-
-    assertEquals(fullName.toString(), fullName(uriInfo.getEntityTypeCast()));
-    return this;
-  }
-
-  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, final 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/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java
deleted file mode 100644
index 6febab2..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java
+++ /dev/null
@@ -1,23 +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.server.core.testutil;
-
-public interface Validator {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
index c7ec93b..4333a06 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
@@ -26,6 +26,7 @@ import java.util.List;
 
 import org.apache.olingo.odata4.server.core.uri.parser.RawUri;
 import org.apache.olingo.odata4.server.core.uri.parser.UriDecoder;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserSyntaxException;
 import org.junit.Test;
 
 public class RawUriTest {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java
index 222d067..b188355 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java
@@ -38,9 +38,6 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
 import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceEntitySetImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.CountOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
index 9a5f65b..1462ab9 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
@@ -42,25 +42,6 @@ import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
 import org.apache.olingo.odata4.server.core.edm.provider.EdmSingletonImpl;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriParameterImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceComplexPropertyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceCountImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceEntitySetImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceFunctionImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceItImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAllImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAnyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaVarImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceNavigationPropertyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourcePrimitivePropertyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceRefImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceRootImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceSingletonImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceStartingTypeFilterImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceTypedImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceValueImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
 import org.junit.Test;
@@ -495,6 +476,7 @@ public class UriParameterImplTest {
     assertEquals(true, impl.isCollection());
   }
 
+  /*
   @Test
   public void testUriResourceStartingTypeFilterImpl() {
     UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl();
@@ -516,5 +498,5 @@ public class UriParameterImplTest {
     impl.setKeyPredicates(keyPredicates);
     assertEquals(false, impl.isCollection());
 
-  }
+  }*/
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
index 7c41bff..ecbcaaf 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
@@ -18,12 +18,17 @@
  ******************************************************************************/
 package org.apache.olingo.odata4.server.core.uri.antlr;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.Arrays;
 
 import org.apache.olingo.odata4.commons.api.ODataApplicationException;
 import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
 import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
 import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind;
@@ -32,10 +37,11 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCall
 import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.server.core.testutil.FilterValidator;
-import org.apache.olingo.odata4.server.core.testutil.ResourceValidator;
-import org.apache.olingo.odata4.server.core.testutil.UriValidator;
-import org.apache.olingo.odata4.server.core.uri.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+import org.apache.olingo.odata4.server.core.uri.testutil.FilterValidator;
+import org.apache.olingo.odata4.server.core.uri.testutil.ResourceValidator;
+import org.apache.olingo.odata4.server.core.uri.testutil.UriValidator;
 import org.junit.Test;
 
 public class TestFullResourcePath {
@@ -53,7 +59,7 @@ public class TestFullResourcePath {
 
   @Test
   public void test() throws UriParserException {
-    // testUri.log("ESAllPrim?$orderby=PropertyDouble eq 3.5E+38");
+
   }
 
   @Test
@@ -2344,10 +2350,11 @@ public class TestFullResourcePath {
         + "$expand=com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
         .isKind(UriInfoKind.resource).goPath().first()
         .goExpand().first()
+        .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
         .goPath().first()
-        .isType(EdmTechProvider.nameETTwoKeyNav)
-        .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
-        .n()
+        // .isType(EdmTechProvider.nameETTwoKeyNav)
+        // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+        // .n()
         .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
 
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')?"
@@ -2356,10 +2363,11 @@ public class TestFullResourcePath {
         .isKeyPredicate(0, "PropertyInt16", "1")
         .isKeyPredicate(1, "PropertyString", "'Hugo'")
         .goExpand().first()
+        .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
         .goPath().first()
-        .isType(EdmTechProvider.nameETTwoKeyNav)
-        .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
-        .n()
+        //.isType(EdmTechProvider.nameETTwoKeyNav)
+        //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+        //.n()
         .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
 
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?"
@@ -2368,10 +2376,11 @@ public class TestFullResourcePath {
         .isKeyPredicate(0, "PropertyInt16", "1")
         .isKeyPredicate(1, "PropertyString", "'2'")
         .goExpand().first()
+        .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
         .goPath().first()
-        .isType(EdmTechProvider.nameETTwoKeyNav)
-        .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
-        .n()
+        //.isType(EdmTechProvider.nameETTwoKeyNav)
+        //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+        //.n()
         .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true);
 
     testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav"
@@ -2380,20 +2389,22 @@ public class TestFullResourcePath {
         .isKeyPredicate(0, "PropertyInt16", "1")
         .isKeyPredicate(1, "PropertyString", "'2'")
         .goExpand().first()
+        .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
         .goPath().first()
-        .isType(EdmTechProvider.nameETTwoKeyNav)
-        .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
-        .n()
+        //.isType(EdmTechProvider.nameETTwoKeyNav)
+        //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+        //.n()
         .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
         .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav);
 
     testUri.run("ESTwoKeyNav?$expand=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexNav/NavPropertyETTwoKeyNavOne")
         .isKind(UriInfoKind.resource).goPath().first()
         .goExpand().first()
+        .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
         .goPath().first()
-        .isType(EdmTechProvider.nameETTwoKeyNav)
-        .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
-        .n()
+        //.isType(EdmTechProvider.nameETTwoKeyNav)
+        //.isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+        //.n()
         .isComplex("PropertyComplexNav")
         .isType(EdmTechProvider.nameCTBasePrimCompNav)
         .n()
@@ -2403,10 +2414,11 @@ public class TestFullResourcePath {
         + "/com.sap.odata.test1.CTTwoBasePrimCompNav/NavPropertyETTwoKeyNavOne")
         .isKind(UriInfoKind.resource).goPath().first()
         .goExpand().first()
+        .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
         .goPath().first()
-        .isType(EdmTechProvider.nameETTwoKeyNav)
-        .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
-        .n()
+        //.isType(EdmTechProvider.nameETTwoKeyNav)
+        //.isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+        //.n()
         .isComplex("PropertyComplexNav")
         .isType(EdmTechProvider.nameCTBasePrimCompNav)
         .n()
@@ -2434,11 +2446,12 @@ public class TestFullResourcePath {
         .isKeyPredicate(0, "PropertyInt16", "1")
         .isKeyPredicate(1, "PropertyString", "'2'")
         .goExpand().first()
+        .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav)
         .goPath().first()
-        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
-        .isType(EdmTechProvider.nameETTwoKeyNav)
-        .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
-        .n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
+        //.isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        //.isType(EdmTechProvider.nameETTwoKeyNav)
+        //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+        //.n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
         .isType(EdmTechProvider.nameETTwoKeyNav)
         .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav)
         .goUpExpandValidator()
@@ -2462,6 +2475,17 @@ public class TestFullResourcePath {
         .goPath().first()
         .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
         .isType(EdmTechProvider.nameETKeyNav);
+    
+    testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$select=com.sap.odata.test1.ETBaseTwoKeyNav"
+        + "/PropertyInt16")
+        .isKind(UriInfoKind.resource).goPath()
+        .first()
+        .isKeyPredicate(0, "PropertyInt16", "1")
+        .isKeyPredicate(1, "PropertyString", "'2'")
+        .isSelectStartType(0, EdmTechProvider.nameETBaseTwoKeyNav)
+        .goSelectItem(0)
+        .first()
+        .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);        
 
     testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyInt16)")
         .isKind(UriInfoKind.resource)
@@ -2835,25 +2859,27 @@ public class TestFullResourcePath {
         .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>>")
+        .is("<<PropertyDate> eq <2013-11-12>>")
         .root().left()
         .isType(EdmTechProvider.nameDate)
-        .isMember().goPath()
-        .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter)
-        .isType(EdmTechProvider.nameETTwoKeyNav).isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
-        .n().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false)
+        .isMember().isMemberStartType(EdmTechProvider.nameETBaseTwoKeyNav).goPath()
+        // .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        // .isType(EdmTechProvider.nameETTwoKeyNav).isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+        // .n().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false)
+        .first().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false)
         .goUpFilterValidator()
         .root().right()
         .isLiteral("2013-11-12");
 
     testFilter.runOnCTTwoPrim("com.sap.odata.test1.CTBase/AdditionalPropString eq 'SomeString'")
-        .is("<<com.sap.odata.test1.CTTwoPrim/com.sap.odata.test1.CTBase/AdditionalPropString> eq <'SomeString'>>")
+        .is("<<AdditionalPropString> eq <'SomeString'>>")
         .root().left()
         .isType(EdmTechProvider.nameString)
-        .isMember().goPath()
-        .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter)
-        .isType(EdmTechProvider.nameCTTwoPrim).isTypeFilterOnEntry(EdmTechProvider.nameCTBase)
-        .n().isPrimitiveProperty("AdditionalPropString", EdmTechProvider.nameString, false)
+        .isMember().isMemberStartType(EdmTechProvider.nameCTBase).goPath()
+        // .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        // .isType(EdmTechProvider.nameCTTwoPrim).isTypeFilterOnEntry(EdmTechProvider.nameCTBase)
+        // .n().isPrimitiveProperty("AdditionalPropString", EdmTechProvider.nameString, false)
+        .first().isPrimitiveProperty("AdditionalPropString", EdmTechProvider.nameString, false)
         .goUpFilterValidator()
         .root().right()
         .isLiteral("'SomeString'");
@@ -2874,7 +2900,7 @@ public class TestFullResourcePath {
         .root().right()
         .isLiteral("'SomeString'");
 
-    // testFilter.runOnETTwoKeyNavEx("invalid").isExSemantic(0);
+    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);
@@ -3269,7 +3295,7 @@ public class TestFullResourcePath {
         .root().right()
         .isType(EdmTechProvider.nameDecimal);
 
-    // DODO not synced
+    //
     testFilter.runOnETAllPrim("PropertyDecimal ge PropertyDecimal")
         .is("<<PropertyDecimal> ge <PropertyDecimal>>")
         .isBinary(BinaryOperatorKind.GE)
@@ -3291,6 +3317,13 @@ public class TestFullResourcePath {
         .isType(EdmTechProvider.nameDecimal)
         .root().right()
         .isType(EdmTechProvider.nameDecimal);
+
+    testFilter.runOnETAllPrim("PropertyDecimal sub NaN")
+        .right().isLiteral("NaN").isType(EdmTechProvider.nameDecimal);
+    testFilter.runOnETAllPrim("PropertyDecimal sub -INF")
+        .right().isLiteral("-INF").isType(EdmTechProvider.nameDecimal);
+    testFilter.runOnETAllPrim("PropertyDecimal sub INF")
+        .right().isLiteral("INF").isType(EdmTechProvider.nameDecimal);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
index 60ddae6..77aa204 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
@@ -19,7 +19,7 @@
 package org.apache.olingo.odata4.server.core.uri.antlr;
 
 import org.antlr.v4.runtime.Lexer;
-import org.apache.olingo.odata4.server.core.testutil.TokenValidator;
+import org.apache.olingo.odata4.server.core.uri.testutil.TokenValidator;
 import org.junit.Test;
 
 public class TestLexer {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
index 09d932b..a856e89 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
@@ -18,7 +18,7 @@
  ******************************************************************************/
 package org.apache.olingo.odata4.server.core.uri.antlr;
 
-import org.apache.olingo.odata4.server.core.testutil.ParserValidator;
+import org.apache.olingo.odata4.server.core.uri.testutil.ParserValidator;
 import org.junit.Test;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
index 66eed3f..77dc1ac 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
@@ -30,10 +30,10 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCall
 import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.server.core.testutil.FilterValidator;
-import org.apache.olingo.odata4.server.core.testutil.ResourceValidator;
-import org.apache.olingo.odata4.server.core.testutil.UriValidator;
-import org.apache.olingo.odata4.server.core.uri.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.parser.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.testutil.FilterValidator;
+import org.apache.olingo.odata4.server.core.uri.testutil.ResourceValidator;
+import org.apache.olingo.odata4.server.core.uri.testutil.UriValidator;
 import org.junit.Test;
 
 public class TestUriParserImpl {
@@ -1005,40 +1005,44 @@ public class TestUriParserImpl {
     // on EntityType entry
     testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')?"
         + "$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
-        .goFilter().root().isMember().goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
-        .isType(EdmTechProvider.nameETTwoKeyNav, false)
-        .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
-        .at(1).isType(EdmTechProvider.nameDate);
+        .goFilter().root().isMember()
+        .isMemberStartType(EdmTechProvider.nameETBaseTwoKeyNav).goPath()
+        // .at(0)
+        // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        // .isType(EdmTechProvider.nameETTwoKeyNav, false)
+        // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+        .at(0).isType(EdmTechProvider.nameDate);
 
     // on EntityType collection
     testUri.run("ESTwoKeyNav?$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
-        .goFilter().root().isMember().goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
-        .isType(EdmTechProvider.nameETTwoKeyNav, true)
-        .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
-        .at(1).isType(EdmTechProvider.nameDate);
+        .goFilter().root().isMember()
+        .isMemberStartType(EdmTechProvider.nameETBaseTwoKeyNav).goPath()
+        // .at(0)
+        // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        // .isType(EdmTechProvider.nameETTwoKeyNav, true)
+        // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+        .at(0).isType(EdmTechProvider.nameDate);
 
     testUri.run("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?"
         + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
-        .goFilter().root().isMember().goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
-        .isType(EdmTechProvider.nameCTTwoPrim, false)
-        .isTypeFilterOnEntry(EdmTechProvider.nameCTBase)
-        .at(1).isType(EdmTechProvider.nameString);
+        .goFilter().root().isMember()
+        .isMemberStartType(EdmTechProvider.nameCTBase).goPath()
+        //.at(0)
+        //.isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        //.isType(EdmTechProvider.nameCTTwoPrim, false)
+        //.isTypeFilterOnEntry(EdmTechProvider.nameCTBase)
+        .at(0).isType(EdmTechProvider.nameString);
 
     // on Complex collection
     testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?"
         + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
-        .goFilter().root().isMember().goPath()
-        .at(0)
-        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
-        .isType(EdmTechProvider.nameCTTwoPrim, true)
-        .isTypeFilterOnCollection(EdmTechProvider.nameCTBase)
-        .at(1).isType(EdmTechProvider.nameString);
+        .goFilter().root().isMember()
+        .isMemberStartType(EdmTechProvider.nameCTBase).goPath()
+        //.at(0)
+        //.isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+        //.isType(EdmTechProvider.nameCTTwoPrim, true)
+        //.isTypeFilterOnCollection(EdmTechProvider.nameCTBase)
+        .at(0).isType(EdmTechProvider.nameString);
 
   }
 
@@ -1116,16 +1120,10 @@ public class TestUriParserImpl {
         .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false);
 
     testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.ETBaseTwoKeyNav")
-        .goSelectItemPath(0)
-        .first()
-        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
-        .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav);
+        .isSelectStartType(0,EdmTechProvider.nameETBaseTwoKeyNav);
 
     testUri.run("ESTwoKeyNav/PropertyComplexNav?$select=com.sap.odata.test1.CTTwoBasePrimCompNav")
-        .goSelectItemPath(0)
-        .first()
-        .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
-        .isTypeFilterOnCollection(EdmTechProvider.nameCTTwoBasePrimCompNav);
+        .isSelectStartType(0,EdmTechProvider.nameCTTwoBasePrimCompNav);
 
     testUri.run("ESTwoKeyNav?$select=PropertyComplexNav/com.sap.odata.test1.CTTwoBasePrimCompNav")
         .goSelectItemPath(0)

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
index 0f4c737..2939395 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
@@ -29,7 +29,7 @@ import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
 import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.expression.AliasImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
@@ -109,8 +109,8 @@ public class QueryOptionTest {
 
     option = new ExpandItemImpl();
     UriInfoResource resource = new UriInfoImpl().asUriInfoResource();
-    option.setResourceInfo(resource);
-    assertEquals(resource, option.getResourceInfo());
+    option.setResourcePath(resource);
+    assertEquals(resource, option.getResourcePath());
 
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java
index 6d29be5..9c22a61 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java
@@ -38,10 +38,10 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.UnaryOpera
 import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
 import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.server.core.testutil.FilterTreeToText;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceFunctionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl;
+import org.apache.olingo.odata4.server.core.uri.testutil.FilterTreeToText;
 import org.junit.Test;
 
 public class ExpressionTest {
@@ -135,11 +135,11 @@ public class ExpressionTest {
     EdmAction action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
     UriInfoResource uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
         new UriResourceActionImpl().setAction(action)).asUriInfoResource();
-    expression.setPath(uriInfo);
+    expression.setResourcePath(uriInfo);
     assertEquals(action.getReturnType().getType(), expression.getType());
 
     // check accept and path
-    assertEquals(uriInfo, expression.getPath());
+    assertEquals(uriInfo, expression.getResourcePath());
     assertEquals("<UARTPrimParam>", expression.accept(new FilterTreeToText()));
 
     // UriResourceImplTyped check collection = false case
@@ -147,21 +147,21 @@ public class ExpressionTest {
 
     // UriResourceImplTyped check collection = true case
     action = edm.getAction(EdmTechProvider.nameUARTPrimCollParam, null, null);
-    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+    expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
         new UriResourceActionImpl().setAction(action))
         .asUriInfoResource());
     assertEquals(true, expression.isCollection());
 
     // UriResourceImplTyped with filter
     action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
-    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+    expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
         new UriResourceActionImpl().setAction(action).setTypeFilter(entityType))
         .asUriInfoResource());
     assertEquals(entityType, expression.getType());
 
     // UriResourceImplKeyPred
     EdmFunction function = edm.getFunction(EdmTechProvider.nameUFCRTETKeyNav, null, null, null);
-    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+    expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
         new UriResourceFunctionImpl().setFunction(function))
         .asUriInfoResource());
     assertEquals(function.getReturnType().getType(), expression.getType());
@@ -170,7 +170,7 @@ public class ExpressionTest {
     EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
     function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
         Arrays.asList(("ParameterInt16")));
-    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+    expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
         new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityBaseType))
         .asUriInfoResource());
     assertEquals(entityBaseType, expression.getType());
@@ -179,7 +179,7 @@ public class ExpressionTest {
     entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
     function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
         Arrays.asList(("ParameterInt16")));
-    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+    expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
         new UriResourceFunctionImpl().setFunction(function).setCollectionTypeFilter(entityBaseType))
         .asUriInfoResource());
     assertEquals(entityBaseType, expression.getType());
@@ -188,7 +188,7 @@ public class ExpressionTest {
     entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
     function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
         Arrays.asList(("ParameterInt16")));
-    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.all));
+    expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.all));
     assertEquals(null, expression.getType());
 
     // no typed collection else case


[7/9] Merge from origin/master

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
index 0000000,ff090fd..0e1b46a
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java
@@@ -1,0 -1,583 +1,583 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.assertNotNull;
+ import static org.junit.Assert.fail;
+ 
+ import java.util.List;
+ 
+ import org.apache.olingo.odata4.commons.api.ODataApplicationException;
+ import org.apache.olingo.odata4.commons.api.edm.Edm;
+ import org.apache.olingo.odata4.commons.api.edm.EdmElement;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+ import org.apache.olingo.odata4.server.api.uri.UriInfo;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+ import org.apache.olingo.odata4.server.api.uri.UriParameter;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
+ import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceComplexPropertyImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceEntitySetImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAllImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAnyImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceNavigationPropertyImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourcePrimitivePropertyImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceSingletonImpl;
+ import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl;
+ import org.apache.olingo.odata4.server.core.uri.parser.UriParserException;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+ 
+ public class ResourceValidator implements Validator {
+   private Edm edm;
+   private Validator invokedBy;
+   private UriInfo uriInfo = null;
+ 
+   private UriResourceImpl uriPathInfo = null;
+   private int uriResourceIndex;
+ 
+   // --- Setup ---
+ 
+   public ResourceValidator setUpValidator(final Validator uriValidator) {
+     invokedBy = uriValidator;
+     return this;
+   }
+ 
+   public ResourceValidator setEdm(final Edm edm) {
+     this.edm = edm;
+     return this;
+   }
+ 
+   public ResourceValidator setUriInfoImplPath(final UriInfoImpl uriInfoPath) {
+     uriInfo = uriInfoPath;
+     last();
+     return this;
+   }
+ 
+   // --- Execution ---
+ 
+   public ResourceValidator run(final String uri) {
+     ParserWithLogging testParser = new ParserWithLogging();
+ 
+     UriInfoImpl uriInfoTmp = null;
+     uriPathInfo = null;
+     try {
+       uriInfoTmp = (UriInfoImpl) testParser.parseUri(uri, edm);
+     } catch (UriParserException e) {
+       fail("Exception occured while parsing the URI: " + uri + "\n"
+           + " Message: " + e.getMessage());
+     }
+ 
+     if (uriInfoTmp.getKind() != UriInfoKind.resource) {
+       fail("Invalid UriInfoKind: " + uriInfoTmp.getKind().toString());
+     }
+     uriInfo = uriInfoTmp;
+ 
+     first();
+     return this;
+   }
+ 
+   // --- Navigation ---
+ 
+   public UriValidator goUpUriValidator() {
+     return (UriValidator) invokedBy;
+   }
+ 
+   public ExpandValidator goUpExpandValidator() {
+     return (ExpandValidator) invokedBy;
+   }
+ 
+   public FilterValidator goUpFilterValidator() {
+     return (FilterValidator) invokedBy;
+   }
+ 
+   public FilterValidator goParameter(final int index) {
+     assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+     UriResourceFunctionImpl function = (UriResourceFunctionImpl) uriPathInfo;
+ 
+     return new FilterValidator()
+         .setEdm(edm)
 -        .setExpression(function.getParameters().get(index).getExression())
++        .setExpression(function.getParameters().get(index).getExpression())
+         .setValidator(this);
+   }
+ 
+   public FilterValidator goLambdaExpression() {
+     if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
+       return new FilterValidator()
+           .setEdm(edm)
+           .setExpression(((UriResourceLambdaAllImpl) uriPathInfo).getExpression());
+ 
+     } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
+       return new FilterValidator()
+           .setEdm(edm)
+           .setExpression(((UriResourceLambdaAnyImpl) uriPathInfo).getExpression());
+     } else {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+     return null;
+   }
+ 
+   public ResourceValidator goSelectItem(final int index) {
+     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+ 
+     SelectItem item = select.getSelectItems().get(index);
+     UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourcePath();
+ 
+     return new ResourceValidator()
+         .setUpValidator(this)
+         .setEdm(edm)
+         .setUriInfoImplPath(uriInfo1);
+ 
+   }
+ 
+   public ExpandValidator goExpand() {
+     ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
+     if (expand == null) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+ 
+     return new ExpandValidator().setUpValidator(this).setExpand(expand);
+   }
+ 
+   public ResourceValidator first() {
+     uriResourceIndex = 0;
+     uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(0);
+     return this;
+   }
+ 
+   public ResourceValidator last() {
+     uriResourceIndex = 0;
+ 
+     try {
+       uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
+       uriResourceIndex = uriInfo.getUriResourceParts().size() - 1;
+     } catch (IndexOutOfBoundsException ex) {
+       fail("not enough segments");
+     }
+ 
+     return this;
+   }
+ 
+   public ResourceValidator n() {
+     uriResourceIndex++;
+ 
+     try {
+       uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriResourceIndex);
+     } catch (IndexOutOfBoundsException ex) {
+       fail("not enough segments");
+     }
+ 
+     return this;
+   }
+ 
+   public ResourceValidator at(final int index) {
+     uriResourceIndex = index;
+     try {
+       uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(index);
+     } catch (IndexOutOfBoundsException ex) {
+       fail("not enough segments");
+     }
+     return this;
+   }
+ 
+   // --- Validation ---
+ 
+   public ResourceValidator isLambdaVar(final String var) {
+     String actualVar = null;
+     if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
+       actualVar = ((UriResourceLambdaAllImpl) uriPathInfo).getLamdaVariable();
+     } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
+       actualVar = ((UriResourceLambdaAnyImpl) uriPathInfo).getLamdaVariable();
+     } else {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+ 
+     assertEquals(var, actualVar);
+     return this;
+   }
+ 
+   public ResourceValidator isTypeFilter(final FullQualifiedName expectedType) {
+ 
+     if (uriPathInfo.getKind() != UriResourceKind.complexProperty &&
+         uriPathInfo.getKind() != UriResourceKind.singleton &&
+         uriPathInfo.getKind() != UriResourceKind.startingTypeFilter) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+ 
+     EdmType actualType = null;
+     if (uriPathInfo instanceof UriResourceComplexPropertyImpl) {
+       actualType = ((UriResourceComplexPropertyImpl) uriPathInfo).getComplexTypeFilter();
+     } else if (uriPathInfo instanceof UriResourceSingletonImpl) {
+       actualType = ((UriResourceSingletonImpl) uriPathInfo).getEntityTypeFilter();
+     }
+ 
+     if (actualType == null) {
+       fail("type information not set");
+     }
+ 
+     FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+ 
+     assertEquals(expectedType.toString(), actualName.toString());
+     return this;
+   }
+ 
+   public ResourceValidator isType(final FullQualifiedName type) {
+     if (!(uriPathInfo instanceof UriResourcePartTyped)) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+     UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
+ 
+     EdmType actualType = uriPathInfoTyped.getType();
+     if (actualType == null) {
+       fail("type information not set");
+     }
+ 
+     FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+ 
+     assertEquals(type.toString(), actualName.toString());
+ 
+     return this;
+   }
+ 
+   public ResourceValidator isType(final FullQualifiedName type, final boolean isFinallyACollection) {
+     isType(type);
+     assertEquals(isFinallyACollection, ((UriResourcePartTyped) uriPathInfo).isCollection());
+     return this;
+   }
+ 
+   public ResourceValidator isTypeFilterOnEntry(final FullQualifiedName type) {
+     if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+ 
+     UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
+ 
+     // input parameter type may be null in order to assert that the singleTypeFilter is not set
+     EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry();
+     if (type == null) {
+       assertEquals(type, actualType);
+     } else {
+       assertEquals(type.toString(), new FullQualifiedName(actualType.getNamespace(), actualType.getName()).toString());
+     }
+ 
+     return this;
+   }
+ 
+   public ResourceValidator isTypeFilterOnCollection(final FullQualifiedName expectedType) {
+     if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+     UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
+ 
+     // input parameter type may be null in order to assert that the collectionTypeFilter is not set
+     EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection();
+     if (expectedType == null) {
+       assertEquals(expectedType, actualType);
+     } else {
+       FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+       assertEquals(expectedType.toString(), actualName.toString());
+     }
+ 
+     return this;
+   }
+ 
+   // other functions
+   public ResourceValidator checkCustomParameter(final int index, final String name, final String value) {
+     if (uriInfo == null) {
+       fail("hasQueryParameter: uriInfo == null");
+     }
+ 
+     List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
+     if (list.size() <= index) {
+       fail("not enough queryParameters");
+     }
+ 
+     CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
+     assertEquals(name, option.getName());
+     assertEquals(value, option.getText());
+     return this;
+   }
+ 
+   // TODO remove
+   public ResourceValidator isCollection(final boolean isCollection) {
+     if (!(uriPathInfo instanceof UriResourcePartTyped)) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+     UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
+ 
+     EdmType type = uriPathInfoTyped.getType();
+     if (type == null) {
+       fail("isCollection: type == null");
+     }
+     assertEquals(isCollection, uriPathInfoTyped.isCollection());
+     return this;
+   }
+ 
+   public ResourceValidator isFilterString(final String expectedFilterTreeAsString) {
+ 
+     ExpressionImpl filterTree = (ExpressionImpl) uriInfo.getFilterOption().getExpression();
+     try {
+       String filterTreeAsString = filterTree.accept(new FilterTreeToText());
+       assertEquals(expectedFilterTreeAsString, filterTreeAsString);
+     } catch (ExpressionVisitException e) {
+       fail("isFilterString: Exception " + e.getMessage() + " occured");
+     } catch (ODataApplicationException e) {
+       fail("isFilterString: Exception " + e.getMessage() + " occured");
+     }
+ 
+     return this;
+   }
+ 
+   public ResourceValidator isKeyPredicateRef(final int index, final String name, final String refencedProperty) {
+     if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+ 
+     UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
+     List<UriParameter> keyPredicates = info.getKeyPredicates();
+     assertEquals(name, keyPredicates.get(index).getName());
+     assertEquals(refencedProperty, keyPredicates.get(index).getRefencedProperty());
+     return this;
+ 
+   }
+ 
+   public ResourceValidator isKeyPredicate(final int index, final String name, final String text) {
+     if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+ 
+     UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
+     List<UriParameter> keyPredicates = info.getKeyPredicates();
+     assertEquals(name, keyPredicates.get(index).getName());
+     assertEquals(text, keyPredicates.get(index).getText());
+     return this;
+ 
+   }
+ 
+   public ResourceValidator isParameter(final int index, final String name, final String text) {
+     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(text, keyPredicates.get(index).getText());
+     return this;
+ 
+   }
+ 
+   public ResourceValidator 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 ResourceValidator isKind(final UriInfoKind kind) {
+     assertEquals(kind, uriInfo.getKind());
+     return this;
+   }
+ 
+   public ResourceValidator isPrimitiveProperty(final String name,
+       final FullQualifiedName type, final boolean isCollection) {
+     if (!(uriPathInfo instanceof UriResourcePrimitivePropertyImpl)) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+ 
+     UriResourcePrimitivePropertyImpl uriPathInfoProp = (UriResourcePrimitivePropertyImpl) uriPathInfo;
+ 
+     EdmElement property = uriPathInfoProp.getProperty();
+ 
+     assertEquals(name, property.getName());
+     assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+     assertEquals(isCollection, property.isCollection());
+     return this;
+   }
+ 
+   public ResourceValidator
+       isComplexProperty(final String name, final FullQualifiedName type, final boolean isCollection) {
+     if (!(uriPathInfo instanceof UriResourceComplexPropertyImpl)) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+ 
+     UriResourceComplexPropertyImpl uriPathInfoProp = (UriResourceComplexPropertyImpl) uriPathInfo;
+ 
+     EdmElement property = uriPathInfoProp.getProperty();
+ 
+     assertEquals(name, property.getName());
+     assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+     assertEquals(isCollection, property.isCollection());
+     return this;
+   }
+ 
+   public ResourceValidator isNavProperty(final String name, final FullQualifiedName type, final boolean isCollection) {
+     if (!(uriPathInfo instanceof UriResourceNavigationPropertyImpl)) {
+       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+     }
+ 
+     UriResourceNavigationPropertyImpl uriPathInfoProp = (UriResourceNavigationPropertyImpl) uriPathInfo;
+ 
+     EdmElement property = uriPathInfoProp.getProperty();
+ 
+     assertEquals(name, property.getName());
+     assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+     assertEquals(isCollection, uriPathInfoProp.isCollection());
+     return this;
+   }
+ 
+   public ResourceValidator isUriPathInfoKind(final UriResourceKind infoType) {
+     assertNotNull(uriPathInfo);
+     assertEquals(infoType, uriPathInfo.getKind());
+     return this;
+   }
+ 
+   public ResourceValidator isAction(final String name) {
+     assertEquals(UriResourceKind.action, uriPathInfo.getKind());
+     assertEquals(name, ((UriResourceActionImpl) uriPathInfo).getAction().getName());
+     return this;
+   }
+ 
+   public ResourceValidator isFunction(final String name) {
+     assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+     assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunction().getName());
+     return this;
+   }
+ 
+   public ResourceValidator isFunctionImport(final String name) {
+     assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+     assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunctionImport().getName());
+     return this;
+   }
+ 
+   public ResourceValidator isEntitySet(final String name) {
+     assertEquals(UriResourceKind.entitySet, uriPathInfo.getKind());
+     assertEquals(name, ((UriResourceEntitySetImpl) uriPathInfo).getEntitySet().getName());
+     return this;
+   }
+ 
+   public ResourceValidator isComplex(final String name) {
+     assertEquals(UriResourceKind.complexProperty, uriPathInfo.getKind());
+     assertEquals(name, ((UriResourceComplexPropertyImpl) uriPathInfo).getProperty().getName());
+     return this;
+   }
+ 
+   public ResourceValidator isSingleton(final String name) {
+     assertEquals(UriResourceKind.singleton, uriPathInfo.getKind());
+     assertEquals(name, ((UriResourceSingletonImpl) uriPathInfo).getSingleton().getName());
+     return this;
+   }
+ 
+   public ResourceValidator isValue() {
+     assertEquals(UriResourceKind.value, uriPathInfo.getKind());
+     return this;
+   }
+ 
+   public ResourceValidator isCount() {
+     assertEquals(UriResourceKind.count, uriPathInfo.getKind());
+     return this;
+   }
+ 
+   public ResourceValidator isRef() {
+     assertEquals(UriResourceKind.ref, uriPathInfo.getKind());
+     return this;
+   }
+ 
+   public ResourceValidator isActionImport(final String actionName) {
+     assertEquals(UriResourceKind.action, uriPathInfo.getKind());
+     assertEquals(actionName, ((UriResourceActionImpl) uriPathInfo).getActionImport().getName());
+     return this;
+   }
+ 
+   public ResourceValidator isIt() {
+     assertEquals(UriResourceKind.it, uriPathInfo.getKind());
+     return this;
+   }
+ 
+   public ResourceValidator isTopText(final String topText) {
+     assertEquals(topText, uriInfo.getTopOption().getText());
+     return this;
+   }
+ 
+   public ResourceValidator isFormatText(final String formatText) {
+     assertEquals(formatText, uriInfo.getFormatOption().getText());
+     return this;
+   }
+ 
+   public ResourceValidator isInlineCountText(final String inlineCountText) {
+     assertEquals(inlineCountText, uriInfo.getInlineCountOption().getText());
+     return this;
+   }
+ 
+   public ResourceValidator isSkipText(final String skipText) {
+     assertEquals(skipText, uriInfo.getSkipOption().getText());
+     return this;
+   }
+ 
+   public ResourceValidator isSkipTokenText(final String skipTokenText) {
+     assertEquals(skipTokenText, uriInfo.getSkipTokenOption().getText());
+     return this;
+   }
+ 
+   public ResourceValidator isSelectItemStar(final int index) {
+     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+ 
+     SelectItem item = select.getSelectItems().get(index);
+     assertEquals(true, item.isStar());
+     return this;
+   }
+ 
+   public ResourceValidator isSelectItemAllOp(final int index, final FullQualifiedName fqn) {
+     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+ 
+     SelectItem item = select.getSelectItems().get(index);
+     assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+     return this;
+   }
+ 
+   public ResourceValidator isSelectStartType(final int index, FullQualifiedName fullName) {
+     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+     SelectItem item = select.getSelectItems().get(index);
+ 
+     EdmType actualType = item.getStartTypeFilter();
+     
+     FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+     assertEquals(fullName, actualName);
+     return this;
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java
index 0000000,c634790..8f9f202
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java
@@@ -1,0 -1,105 +1,105 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.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;
+ import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
+ 
+ class TestErrorLogger implements ANTLRErrorListener {
+ 
+   private String prefix;
+   private int logLevel = 0;
+ 
+   public TestErrorLogger(final String prefix, final 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) {
+ 
+     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) {
+ 
+   }
+ 
+   @Override
+   public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
+       final int stopIndex,
+       final BitSet conflictingAlts, final ATNConfigSet configs) {
+ 
+   }
+ 
+   @Override
+   public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
+       final int stopIndex, final int prediction,
+       final ATNConfigSet configs) {
+ 
+   }
+ 
+   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);
+ 
+     printStack(recognizer);
+ 
+     System.out.println(" line/char :" + line + " / " + charPositionInLine);
+     System.out.println(" sym       :" + offendingSymbol);
+     if (e != null && e.getOffendingToken() != null) {
+ 
+       String lexerTokenName = "";
+       try {
+         lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+       } catch (ArrayIndexOutOfBoundsException es) {
+         lexerTokenName = "token error";
+       }
+ 
+       System.out.println(" tokenname:" + lexerTokenName);
+     }
+ 
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java
index 0000000,9a56c7f..f9047af
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java
@@@ -1,0 -1,194 +1,194 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import static org.junit.Assert.assertEquals;
+ 
+ import java.util.List;
+ 
+ import org.antlr.v4.runtime.ANTLRInputStream;
+ import org.antlr.v4.runtime.Token;
+ import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
+ 
+ //TODO extend to test also exception which can occure while paring
+ public class TokenValidator {
+ 
+   private String input = null;
+ 
+   private List<? extends Token> tokens = null;
+   private Token curToken = null;
+   private Exception curException = null;
+ 
+   private int startMode;
+   private int logLevel = 0;
+ 
+   // --- Setup ---
+ 
+   public TokenValidator log(final int logLevel) {
+     this.logLevel = logLevel;
+     return this;
+   }
+ 
+   // --- Execution ---
+ 
+   public TokenValidator run(final String uri) {
+     input = uri;
+ 
+     tokens = parseInput(uri);
+     if (logLevel > 0) {
+       showTokens();
+     }
+ 
+     first();
+     exFirst();
+     logLevel = 0;
+ 
+     return this;
+   }
+ 
+   // --- Navigation ---
+ 
+   // navigate within the tokenlist
+   public TokenValidator first() {
+     try {
+       curToken = tokens.get(0);
+     } catch (IndexOutOfBoundsException ex) {
+       curToken = null;
+     }
+     return this;
+   }
+ 
+   public TokenValidator last() {
+     curToken = tokens.get(tokens.size() - 1);
+     return this;
+   }
+ 
+   public TokenValidator at(final int index) {
+     try {
+       curToken = tokens.get(index);
+     } catch (IndexOutOfBoundsException ex) {
+       curToken = null;
+     }
+     return this;
+   }
+ 
+   public TokenValidator exLast() {
+     // curException = exceptions.get(exceptions.size() - 1);
+     return this;
+   }
+ 
+   // navigate within the exception list
+   public TokenValidator exFirst() {
+     try {
+       // curException = exceptions.get(0);
+     } catch (IndexOutOfBoundsException ex) {
+       curException = null;
+     }
+     return this;
+ 
+   }
+ 
+   public TokenValidator exAt(final int index) {
+     try {
+       // curException = exceptions.get(index);
+     } catch (IndexOutOfBoundsException ex) {
+       curException = null;
+     }
+     return this;
+   }
+ 
+   // --- Validation ---
+ 
+   public TokenValidator isText(final String expected) {
+     assertEquals(expected, curToken.getText());
+     return this;
+   }
+ 
+   public TokenValidator isAllText(final String expected) {
+     String actual = "";
+ 
+     for (Token curToken : tokens) {
+       actual += curToken.getText();
+     }
+     assertEquals(expected, actual);
+     return this;
+   }
+ 
+   public TokenValidator isAllInput() {
+     String actual = "";
+ 
+     for (Token curToken : tokens) {
+       actual += curToken.getText();
+     }
+     assertEquals(input, actual);
+     return this;
+   }
+ 
+   public TokenValidator isInput() {
+     assertEquals(input, curToken.getText());
+     return this;
+   }
+ 
+   public TokenValidator isType(final int expected) {
+     assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
+     return this;
+   }
+ 
+   public TokenValidator isExType(final Class<?> exClass) {
+     assertEquals(exClass, curException.getClass());
+     return this;
+   }
+ 
+   public void globalMode(final int mode) {
+     startMode = mode;
+   }
+ 
+   // --- Helper ---
+ 
+   private List<? extends Token> parseInput(final String input) {
+     ANTLRInputStream inputStream = new ANTLRInputStream(input);
+ 
+     UriLexer lexer = new UriLexerWithTrace(inputStream, logLevel, startMode);
+     // lexer.addErrorListener(new ErrorCollector(this));
+     return lexer.getAllTokens();
+   }
+ 
+   public TokenValidator showTokens() {
+     boolean first = true;
+     System.out.println("input: " + input);
+     String nL = "\n";
+     String out = "[" + nL;
+     for (Token token : tokens) {
+       if (!first) {
+         out += ",";
+         first = false;
+       }
+       int index = token.getType();
+       if (index != -1) {
+         out += "\"" + token.getText() + "\"" + "     " + UriLexer.tokenNames[index] + nL;
+       } else {
+         out += "\"" + token.getText() + "\"" + "     " + index + nL;
+       }
+     }
+     out += ']';
+     System.out.println("tokens: " + out);
+     return this;
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java
index 0000000,60d5b68..b9f8b36
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java
@@@ -1,0 -1,85 +1,85 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import org.antlr.v4.runtime.ANTLRInputStream;
+ import org.antlr.v4.runtime.Token;
+ import org.apache.olingo.odata4.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/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java
index 0000000,b5478bf..fd1954b
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java
@@@ -1,0 -1,258 +1,258 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.fail;
+ 
+ import java.util.List;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.Edm;
+ import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+ import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+ import org.apache.olingo.odata4.server.core.uri.parser.Parser;
+ import org.apache.olingo.odata4.server.core.uri.parser.UriParserException;
+ import org.apache.olingo.odata4.server.core.uri.parser.UriParserSemanticException;
+ import org.apache.olingo.odata4.server.core.uri.parser.UriParserSyntaxException;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+ import org.apache.olingo.odata4.server.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) {
+     this.edm = edm;
+     return this;
+   }
+ 
+   // 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, 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, edm);
+       fail("Exception expected");
+     } catch (UriParserException e) {
+       exception = e;
+     }
+ 
+     return this;
+   }
+ 
+   public UriValidator log(final String uri) {
+     ParserWithLogging parserTest = new ParserWithLogging();
+     parserTest.setLogLevel(1);
+     uriInfo = null;
+     try {
+       // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
+       uriInfo = (UriInfoImpl) parserTest.parseUri(uri, edm);
+     } catch (UriParserException e) {
+       fail("Exception occured while parsing the URI: " + uri + "\n"
+           + " Exception: " + e.getMessage());
+     }
+ 
+     return this;
+   }
+ 
+   // Navigation
+   public ResourceValidator goPath() {
+     if (uriInfo.getKind() != UriInfoKind.resource) {
+       fail("invalid resource kind: " + uriInfo.getKind().toString());
+     }
+ 
+     return new ResourceValidator()
+         .setUpValidator(this)
+         .setEdm(edm)
+         .setUriInfoImplPath(uriInfo);
+   }
+ 
+   public FilterValidator goFilter() {
+     FilterOptionImpl filter = (FilterOptionImpl) uriInfo.getFilterOption();
+     if (filter == null) {
+       fail("no filter found");
+     }
+     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().setUpValidator(this).setExpand(expand);
+   }
+ 
+   public ResourceValidator goSelectItemPath(final int index) {
+     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+ 
+     SelectItem item = select.getSelectItems().get(index);
+     UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourcePath();
+ 
+     return new ResourceValidator()
+         .setUpValidator(this)
+         .setEdm(edm)
+         .setUriInfoImplPath(uriInfo1);
+ 
+   }
+   
+   public UriValidator isSelectStartType(int index, final FullQualifiedName fullName) {
+     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+     SelectItem item = select.getSelectItems().get(index);
+     EdmType actualType = item.getStartTypeFilter();
+     
+     FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+     assertEquals(fullName, actualName);
+     return this;
+  
+   
+ }
+ 
+   // Validation
+   public UriValidator isKind(final UriInfoKind kind) {
+     assertEquals(kind, uriInfo.getKind());
+     return this;
+   }
+ 
+   public UriValidator isCustomParameter(final int index, final String name, final String value) {
+     if (uriInfo == null) {
+       fail("hasQueryParameter: uriInfo == null");
+     }
+ 
+     List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
+     if (list.size() <= index) {
+       fail("not enought queryParameters");
+     }
+ 
+     CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
+     assertEquals(name, option.getName());
+     assertEquals(value, option.getText());
+     return this;
+   }
+ 
+   public void isCrossJoinEntityList(final List<String> entitySets) {
+     if (uriInfo.getKind() != UriInfoKind.crossjoin) {
+       fail("invalid resource kind: " + uriInfo.getKind().toString());
+     }
+ 
+     int i = 0;
+     for (String entitySet : entitySets) {
+       assertEquals(entitySet, uriInfo.getEntitySetNames().get(i));
+       i++;
+     }
+ 
+   }
+ 
+   public UriValidator isExSyntax(final long errorID) {
+     assertEquals(UriParserSyntaxException.class, exception.getClass());
+     return this;
+   }
+ 
+   public UriValidator isExSemantic(final 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;
+   }
+ 
+   public UriValidator isEntityType(final FullQualifiedName fullName) {
+     if (uriInfo.getKind() != UriInfoKind.entityId) {
+       fail("invalid resource kind: " + uriInfo.getKind().toString());
+     }
+ 
+     assertEquals(fullName.toString(), fullName(uriInfo.getEntityTypeCast()));
+     return this;
+   }
+ 
+   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, final 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/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java
index 0000000,a7acc69..c4325ba
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java
@@@ -1,0 -1,23 +1,23 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ public interface Validator {
+ 
+ }


[9/9] git commit: Merge from origin/master

Posted by il...@apache.org.
Merge from origin/master


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/f094e109
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/f094e109
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/f094e109

Branch: refs/heads/olingo169
Commit: f094e109d7b43455db03099828aa0293d9f77417
Parents: e6728fd 32467b8
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Feb 20 14:28:17 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Feb 20 14:28:17 2014 +0100

----------------------------------------------------------------------
 .../odata4/server/api/uri/UriInfoResource.java  |   4 +-
 .../odata4/server/api/uri/UriParameter.java     |   2 +-
 .../api/uri/UriResourceStartingTypeFilter.java  |  29 -
 .../server/api/uri/queryoption/CountOption.java |  25 +
 .../server/api/uri/queryoption/ExpandItem.java  |   8 +-
 .../api/uri/queryoption/InlineCountOption.java  |  25 -
 .../server/api/uri/queryoption/SelectItem.java  |   5 +-
 .../api/uri/queryoption/expression/Member.java  |   6 +-
 .../odata4/server/core/uri/antlr/UriParser.g4   |   3 +-
 .../odata4/server/core/uri/UriInfoImpl.java     | 296 ++++++++++
 .../server/core/uri/UriParameterImpl.java       |  82 +++
 .../server/core/uri/UriParserException.java     |  36 --
 .../core/uri/UriParserSemanticException.java    |  37 --
 .../core/uri/UriParserSyntaxException.java      |  36 --
 .../server/core/uri/UriResourceActionImpl.java  |  77 +++
 .../uri/UriResourceComplexPropertyImpl.java     |  70 +++
 .../server/core/uri/UriResourceCountImpl.java   |  35 ++
 .../core/uri/UriResourceEntitySetImpl.java      |  66 +++
 .../core/uri/UriResourceFunctionImpl.java       | 111 ++++
 .../odata4/server/core/uri/UriResourceImpl.java |  39 ++
 .../server/core/uri/UriResourceItImpl.java      |  65 +++
 .../core/uri/UriResourceLambdaAllImpl.java      |  73 +++
 .../core/uri/UriResourceLambdaAnyImpl.java      |  72 +++
 .../core/uri/UriResourceLambdaVarImpl.java      |  70 +++
 .../uri/UriResourceNavigationPropertyImpl.java  |  63 ++
 .../uri/UriResourcePrimitivePropertyImpl.java   |  59 ++
 .../server/core/uri/UriResourceRefImpl.java     |  36 ++
 .../server/core/uri/UriResourceRootImpl.java    |  62 ++
 .../core/uri/UriResourceSingletonImpl.java      |  71 +++
 .../uri/UriResourceStartingTypeFilterImpl.java  |  66 +++
 .../server/core/uri/UriResourceTypedImpl.java   |  60 ++
 .../server/core/uri/UriResourceValueImpl.java   |  36 ++
 .../core/uri/UriResourceWithKeysImpl.java       |  99 ++++
 .../server/core/uri/apiimpl/UriInfoImpl.java    | 291 ---------
 .../core/uri/apiimpl/UriParameterImpl.java      |  82 ---
 .../core/uri/apiimpl/UriResourceActionImpl.java |  77 ---
 .../apiimpl/UriResourceComplexPropertyImpl.java |  70 ---
 .../core/uri/apiimpl/UriResourceCountImpl.java  |  35 --
 .../uri/apiimpl/UriResourceEntitySetImpl.java   |  66 ---
 .../uri/apiimpl/UriResourceFunctionImpl.java    | 111 ----
 .../core/uri/apiimpl/UriResourceImpl.java       |  39 --
 .../core/uri/apiimpl/UriResourceItImpl.java     |  65 ---
 .../uri/apiimpl/UriResourceLambdaAllImpl.java   |  73 ---
 .../uri/apiimpl/UriResourceLambdaAnyImpl.java   |  72 ---
 .../uri/apiimpl/UriResourceLambdaVarImpl.java   |  70 ---
 .../UriResourceNavigationPropertyImpl.java      |  63 --
 .../UriResourcePrimitivePropertyImpl.java       |  59 --
 .../core/uri/apiimpl/UriResourceRefImpl.java    |  36 --
 .../core/uri/apiimpl/UriResourceRootImpl.java   |  62 --
 .../uri/apiimpl/UriResourceSingletonImpl.java   |  71 ---
 .../UriResourceStartingTypeFilterImpl.java      |  68 ---
 .../core/uri/apiimpl/UriResourceTypedImpl.java  |  60 --
 .../core/uri/apiimpl/UriResourceValueImpl.java  |  36 --
 .../uri/apiimpl/UriResourceWithKeysImpl.java    |  99 ----
 .../odata4/server/core/uri/parser/Parser.java   |   6 +-
 .../odata4/server/core/uri/parser/RawUri.java   |   2 +-
 .../server/core/uri/parser/UriContext.java      |   2 +-
 .../server/core/uri/parser/UriDecoder.java      |   3 +-
 .../core/uri/parser/UriParseTreeVisitor.java    | 194 ++++--
 .../core/uri/parser/UriParserException.java     |  36 ++
 .../uri/parser/UriParserSemanticException.java  |  37 ++
 .../uri/parser/UriParserSyntaxException.java    |  36 ++
 .../core/uri/queryoption/CountOptionImpl.java   |   4 +-
 .../core/uri/queryoption/ExpandItemImpl.java    |  24 +-
 .../core/uri/queryoption/SelectItemImpl.java    |  17 +-
 .../uri/queryoption/expression/MemberImpl.java  |  23 +-
 .../server/core/testutil/ExpandValidator.java   | 220 -------
 .../server/core/testutil/FilterTreeToText.java  | 154 -----
 .../server/core/testutil/FilterValidator.java   | 518 ----------------
 .../server/core/testutil/ParseTreeToText.java   |  82 ---
 .../server/core/testutil/ParserValidator.java   | 243 --------
 .../server/core/testutil/ParserWithLogging.java |  56 --
 .../server/core/testutil/ResourceValidator.java | 571 ------------------
 .../server/core/testutil/TestErrorLogger.java   | 105 ----
 .../server/core/testutil/TokenValidator.java    | 194 ------
 .../server/core/testutil/UriLexerWithTrace.java |  85 ---
 .../server/core/testutil/UriValidator.java      | 245 --------
 .../odata4/server/core/testutil/Validator.java  |  23 -
 .../odata4/server/core/uri/RawUriTest.java      |   1 +
 .../odata4/server/core/uri/UriInfoImplTest.java |   3 -
 .../server/core/uri/UriParameterImplTest.java   |  24 +-
 .../core/uri/antlr/TestFullResourcePath.java    | 111 ++--
 .../odata4/server/core/uri/antlr/TestLexer.java |   2 +-
 .../server/core/uri/antlr/TestParser.java       |   2 +-
 .../core/uri/antlr/TestUriParserImpl.java       |  70 ++-
 .../core/uri/queryoption/QueryOptionTest.java   |   6 +-
 .../queryoption/expression/ExpressionTest.java  |  24 +-
 .../core/uri/testutil/ExpandValidator.java      | 232 ++++++++
 .../core/uri/testutil/FilterTreeToText.java     | 154 +++++
 .../core/uri/testutil/FilterValidator.java      | 534 +++++++++++++++++
 .../core/uri/testutil/ParseTreeToText.java      |  82 +++
 .../core/uri/testutil/ParserValidator.java      | 243 ++++++++
 .../core/uri/testutil/ParserWithLogging.java    |  56 ++
 .../core/uri/testutil/ResourceValidator.java    | 583 +++++++++++++++++++
 .../core/uri/testutil/TestErrorLogger.java      | 105 ++++
 .../core/uri/testutil/TokenValidator.java       | 194 ++++++
 .../core/uri/testutil/UriLexerWithTrace.java    |  85 +++
 .../server/core/uri/testutil/UriValidator.java  | 258 ++++++++
 .../server/core/uri/testutil/Validator.java     |  23 +
 99 files changed, 4635 insertions(+), 4466 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java
index 9bb1dad,1d6e0cd..c3ffa16
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java
@@@ -26,7 -26,7 +26,7 @@@ public interface UriParameter 
  
    public String getText();
  
--  public Expression getExression();
++  public Expression getExpression();
  
    public String getName();
  

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java
index 0000000,70cb0fb..5223070
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java
@@@ -1,0 -1,25 +1,25 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.api.uri.queryoption;
+ 
+ public interface CountOption extends SystemQueryOption {
+ 
+   boolean getValue();
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
index 5413392,47b6a3e..cb1b720
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
@@@ -12,12 -12,13 +12,13 @@@
   * 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
 + * KIND, either express or implied.  See the License for the
   * specific language governing permissions and limitations
   * under the License.
 - ******************************************************************************/
 + */
  package org.apache.olingo.odata4.server.api.uri.queryoption;
  
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
  import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
  
  public interface ExpandItem {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
index 58dd176,f150f00..196fa39
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
@@@ -12,12 -12,13 +12,13 @@@
   * 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
 + * KIND, either express or implied.  See the License for the
   * specific language governing permissions and limitations
   * under the License.
 - ******************************************************************************/
 + */
  package org.apache.olingo.odata4.server.api.uri.queryoption;
  
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
  import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
  import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
  

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
index 0000000,e527feb..59b16a4
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
@@@ -1,0 -1,296 +1,296 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import java.util.ArrayList;
+ import java.util.Collections;
+ import java.util.List;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+ import org.apache.olingo.odata4.server.api.uri.UriInfo;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoAll;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoBatch;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoCrossjoin;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoEntityId;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoMetadata;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoService;
+ import org.apache.olingo.odata4.server.api.uri.UriResource;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.SkipTokenOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.CountOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.FormatOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.IdOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.SearchOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.SkipOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.SkipTokenOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.SystemQueryOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.TopOptionImpl;
+ 
+ public class UriInfoImpl implements UriInfo {
+ 
+   private UriInfoKind kind;
+ 
+   private List<String> entitySetNames = new ArrayList<String>(); // for $entity
+   private EdmEntityType entityTypeCast; // for $entity
+ 
+   // Query options
+   private List<CustomQueryOptionImpl> customQueryOptions = new ArrayList<CustomQueryOptionImpl>();
+   private ExpandOptionImpl expandOption;
+   private FilterOptionImpl filterOption;
+   private FormatOptionImpl formatOption;
+   private IdOption idOption;
+   private CountOptionImpl inlineCountOption;
+   private OrderByOptionImpl orderByOption;
+   private SearchOptionImpl searchOption;
+   private SelectOptionImpl selectOption;
+   private SkipOptionImpl skipOption;
+   private SkipTokenOptionImpl skipTokenOption;
+   private TopOptionImpl topOption;
+ 
+   private String fragment;
+ 
+   private UriResource lastResourcePart;
+   private List<UriResource> pathParts = new ArrayList<UriResource>();
+ 
+   @Override
+   public UriInfoAll asUriInfoAll() {
+     return this;
+   }
+ 
+   @Override
+   public UriInfoBatch asUriInfoBatch() {
+     return this;
+   }
+ 
+   @Override
+   public UriInfoCrossjoin asUriInfoCrossjoin() {
+     return this;
+   }
+ 
+   @Override
+   public UriInfoEntityId asUriInfoEntityId() {
+     return this;
+   }
+ 
+   @Override
+   public UriInfoMetadata asUriInfoMetadata() {
+     return this;
+   }
+ 
+   @Override
+   public UriInfoResource asUriInfoResource() {
+     return this;
+   }
+ 
+   @Override
+   public List<String> getEntitySetNames() {
+     return Collections.unmodifiableList(entitySetNames);
+   }
+ 
+   public void addEntitySetName(final String entitySet) {
+     entitySetNames.add(entitySet);
+   }
+ 
+   @Override
+   public List<UriResource> getUriResourceParts() {
+     List<UriResource> returnList = new ArrayList<UriResource>();
+     for (UriResource item : pathParts) {
+       returnList.add(item);
+     }
+     return Collections.unmodifiableList(returnList);
+   }
+ 
+   public UriInfoImpl addResourcePart(final UriResourceImpl uriPathInfo) {
+     pathParts.add(uriPathInfo);
+     lastResourcePart = uriPathInfo;
+     return this;
+   }
+ 
+   @Override
+   public List<CustomQueryOption> getCustomQueryOptions() {
+     List<CustomQueryOption> retList = new ArrayList<CustomQueryOption>();
+     for (CustomQueryOptionImpl item : customQueryOptions) {
+       retList.add(item);
+     }
+     return retList;
+   }
+ 
+   @Override
+   public EdmEntityType getEntityTypeCast() {
+     return entityTypeCast;
+   }
+ 
+   public UriInfoImpl setEntityTypeCast(final EdmEntityType type) {
+     entityTypeCast = type;
+     return this;
+   }
+ 
+   @Override
+   public ExpandOption getExpandOption() {
+     return expandOption;
+   }
+ 
+   @Override
+   public FilterOption getFilterOption() {
+     return filterOption;
+   }
+ 
+   @Override
+   public FormatOption getFormatOption() {
+     return formatOption;
+   }
+ 
+   @Override
+   public IdOption getIdOption() {
+     return idOption;
+   }
+ 
+   @Override
+   public CountOption getInlineCountOption() {
+     return inlineCountOption;
+   }
+ 
+   @Override
+   public UriInfoKind getKind() {
+     return kind;
+   }
+ 
+   public UriInfoImpl setKind(final UriInfoKind kind) {
+     this.kind = kind;
+     return this;
+   }
+ 
+   public UriResource getLastResourcePart() {
+     return lastResourcePart;
+   }
+ 
+   @Override
+   public OrderByOption getOrderByOption() {
+     return orderByOption;
+   }
+ 
+   @Override
+   public SearchOption getSearchOption() {
+ 
+     return searchOption;
+   }
+ 
+   @Override
+   public SelectOption getSelectOption() {
+     return selectOption;
+   }
+ 
+   @Override
+   public SkipOption getSkipOption() {
+     return skipOption;
+   }
+ 
+   @Override
+   public SkipTokenOption getSkipTokenOption() {
+     return skipTokenOption;
+   }
+ 
+   @Override
+   public TopOption getTopOption() {
+     return topOption;
+   }
+ 
+   public UriInfoImpl setQueryOptions(final List<QueryOptionImpl> list) {
+ 
+     for (QueryOptionImpl item : list) {
+       if (item instanceof SystemQueryOptionImpl) {
+         setSystemQueryOption((SystemQueryOptionImpl) item);
+       } else if (item instanceof CustomQueryOptionImpl) {
+         addCustomQueryOption(item);
+       }
+     }
+     return this;
+   }
+ 
+   public void addCustomQueryOption(final QueryOptionImpl item) {
+     customQueryOptions.add((CustomQueryOptionImpl) item);
+   }
+ 
+   public UriInfoImpl setSystemQueryOption(final SystemQueryOptionImpl systemOption) {
+ 
+     if (systemOption.getKind() == SupportedQueryOptions.EXPAND) {
+       expandOption = (ExpandOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.FILTER) {
+       filterOption = (FilterOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.FORMAT) {
+       formatOption = (FormatOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.ID) {
+       idOption = (IdOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.INLINECOUNT) {
+       inlineCountOption = (CountOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.ORDERBY) {
+       orderByOption = (OrderByOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.SEARCH) {
+       searchOption = (SearchOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.SELECT) {
+       selectOption = (SelectOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.SKIP) {
+       skipOption = (SkipOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.SKIPTOKEN) {
+       skipTokenOption = (SkipTokenOptionImpl) systemOption;
+     } else if (systemOption.getKind() == SupportedQueryOptions.TOP) {
+       topOption = (TopOptionImpl) systemOption;
+     }
+     return this;
+   }
+ 
+   @Override
+   public UriInfoService asUriInfoService() {
+     return this;
+   }
+ 
+   @Override
+   public String getFragment() {
+     return fragment;
+   }
+ 
+   public UriInfoImpl setFragment(final String fragment) {
+     this.fragment = fragment;
+     return this;
+   }
+ 
+   public void removeResourcePart(int index) {
+     this.pathParts.remove(index);
+     
+   }
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
index 0000000,96e7162..582c5ee
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
@@@ -1,0 -1,83 +1,82 @@@
 -/*******************************************************************************
 - * 
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.server.api.uri.UriParameter;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+ 
+ public class UriParameterImpl implements UriParameter {
+   private String name;
+   private String text;
+   private String alias;
+   private Expression expression;
+   private String referencedProperty;
+ 
+   @Override
+   public String getName() {
+     return name;
+   }
+ 
+   public UriParameterImpl setName(final String name) {
+     this.name = name;
+     return this;
+   }
+ 
+   @Override
+   public String getAlias() {
+     return alias;
+   }
+ 
+   public UriParameterImpl setAlias(final String alias) {
+     this.alias = alias;
+     return this;
+   }
+ 
+   @Override
+   public String getText() {
+     return text;
+   }
+ 
+   public UriParameterImpl setText(final String text) {
+     this.text = text;
+     return this;
+   }
+ 
+   @Override
 -  public Expression getExression() {
++  public Expression getExpression() {
+     return expression;
+   }
+ 
+   public UriParameterImpl setExpression(final ExpressionImpl expression) {
+     this.expression = expression;
+     return this;
+   }
+ 
+   @Override
+   public String getRefencedProperty() {
+     return referencedProperty;
+   }
+ 
+   public UriParameterImpl setRefencedProperty(final String referencedProperty) {
+     this.referencedProperty = referencedProperty;
+     return this;
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
index 0000000,e4b1113..a5a539e
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
@@@ -1,0 -1,77 +1,77 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+ import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceAction;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ 
+ public class UriResourceActionImpl extends UriResourceTypedImpl implements UriResourceAction {
+ 
+   protected EdmAction action;
+   protected EdmActionImport actionImport;
+ 
+   public UriResourceActionImpl() {
+     super(UriResourceKind.action);
+   }
+ 
+   @Override
+   public EdmAction getAction() {
+     return action;
+   }
+ 
+   public UriResourceActionImpl setAction(final EdmAction action) {
+     this.action = action;
+     return this;
+   }
+ 
+   @Override
+   public EdmActionImport getActionImport() {
+     return actionImport;
+   }
+ 
+   public UriResourceActionImpl setActionImport(final EdmActionImport actionImport) {
+     this.actionImport = actionImport;
+     setAction(actionImport.getAction());
+     return this;
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     return action.getReturnType().isCollection();
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return action.getReturnType().getType();
+   }
+ 
+   @Override
+   public String toString() {
+     if (actionImport != null) {
+       return actionImport.getName();
+     } else if (action != null) {
+       return action.getName();
+     }
+     return "";
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
index 0000000,18f803f..4ba6093
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
@@@ -1,0 -1,70 +1,70 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+ import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceComplexProperty;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ 
+ public class UriResourceComplexPropertyImpl extends UriResourceTypedImpl implements UriResourceComplexProperty {
+ 
+   protected EdmProperty property;
+ 
+   public UriResourceComplexPropertyImpl() {
+     super(UriResourceKind.complexProperty);
+   }
+ 
+   @Override
+   public EdmProperty getProperty() {
+     return property;
+   }
+ 
+   public UriResourceComplexPropertyImpl setProperty(final EdmProperty property) {
+     this.property = property;
+     return this;
+   }
+ 
+   @Override
+   public EdmComplexType getComplexType() {
+     return (EdmComplexType) getType();
+   }
+ 
+   @Override
+   public EdmComplexType getComplexTypeFilter() {
+     return (EdmComplexType) typeFilter;
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return property.getType();
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     return property.isCollection();
+   }
+ 
+   @Override
+   public String toString() {
+     return property.getName();
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
index 0000000,179d174..46ae414
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
@@@ -1,0 -1,35 +1,35 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.server.api.uri.UriResourceCount;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ 
+ public class UriResourceCountImpl extends UriResourceImpl implements UriResourceCount {
+ 
+   public UriResourceCountImpl() {
+     super(UriResourceKind.count);
+   }
+ 
+   @Override
+   public String toString() {
+     return "$count";
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
index 0000000,8c1617a..b7033e0
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
@@@ -1,0 -1,67 +1,66 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
 -
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+ import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceEntitySet;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ 
+ public class UriResourceEntitySetImpl extends UriResourceWithKeysImpl implements UriResourceEntitySet {
+   protected EdmEntitySet edmEntitySet = null;
+ 
+   public UriResourceEntitySetImpl() {
+     super(UriResourceKind.entitySet);
+   }
+ 
+   @Override
+   public EdmEntitySet getEntitySet() {
+     return edmEntitySet;
+   }
+ 
+   public UriResourceEntitySetImpl setEntitSet(final EdmEntitySet edmES) {
+     edmEntitySet = edmES;
+     return this;
+   }
+ 
+   @Override
+   public EdmEntityType getEntityType() {
+     return edmEntitySet.getEntityType();
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return edmEntitySet.getEntityType();
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     if (keyPredicates == null) {
+       return true;
+     }
+     return false;
+   }
+ 
+   @Override
+   public String toString() {
+     return edmEntitySet.getName();
+   }
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
index 0000000,5600d8c..3f0eaa1
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
@@@ -1,0 -1,111 +1,111 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import java.util.ArrayList;
+ import java.util.List;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+ import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriParameter;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceFunction;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ 
+ /**
+  * Covers Function imports and BoundFunction in URI
+  */
+ public class UriResourceFunctionImpl extends UriResourceWithKeysImpl implements UriResourceFunction {
+ 
+   protected List<UriParameterImpl> parameters;
+   protected EdmFunction function;
+   protected EdmFunctionImport functionImport;
+   private boolean isParameterListFilled = false;
+ 
+   public UriResourceFunctionImpl() {
+     super(UriResourceKind.function);
+   }
+ 
+   @Override
+   public List<UriParameter> getParameters() {
+     List<UriParameter> retList = new ArrayList<UriParameter>();
+     for (UriParameterImpl item : parameters) {
+       retList.add(item);
+     }
+     return retList;
+   }
+ 
+   public UriResourceFunctionImpl setParameters(final List<UriParameterImpl> parameters) {
+     isParameterListFilled = true;
+     this.parameters = parameters;
+     return this;
+   }
+ 
+   @Override
+   public EdmFunction getFunction() {
+     return function;
+   }
+ 
+   public UriResourceFunctionImpl setFunction(final EdmFunction function) {
+     this.function = function;
+     return this;
+   }
+ 
+   @Override
+   public EdmFunctionImport getFunctionImport() {
+     return functionImport;
+   }
+ 
+   public UriResourceFunctionImpl setFunctionImport(final EdmFunctionImport edmFI,
+       final List<UriParameterImpl> parameters) {
+     functionImport = edmFI;
+ 
+     setParameters(parameters);
+ 
+     return this;
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return function.getReturnType().getType();
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     if (keyPredicates != null) {
+       return false;
+     }
+     return function.getReturnType().isCollection();
+   }
+ 
+   @Override
+   public String toString() {
+     if (functionImport != null) {
+       return functionImport.getName();
+     } else if (function != null) {
+       return function.getName();
+     }
+     return "";
+   }
+ 
+   public boolean isParameterListFilled() {
+     return isParameterListFilled;
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java
index 0000000,c0b04c6..5441fb0
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java
@@@ -1,0 -1,39 +1,39 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.server.api.uri.UriResource;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ 
+ /**
+  * Covers Functionimports and BoundFunction in URI
+  */
+ public abstract class UriResourceImpl implements UriResource {
+   protected UriResourceKind kind;
+ 
+   public UriResourceImpl(final UriResourceKind kind) {
+     this.kind = kind;
+   }
+ 
+   @Override
+   public UriResourceKind getKind() {
+     return kind;
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
index 0000000,4d91f1a..665dd6e
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
@@@ -1,0 -1,65 +1,65 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceIt;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ 
+ /**
+  * Covers Functionimports and BoundFunction in URI
+  */
+ public class UriResourceItImpl extends UriResourceWithKeysImpl implements UriResourceIt {
+ 
+   private EdmType type;
+   private boolean isCollection;
+ 
+   public UriResourceItImpl() {
+     super(UriResourceKind.it);
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return type;
+   }
+ 
+   public UriResourceItImpl setType(final EdmType type) {
+     this.type = type;
+     return this;
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     if (keyPredicates != null) {
+       return false;
+     }
+     return isCollection;
+   }
+ 
+   public UriResourceItImpl setCollection(final boolean isCollection) {
+     this.isCollection = isCollection;
+     return this;
+   }
+ 
+   @Override
+   public String toString() {
+     return "$it";
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
index 0000000,39ca238..175efc2
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
@@@ -1,0 -1,73 +1,73 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAll;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+ 
+ public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements UriResourceLambdaAll {
+   protected EdmProperty property;
+   private String lamdaVariable;
+   private ExpressionImpl expression;
+ 
+   public UriResourceLambdaAllImpl() {
+     super(UriResourceKind.lambdaAll);
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     return false;
+   }
+ 
+   @Override
+   public String getLamdaVariable() {
+     return lamdaVariable;
+   }
+ 
+   public UriResourceLambdaAllImpl setLamdaVariable(final String lamdaVariable) {
+     this.lamdaVariable = lamdaVariable;
+     return this;
+   };
+ 
+   @Override
+   public Expression getExpression() {
+     return expression;
+   }
+ 
+   public UriResourceLambdaAllImpl setExpression(final ExpressionImpl expression) {
+     this.expression = expression;
+     return this;
+   };
+ 
+   @Override
+   public String toString() {
+     return "all";
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
index 0000000,3a20c81..87dcd25
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
@@@ -1,0 -1,72 +1,72 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAny;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+ 
+ public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements UriResourceLambdaAny {
+   protected EdmProperty property;
+   private String lamdaVariable;
+   private ExpressionImpl expression;
+ 
+   public UriResourceLambdaAnyImpl() {
+     super(UriResourceKind.lambdaAny);
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     return false;
+   }
+ 
+   @Override
+   public String getLamdaVariable() {
+     return lamdaVariable;
+   }
+ 
+   public UriResourceLambdaAnyImpl setLamdaVariable(final String lamdaVariable) {
+     this.lamdaVariable = lamdaVariable;
+     return this;
+   };
+ 
+   @Override
+   public Expression getExpression() {
+     return expression;
+   }
+ 
+   public UriResourceLambdaAnyImpl setExpression(final ExpressionImpl expression) {
+     this.expression = expression;
+     return this;
+   }
+ 
+   @Override
+   public String toString() {
+     return "any";
+   };
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
index 0000000,e3154dc..f84971b
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
@@@ -1,0 -1,70 +1,70 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaRef;
+ 
+ public class UriResourceLambdaVarImpl extends UriResourceTypedImpl implements UriResourceLambdaRef {
+ 
+   private EdmType type;
+   private boolean isCollection;
+   private String variableText;
+ 
+   public UriResourceLambdaVarImpl() {
+     super(UriResourceKind.lambdaVariable);
+   }
+ 
+   @Override
+   public String getVariableText() {
+     return variableText;
+   }
+ 
+   public UriResourceLambdaVarImpl setVariableText(final String variableText) {
+     this.variableText = variableText;
+     return this;
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return type;
+   }
+ 
+   public UriResourceLambdaVarImpl setType(final EdmType type) {
+     this.type = type;
+     return this;
+ 
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     return isCollection;
+   }
+ 
+   public UriResourceLambdaVarImpl setCollection(final boolean isCollection) {
+     this.isCollection = isCollection;
+     return this;
+   }
+ 
+   @Override
+   public String toString() {
+     return variableText;
+   }
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
index 0000000,637f09a..6cccd1f
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
@@@ -1,0 -1,63 +1,63 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceNavigation;
+ 
+ public class UriResourceNavigationPropertyImpl extends UriResourceWithKeysImpl implements UriResourceNavigation {
+ 
+   protected EdmNavigationProperty navigationProperty;
+ 
+   public UriResourceNavigationPropertyImpl() {
+     super(UriResourceKind.navigationProperty);
+   }
+ 
+   @Override
+   public EdmNavigationProperty getProperty() {
+     return navigationProperty;
+   }
+ 
+   public UriResourceNavigationPropertyImpl setNavigationProperty(final EdmNavigationProperty property) {
+     navigationProperty = property;
+     return this;
+ 
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return navigationProperty.getType();
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     if (keyPredicates != null) {
+       return false;
+     }
+     return navigationProperty.isCollection();
+   }
+ 
+   @Override
+   public String toString() {
+     return navigationProperty.getName();
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
index 0000000,3fd4139..57a0046
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
@@@ -1,0 -1,59 +1,59 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourcePrimitiveProperty;
+ 
+ public class UriResourcePrimitivePropertyImpl extends UriResourceTypedImpl implements UriResourcePrimitiveProperty {
+ 
+   EdmProperty property;
+ 
+   public UriResourcePrimitivePropertyImpl() {
+     super(UriResourceKind.primitiveProperty);
+   }
+ 
+   @Override
+   public EdmProperty getProperty() {
+     return property;
+   }
+ 
+   public UriResourcePrimitivePropertyImpl setProperty(final EdmProperty property) {
+     this.property = property;
+     return this;
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return property.getType();
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     return property.isCollection();
+   }
+ 
+   @Override
+   public String toString() {
+     return property.getName();
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
index 0000000,17cf8f3..87e5d65
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
@@@ -1,0 -1,36 +1,36 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceRef;
+ 
+ public class UriResourceRefImpl extends UriResourceImpl implements UriResourceRef {
+ 
+   public UriResourceRefImpl() {
+     super(UriResourceKind.ref);
+ 
+   }
+ 
+   @Override
+   public String toString() {
+     return "$ref";
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
index 0000000,1d5f55d..3e7620d
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
@@@ -1,0 -1,62 +1,62 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceRoot;
+ 
+ public class UriResourceRootImpl extends UriResourceWithKeysImpl implements UriResourceRoot {
+ 
+   private EdmType type;
+   private boolean isCollection;
+ 
+   public UriResourceRootImpl() {
+     super(UriResourceKind.root);
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return type;
+   }
+ 
+   public UriResourceRootImpl setType(final EdmType type) {
+     this.type = type;
+     return this;
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     if (keyPredicates != null) {
+       return false;
+     }
+     return isCollection;
+   }
+ 
+   public UriResourceRootImpl setCollection(final boolean isCollection) {
+     this.isCollection = isCollection;
+     return this;
+   }
+ 
+   @Override
+   public String toString() {
+     return "$root";
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
index 0000000,abb8964..56e408b
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
@@@ -1,0 -1,71 +1,71 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+ import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceSingleton;
+ 
+ public class UriResourceSingletonImpl extends UriResourceTypedImpl implements UriResourceSingleton {
+ 
+   private EdmSingleton singleton;
+ 
+   public UriResourceSingletonImpl() {
+     super(UriResourceKind.singleton);
+   }
+ 
+   @Override
+   public EdmSingleton getSingleton() {
+     return singleton;
+   }
+ 
+   public UriResourceSingletonImpl setSingleton(final EdmSingleton singleton) {
+ 
+     this.singleton = singleton;
+     return this;
+   }
+ 
+   @Override
+   public EdmEntityType getEntityTypeFilter() {
+     return (EdmEntityType) typeFilter;
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return singleton.getEntityType();
+   }
+ 
+   @Override
+   public EdmEntityType getEntityType() {
+     return singleton.getEntityType();
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     return false;
+   }
+ 
+   @Override
+   public String toString() {
+     return singleton.getName();
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
index 0000000,2fba96c..baf4ebe
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
@@@ -1,0 -1,68 +1,66 @@@
 -/*******************************************************************************
 - * 2 * Licensed to the Apache Software Foundation (ASF) under one
 - * 3 * or more contributor license agreements. See the NOTICE file
 - * 4 * distributed with this work for additional information
 - * 5 * regarding copyright ownership. The ASF licenses this file
 - * 6 * to you under the Apache License, Version 2.0 (the
 - * 7 * "License"); you may not use this file except in compliance
 - * 8 * with the License. You may obtain a copy of the License at
 - * 9 *
 - * 10 * http://www.apache.org/licenses/LICENSE-2.0
 - * 11 *
 - * 12 * Unless required by applicable law or agreed to in writing,
 - * 13 * software distributed under the License is distributed on an
 - * 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 - * 15 * KIND, either express or implied. See the License for the
 - * 16 * specific language governing permissions and limitations
 - * 17 * under the License.
 - * 18
 - ******************************************************************************/
 -
++/* 
++ * 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.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ 
+ public class UriResourceStartingTypeFilterImpl extends UriResourceWithKeysImpl {
+ 
+   private EdmType type;
+   private boolean isCollection;
+ 
+   public UriResourceStartingTypeFilterImpl() {
+     super(UriResourceKind.startingTypeFilter);
+   }
+ 
+   @Override
+   public UriResourceKind getKind() {
+     return kind;
+   }
+ 
+   @Override
+   public EdmType getType() {
+     return type;
+   }
+ 
+   public UriResourceStartingTypeFilterImpl setType(final EdmType type) {
+     this.type = type;
+     return this;
+   }
+ 
+   @Override
+   public boolean isCollection() {
+     if (keyPredicates != null) {
+       return false;
+     }
+     return isCollection;
+   }
+ 
+   public UriResourceStartingTypeFilterImpl setCollection(final boolean isCollection) {
+     this.isCollection = isCollection;
+     return this;
+   }
+ 
+   @Override
+   public String toString() {
+     return type.getNamespace() + "." + type.getName();
+   }
+ 
 -}
++}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
index 0000000,36f146e..2cec8de
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
@@@ -1,0 -1,60 +1,60 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+ 
+ public abstract class UriResourceTypedImpl extends UriResourceImpl implements UriResourcePartTyped {
+ 
+   protected EdmType typeFilter = null;
+ 
+   public UriResourceTypedImpl(final UriResourceKind kind) {
+     super(kind);
+   }
+ 
+   public EdmType getTypeFilter() {
+     return typeFilter;
+   }
+ 
+   public UriResourceTypedImpl setTypeFilter(final EdmStructuralType typeFilter) {
+     this.typeFilter = typeFilter;
+     return this;
+   }
+ 
+   @Override
+   public String toString(final boolean includeFilters) {
+     if (includeFilters) {
+       if (typeFilter != null) {
+         return toString() + "/" + getFQN(typeFilter).toString();
+       } else {
+         return toString();
+       }
+     }
+     return toString();
+   }
+ 
+   private FullQualifiedName getFQN(final EdmType type) {
+     return new FullQualifiedName(type.getNamespace(), type.getName());
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
index 0000000,9544b98..5377614
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
@@@ -1,0 -1,36 +1,36 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceValue;
+ 
+ public class UriResourceValueImpl extends UriResourceImpl implements UriResourceValue {
+ 
+   public UriResourceValueImpl() {
+     super(UriResourceKind.value);
+ 
+   }
+ 
+   @Override
+   public String toString() {
+     return "$value";
+   }
+ 
+ }


[8/9] Merge from origin/master

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
index 0000000,90f7456..d911aa5
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
@@@ -1,0 -1,99 +1,99 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri;
+ 
+ import java.util.ArrayList;
+ import java.util.List;
+ 
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+ import org.apache.olingo.odata4.server.api.uri.UriParameter;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+ import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+ 
+ public abstract class UriResourceWithKeysImpl extends UriResourceImpl implements UriResourcePartTyped {
+ 
+   protected EdmType collectionTypeFilter = null;
+   protected List<UriParameterImpl> keyPredicates = null;
+   protected EdmType entryTypeFilter = null;
+ 
+   public UriResourceWithKeysImpl(final UriResourceKind kind) {
+     super(kind);
+   }
+ 
+   public EdmType getTypeFilterOnCollection() {
+     return collectionTypeFilter;
+   }
+ 
+   public EdmType getTypeFilterOnEntry() {
+     return entryTypeFilter;
+   }
+ 
+   public List<UriParameter> getKeyPredicates() {
+     List<UriParameter> retList = new ArrayList<UriParameter>();
+     for (UriParameterImpl item : keyPredicates) {
+       retList.add(item);
+     }
+     return retList;
+   }
+ 
+   public UriResourceWithKeysImpl setKeyPredicates(final List<UriParameterImpl> list) {
+     keyPredicates = list;
+     return this;
+   }
+ 
+   public UriResourceWithKeysImpl setEntryTypeFilter(final EdmType entryTypeFilter) {
+     this.entryTypeFilter = entryTypeFilter;
+     return this;
+   }
+ 
+   public UriResourceWithKeysImpl setCollectionTypeFilter(final EdmType collectionTypeFilter) {
+     this.collectionTypeFilter = collectionTypeFilter;
+     return this;
+   }
+ 
+   @Override
+   public String toString(final boolean includeFilters) {
+ 
+     if (includeFilters == true) {
+       String tmp = "";
+       if (collectionTypeFilter != null) {
+         tmp += getFQN(collectionTypeFilter).toString();
+       }
+ 
+       if (entryTypeFilter != null) {
+         if (tmp.length() == 0) {
+           tmp = getFQN(entryTypeFilter).toString();
+         } else {
+           tmp += "/()" + getFQN(entryTypeFilter).toString();
+         }
+       }
+       if (tmp.length() != 0) {
+         return toString() + "/" + tmp;
+       }
+     }
+ 
+     return toString();
+   }
+ 
+   private FullQualifiedName getFQN(final EdmType type) {
+     return new FullQualifiedName(type.getNamespace(), type.getName());
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
index 0000000,7c2a8ea..8f54672
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
@@@ -1,0 -1,36 +1,36 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.parser;
+ 
+ //TODO Check name of this exception when implementing proper error handling
+ public class UriParserException extends Exception {
+   /**
+    * 
+    */
+   private static final long serialVersionUID = 1L;
+ 
+   public UriParserException(final String message, final Throwable cause) {
+     super(message, cause);
+   }
+ 
+   public UriParserException(final String message) {
+     super(message, null);
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
index 0000000,4e13b93..29c6653
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
@@@ -1,0 -1,37 +1,37 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.parser;
+ 
+ //TODO Check name of this exception when implementing proper error handling
+ public class UriParserSemanticException extends UriParserException {
+ 
+   /**
+    * 
+    */
+   private static final long serialVersionUID = 1L;
+ 
+   public UriParserSemanticException(final String message, final Throwable cause) {
+     super(message, cause);
+   }
+ 
+   public UriParserSemanticException(final String message) {
+     super(message, null);
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java
index 0000000,95bb645..9fffde6
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java
@@@ -1,0 -1,36 +1,36 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.parser;
+ 
+ public class UriParserSyntaxException extends UriParserException {
+ 
+   /**
+    * 
+    */
+   private static final long serialVersionUID = 1L;
+ 
+   public UriParserSyntaxException(final String message, final Throwable cause) {
+     super(message, cause);
+   }
+ 
+   public UriParserSyntaxException(final String message) {
+     super(message, null);
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
index b9d6f2c,a9a2fe0..86841da
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
@@@ -12,16 -12,16 +12,16 @@@
   * 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
 + * KIND, either express or implied.  See the License for the
   * specific language governing permissions and limitations
   * under the License.
 - ******************************************************************************/
 + */
  package org.apache.olingo.odata4.server.core.uri.queryoption;
  
- import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption;
  import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
  
- public class CountOptionImpl extends SystemQueryOptionImpl implements InlineCountOption {
+ public class CountOptionImpl extends SystemQueryOptionImpl implements CountOption {
  
    private boolean count;
  

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
index 5da20ca,1a79b02..a3085fa
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
@@@ -12,12 -12,13 +12,13 @@@
   * 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
 + * KIND, either express or implied.  See the License for the
   * specific language governing permissions and limitations
   * under the License.
 - ******************************************************************************/
 + */
  package org.apache.olingo.odata4.server.core.uri.queryoption;
  
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
  import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
  import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
  import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
index 3e09901,1462ab9..234ba4f
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
@@@ -81,7 -62,7 +62,7 @@@ public class UriParameterImplTest 
      assertEquals("Text", impl.getText());
      assertEquals("A", impl.getName());
      assertEquals("@A", impl.getAlias());
--    assertEquals(expression, impl.getExression());
++    assertEquals(expression, impl.getExpression());
    }
  
    @Test

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
index cda6784,ecbcaaf..5f723a2
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
@@@ -12,12 -12,15 +12,15 @@@
   * 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
 + * KIND, either express or implied.  See the License for the
   * specific language governing permissions and limitations
   * under the License.
 - ******************************************************************************/
 + */
  package org.apache.olingo.odata4.server.core.uri.antlr;
  
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.fail;
+ 
  import java.io.UnsupportedEncodingException;
  import java.net.URLEncoder;
  import java.util.Arrays;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
index 232f19a,a856e89..7f2add7
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
@@@ -12,13 -12,13 +12,13 @@@
   * 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
 + * KIND, either express or implied.  See the License for the
   * specific language governing permissions and limitations
   * under the License.
 - ******************************************************************************/
 + */
  package org.apache.olingo.odata4.server.core.uri.antlr;
  
- import org.apache.olingo.odata4.server.core.testutil.ParserValidator;
+ import org.apache.olingo.odata4.server.core.uri.testutil.ParserValidator;
  import org.junit.Test;
  
  /**

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java
index 0000000,e46ef82..4d6d48c
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java
@@@ -1,0 -1,233 +1,232 @@@
 -/*******************************************************************************
 - * 
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.fail;
+ 
+ import org.apache.olingo.odata4.commons.api.ODataApplicationException;
+ import org.apache.olingo.odata4.commons.api.edm.Edm;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
+ import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+ 
+ public class ExpandValidator implements Validator {
+   private Edm edm;
+   private Validator invokedByValidator;
+ 
+   private int expandItemIndex;
+   private ExpandOptionImpl expandOption;
+   private ExpandItem expandItem;
+ 
+   // --- Setup ---
+ 
+   public ExpandValidator setUpValidator(final Validator validator) {
+     invokedByValidator = validator;
+     return this;
+   }
+ 
+   public ExpandValidator setExpand(final ExpandOptionImpl expand) {
+     expandOption = expand;
+     first();
+     return this;
+   }
+ 
+   public ExpandValidator setEdm(final Edm edm) {
+     this.edm = edm;
+     return this;
+   }
+ 
+   // --- Navigation ---
+ 
+   public ExpandValidator goUpToExpandValidator() {
+     return (ExpandValidator) invokedByValidator;
+   }
+ 
+   public ResourceValidator goUpToUriResourceValidator() {
+     return (ResourceValidator) invokedByValidator;
+   }
+ 
+   public ResourceValidator goPath() {
+     UriInfoImpl uriInfo = (UriInfoImpl) expandItem.getResourcePath();
+ 
+     if (uriInfo.getKind() != UriInfoKind.resource) {
+       fail("goPath() can only be used on UriInfoKind.resource");
+     }
+ 
+     return new ResourceValidator()
+         .setUpValidator(this)
+         .setEdm(edm)
+         .setUriInfoImplPath(uriInfo);
+ 
+   }
+ 
+   public FilterValidator goOrder(final int index) {
+     OrderByOptionImpl orderBy = (OrderByOptionImpl) expandItem.getOrderByOption();
+ 
+     return new FilterValidator()
+         .setValidator(this)
+         .setEdm(edm)
+         .setExpression(orderBy.getOrders().get(index).getExpression());
+   }
+ 
+   public ResourceValidator goSelectItem(final int index) {
+     SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+ 
+     SelectItem item = select.getSelectItems().get(index);
+     UriInfoImpl uriInfo = (UriInfoImpl) item.getResourcePath();
+ 
+     return new ResourceValidator()
+         .setUpValidator(this)
+         .setEdm(edm)
+         .setUriInfoImplPath(uriInfo);
+ 
+   }
+ 
+   public ExpandValidator goExpand() {
+     ExpandValidator val = new ExpandValidator()
+         .setExpand((ExpandOptionImpl) expandItem.getExpandOption())
+         .setUpValidator(this);
+     return val;
+   }
+ 
+   public ExpandValidator first() {
+     expandItemIndex = 0;
+     expandItem = expandOption.getExpandItems().get(expandItemIndex);
+     return this;
+   }
+ 
+   public ExpandValidator next() {
+     expandItemIndex++;
+ 
+     try {
+       expandItem = expandOption.getExpandItems().get(expandItemIndex);
+     } catch (IndexOutOfBoundsException ex) {
+       fail("not enought segments");
+     }
+     return this;
+ 
+   }
+ 
+   public ExpandValidator isSegmentStar(final int index) {
+     assertEquals(true, expandItem.isStar());
+     return this;
+   }
+ 
+   public ExpandValidator isSegmentRef(final int index) {
+     assertEquals(true, expandItem.isRef());
+     return this;
+   }
+ 
+   public ExpandValidator isLevelText(final String text) {
+     QueryOptionImpl option = (QueryOptionImpl) expandItem.getLevelsOption();
+     assertEquals(text, option.getText());
+     return this;
+   }
+ 
+   public ExpandValidator isSkipText(final String text) {
+     QueryOptionImpl option = (QueryOptionImpl) expandItem.getSkipOption();
+     assertEquals(text, option.getText());
+     return this;
+   }
+ 
+   public ExpandValidator isTopText(final String text) {
+     QueryOptionImpl option = (QueryOptionImpl) expandItem.getTopOption();
+     assertEquals(text, option.getText());
+     return this;
+   }
+ 
+   public ExpandValidator isInlineCountText(final String text) {
+     QueryOptionImpl option = (QueryOptionImpl) expandItem.getInlineCountOption();
+     assertEquals(text, option.getText());
+     return this;
+   }
+ 
+   public ExpandValidator isSelectText(final String text) {
+     QueryOptionImpl option = (QueryOptionImpl) expandItem.getSelectOption();
+     assertEquals(text, option.getText());
+     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 isSelectItemAllOperations(final int index, final FullQualifiedName fqn) {
+     SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+ 
+     SelectItem item = select.getSelectItems().get(index);
+     assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+     return this;
+   }
+ 
+   public ExpandValidator isFilterOptionText(final String text) {
+     QueryOptionImpl option = (QueryOptionImpl) expandItem.getFilterOption();
+     assertEquals(text, option.getText());
+     return this;
+   }
+ 
+   public ExpandValidator isFilterSerialized(final String serialized) {
+     FilterOptionImpl filter = (FilterOptionImpl) expandItem.getFilterOption();
+ 
+     try {
+       String tmp = FilterTreeToText.Serialize(filter);
+       assertEquals(serialized, tmp);
+     } catch (ExpressionVisitException e) {
+       fail("Exception occured while converting the filterTree into text" + "\n"
+           + " Exception: " + e.getMessage());
+     } catch (ODataApplicationException e) {
+       fail("Exception occured while converting the filterTree into text" + "\n"
+           + " Exception: " + e.getMessage());
+     }
+ 
+     return this;
+   }
+ 
+   public ExpandValidator isSortOrder(final int index, final boolean descending) {
+     OrderByOptionImpl orderBy = (OrderByOptionImpl) expandItem.getOrderByOption();
+     assertEquals(descending, orderBy.getOrders().get(index).isDescending());
+     return this;
+   }
+ 
+   public ExpandValidator isExpandStartType(final FullQualifiedName fullName) {
+       EdmType actualType = expandItem.getStartTypeFilter();
+       
+       FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+       assertEquals(fullName, actualName);
+       return this;
+    
+     
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java
index 0000000,cbf0c33..3513890
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java
@@@ -1,0 -1,154 +1,154 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import java.util.List;
+ 
+ import org.apache.olingo.odata4.commons.api.ODataApplicationException;
+ import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+ import org.apache.olingo.odata4.server.api.uri.UriResource;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAll;
+ import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAny;
+ import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCallKind;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.UnaryOperatorKind;
+ 
+ public class FilterTreeToText implements ExpressionVisitor<String> {
+ 
+   public static String Serialize(final FilterOption filter)
+       throws ExpressionVisitException, ODataApplicationException {
+ 
+     Expression expression = filter.getExpression();
+     return expression.accept(new FilterTreeToText());
+   }
+ 
+   public static String Serialize(final Expression expression)
+       throws ExpressionVisitException, ODataApplicationException {
+ 
+     return expression.accept(new FilterTreeToText());
+   }
+ 
+   @Override
+   public String visitBinaryOperator(final BinaryOperatorKind operator, final String left, final String right)
+       throws ExpressionVisitException {
+ 
+     return "<" + left + " " + operator.toString() + " " + right + ">";
+   }
+ 
+   @Override
+   public String visitUnaryOperator(final UnaryOperatorKind operator, final String operand)
+       throws ExpressionVisitException {
+ 
+     return "<" + operator + " " + operand.toString() + ">";
+   }
+ 
+   @Override
+   public String visitMethodCall(final MethodCallKind methodCall, final List<String> parameters)
+       throws ExpressionVisitException {
+ 
+     String text = "<" + methodCall + "(";
+     int i = 0;
+     while (i < parameters.size()) {
+       if (i > 0) {
+         text += ",";
+       }
+       text += parameters.get(i);
+       i++;
+     }
+     return text + ")>";
+   }
+ 
+   @Override
+   public String visitLiteral(final String literal) throws ExpressionVisitException {
+     return "<" + literal + ">";
+   }
+ 
+   @Override
+   public String visitMember(final UriInfoResource resource) throws ExpressionVisitException, ODataApplicationException {
+     String ret = "";
+ 
+     UriInfoResource path = resource;
+ 
+     for (UriResource item : path.getUriResourceParts()) {
+       String tmp = "";
+       if (item instanceof UriResourceLambdaAll) {
+         UriResourceLambdaAll all = (UriResourceLambdaAll) item;
+         tmp = visitLambdaExpression("ALL", all.getLamdaVariable(), all.getExpression());
+       } else if (item instanceof UriResourceLambdaAny) {
+         UriResourceLambdaAny any = (UriResourceLambdaAny) item;
+         tmp = visitLambdaExpression("ANY", any.getLamdaVariable(), any.getExpression());
+       } else if (item instanceof UriResourcePartTyped) {
+         UriResourcePartTyped typed = (UriResourcePartTyped) item;
+         tmp = typed.toString(true);
+       }
+ 
+       if (ret.length() != 0) {
+         ret += "/";
+       }
+       ret += tmp;
+ 
+     }
+     return "<" + ret + ">";
+   }
+ 
+   @Override
+   public String visitAlias(final String referenceName) throws ExpressionVisitException {
+     return "<" + referenceName + ">";
+   }
+ 
+   @Override
+   public String visitLambdaExpression(final String functionText, final String string, final Expression expression)
+       throws ExpressionVisitException, ODataApplicationException {
+ 
+     return "<" + functionText + ";" + ((expression == null) ? "" : expression.accept(this)) + ">";
+   }
+ 
+   @Override
+   public String visitTypeLiteral(final EdmType type) {
+     return "<" + type.getNamespace() + "." + type.getName() + ">";
+   }
+ 
+   @Override
+   public String visitLambdaReference(final String variableText) {
+     return "<" + variableText + ">";
+   }
+ 
+   @Override
+   public String visitEnum(final EdmEnumType type, final List<String> enumValues)
+       throws ExpressionVisitException, ODataApplicationException {
+     String tmp = "";
+ 
+     for (String item : enumValues) {
+       if (tmp.length() > 0) {
+         tmp += ",";
+       }
+       tmp += item;
+     }
+ 
+     return "<" + type.getNamespace() + "." + type.getName() + "<" + tmp + ">>";
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java
index 0000000,ed2fcff..da13d4b
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java
@@@ -1,0 -1,534 +1,534 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.fail;
+ 
+ import java.util.List;
+ 
+ import org.apache.olingo.odata4.commons.api.ODataApplicationException;
+ import org.apache.olingo.odata4.commons.api.edm.Edm;
+ import org.apache.olingo.odata4.commons.api.edm.EdmType;
+ import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+ import org.apache.olingo.odata4.server.api.uri.UriInfo;
+ import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Member;
+ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCallKind;
+ import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+ import org.apache.olingo.odata4.server.core.uri.parser.Parser;
+ import org.apache.olingo.odata4.server.core.uri.parser.UriParserException;
+ import org.apache.olingo.odata4.server.core.uri.parser.UriParserSemanticException;
+ import org.apache.olingo.odata4.server.core.uri.parser.UriParserSyntaxException;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.BinaryImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.EnumerationImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MethodCallImpl;
+ import org.apache.olingo.odata4.server.core.uri.queryoption.expression.TypeLiteralImpl;
+ 
+ public class FilterValidator implements Validator {
+   private Edm edm;
+ 
+   private Validator invokedByValidator;
+   private FilterOptionImpl filter;
+ 
+   private Expression curExpression;
+   private Expression rootExpression;
+ 
+   private OrderByOptionImpl orderBy;
+ 
+   private UriParserException exception;
+ 
+   // --- Setup ---
+   public FilterValidator setUriResourcePathValidator(final ResourceValidator uriResourcePathValidator) {
+     invokedByValidator = uriResourcePathValidator;
+     return this;
+   }
+ 
+   public FilterValidator setUriValidator(final UriValidator uriValidator) {
+     invokedByValidator = uriValidator;
+     return this;
+   }
+ 
+   public FilterValidator setValidator(final Validator uriValidator) {
+     invokedByValidator = uriValidator;
+     return this;
+   }
+ 
+   public FilterValidator setEdm(final Edm edm) {
+     this.edm = edm;
+     return this;
+   }
+ 
+   public FilterValidator setFilter(final FilterOptionImpl filter) {
+     this.filter = filter;
+ 
+     if (filter.getExpression() == null) {
+       fail("FilterValidator: no filter found");
+     }
+     setExpression(filter.getExpression());
+     return this;
+   }
+ 
+   public FilterValidator setOrderBy(final OrderByOptionImpl orderBy) {
+     this.orderBy = orderBy;
+ 
+     return this;
+   }
+ 
+   public FilterValidator setExpression(final Expression expression) {
+     rootExpression = curExpression = expression;
+     return this;
+   }
+ 
+   // --- Execution ---
+ 
+   public FilterValidator runOrderByOnETAllPrim(final String orderBy) throws UriParserException {
+     String uri = "ESAllPrim?$orderby=" + orderBy.trim();
+     return runUriOrderBy(uri);
+   }
+ 
+   public FilterValidator runOrderByOnETTwoKeyNav(final String orderBy) throws UriParserException {
+     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 {
+     String uri = "ESTwoKeyNav?$filter=" + filter.trim();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runOnETTwoKeyNavSingle(final String filter) throws UriParserException {
+     String uri = "SINav?$filter=" + filter.trim();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runOnETTwoKeyNavEx(final String filter) throws UriParserException {
+     String uri = "ESTwoKeyNav?$filter=" + filter.trim();
+     return runUriEx(uri);
+   }
+ 
+   public FilterValidator runOnETAllPrim(final String filter) throws UriParserException {
+     String uri = "ESAllPrim(1)?$filter=" + filter.trim();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runOnETKeyNav(final String filter) throws UriParserException {
+     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();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runOnString(final String filter) throws UriParserException {
+     String uri = "SINav/PropertyString?$filter=" + filter.trim();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runOnInt32(final String filter) throws UriParserException {
+     String uri = "ESCollAllPrim(1)/CollPropertyInt32?$filter=" + filter.trim();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runOnDateTimeOffset(final String filter) throws UriParserException {
+     String uri = "ESCollAllPrim(1)/CollPropertyDateTimeOffset?$filter=" + filter.trim();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runOnDuration(final String filter) throws UriParserException {
+     String uri = "ESCollAllPrim(1)/CollPropertyDuration?$filter=" + filter.trim();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runOnTimeOfDay(final String filter) throws UriParserException {
+     String uri = "ESCollAllPrim(1)/CollPropertyTimeOfDay?$filter=" + filter.trim();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runESabc(final String filter) throws UriParserException {
+     String uri = "ESabc?$filter=" + filter.trim();
+     return runUri(uri);
+   }
+ 
+   public FilterValidator runUri(final String uri) throws UriParserException {
+     Parser parser = new Parser();
+     UriInfo uriInfo = null;
+ 
+     uriInfo = parser.parseUri(uri, 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;
+ 
+     try {
+       uriInfo = parser.parseUri(uri, edm);
+     } catch (UriParserException e) {
+       exception = e;
+       return this;
+     }
+ 
+     if (uriInfo.getKind() != UriInfoKind.resource) {
+       fail("Filtervalidator can only be used on resourcePaths");
+     }
+ 
+     setFilter((FilterOptionImpl) uriInfo.getFilterOption());
+     curExpression = filter.getExpression();
+     return this;
+   }
+ 
+   public FilterValidator runUriOrderBy(final String uri) throws UriParserException {
+     Parser parser = new Parser();
+     UriInfo uriInfo = null;
+ 
+     uriInfo = parser.parseUri(uri, edm);
+ 
+     if (uriInfo.getKind() != UriInfoKind.resource) {
+       fail("Filtervalidator can only be used on resourcePaths");
+     }
+ 
+     setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
+     return this;
+   }
+ 
+   public FilterValidator runUriOrderByEx(final String uri) {
+     Parser parser = new Parser();
+     UriInfo uriInfo = null;
+ 
+     try {
+       uriInfo = parser.parseUri(uri, edm);
+     } catch (UriParserException e) {
+       exception = e;
+       return this;
+     }
+ 
+     if (uriInfo.getKind() != UriInfoKind.resource) {
+       fail("Filtervalidator can only be used on resourcePaths");
+     }
+ 
+     setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
+     return this;
+   }
+ 
+   // --- Navigation ---
+ 
+   public ExpandValidator goUpToExpandValidator() {
+     return (ExpandValidator) invokedByValidator;
+   }
+ 
+   public ResourceValidator goUpToResourceValidator() {
+     return (ResourceValidator) invokedByValidator;
+   }
+ 
+   public ResourceValidator goPath() {
+     if (!(curExpression instanceof MemberImpl)) {
+       fail("Current expression not a member");
+     }
+ 
+     MemberImpl member = (MemberImpl) curExpression;
+ 
+     return new ResourceValidator()
+         .setEdm(edm)
+         .setUriInfoImplPath((UriInfoImpl) member.getResourcePath())
+         .setUpValidator(this);
+ 
+   }
+ 
+   public FilterValidator goParameter(final int parameterIndex) {
+     if (curExpression instanceof MethodCallImpl) {
+       MethodCallImpl methodCall = (MethodCallImpl) curExpression;
+       curExpression = methodCall.getParameters().get(parameterIndex);
+     } else {
+       fail("Current expression not a methodCall");
+     }
+     return this;
+   }
+ 
+   // --- Validation ---
+ 
+   /**
+    * Validates the serialized filterTree against a given filterString
+    * The given expected filterString is compressed before to allow better readable code in the unit tests
+    * @param toBeCompr
+    * @return
+    */
+   public FilterValidator isCompr(final String toBeCompr) {
+     return is(compress(toBeCompr));
+   }
+ 
+   public FilterValidator is(final String expectedFilterAsString) {
+     try {
+       String actualFilterAsText = FilterTreeToText.Serialize((FilterOptionImpl) filter);
+       assertEquals(expectedFilterAsString, actualFilterAsText);
+     } catch (ExpressionVisitException e) {
+       fail("Exception occured while converting the filterTree into text" + "\n"
+           + " Exception: " + e.getMessage());
+     } catch (ODataApplicationException e) {
+       fail("Exception occured while converting the filterTree into text" + "\n"
+           + " Exception: " + e.getMessage());
+     }
+ 
+     return this;
+   }
+ 
+   // --- Helper ---
+ 
+   private String compress(final String expected) {
+     String ret = expected.replaceAll("\\s+", " ");
+     ret = ret.replaceAll("< ", "<");
+     ret = ret.replaceAll(" >", ">");
+     return ret;
+   }
+ 
+   public FilterValidator isType(final FullQualifiedName fullName) {
+     EdmType actualType = null;
+ 
+     if (curExpression instanceof MemberImpl) {
+       Member member = (Member) curExpression;
+       actualType = member.getType();
+     } else if (curExpression instanceof TypeLiteralImpl) {
+       TypeLiteralImpl typeLiteral = (TypeLiteralImpl) curExpression;
+       actualType = typeLiteral.getType();
+     } else if (curExpression instanceof LiteralImpl) {
+       LiteralImpl typeLiteral = (LiteralImpl) curExpression;
+       actualType = typeLiteral.getType();
+     }
+ 
+     if (actualType == null) {
+       fail("Current expression not typed");
+     }
+ 
+     FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+     assertEquals(fullName, actualName);
+     return this;
+   }
+ 
+   public FilterValidator left() {
+     if (!(curExpression instanceof BinaryImpl)) {
+       fail("Current expression not a binary operator");
+     }
+ 
+     curExpression = ((BinaryImpl) curExpression).getLeftOperand();
+ 
+     return this;
+   }
+ 
+   public FilterValidator root() {
+     if (filter != null) {
+       curExpression = filter.getExpression();
+     } else {
+       curExpression = rootExpression;
+     }
+ 
+     return this;
+   }
+ 
+   public FilterValidator right() {
+     if (!(curExpression instanceof BinaryImpl)) {
+       fail("Current expression is not a binary operator");
+     }
+ 
+     curExpression = ((BinaryImpl) curExpression).getRightOperand();
+ 
+     return this;
+ 
+   }
+ 
+   public FilterValidator isLiteral(final String literalText) {
+     if (!(curExpression instanceof LiteralImpl)) {
+       fail("Current expression is not a literal");
+     }
+ 
+     String actualLiteralText = ((LiteralImpl) curExpression).getText();
+     assertEquals(literalText, actualLiteralText);
+ 
+     return this;
+   }
+ 
+   public FilterValidator isMethod(final MethodCallKind methodKind, final int parameterCount) {
+     if (!(curExpression instanceof MethodCallImpl)) {
+       fail("Current expression is not a methodCall");
+     }
+ 
+     MethodCallImpl methodCall = (MethodCallImpl) curExpression;
+     assertEquals(methodKind, methodCall.getMethod());
+     assertEquals(parameterCount, methodCall.getParameters().size());
+ 
+     return this;
+   }
+ 
+   public FilterValidator isParameterText(final int parameterIndex, final String parameterText)
+       throws ExpressionVisitException, ODataApplicationException {
+ 
+     if (!(curExpression instanceof MethodCallImpl)) {
+       fail("Current expression is not a method");
+     }
+ 
+     MethodCallImpl methodCall = (MethodCallImpl) curExpression;
+ 
+     Expression parameter = methodCall.getParameters().get(parameterIndex);
+     String actualParameterText = FilterTreeToText.Serialize(parameter);
+     assertEquals(parameterText, actualParameterText);
+ 
+     return this;
+   }
+ 
+   public FilterValidator isBinary(final BinaryOperatorKind binaryOperator) {
+     if (!(curExpression instanceof BinaryImpl)) {
+       fail("Current expression is not a binary operator");
+     }
+ 
+     BinaryImpl binary = (BinaryImpl) curExpression;
+     assertEquals(binaryOperator, binary.getOperator());
+ 
+     return this;
+   }
+ 
+   public FilterValidator isTypedLiteral(final FullQualifiedName fullName) {
+     if (!(curExpression instanceof TypeLiteralImpl)) {
+       fail("Current expression not a typeLiteral");
+     }
+ 
+     isType(fullName);
+ 
+     return this;
+   }
+ 
+   public FilterValidator isMember() {
+     if (!(curExpression instanceof MemberImpl)) {
+       fail("Current expression not a member");
+     }
+ 
+     return this;
+   }
+   
+   public FilterValidator isMemberStartType(final FullQualifiedName fullName) {
+     if (!(curExpression instanceof MemberImpl)) {
+       fail("Current expression not a member");
+     }
+     
+     MemberImpl member = (MemberImpl) curExpression;
+     EdmType actualType = member.getStartTypeFilter();
+     
+     FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+     assertEquals(fullName, actualName);
+     return this;
+   }
+ 
+   public FilterValidator isEnum(final FullQualifiedName nameenstring, final List<String> enumValues) {
+     if (!(curExpression instanceof EnumerationImpl)) {
+       fail("Current expression not a enumeration");
+     }
+ 
+     EnumerationImpl enumeration = (EnumerationImpl) curExpression;
+ 
+     FullQualifiedName actualName =
+         new FullQualifiedName(enumeration.getType().getNamespace(), enumeration.getType().getName());
+ 
+     // check name
+     assertEquals(nameenstring.toString(), actualName.toString());
+ 
+     // check values
+     int i = 0;
+     for (String item : enumValues) {
+       assertEquals(item, enumeration.getValues().get(i));
+       i++;
+     }
+ 
+     return this;
+   }
+ 
+   public FilterValidator isSortOrder(final int index, final boolean descending) {
+     assertEquals(descending, orderBy.getOrders().get(index).isDescending());
+     return this;
+   }
+ 
+   public FilterValidator goOrder(final int index) {
+     curExpression = orderBy.getOrders().get(index).getExpression();
+     return this;
+   }
+ 
+   public FilterValidator isExSyntax(final long errorID) {
+     assertEquals(UriParserSyntaxException.class, exception.getClass());
+     return this;
+   }
+ 
+   public FilterValidator isExSemantic(final long errorID) {
+     assertEquals(UriParserSemanticException.class, exception.getClass());
+     return this;
+   }
+ 
+   public FilterValidator isNull() {
+     if (!(curExpression instanceof LiteralImpl)) {
+       fail("Current expression is not a literal");
+     }
+ 
+     String actualLiteralText = ((LiteralImpl) curExpression).getText();
+     assertEquals("null", actualLiteralText);
+     return this;
+   }
+ 
+   public FilterValidator isTrue() {
+     if (!(curExpression instanceof LiteralImpl)) {
+       fail("Current expression is not a literal");
+     }
+ 
+     String actualLiteralText = ((LiteralImpl) curExpression).getText();
+     assertEquals("true", actualLiteralText);
+     return this;
+   }
+ 
+   public FilterValidator isFalse() {
+     if (!(curExpression instanceof LiteralImpl)) {
+       fail("Current expression is not a literal");
+     }
+ 
+     String actualLiteralText = ((LiteralImpl) curExpression).getText();
+     assertEquals("false", actualLiteralText);
+     return this;
+   }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java
index 0000000,d484020..d81bbcf
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java
@@@ -1,0 -1,82 +1,82 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import java.util.Arrays;
+ import java.util.List;
+ 
+ import org.antlr.v4.runtime.Token;
+ import org.antlr.v4.runtime.misc.NotNull;
+ import org.antlr.v4.runtime.misc.Nullable;
+ import org.antlr.v4.runtime.misc.Utils;
+ import org.antlr.v4.runtime.tree.ErrorNode;
+ import org.antlr.v4.runtime.tree.RuleNode;
+ import org.antlr.v4.runtime.tree.TerminalNode;
+ import org.antlr.v4.runtime.tree.Tree;
+ 
+ public class ParseTreeToText {
+ 
+   public static String getTreeAsText(final Tree contextTree, final String[] ruleNames) {
+     return toStringTree(contextTree, Arrays.asList(ruleNames));
+   }
+ 
+   private static String toStringTree(final Tree t, @Nullable final List<String> ruleNames) {
+ 
+     if (t.getChildCount() == 0) {
+       return Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
+     }
+ 
+     StringBuilder buf = new StringBuilder();
+     String s = Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
+     buf.append(s);
+     buf.append("(");
+ 
+     for (int i = 0; i < t.getChildCount(); i++) {
+       if (i > 0) {
+         buf.append(' ');
+       }
+       buf.append(toStringTree(t.getChild(i), ruleNames));
+     }
+     buf.append(")");
+     return buf.toString();
+   }
+ 
+   private static String getNodeText(@NotNull final Tree t, @Nullable final List<String> ruleNames) {
+     if (ruleNames != null) {
+       if (t instanceof RuleNode) {
+         int ruleIndex = ((RuleNode) t).getRuleContext().getRuleIndex();
+         return ruleNames.get(ruleIndex);
+       } else if (t instanceof ErrorNode) {
+         return t.toString();
+       } else if (t instanceof TerminalNode) {
+         Token symbol = ((TerminalNode) t).getSymbol();
+         if (symbol != null) {
+           String s = symbol.getText();
+           return s;
+         }
+       }
+     }
+     // no recog for rule names
+     Object payload = t.getPayload();
+     if (payload instanceof Token) {
+       return ((Token) payload).getText();
+     }
+     return t.getPayload().toString();
+   }
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
index 0000000,280f0a1..dc4936e
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java
@@@ -1,0 -1,243 +1,243 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import static org.junit.Assert.assertEquals;
+ 
+ import java.util.ArrayList;
+ import java.util.List;
+ 
+ import org.antlr.v4.runtime.ParserRuleContext;
+ import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
+ 
+ // TODO extend to test also exception which can occure while paring
+ public class ParserValidator {
+ 
+   private String input = null;
+   private ParserRuleContext root;
+ 
+   int logLevel = 0;
+   private int lexerLogLevel = 0;
+ 
+   boolean allowFullContext;
+   boolean allowContextSensitifity;
+   boolean allowAmbiguity;
+ 
+   List<Exception> exceptions = new ArrayList<Exception>();
+   private Exception curException = null;
+ 
+   // --- Setup ---
+ 
+   public ParserValidator log(final int logLevel) {
+     this.logLevel = logLevel;
+     return this;
+   }
+ 
+   public ParserValidator lexerLog(final int logLevel) {
+     lexerLogLevel = logLevel;
+     return this;
+   }
+ 
+   /**
+    * TODO verify
+    * Used in fast LL Parsing:
+    * Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is
+    * required
+    * @return
+    */
+   public ParserValidator aFC() {
+     allowFullContext = true;
+     return this;
+   }
+ 
+   /**
+    * 
+    * TODO verify
+    * Used in fast LL Parsing:
+    * Allows ContextSensitifity Errors which occur often when using the slower full context parsing
+    * and indicate that there is a context sensitivity ( which may not be an error).
+    * @return
+    */
+   public ParserValidator aCS() {
+     allowContextSensitifity = true;
+     return this;
+   }
+ 
+   /**
+    * TODO verify
+    * Used in fast LL Parsing:
+    * Allows ambiguities
+    * @return
+    */
+   public ParserValidator aAM() {
+     allowAmbiguity = true;
+     return this;
+   }
+ 
+   // --- Execution ---
+ 
+   public ParserValidator run(final String uri) {
+     input = uri;
+ 
+     // just run a short lexer step. E.g. to print the tokens
+     if (lexerLogLevel > 0) {
+       (new TokenValidator()).log(lexerLogLevel).run(input);
+     }
+ 
+     /**/// root = parseInput(uri);
+ 
+     // if LOG > 0 - Write serialized tree
+     if (logLevel > 0) {
+       if (root != null) {
+         System.out.println(ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames()));
+       } else {
+         System.out.println("root == null");
+       }
+     }
+ 
+     // reset for next test
+     allowFullContext = false;
+     allowContextSensitifity = false;
+     allowAmbiguity = false;
+     logLevel = 0;
+ 
+     return this;
+   }
+ 
+   // --- Navigation ---
+ 
+   public ParserValidator exFirst() {
+     try {
+       // curWeakException = exceptions.get(0);
+     } catch (IndexOutOfBoundsException ex) {
+       // curWeakException = null;
+     }
+     return this;
+ 
+   }
+ 
+   public ParserValidator exLast() {
+     // curWeakException = exceptions.get(exceptions.size() - 1);
+     return this;
+   }
+ 
+   public ParserValidator exAt(final int index) {
+     try {
+       // curWeakException = exceptions.get(index);
+     } catch (IndexOutOfBoundsException ex) {
+       // curWeakException = null;
+     }
+     return this;
+   }
+ 
+   // --- Validation ---
+ 
+   public ParserValidator isText(final String expected) {
+ 
+     assertEquals(null, curException);
+     assertEquals(0, exceptions.size());
+ 
+     String actualTreeAsText = ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames());
+ 
+     assertEquals(expected, actualTreeAsText);
+     return this;
+   }
+ 
+   public ParserValidator isExeptionType(final Class<?> exClass) {
+     assertEquals(exClass, curException.getClass());
+     return this;
+   }
+ 
+   // --- Helper ---
+   /*
+    * private OdataRelativeUriEOFContext parseInput(final String input) {
+    * UriParserParser parser = null;
+    * UriLexerWithTrace lexer = null;
+    * OdataRelativeUriEOFContext ret = null;
+    * 
+    * // Use 2 stage approach to improve performance
+    * // see https://github.com/antlr/antlr4/issues/192
+    * // TODO verify this
+    * 
+    * // stage= 1
+    * try {
+    * curException = null;
+    * exceptions.clear();
+    * 
+    * // create parser
+    * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
+    * parser = new UriParserParser(new CommonTokenStream(lexer));
+    * 
+    * // write always a error message in case of syntax errors
+    * // parser.addErrorListener(new TestErrorHandler<Object>());
+    * // check error message if whether they are allowed or not
+    * // parser.addErrorListener(new ErrorCollector());
+    * 
+    * // bail out of parser at first syntax error. --> proceed in catch block with step 2
+    * parser.setErrorHandler(new BailErrorStrategy());
+    * 
+    * // user the faster SLL parsing
+    * parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
+    * 
+    * // parse
+    * if (logLevel > 0) {
+    * System.out.println("Step 1");
+    * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode());
+    * }
+    * ret = parser.odataRelativeUriEOF();
+    * 
+    * } catch (Exception exception) {
+    * curException = exception;
+    * try {
+    * // clear status
+    * curException = null;
+    * exceptions.clear();
+    * 
+    * // create parser
+    * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
+    * parser = new UriParserParser(new CommonTokenStream(lexer));
+    * 
+    * // write always a error message in case of syntax errors
+    * // parser.addErrorListener(new ErrorCollector(this));
+    * // check error message if whether they are allowed or not
+    * // parser.addErrorListener(new ErrorCollector(this));
+    * 
+    * // Used default error strategy
+    * parser.setErrorHandler(new DefaultErrorStrategy());
+    * 
+    * // User the slower SLL parsing
+    * parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+    * 
+    * // parse
+    * if (logLevel > 1) {
+    * System.out.println("Step 2");
+    * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
+    * }
+    * ret = parser.odataRelativeUriEOF();
+    * 
+    * } catch (Exception exception1) {
+    * curException = exception1;
+    * // exceptionOnStage = 2;
+    * }
+    * }
+    * 
+    * return ret;
+    * }
+    */
+ }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f094e109/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java
----------------------------------------------------------------------
diff --cc odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java
index 0000000,147bae6..b006e86
mode 000000,100644..100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java
@@@ -1,0 -1,56 +1,56 @@@
 -/*******************************************************************************
++/* 
+  * Licensed to the Apache Software Foundation (ASF) under one
 - * or more contributor license agreements. See the NOTICE file
++ * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
 - * regarding copyright ownership. The ASF licenses this file
++ * 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
 - * 
++ * 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
++ * KIND, either express or implied.  See the License for the
+  * specific language governing permissions and limitations
+  * under the License.
 - ******************************************************************************/
++ */
+ package org.apache.olingo.odata4.server.core.uri.testutil;
+ 
+ import org.antlr.v4.runtime.DefaultErrorStrategy;
+ import org.antlr.v4.runtime.DiagnosticErrorListener;
+ import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
+ import org.apache.olingo.odata4.server.core.uri.parser.Parser;
+ 
+ public class ParserWithLogging extends Parser {
+   TestErrorLogger errorCollector1;
+   TestErrorLogger errorCollector2;
+ 
+   public ParserWithLogging() {
+     errorCollector1 = new TestErrorLogger("Stage 1", 1);
+     errorCollector2 = new TestErrorLogger("Stage 2", 1);
+   }
+ 
+   @Override
+   protected void addStage2ErrorStategy(final 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(final UriParserParser parser) {
+     // Log error to console
+     parser.removeErrorListeners();
+     parser.addErrorListener(errorCollector1);
+     parser.addErrorListener(new DiagnosticErrorListener());
+   }
+ 
+   @Override
+   protected void addStage2ErrorListener(final UriParserParser parser) {
+     // Log error to console
+     parser.removeErrorListeners();
+     parser.addErrorListener(errorCollector2);
+     parser.addErrorListener(new DiagnosticErrorListener());
+   }
+ }


[5/9] [OLINGO-63] Uri Parser: add special handling for leading type filter in member, expand, select

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
new file mode 100644
index 0000000..9544b98
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceValue;
+
+public class UriResourceValueImpl extends UriResourceImpl implements UriResourceValue {
+
+  public UriResourceValueImpl() {
+    super(UriResourceKind.value);
+
+  }
+
+  @Override
+  public String toString() {
+    return "$value";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
new file mode 100644
index 0000000..90f7456
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriParameter;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+
+public abstract class UriResourceWithKeysImpl extends UriResourceImpl implements UriResourcePartTyped {
+
+  protected EdmType collectionTypeFilter = null;
+  protected List<UriParameterImpl> keyPredicates = null;
+  protected EdmType entryTypeFilter = null;
+
+  public UriResourceWithKeysImpl(final UriResourceKind kind) {
+    super(kind);
+  }
+
+  public EdmType getTypeFilterOnCollection() {
+    return collectionTypeFilter;
+  }
+
+  public EdmType getTypeFilterOnEntry() {
+    return entryTypeFilter;
+  }
+
+  public List<UriParameter> getKeyPredicates() {
+    List<UriParameter> retList = new ArrayList<UriParameter>();
+    for (UriParameterImpl item : keyPredicates) {
+      retList.add(item);
+    }
+    return retList;
+  }
+
+  public UriResourceWithKeysImpl setKeyPredicates(final List<UriParameterImpl> list) {
+    keyPredicates = list;
+    return this;
+  }
+
+  public UriResourceWithKeysImpl setEntryTypeFilter(final EdmType entryTypeFilter) {
+    this.entryTypeFilter = entryTypeFilter;
+    return this;
+  }
+
+  public UriResourceWithKeysImpl setCollectionTypeFilter(final EdmType collectionTypeFilter) {
+    this.collectionTypeFilter = collectionTypeFilter;
+    return this;
+  }
+
+  @Override
+  public String toString(final boolean includeFilters) {
+
+    if (includeFilters == true) {
+      String tmp = "";
+      if (collectionTypeFilter != null) {
+        tmp += getFQN(collectionTypeFilter).toString();
+      }
+
+      if (entryTypeFilter != null) {
+        if (tmp.length() == 0) {
+          tmp = getFQN(entryTypeFilter).toString();
+        } else {
+          tmp += "/()" + getFQN(entryTypeFilter).toString();
+        }
+      }
+      if (tmp.length() != 0) {
+        return toString() + "/" + tmp;
+      }
+    }
+
+    return toString();
+  }
+
+  private FullQualifiedName getFQN(final EdmType type) {
+    return new FullQualifiedName(type.getNamespace(), type.getName());
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java
deleted file mode 100644
index 4f69cbf..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java
+++ /dev/null
@@ -1,291 +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.server.core.uri.apiimpl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.server.api.uri.UriInfo;
-import org.apache.olingo.odata4.server.api.uri.UriInfoAll;
-import org.apache.olingo.odata4.server.api.uri.UriInfoBatch;
-import org.apache.olingo.odata4.server.api.uri.UriInfoCrossjoin;
-import org.apache.olingo.odata4.server.api.uri.UriInfoEntityId;
-import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.server.api.uri.UriInfoMetadata;
-import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.server.api.uri.UriInfoService;
-import org.apache.olingo.odata4.server.api.uri.UriResource;
-import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.SkipTokenOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
-import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption;
-import org.apache.olingo.odata4.server.core.uri.queryoption.CountOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.FormatOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.SearchOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.SkipOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.SkipTokenOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.SystemQueryOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.TopOptionImpl;
-
-public class UriInfoImpl implements UriInfo {
-
-  private UriInfoKind kind;
-
-  private List<String> entitySetNames = new ArrayList<String>(); // for $entity
-  private EdmEntityType entityTypeCast; // for $entity
-
-  // Query options
-  private List<CustomQueryOptionImpl> customQueryOptions = new ArrayList<CustomQueryOptionImpl>();
-  private ExpandOptionImpl expandOption;
-  private FilterOptionImpl filterOption;
-  private FormatOptionImpl formatOption;
-  private IdOption idOption;
-  private CountOptionImpl inlineCountOption;
-  private OrderByOptionImpl orderByOption;
-  private SearchOptionImpl searchOption;
-  private SelectOptionImpl selectOption;
-  private SkipOptionImpl skipOption;
-  private SkipTokenOptionImpl skipTokenOption;
-  private TopOptionImpl topOption;
-
-  private String fragment;
-
-  private UriResource lastResourcePart;
-  private List<UriResource> pathParts = new ArrayList<UriResource>();
-
-  @Override
-  public UriInfoAll asUriInfoAll() {
-    return this;
-  }
-
-  @Override
-  public UriInfoBatch asUriInfoBatch() {
-    return this;
-  }
-
-  @Override
-  public UriInfoCrossjoin asUriInfoCrossjoin() {
-    return this;
-  }
-
-  @Override
-  public UriInfoEntityId asUriInfoEntityId() {
-    return this;
-  }
-
-  @Override
-  public UriInfoMetadata asUriInfoMetadata() {
-    return this;
-  }
-
-  @Override
-  public UriInfoResource asUriInfoResource() {
-    return this;
-  }
-
-  @Override
-  public List<String> getEntitySetNames() {
-    return Collections.unmodifiableList(entitySetNames);
-  }
-
-  public void addEntitySetName(final String entitySet) {
-    entitySetNames.add(entitySet);
-  }
-
-  @Override
-  public List<UriResource> getUriResourceParts() {
-    List<UriResource> returnList = new ArrayList<UriResource>();
-    for (UriResource item : pathParts) {
-      returnList.add(item);
-    }
-    return Collections.unmodifiableList(returnList);
-  }
-
-  public UriInfoImpl addResourcePart(final UriResourceImpl uriPathInfo) {
-    pathParts.add(uriPathInfo);
-    lastResourcePart = uriPathInfo;
-    return this;
-  }
-
-  @Override
-  public List<CustomQueryOption> getCustomQueryOptions() {
-    List<CustomQueryOption> retList = new ArrayList<CustomQueryOption>();
-    for (CustomQueryOptionImpl item : customQueryOptions) {
-      retList.add(item);
-    }
-    return retList;
-  }
-
-  @Override
-  public EdmEntityType getEntityTypeCast() {
-    return entityTypeCast;
-  }
-
-  public UriInfoImpl setEntityTypeCast(final EdmEntityType type) {
-    entityTypeCast = type;
-    return this;
-  }
-
-  @Override
-  public ExpandOption getExpandOption() {
-    return expandOption;
-  }
-
-  @Override
-  public FilterOption getFilterOption() {
-    return filterOption;
-  }
-
-  @Override
-  public FormatOption getFormatOption() {
-    return formatOption;
-  }
-
-  @Override
-  public IdOption getIdOption() {
-    return idOption;
-  }
-
-  @Override
-  public InlineCountOption getInlineCountOption() {
-    return inlineCountOption;
-  }
-
-  @Override
-  public UriInfoKind getKind() {
-    return kind;
-  }
-
-  public UriInfoImpl setKind(final UriInfoKind kind) {
-    this.kind = kind;
-    return this;
-  }
-
-  public UriResource getLastResourcePart() {
-    return lastResourcePart;
-  }
-
-  @Override
-  public OrderByOption getOrderByOption() {
-    return orderByOption;
-  }
-
-  @Override
-  public SearchOption getSearchOption() {
-
-    return searchOption;
-  }
-
-  @Override
-  public SelectOption getSelectOption() {
-    return selectOption;
-  }
-
-  @Override
-  public SkipOption getSkipOption() {
-    return skipOption;
-  }
-
-  @Override
-  public SkipTokenOption getSkipTokenOption() {
-    return skipTokenOption;
-  }
-
-  @Override
-  public TopOption getTopOption() {
-    return topOption;
-  }
-
-  public UriInfoImpl setQueryOptions(final List<QueryOptionImpl> list) {
-
-    for (QueryOptionImpl item : list) {
-      if (item instanceof SystemQueryOptionImpl) {
-        setSystemQueryOption((SystemQueryOptionImpl) item);
-      } else if (item instanceof CustomQueryOptionImpl) {
-        addCustomQueryOption(item);
-      }
-    }
-    return this;
-  }
-
-  public void addCustomQueryOption(final QueryOptionImpl item) {
-    customQueryOptions.add((CustomQueryOptionImpl) item);
-  }
-
-  public UriInfoImpl setSystemQueryOption(final SystemQueryOptionImpl systemOption) {
-
-    if (systemOption.getKind() == SupportedQueryOptions.EXPAND) {
-      expandOption = (ExpandOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.FILTER) {
-      filterOption = (FilterOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.FORMAT) {
-      formatOption = (FormatOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.ID) {
-      idOption = (IdOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.INLINECOUNT) {
-      inlineCountOption = (CountOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.ORDERBY) {
-      orderByOption = (OrderByOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.SEARCH) {
-      searchOption = (SearchOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.SELECT) {
-      selectOption = (SelectOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.SKIP) {
-      skipOption = (SkipOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.SKIPTOKEN) {
-      skipTokenOption = (SkipTokenOptionImpl) systemOption;
-    } else if (systemOption.getKind() == SupportedQueryOptions.TOP) {
-      topOption = (TopOptionImpl) systemOption;
-    }
-    return this;
-  }
-
-  @Override
-  public UriInfoService asUriInfoService() {
-    return this;
-  }
-
-  @Override
-  public String getFragment() {
-    return fragment;
-  }
-
-  public UriInfoImpl setFragment(final String fragment) {
-    this.fragment = fragment;
-    return this;
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java
deleted file mode 100644
index 38c6768..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java
+++ /dev/null
@@ -1,83 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.server.api.uri.UriParameter;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriParameterImpl implements UriParameter {
-  private String name;
-  private String text;
-  private String alias;
-  private Expression expression;
-  private String referencedProperty;
-
-  @Override
-  public String getName() {
-    return name;
-  }
-
-  public UriParameterImpl setName(final String name) {
-    this.name = name;
-    return this;
-  }
-
-  @Override
-  public String getAlias() {
-    return alias;
-  }
-
-  public UriParameterImpl setAlias(final String alias) {
-    this.alias = alias;
-    return this;
-  }
-
-  @Override
-  public String getText() {
-    return text;
-  }
-
-  public UriParameterImpl setText(final String text) {
-    this.text = text;
-    return this;
-  }
-
-  @Override
-  public Expression getExression() {
-    return expression;
-  }
-
-  public UriParameterImpl setExpression(final ExpressionImpl expression) {
-    this.expression = expression;
-    return this;
-  }
-
-  @Override
-  public String getRefencedProperty() {
-    return referencedProperty;
-  }
-
-  public UriParameterImpl setRefencedProperty(final String referencedProperty) {
-    this.referencedProperty = referencedProperty;
-    return this;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceActionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceActionImpl.java
deleted file mode 100644
index f8805c6..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceActionImpl.java
+++ /dev/null
@@ -1,77 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmAction;
-import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceAction;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-
-public class UriResourceActionImpl extends UriResourceTypedImpl implements UriResourceAction {
-
-  protected EdmAction action;
-  protected EdmActionImport actionImport;
-
-  public UriResourceActionImpl() {
-    super(UriResourceKind.action);
-  }
-
-  @Override
-  public EdmAction getAction() {
-    return action;
-  }
-
-  public UriResourceActionImpl setAction(final EdmAction action) {
-    this.action = action;
-    return this;
-  }
-
-  @Override
-  public EdmActionImport getActionImport() {
-    return actionImport;
-  }
-
-  public UriResourceActionImpl setActionImport(final EdmActionImport actionImport) {
-    this.actionImport = actionImport;
-    setAction(actionImport.getAction());
-    return this;
-  }
-
-  @Override
-  public boolean isCollection() {
-    return action.getReturnType().isCollection();
-  }
-
-  @Override
-  public EdmType getType() {
-    return action.getReturnType().getType();
-  }
-
-  @Override
-  public String toString() {
-    if (actionImport != null) {
-      return actionImport.getName();
-    } else if (action != null) {
-      return action.getName();
-    }
-    return "";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceComplexPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceComplexPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceComplexPropertyImpl.java
deleted file mode 100644
index 0fd03ae..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceComplexPropertyImpl.java
+++ /dev/null
@@ -1,70 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceComplexProperty;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-
-public class UriResourceComplexPropertyImpl extends UriResourceTypedImpl implements UriResourceComplexProperty {
-
-  protected EdmProperty property;
-
-  public UriResourceComplexPropertyImpl() {
-    super(UriResourceKind.complexProperty);
-  }
-
-  @Override
-  public EdmProperty getProperty() {
-    return property;
-  }
-
-  public UriResourceComplexPropertyImpl setProperty(final EdmProperty property) {
-    this.property = property;
-    return this;
-  }
-
-  @Override
-  public EdmComplexType getComplexType() {
-    return (EdmComplexType) getType();
-  }
-
-  @Override
-  public EdmComplexType getComplexTypeFilter() {
-    return (EdmComplexType) typeFilter;
-  }
-
-  @Override
-  public EdmType getType() {
-    return property.getType();
-  }
-
-  @Override
-  public boolean isCollection() {
-    return property.isCollection();
-  }
-
-  @Override
-  public String toString() {
-    return property.getName();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceCountImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceCountImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceCountImpl.java
deleted file mode 100644
index 3417e8b..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceCountImpl.java
+++ /dev/null
@@ -1,35 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.server.api.uri.UriResourceCount;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-
-public class UriResourceCountImpl extends UriResourceImpl implements UriResourceCount {
-
-  public UriResourceCountImpl() {
-    super(UriResourceKind.count);
-  }
-
-  @Override
-  public String toString() {
-    return "$count";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceEntitySetImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceEntitySetImpl.java
deleted file mode 100644
index 2066445..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceEntitySetImpl.java
+++ /dev/null
@@ -1,67 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-
-public class UriResourceEntitySetImpl extends UriResourceWithKeysImpl implements UriResourceEntitySet {
-  protected EdmEntitySet edmEntitySet = null;
-
-  public UriResourceEntitySetImpl() {
-    super(UriResourceKind.entitySet);
-  }
-
-  @Override
-  public EdmEntitySet getEntitySet() {
-    return edmEntitySet;
-  }
-
-  public UriResourceEntitySetImpl setEntitSet(final EdmEntitySet edmES) {
-    edmEntitySet = edmES;
-    return this;
-  }
-
-  @Override
-  public EdmEntityType getEntityType() {
-    return edmEntitySet.getEntityType();
-  }
-
-  @Override
-  public EdmType getType() {
-    return edmEntitySet.getEntityType();
-  }
-
-  @Override
-  public boolean isCollection() {
-    if (keyPredicates == null) {
-      return true;
-    }
-    return false;
-  }
-
-  @Override
-  public String toString() {
-    return edmEntitySet.getName();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java
deleted file mode 100644
index 344faa7..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java
+++ /dev/null
@@ -1,111 +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.server.core.uri.apiimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriParameter;
-import org.apache.olingo.odata4.server.api.uri.UriResourceFunction;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-
-/**
- * Covers Function imports and BoundFunction in URI
- */
-public class UriResourceFunctionImpl extends UriResourceWithKeysImpl implements UriResourceFunction {
-
-  protected List<UriParameterImpl> parameters;
-  protected EdmFunction function;
-  protected EdmFunctionImport functionImport;
-  private boolean isParameterListFilled = false;
-
-  public UriResourceFunctionImpl() {
-    super(UriResourceKind.function);
-  }
-
-  @Override
-  public List<UriParameter> getParameters() {
-    List<UriParameter> retList = new ArrayList<UriParameter>();
-    for (UriParameterImpl item : parameters) {
-      retList.add(item);
-    }
-    return retList;
-  }
-
-  public UriResourceFunctionImpl setParameters(final List<UriParameterImpl> parameters) {
-    isParameterListFilled = true;
-    this.parameters = parameters;
-    return this;
-  }
-
-  @Override
-  public EdmFunction getFunction() {
-    return function;
-  }
-
-  public UriResourceFunctionImpl setFunction(final EdmFunction function) {
-    this.function = function;
-    return this;
-  }
-
-  @Override
-  public EdmFunctionImport getFunctionImport() {
-    return functionImport;
-  }
-
-  public UriResourceFunctionImpl setFunctionImport(final EdmFunctionImport edmFI,
-      final List<UriParameterImpl> parameters) {
-    functionImport = edmFI;
-
-    setParameters(parameters);
-
-    return this;
-  }
-
-  @Override
-  public EdmType getType() {
-    return function.getReturnType().getType();
-  }
-
-  @Override
-  public boolean isCollection() {
-    if (keyPredicates != null) {
-      return false;
-    }
-    return function.getReturnType().isCollection();
-  }
-
-  @Override
-  public String toString() {
-    if (functionImport != null) {
-      return functionImport.getName();
-    } else if (function != null) {
-      return function.getName();
-    }
-    return "";
-  }
-
-  public boolean isParameterListFilled() {
-    return isParameterListFilled;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceImpl.java
deleted file mode 100644
index 7b17d70..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceImpl.java
+++ /dev/null
@@ -1,39 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.server.api.uri.UriResource;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-
-/**
- * Covers Functionimports and BoundFunction in URI
- */
-public abstract class UriResourceImpl implements UriResource {
-  protected UriResourceKind kind;
-
-  public UriResourceImpl(final UriResourceKind kind) {
-    this.kind = kind;
-  }
-
-  @Override
-  public UriResourceKind getKind() {
-    return kind;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java
deleted file mode 100644
index 587345b..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java
+++ /dev/null
@@ -1,65 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceIt;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-
-/**
- * Covers Functionimports and BoundFunction in URI
- */
-public class UriResourceItImpl extends UriResourceWithKeysImpl implements UriResourceIt {
-
-  private EdmType type;
-  private boolean isCollection;
-
-  public UriResourceItImpl() {
-    super(UriResourceKind.it);
-  }
-
-  @Override
-  public EdmType getType() {
-    return type;
-  }
-
-  public UriResourceItImpl setType(final EdmType type) {
-    this.type = type;
-    return this;
-  }
-
-  @Override
-  public boolean isCollection() {
-    if (keyPredicates != null) {
-      return false;
-    }
-    return isCollection;
-  }
-
-  public UriResourceItImpl setCollection(final boolean isCollection) {
-    this.isCollection = isCollection;
-    return this;
-  }
-
-  @Override
-  public String toString() {
-    return "$it";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAllImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAllImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAllImpl.java
deleted file mode 100644
index 6d4cd76..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAllImpl.java
+++ /dev/null
@@ -1,73 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAll;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements UriResourceLambdaAll {
-  protected EdmProperty property;
-  private String lamdaVariable;
-  private ExpressionImpl expression;
-
-  public UriResourceLambdaAllImpl() {
-    super(UriResourceKind.lambdaAll);
-  }
-
-  @Override
-  public EdmType getType() {
-    return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
-  }
-
-  @Override
-  public boolean isCollection() {
-    return false;
-  }
-
-  @Override
-  public String getLamdaVariable() {
-    return lamdaVariable;
-  }
-
-  public UriResourceLambdaAllImpl setLamdaVariable(final String lamdaVariable) {
-    this.lamdaVariable = lamdaVariable;
-    return this;
-  };
-
-  @Override
-  public Expression getExpression() {
-    return expression;
-  }
-
-  public UriResourceLambdaAllImpl setExpression(final ExpressionImpl expression) {
-    this.expression = expression;
-    return this;
-  };
-
-  @Override
-  public String toString() {
-    return "all";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAnyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAnyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAnyImpl.java
deleted file mode 100644
index d67bc77..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAnyImpl.java
+++ /dev/null
@@ -1,72 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAny;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements UriResourceLambdaAny {
-  protected EdmProperty property;
-  private String lamdaVariable;
-  private ExpressionImpl expression;
-
-  public UriResourceLambdaAnyImpl() {
-    super(UriResourceKind.lambdaAny);
-  }
-
-  @Override
-  public EdmType getType() {
-    return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
-  }
-
-  @Override
-  public boolean isCollection() {
-    return false;
-  }
-
-  @Override
-  public String getLamdaVariable() {
-    return lamdaVariable;
-  }
-
-  public UriResourceLambdaAnyImpl setLamdaVariable(final String lamdaVariable) {
-    this.lamdaVariable = lamdaVariable;
-    return this;
-  };
-
-  @Override
-  public Expression getExpression() {
-    return expression;
-  }
-
-  public UriResourceLambdaAnyImpl setExpression(final ExpressionImpl expression) {
-    this.expression = expression;
-    return this;
-  }
-
-  @Override
-  public String toString() {
-    return "any";
-  };
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaVarImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaVarImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaVarImpl.java
deleted file mode 100644
index 87d0d6e..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaVarImpl.java
+++ /dev/null
@@ -1,70 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaRef;
-
-public class UriResourceLambdaVarImpl extends UriResourceTypedImpl implements UriResourceLambdaRef {
-
-  private EdmType type;
-  private boolean isCollection;
-  private String variableText;
-
-  public UriResourceLambdaVarImpl() {
-    super(UriResourceKind.lambdaVariable);
-  }
-
-  @Override
-  public String getVariableText() {
-    return variableText;
-  }
-
-  public UriResourceLambdaVarImpl setVariableText(final String variableText) {
-    this.variableText = variableText;
-    return this;
-  }
-
-  @Override
-  public EdmType getType() {
-    return type;
-  }
-
-  public UriResourceLambdaVarImpl setType(final EdmType type) {
-    this.type = type;
-    return this;
-
-  }
-
-  @Override
-  public boolean isCollection() {
-    return isCollection;
-  }
-
-  public UriResourceLambdaVarImpl setCollection(final boolean isCollection) {
-    this.isCollection = isCollection;
-    return this;
-  }
-
-  @Override
-  public String toString() {
-    return variableText;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceNavigationPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceNavigationPropertyImpl.java
deleted file mode 100644
index 0530e1b..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceNavigationPropertyImpl.java
+++ /dev/null
@@ -1,63 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceNavigation;
-
-public class UriResourceNavigationPropertyImpl extends UriResourceWithKeysImpl implements UriResourceNavigation {
-
-  protected EdmNavigationProperty navigationProperty;
-
-  public UriResourceNavigationPropertyImpl() {
-    super(UriResourceKind.navigationProperty);
-  }
-
-  @Override
-  public EdmNavigationProperty getProperty() {
-    return navigationProperty;
-  }
-
-  public UriResourceNavigationPropertyImpl setNavigationProperty(final EdmNavigationProperty property) {
-    navigationProperty = property;
-    return this;
-
-  }
-
-  @Override
-  public EdmType getType() {
-    return navigationProperty.getType();
-  }
-
-  @Override
-  public boolean isCollection() {
-    if (keyPredicates != null) {
-      return false;
-    }
-    return navigationProperty.isCollection();
-  }
-
-  @Override
-  public String toString() {
-    return navigationProperty.getName();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourcePrimitivePropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourcePrimitivePropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourcePrimitivePropertyImpl.java
deleted file mode 100644
index ade9929..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourcePrimitivePropertyImpl.java
+++ /dev/null
@@ -1,59 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourcePrimitiveProperty;
-
-public class UriResourcePrimitivePropertyImpl extends UriResourceTypedImpl implements UriResourcePrimitiveProperty {
-
-  EdmProperty property;
-
-  public UriResourcePrimitivePropertyImpl() {
-    super(UriResourceKind.primitiveProperty);
-  }
-
-  @Override
-  public EdmProperty getProperty() {
-    return property;
-  }
-
-  public UriResourcePrimitivePropertyImpl setProperty(final EdmProperty property) {
-    this.property = property;
-    return this;
-  }
-
-  @Override
-  public EdmType getType() {
-    return property.getType();
-  }
-
-  @Override
-  public boolean isCollection() {
-    return property.isCollection();
-  }
-
-  @Override
-  public String toString() {
-    return property.getName();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRefImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRefImpl.java
deleted file mode 100644
index 5f39a87..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRefImpl.java
+++ /dev/null
@@ -1,36 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceRef;
-
-public class UriResourceRefImpl extends UriResourceImpl implements UriResourceRef {
-
-  public UriResourceRefImpl() {
-    super(UriResourceKind.ref);
-
-  }
-
-  @Override
-  public String toString() {
-    return "$ref";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRootImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRootImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRootImpl.java
deleted file mode 100644
index 66c7da3..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRootImpl.java
+++ /dev/null
@@ -1,62 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceRoot;
-
-public class UriResourceRootImpl extends UriResourceWithKeysImpl implements UriResourceRoot {
-
-  private EdmType type;
-  private boolean isCollection;
-
-  public UriResourceRootImpl() {
-    super(UriResourceKind.root);
-  }
-
-  @Override
-  public EdmType getType() {
-    return type;
-  }
-
-  public UriResourceRootImpl setType(final EdmType type) {
-    this.type = type;
-    return this;
-  }
-
-  @Override
-  public boolean isCollection() {
-    if (keyPredicates != null) {
-      return false;
-    }
-    return isCollection;
-  }
-
-  public UriResourceRootImpl setCollection(final boolean isCollection) {
-    this.isCollection = isCollection;
-    return this;
-  }
-
-  @Override
-  public String toString() {
-    return "$root";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceSingletonImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceSingletonImpl.java
deleted file mode 100644
index d05e772..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceSingletonImpl.java
+++ /dev/null
@@ -1,71 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceSingleton;
-
-public class UriResourceSingletonImpl extends UriResourceTypedImpl implements UriResourceSingleton {
-
-  private EdmSingleton singleton;
-
-  public UriResourceSingletonImpl() {
-    super(UriResourceKind.singleton);
-  }
-
-  @Override
-  public EdmSingleton getSingleton() {
-    return singleton;
-  }
-
-  public UriResourceSingletonImpl setSingleton(final EdmSingleton singleton) {
-
-    this.singleton = singleton;
-    return this;
-  }
-
-  @Override
-  public EdmEntityType getEntityTypeFilter() {
-    return (EdmEntityType) typeFilter;
-  }
-
-  @Override
-  public EdmType getType() {
-    return singleton.getEntityType();
-  }
-
-  @Override
-  public EdmEntityType getEntityType() {
-    return singleton.getEntityType();
-  }
-
-  @Override
-  public boolean isCollection() {
-    return false;
-  }
-
-  @Override
-  public String toString() {
-    return singleton.getName();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceStartingTypeFilterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceStartingTypeFilterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceStartingTypeFilterImpl.java
deleted file mode 100644
index b1781de..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceStartingTypeFilterImpl.java
+++ /dev/null
@@ -1,68 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceStartingTypeFilter;
-
-public class UriResourceStartingTypeFilterImpl extends UriResourceWithKeysImpl
-    implements UriResourceStartingTypeFilter {
-
-  private EdmType type;
-  private boolean isCollection;
-
-  public UriResourceStartingTypeFilterImpl() {
-    super(UriResourceKind.startingTypeFilter);
-  }
-
-  @Override
-  public UriResourceKind getKind() {
-    return kind;
-  }
-
-  @Override
-  public EdmType getType() {
-    return type;
-  }
-
-  public UriResourceStartingTypeFilterImpl setType(final EdmType type) {
-    this.type = type;
-    return this;
-  }
-
-  @Override
-  public boolean isCollection() {
-    if (keyPredicates != null) {
-      return false;
-    }
-    return isCollection;
-  }
-
-  public UriResourceStartingTypeFilterImpl setCollection(final boolean isCollection) {
-    this.isCollection = isCollection;
-    return this;
-  }
-
-  @Override
-  public String toString() {
-    return type.getNamespace() + "." + type.getName();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java
deleted file mode 100644
index 9b2983d..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java
+++ /dev/null
@@ -1,60 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
-
-public abstract class UriResourceTypedImpl extends UriResourceImpl implements UriResourcePartTyped {
-
-  protected EdmType typeFilter = null;
-
-  public UriResourceTypedImpl(final UriResourceKind kind) {
-    super(kind);
-  }
-
-  public EdmType getTypeFilter() {
-    return typeFilter;
-  }
-
-  public UriResourceTypedImpl setTypeFilter(final EdmStructuralType typeFilter) {
-    this.typeFilter = typeFilter;
-    return this;
-  }
-
-  @Override
-  public String toString(final boolean includeFilters) {
-    if (includeFilters) {
-      if (typeFilter != null) {
-        return toString() + "/" + getFQN(typeFilter).toString();
-      } else {
-        return toString();
-      }
-    }
-    return toString();
-  }
-
-  private FullQualifiedName getFQN(final EdmType type) {
-    return new FullQualifiedName(type.getNamespace(), type.getName());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceValueImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceValueImpl.java
deleted file mode 100644
index 2377ff8..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceValueImpl.java
+++ /dev/null
@@ -1,36 +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.server.core.uri.apiimpl;
-
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourceValue;
-
-public class UriResourceValueImpl extends UriResourceImpl implements UriResourceValue {
-
-  public UriResourceValueImpl() {
-    super(UriResourceKind.value);
-
-  }
-
-  @Override
-  public String toString() {
-    return "$value";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java
deleted file mode 100644
index 6fec51e..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java
+++ /dev/null
@@ -1,99 +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.server.core.uri.apiimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.odata4.server.api.uri.UriParameter;
-import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
-
-public abstract class UriResourceWithKeysImpl extends UriResourceImpl implements UriResourcePartTyped {
-
-  protected EdmType collectionTypeFilter = null;
-  protected List<UriParameterImpl> keyPredicates = null;
-  protected EdmType entryTypeFilter = null;
-
-  public UriResourceWithKeysImpl(final UriResourceKind kind) {
-    super(kind);
-  }
-
-  public EdmType getTypeFilterOnCollection() {
-    return collectionTypeFilter;
-  }
-
-  public EdmType getTypeFilterOnEntry() {
-    return entryTypeFilter;
-  }
-
-  public List<UriParameter> getKeyPredicates() {
-    List<UriParameter> retList = new ArrayList<UriParameter>();
-    for (UriParameterImpl item : keyPredicates) {
-      retList.add(item);
-    }
-    return retList;
-  }
-
-  public UriResourceWithKeysImpl setKeyPredicates(final List<UriParameterImpl> list) {
-    keyPredicates = list;
-    return this;
-  }
-
-  public UriResourceWithKeysImpl setEntryTypeFilter(final EdmType entryTypeFilter) {
-    this.entryTypeFilter = entryTypeFilter;
-    return this;
-  }
-
-  public UriResourceWithKeysImpl setCollectionTypeFilter(final EdmType collectionTypeFilter) {
-    this.collectionTypeFilter = collectionTypeFilter;
-    return this;
-  }
-
-  @Override
-  public String toString(final boolean includeFilters) {
-
-    if (includeFilters == true) {
-      String tmp = "";
-      if (collectionTypeFilter != null) {
-        tmp += getFQN(collectionTypeFilter).toString();
-      }
-
-      if (entryTypeFilter != null) {
-        if (tmp.length() == 0) {
-          tmp = getFQN(entryTypeFilter).toString();
-        } else {
-          tmp += "/()" + getFQN(entryTypeFilter).toString();
-        }
-      }
-      if (tmp.length() != 0) {
-        return toString() + "/" + tmp;
-      }
-    }
-
-    return toString();
-  }
-
-  private FullQualifiedName getFQN(final EdmType type) {
-    return new FullQualifiedName(type.getNamespace(), type.getName());
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
index 1fc33f6..df72c82 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
@@ -34,8 +34,8 @@ import org.apache.olingo.odata4.server.api.uri.UriInfo;
 import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
 import org.apache.olingo.odata4.server.api.uri.UriResource;
 import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
-import org.apache.olingo.odata4.server.core.uri.UriParserException;
-import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceImpl;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AllEOFContext;
@@ -48,8 +48,6 @@ import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MetadataEO
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.PathSegmentEOFContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectEOFContext;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.CountOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java
index 1293271..e6dea9c 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java
@@ -22,7 +22,7 @@ import java.util.List;
 
 public class RawUri {
   public String uri;
-  public String sheme;
+  public String scheme;
   public String authority;
   public String path;
   public String queryOptionString;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java
index b752649..f876793 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java
@@ -21,11 +21,11 @@ package org.apache.olingo.odata4.server.core.uri.parser;
 import java.util.Stack;
 
 import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandPathContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectItemContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectSegmentContext;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
 import org.apache.olingo.odata4.server.core.uri.parser.UriParseTreeVisitor.TypeInformation;
 import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandItemImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.SelectItemImpl;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
index 6aa87b1..2369961 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
@@ -27,7 +27,6 @@ import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
 import org.apache.olingo.odata4.server.core.uri.parser.RawUri.QueryOption;
 
 public class UriDecoder {
@@ -39,7 +38,7 @@ public class UriDecoder {
 
     Matcher m = uriPattern.matcher(uri);
     if (m.matches()) {
-      rawUri.sheme = m.group(2);
+      rawUri.scheme = m.group(2);
       rawUri.authority = m.group(4);
       rawUri.path = m.group(5);
       rawUri.queryOptionString = m.group(7);


[4/9] [OLINGO-63] Uri Parser: add special handling for leading type filter in member, expand, select

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
index d422329..f98e53b 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
@@ -49,8 +49,27 @@ import org.apache.olingo.odata4.server.api.uri.UriResource;
 import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
 import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind;
 import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCallKind;
-import org.apache.olingo.odata4.server.core.uri.UriParserException;
-import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriParameterImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceComplexPropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceCountImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceEntitySetImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceItImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAllImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAnyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaVarImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceNavigationPropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourcePrimitivePropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceRefImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceRootImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceSingletonImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceStartingTypeFilterImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceTypedImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceValueImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserBaseVisitor;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AliasAndValueContext;
@@ -109,8 +128,10 @@ import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MonthMetho
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NameValueOptListContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NameValuePairContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NamespaceContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NaninfinityContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NullruleContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.Number_in_jsonContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OdataIdentifierContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OrderByContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
@@ -141,27 +162,6 @@ import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.Totalsecon
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.UnaryContext;
 import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriParameterImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceComplexPropertyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceCountImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceEntitySetImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceFunctionImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceItImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAllImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAnyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaVarImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceNavigationPropertyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourcePrimitivePropertyImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceRefImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceRootImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceSingletonImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceStartingTypeFilterImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceTypedImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceValueImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.AliasQueryOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.CountOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandItemImpl;
@@ -461,7 +461,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
           if (lastResourcePart == null) {
             // this may be the case if a member expression within a filter starts with a typeCast
             UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
-                .setType(source.type)
+                .setType(filterEntityType)
                 .setCollection(source.isCollection);
             if (source.isCollection) {
               uriResource.setCollectionTypeFilter(filterEntityType);
@@ -527,7 +527,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
           if (lastResourcePart == null) {
             // this may be the case if a member expression within a filter starts with a typeCast
             UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
-                .setType(source.type)
+                .setType(filterComplexType)
                 .setCollection(source.isCollection);
 
             if (source.isCollection) {
@@ -702,8 +702,43 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAll(ctx));
 
-    return new MemberImpl()
-        .setPath(uriInfoImplpath);
+    EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfoImplpath);
+
+    MemberImpl ret = new MemberImpl();
+
+    ret.setResourcePath(uriInfoImplpath);
+    if (startType != null) {
+      ret.setTypeFilter(startType);
+    }
+
+    return ret;
+  }
+
+  private EdmType removeUriResourceStartingTypeFilterImpl(UriInfoImpl uriInfoImplpath) {
+
+    List<UriResource> segments = uriInfoImplpath.getUriResourceParts();
+    if (segments.size() == 0) {
+      return null;
+    }
+    
+    UriResource segment = segments.get(0);
+    if (segment instanceof UriResourceStartingTypeFilterImpl) {
+      UriResourceStartingTypeFilterImpl startingTypeFilter = (UriResourceStartingTypeFilterImpl) segment;
+      
+      EdmType type = null;
+      if (startingTypeFilter.getTypeFilterOnEntry()!= null) {
+         type =startingTypeFilter.getTypeFilterOnEntry();
+      } else if (startingTypeFilter.getTypeFilterOnCollection()!= null) {
+        type =startingTypeFilter.getTypeFilterOnCollection();
+      } else {
+        type =startingTypeFilter.getType();
+      }
+      
+      uriInfoImplpath.removeResourcePart(0);
+      return type;
+    }
+
+    return null;
   }
 
   @Override
@@ -723,8 +758,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAny(ctx));
 
-    return new MemberImpl()
-        .setPath(uriInfoImplpath);
+    EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfoImplpath);
+
+    MemberImpl ret = new MemberImpl();
+    ret.setResourcePath(uriInfoImplpath);
+    if (startType != null) {
+      ret.setTypeFilter(startType);
+    }
+    return ret;
   }
 
   @Override
@@ -1127,7 +1168,12 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     // contextUriInfo.addPathInfo(pathInfoIT);
 
     super.visitExpandPath(ctx);
-    expandItem.setResourceInfo(context.contextUriInfo);
+
+    EdmType startType = this.removeUriResourceStartingTypeFilterImpl(context.contextUriInfo);
+    expandItem.setResourcePath(context.contextUriInfo);
+    if ( startType != null) {
+      expandItem.setTypeFilter(startType);
+    }
 
     // reset context
     context.contextUriInfo = uriInfoResourceBU;
@@ -1148,14 +1194,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       targetType = getTypeInformation(lastSegment).type;
       isColl = lastSegment.isCollection();
     } else {
-      if (context.contextExpandItemPath.getResourceInfo() == null) {
+      if (context.contextExpandItemPath.getResourcePath() == null) {
         // use the type of the last resource path segement
         UriResourceTypedImpl lastSegment = (UriResourceTypedImpl) context.contextUriInfo.getLastResourcePart();
         targetType = getTypeInformation(lastSegment).type;
         isColl = lastSegment.isCollection();
       } else {
         // use the type of the last ''expand'' path segement
-        UriInfoImpl info = (UriInfoImpl) context.contextExpandItemPath.getResourceInfo();
+        UriInfoImpl info = (UriInfoImpl) context.contextExpandItemPath.getResourcePath();
         targetType = getTypeInformation((UriResourceImpl) info.getLastResourcePart()).type;
         isColl = ((UriResourcePartTyped) info.getLastResourcePart()).isCollection();
       }
@@ -1164,14 +1210,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     context.contextTypes.push(new TypeInformation(targetType, isColl));
 
     if (ctx.vC != null) {
-      UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourceInfo();
+      UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourcePath();
       resourcePath.addResourcePart(new UriResourceCountImpl());
 
       for (ExpandCountOptionContext s : ctx.vlEOC) {
         list.add((SystemQueryOptionImpl) s.accept(this));
       }
     } else if (ctx.vR != null) {
-      UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourceInfo();
+      UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourcePath();
       resourcePath.addResourcePart(new UriResourceRefImpl());
 
       for (ExpandRefOptionContext s : ctx.vlEOR) {
@@ -1367,8 +1413,15 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       uriInfoImplpath.addResourcePart((UriResourceImpl) ctx.vANY.accept(this));
     }
 
-    return new MemberImpl()
-        .setPath(uriInfoImplpath);
+    EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfoImplpath);
+
+    MemberImpl ret = new MemberImpl();
+    ret.setResourcePath(uriInfoImplpath);
+    if (startType != null) {
+      ret.setTypeFilter(startType);
+    }
+
+    return ret;
   }
 
   @Override
@@ -1559,6 +1612,11 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   }
 
   @Override
+  public Object visitNaninfinity(NaninfinityContext ctx) {
+    return new LiteralImpl().setType(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance()).setText(ctx.getText());
+  }
+
+  @Override
   public ExpressionImpl visitNowMethodCallExpr(final NowMethodCallExprContext ctx) {
     return new MethodCallImpl()
         .setMethod(MethodCallKind.NOW);
@@ -1663,7 +1721,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     if (child1 instanceof EnumLitContext ||
         child1 instanceof BooleanNonCaseContext ||
-        child1 instanceof NullruleContext) {
+        child1 instanceof NullruleContext ||
+        child1 instanceof NaninfinityContext) {
       return child1.accept(this);
     }
     return new LiteralImpl().setText(ctx.getText());
@@ -1727,7 +1786,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     }
     return new MemberImpl()
-        .setPath(uriInfoImplpath);
+        .setResourcePath(uriInfoImplpath);
 
   }
 
@@ -1799,15 +1858,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     if (ctx.vNS == null) {
 
       EdmType prevType = null;
-      if (context.contextSelectItem.getResourceInfo() == null) {
+      if (context.contextSelectItem.getResourcePath() == null) {
         prevType = context.contextTypes.peek().type;
       } else {
-        UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo();
+        UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
         UriResource last = uriInfo.getLastResourcePart();
-        if (!(last instanceof UriResourceTypedImpl)) {
-          throw wrap(new UriParserSemanticException("prev segement typed"));
+        
+        prevType = getTypeInformation( last).type;
+        if (prevType == null) {
+          throw wrap(new UriParserSemanticException("prev segement not typed"));
         }
-        prevType = getTypeInformation((UriResourceTypedImpl) last).type;
       }
 
       if (!(prevType instanceof EdmStructuralType)) {
@@ -1830,17 +1890,23 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
           UriResourcePrimitivePropertyImpl simple = new UriResourcePrimitivePropertyImpl();
           simple.setProperty(property);
 
-          UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo();
+          UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
           if (uriInfo == null) {
             uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
             uriInfo.addResourcePart(simple);
-            context.contextSelectItem.setResourceInfo(uriInfo);
+
+            EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo);
+            if (startType != null) {
+              context.contextSelectItem.setTypeFilter(startType);
+            }
+
+            context.contextSelectItem.setResourcePath(uriInfo);
           } else {
             uriInfo.addResourcePart(simple);
           }
           return this;
         } else {
-          UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo();
+          UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
 
           UriResourceComplexPropertyImpl complex = new UriResourceComplexPropertyImpl();
           complex.setProperty(property);
@@ -1848,7 +1914,13 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
           if (uriInfo == null) {
             uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
             uriInfo.addResourcePart(complex);
-            context.contextSelectItem.setResourceInfo(uriInfo);
+
+            EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo);
+            if (startType != null) {
+              context.contextSelectItem.setTypeFilter(startType);
+            }
+
+            context.contextSelectItem.setResourcePath(uriInfo);
           } else {
             uriInfo.addResourcePart(complex);
           }
@@ -1864,7 +1936,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       FullQualifiedName fullName = new FullQualifiedName(namespace, odi);
       // contextSelectItem.addQualifiedThing(fullName);
 
-      if (context.contextSelectItem.getResourceInfo() == null) {
+      if (context.contextSelectItem.getResourcePath() == null) {
         EdmType prevType = context.contextTypes.peek().type;
 
         // check for complex type cast
@@ -1877,7 +1949,13 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
               UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
               uriInfo.addResourcePart(resourcePart);
-              context.contextSelectItem.setResourceInfo(uriInfo);
+
+              EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo);
+              if (startType != null) {
+                context.contextSelectItem.setTypeFilter(startType);
+              }
+
+              context.contextSelectItem.setResourcePath(uriInfo);
               return this;
             }
           }
@@ -1890,7 +1968,13 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
               UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
               uriInfo.addResourcePart(resourcePart);
-              context.contextSelectItem.setResourceInfo(uriInfo);
+
+              EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo);
+              if (startType != null) {
+                context.contextSelectItem.setTypeFilter(startType);
+              }
+
+              context.contextSelectItem.setResourcePath(uriInfo);
               return this;
             }
           }
@@ -1899,7 +1983,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
         }
 
       } else {
-        UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo();
+        UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
         UriResource last = uriInfo.getLastResourcePart();
         if (!(last instanceof UriResourceTypedImpl)) {
           throw wrap(new UriParserSemanticException("prev segement typed"));
@@ -1937,10 +2021,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
       }
 
       EdmType prevType = null;
-      if (context.contextSelectItem.getResourceInfo() == null) {
+      if (context.contextSelectItem.getResourcePath() == null) {
         prevType = context.contextTypes.peek().type;
       } else {
-        UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo();
+        UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
         UriResource last = uriInfo.getLastResourcePart();
         if (!(last instanceof UriResourceTypedImpl)) {
           throw wrap(new UriParserSemanticException("prev segement typed"));
@@ -1958,7 +2042,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
         UriResourceActionImpl uriAction = new UriResourceActionImpl();
         uriAction.setAction(action);
 
-        UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourceInfo();
+        UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourcePath();
         resourcePath.addResourcePart(uriAction);
       }
 
@@ -1970,7 +2054,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
         UriResourceFunctionImpl uriFunction = new UriResourceFunctionImpl();
         uriFunction.setFunction(function);
 
-        UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourceInfo();
+        UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourcePath();
         resourcePath.addResourcePart(uriFunction);
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
new file mode 100644
index 0000000..7c2a8ea
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.server.core.uri.parser;
+
+//TODO Check name of this exception when implementing proper error handling
+public class UriParserException extends Exception {
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  public UriParserException(final String message, final Throwable cause) {
+    super(message, cause);
+  }
+
+  public UriParserException(final String message) {
+    super(message, null);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
new file mode 100644
index 0000000..4e13b93
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.server.core.uri.parser;
+
+//TODO Check name of this exception when implementing proper error handling
+public class UriParserSemanticException extends UriParserException {
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  public UriParserSemanticException(final String message, final Throwable cause) {
+    super(message, cause);
+  }
+
+  public UriParserSemanticException(final String message) {
+    super(message, null);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java
new file mode 100644
index 0000000..95bb645
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.server.core.uri.parser;
+
+public class UriParserSyntaxException extends UriParserException {
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
+
+  public UriParserSyntaxException(final String message, final Throwable cause) {
+    super(message, cause);
+  }
+
+  public UriParserSyntaxException(final String message) {
+    super(message, null);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
index 0bc9e6b..a9a2fe0 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java
@@ -18,10 +18,10 @@
  ******************************************************************************/
 package org.apache.olingo.odata4.server.core.uri.queryoption;
 
-import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
 
-public class CountOptionImpl extends SystemQueryOptionImpl implements InlineCountOption {
+public class CountOptionImpl extends SystemQueryOptionImpl implements CountOption {
 
   private boolean count;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
index de81c76..1c30657 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
@@ -21,11 +21,12 @@ package org.apache.olingo.odata4.server.core.uri.queryoption;
 
 import java.util.List;
 
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
 import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
 import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem;
 import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.LevelsExpandOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
@@ -33,6 +34,7 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
 import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
 
 public class ExpandItemImpl implements ExpandItem {
   private LevelsExpandOption levelsExpandOption;
@@ -41,7 +43,7 @@ public class ExpandItemImpl implements ExpandItem {
   private OrderByOption orderByOption;
   private SkipOption skipOption;
   private TopOption topOption;
-  private InlineCountOption inlineCountOption;
+  private CountOption inlineCountOption;
   private SelectOption selectOption;
   private ExpandOption expandOption;
 
@@ -50,6 +52,7 @@ public class ExpandItemImpl implements ExpandItem {
   private boolean isStar;
 
   private boolean isRef;
+  private EdmType startTypeFilter;
 
   public ExpandItemImpl setSystemQueryOption(final SystemQueryOptionImpl sysItem) {
 
@@ -114,7 +117,7 @@ public class ExpandItemImpl implements ExpandItem {
   }
 
   @Override
-  public InlineCountOption getInlineCountOption() {
+  public CountOption getInlineCountOption() {
     return inlineCountOption;
   }
 
@@ -129,13 +132,13 @@ public class ExpandItemImpl implements ExpandItem {
     return expandOption;
   }
 
-  public ExpandItemImpl setResourceInfo(final UriInfoResource resourceInfo) {
+  public ExpandItemImpl setResourcePath(final UriInfoResource resourceInfo) {
     this.resourceInfo = resourceInfo;
     return this;
   }
 
   @Override
-  public UriInfoResource getResourceInfo() {
+  public UriInfoResource getResourcePath() {
 
     return resourceInfo;
   }
@@ -160,4 +163,15 @@ public class ExpandItemImpl implements ExpandItem {
     return this;
   }
 
+  
+  
+  @Override 
+  public EdmType getStartTypeFilter() {
+    return this.startTypeFilter;
+  }
+
+  public ExpandItemImpl setTypeFilter(EdmType startTypeFilter) {
+     this.startTypeFilter = startTypeFilter;
+     return this;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
index 060bc7a..1a79b02 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
@@ -18,6 +18,7 @@
  ******************************************************************************/
 package org.apache.olingo.odata4.server.core.uri.queryoption;
 
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
 import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
@@ -29,13 +30,15 @@ public class SelectItemImpl implements SelectItem {
   private boolean isStar;
   private FullQualifiedName addOperationsInSchemaNameSpace;
 
+  private EdmType startTypeFilter;
+
   @Override
-  public UriInfoResource getResourceInfo() {
+  public UriInfoResource getResourcePath() {
 
     return path;
   }
 
-  public SelectItemImpl setResourceInfo(final UriInfoResource path) {
+  public SelectItemImpl setResourcePath(final UriInfoResource path) {
     this.path = path;
     return this;
   }
@@ -67,5 +70,15 @@ public class SelectItemImpl implements SelectItem {
   public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchemaNameSpace) {
     this.addOperationsInSchemaNameSpace = addOperationsInSchemaNameSpace;
   }
+  
+  @Override 
+  public EdmType getStartTypeFilter() {
+    return this.startTypeFilter;
+  }
+
+  public SelectItemImpl setTypeFilter(EdmType startTypeFilter) {
+     this.startTypeFilter = startTypeFilter;
+     return this;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
index 779be78..6f91b61 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
@@ -25,21 +25,22 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression
 import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
 import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Member;
 import org.apache.olingo.odata4.server.api.uri.queryoption.expression.VisitableExression;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceTypedImpl;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceTypedImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl;
 
 public class MemberImpl extends ExpressionImpl implements Member, VisitableExression {
 
   private UriInfoResource path;
+  private EdmType startTypeFilter;
 
   @Override
-  public UriInfoResource getPath() {
+  public UriInfoResource getResourcePath() {
     return path;
   }
 
-  public Member setPath(final UriInfoResource pathSegments) {
+  public Member setResourcePath(final UriInfoResource pathSegments) {
     path = pathSegments;
     return this;
   }
@@ -84,5 +85,15 @@ public class MemberImpl extends ExpressionImpl implements Member, VisitableExres
     }
     return false;
   }
+  
+  @Override 
+  public EdmType getStartTypeFilter() {
+    return this.startTypeFilter;
+  }
+
+  public MemberImpl setTypeFilter(EdmType startTypeFilter) {
+     this.startTypeFilter = startTypeFilter;
+     return this;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
deleted file mode 100644
index e812f05..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
+++ /dev/null
@@ -1,221 +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.server.core.testutil;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.apache.olingo.odata4.commons.api.ODataApplicationException;
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
-
-public class ExpandValidator implements Validator {
-  private Edm edm;
-  private Validator invokedByValidator;
-
-  private int expandItemIndex;
-  private ExpandOptionImpl expandOption;
-  private ExpandItem expandItem;
-
-  // --- Setup ---
-
-  public ExpandValidator setUpValidator(final Validator validator) {
-    invokedByValidator = validator;
-    return this;
-  }
-
-  public ExpandValidator setExpand(final ExpandOptionImpl expand) {
-    expandOption = expand;
-    first();
-    return this;
-  }
-
-  public ExpandValidator setEdm(final Edm edm) {
-    this.edm = edm;
-    return this;
-  }
-
-  // --- Navigation ---
-
-  public ExpandValidator goUpToExpandValidator() {
-    return (ExpandValidator) invokedByValidator;
-  }
-
-  public ResourceValidator goUpToUriResourceValidator() {
-    return (ResourceValidator) invokedByValidator;
-  }
-
-  public ResourceValidator goPath() {
-    UriInfoImpl uriInfo = (UriInfoImpl) expandItem.getResourceInfo();
-
-    if (uriInfo.getKind() != UriInfoKind.resource) {
-      fail("goPath() can only be used on UriInfoKind.resource");
-    }
-
-    return new ResourceValidator()
-        .setUpValidator(this)
-        .setEdm(edm)
-        .setUriInfoImplPath(uriInfo);
-
-  }
-
-  public FilterValidator goOrder(final int index) {
-    OrderByOptionImpl orderBy = (OrderByOptionImpl) expandItem.getOrderByOption();
-
-    return new FilterValidator()
-        .setValidator(this)
-        .setEdm(edm)
-        .setExpression(orderBy.getOrders().get(index).getExpression());
-  }
-
-  public ResourceValidator goSelectItem(final int index) {
-    SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
-
-    SelectItem item = select.getSelectItems().get(index);
-    UriInfoImpl uriInfo = (UriInfoImpl) item.getResourceInfo();
-
-    return new ResourceValidator()
-        .setUpValidator(this)
-        .setEdm(edm)
-        .setUriInfoImplPath(uriInfo);
-
-  }
-
-  public ExpandValidator goExpand() {
-    ExpandValidator val = new ExpandValidator()
-        .setExpand((ExpandOptionImpl) expandItem.getExpandOption())
-        .setUpValidator(this);
-    return val;
-  }
-
-  public ExpandValidator first() {
-    expandItemIndex = 0;
-    expandItem = expandOption.getExpandItems().get(expandItemIndex);
-    return this;
-  }
-
-  public ExpandValidator next() {
-    expandItemIndex++;
-
-    try {
-      expandItem = expandOption.getExpandItems().get(expandItemIndex);
-    } catch (IndexOutOfBoundsException ex) {
-      fail("not enought segments");
-    }
-    return this;
-
-  }
-
-  public ExpandValidator isSegmentStar(final int index) {
-    assertEquals(true, expandItem.isStar());
-    return this;
-  }
-
-  public ExpandValidator isSegmentRef(final int index) {
-    assertEquals(true, expandItem.isRef());
-    return this;
-  }
-
-  public ExpandValidator isLevelText(final String text) {
-    QueryOptionImpl option = (QueryOptionImpl) expandItem.getLevelsOption();
-    assertEquals(text, option.getText());
-    return this;
-  }
-
-  public ExpandValidator isSkipText(final String text) {
-    QueryOptionImpl option = (QueryOptionImpl) expandItem.getSkipOption();
-    assertEquals(text, option.getText());
-    return this;
-  }
-
-  public ExpandValidator isTopText(final String text) {
-    QueryOptionImpl option = (QueryOptionImpl) expandItem.getTopOption();
-    assertEquals(text, option.getText());
-    return this;
-  }
-
-  public ExpandValidator isInlineCountText(final String text) {
-    QueryOptionImpl option = (QueryOptionImpl) expandItem.getInlineCountOption();
-    assertEquals(text, option.getText());
-    return this;
-  }
-
-  public ExpandValidator isSelectText(final String text) {
-    QueryOptionImpl option = (QueryOptionImpl) expandItem.getSelectOption();
-    assertEquals(text, option.getText());
-    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 isSelectItemAllOperations(final int index, final FullQualifiedName fqn) {
-    SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
-
-    SelectItem item = select.getSelectItems().get(index);
-    assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
-    return this;
-  }
-
-  public ExpandValidator isFilterOptionText(final String text) {
-    QueryOptionImpl option = (QueryOptionImpl) expandItem.getFilterOption();
-    assertEquals(text, option.getText());
-    return this;
-  }
-
-  public ExpandValidator isFilterSerialized(final String serialized) {
-    FilterOptionImpl filter = (FilterOptionImpl) expandItem.getFilterOption();
-
-    try {
-      String tmp = FilterTreeToText.Serialize(filter);
-      assertEquals(serialized, tmp);
-    } catch (ExpressionVisitException e) {
-      fail("Exception occured while converting the filterTree into text" + "\n"
-          + " Exception: " + e.getMessage());
-    } catch (ODataApplicationException e) {
-      fail("Exception occured while converting the filterTree into text" + "\n"
-          + " Exception: " + e.getMessage());
-    }
-
-    return this;
-  }
-
-  public ExpandValidator isSortOrder(final int index, final boolean descending) {
-    OrderByOptionImpl orderBy = (OrderByOptionImpl) expandItem.getOrderByOption();
-    assertEquals(descending, orderBy.getOrders().get(index).isDescending());
-    return this;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
deleted file mode 100644
index a951dab..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
+++ /dev/null
@@ -1,154 +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.server.core.testutil;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.ODataApplicationException;
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.server.api.uri.UriResource;
-import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAll;
-import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAny;
-import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
-import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCallKind;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.UnaryOperatorKind;
-
-public class FilterTreeToText implements ExpressionVisitor<String> {
-
-  public static String Serialize(final FilterOption filter)
-      throws ExpressionVisitException, ODataApplicationException {
-
-    Expression expression = filter.getExpression();
-    return expression.accept(new FilterTreeToText());
-  }
-
-  public static String Serialize(final Expression expression)
-      throws ExpressionVisitException, ODataApplicationException {
-
-    return expression.accept(new FilterTreeToText());
-  }
-
-  @Override
-  public String visitBinaryOperator(final BinaryOperatorKind operator, final String left, final String right)
-      throws ExpressionVisitException {
-
-    return "<" + left + " " + operator.toString() + " " + right + ">";
-  }
-
-  @Override
-  public String visitUnaryOperator(final UnaryOperatorKind operator, final String operand)
-      throws ExpressionVisitException {
-
-    return "<" + operator + " " + operand.toString() + ">";
-  }
-
-  @Override
-  public String visitMethodCall(final MethodCallKind methodCall, final List<String> parameters)
-      throws ExpressionVisitException {
-
-    String text = "<" + methodCall + "(";
-    int i = 0;
-    while (i < parameters.size()) {
-      if (i > 0) {
-        text += ",";
-      }
-      text += parameters.get(i);
-      i++;
-    }
-    return text + ")>";
-  }
-
-  @Override
-  public String visitLiteral(final String literal) throws ExpressionVisitException {
-    return "<" + literal + ">";
-  }
-
-  @Override
-  public String visitMember(final UriInfoResource resource) throws ExpressionVisitException, ODataApplicationException {
-    String ret = "";
-
-    UriInfoResource path = resource;
-
-    for (UriResource item : path.getUriResourceParts()) {
-      String tmp = "";
-      if (item instanceof UriResourceLambdaAll) {
-        UriResourceLambdaAll all = (UriResourceLambdaAll) item;
-        tmp = visitLambdaExpression("ALL", all.getLamdaVariable(), all.getExpression());
-      } else if (item instanceof UriResourceLambdaAny) {
-        UriResourceLambdaAny any = (UriResourceLambdaAny) item;
-        tmp = visitLambdaExpression("ANY", any.getLamdaVariable(), any.getExpression());
-      } else if (item instanceof UriResourcePartTyped) {
-        UriResourcePartTyped typed = (UriResourcePartTyped) item;
-        tmp = typed.toString(true);
-      }
-
-      if (ret.length() != 0) {
-        ret += "/";
-      }
-      ret += tmp;
-
-    }
-    return "<" + ret + ">";
-  }
-
-  @Override
-  public String visitAlias(final String referenceName) throws ExpressionVisitException {
-    return "<" + referenceName + ">";
-  }
-
-  @Override
-  public String visitLambdaExpression(final String functionText, final String string, final Expression expression)
-      throws ExpressionVisitException, ODataApplicationException {
-
-    return "<" + functionText + ";" + ((expression == null) ? "" : expression.accept(this)) + ">";
-  }
-
-  @Override
-  public String visitTypeLiteral(final EdmType type) {
-    return "<" + type.getNamespace() + "." + type.getName() + ">";
-  }
-
-  @Override
-  public String visitLambdaReference(final String variableText) {
-    return "<" + variableText + ">";
-  }
-
-  @Override
-  public String visitEnum(final EdmEnumType type, final List<String> enumValues)
-      throws ExpressionVisitException, ODataApplicationException {
-    String tmp = "";
-
-    for (String item : enumValues) {
-      if (tmp.length() > 0) {
-        tmp += ",";
-      }
-      tmp += item;
-    }
-
-    return "<" + type.getNamespace() + "." + type.getName() + "<" + tmp + ">>";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
deleted file mode 100644
index 2bca2e1..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
+++ /dev/null
@@ -1,518 +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.server.core.testutil;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.ODataApplicationException;
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.odata4.server.api.uri.UriInfo;
-import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Member;
-import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCallKind;
-import org.apache.olingo.odata4.server.core.uri.UriParserException;
-import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException;
-import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
-import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
-import org.apache.olingo.odata4.server.core.uri.parser.Parser;
-import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.BinaryImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.EnumerationImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MethodCallImpl;
-import org.apache.olingo.odata4.server.core.uri.queryoption.expression.TypeLiteralImpl;
-
-public class FilterValidator implements Validator {
-  private Edm edm;
-
-  private Validator invokedByValidator;
-  private FilterOptionImpl filter;
-
-  private Expression curExpression;
-  private Expression rootExpression;
-
-  private OrderByOptionImpl orderBy;
-
-  private UriParserException exception;
-
-  // --- Setup ---
-  public FilterValidator setUriResourcePathValidator(final ResourceValidator uriResourcePathValidator) {
-    invokedByValidator = uriResourcePathValidator;
-    return this;
-  }
-
-  public FilterValidator setUriValidator(final UriValidator uriValidator) {
-    invokedByValidator = uriValidator;
-    return this;
-  }
-
-  public FilterValidator setValidator(final Validator uriValidator) {
-    invokedByValidator = uriValidator;
-    return this;
-  }
-
-  public FilterValidator setEdm(final Edm edm) {
-    this.edm = edm;
-    return this;
-  }
-
-  public FilterValidator setFilter(final FilterOptionImpl filter) {
-    this.filter = filter;
-
-    if (filter.getExpression() == null) {
-      fail("FilterValidator: no filter found");
-    }
-    setExpression(filter.getExpression());
-    return this;
-  }
-
-  public FilterValidator setOrderBy(final OrderByOptionImpl orderBy) {
-    this.orderBy = orderBy;
-
-    return this;
-  }
-
-  public FilterValidator setExpression(final Expression expression) {
-    rootExpression = curExpression = expression;
-    return this;
-  }
-
-  // --- Execution ---
-
-  public FilterValidator runOrderByOnETAllPrim(final String orderBy) throws UriParserException {
-    String uri = "ESAllPrim?$orderby=" + orderBy.trim();
-    return runUriOrderBy(uri);
-  }
-
-  public FilterValidator runOrderByOnETTwoKeyNav(final String orderBy) throws UriParserException {
-    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 {
-    String uri = "ESTwoKeyNav?$filter=" + filter.trim();
-    return runUri(uri);
-  }
-
-  public FilterValidator runOnETTwoKeyNavSingle(final String filter) throws UriParserException {
-    String uri = "SINav?$filter=" + filter.trim();
-    return runUri(uri);
-  }
-
-  public FilterValidator runOnETTwoKeyNavEx(final String filter) throws UriParserException {
-    String uri = "ESTwoKeyNav?$filter=" + filter.trim();
-    return runUriEx(uri);
-  }
-
-  public FilterValidator runOnETAllPrim(final String filter) throws UriParserException {
-    String uri = "ESAllPrim(1)?$filter=" + filter.trim();
-    return runUri(uri);
-  }
-
-  public FilterValidator runOnETKeyNav(final String filter) throws UriParserException {
-    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();
-    return runUri(uri);
-  }
-
-  public FilterValidator runOnString(final String filter) throws UriParserException {
-    String uri = "SINav/PropertyString?$filter=" + filter.trim();
-    return runUri(uri);
-  }
-
-  public FilterValidator runOnInt32(final String filter) throws UriParserException {
-    String uri = "ESCollAllPrim(1)/CollPropertyInt32?$filter=" + filter.trim();
-    return runUri(uri);
-  }
-
-  public FilterValidator runOnDateTimeOffset(final String filter) throws UriParserException {
-    String uri = "ESCollAllPrim(1)/CollPropertyDateTimeOffset?$filter=" + filter.trim();
-    return runUri(uri);
-  }
-
-  public FilterValidator runOnDuration(final String filter) throws UriParserException {
-    String uri = "ESCollAllPrim(1)/CollPropertyDuration?$filter=" + filter.trim();
-    return runUri(uri);
-  }
-
-  public FilterValidator runOnTimeOfDay(final String filter) throws UriParserException {
-    String uri = "ESCollAllPrim(1)/CollPropertyTimeOfDay?$filter=" + filter.trim();
-    return runUri(uri);
-  }
-
-  public FilterValidator runESabc(final String filter) throws UriParserException {
-    String uri = "ESabc?$filter=" + filter.trim();
-    return runUri(uri);
-  }
-
-  public FilterValidator runUri(final String uri) throws UriParserException {
-    Parser parser = new Parser();
-    UriInfo uriInfo = null;
-
-    uriInfo = parser.parseUri(uri, 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;
-
-    try {
-      uriInfo = parser.parseUri(uri, edm);
-    } catch (UriParserException e) {
-      exception = e;
-      return this;
-    }
-
-    if (uriInfo.getKind() != UriInfoKind.resource) {
-      fail("Filtervalidator can only be used on resourcePaths");
-    }
-
-    setFilter((FilterOptionImpl) uriInfo.getFilterOption());
-    curExpression = filter.getExpression();
-    return this;
-  }
-
-  public FilterValidator runUriOrderBy(final String uri) throws UriParserException {
-    Parser parser = new Parser();
-    UriInfo uriInfo = null;
-
-    uriInfo = parser.parseUri(uri, edm);
-
-    if (uriInfo.getKind() != UriInfoKind.resource) {
-      fail("Filtervalidator can only be used on resourcePaths");
-    }
-
-    setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
-    return this;
-  }
-
-  public FilterValidator runUriOrderByEx(final String uri) {
-    Parser parser = new Parser();
-    UriInfo uriInfo = null;
-
-    try {
-      uriInfo = parser.parseUri(uri, edm);
-    } catch (UriParserException e) {
-      exception = e;
-      return this;
-    }
-
-    if (uriInfo.getKind() != UriInfoKind.resource) {
-      fail("Filtervalidator can only be used on resourcePaths");
-    }
-
-    setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
-    return this;
-  }
-
-  // --- Navigation ---
-
-  public ExpandValidator goUpToExpandValidator() {
-    return (ExpandValidator) invokedByValidator;
-  }
-
-  public ResourceValidator goUpToResourceValidator() {
-    return (ResourceValidator) invokedByValidator;
-  }
-
-  public ResourceValidator goPath() {
-    if (!(curExpression instanceof MemberImpl)) {
-      fail("Current expression not a member");
-    }
-
-    MemberImpl member = (MemberImpl) curExpression;
-
-    return new ResourceValidator()
-        .setEdm(edm)
-        .setUriInfoImplPath((UriInfoImpl) member.getPath())
-        .setUpValidator(this);
-
-  }
-
-  public FilterValidator goParameter(final int parameterIndex) {
-    if (curExpression instanceof MethodCallImpl) {
-      MethodCallImpl methodCall = (MethodCallImpl) curExpression;
-      curExpression = methodCall.getParameters().get(parameterIndex);
-    } else {
-      fail("Current expression not a methodCall");
-    }
-    return this;
-  }
-
-  // --- Validation ---
-
-  /**
-   * Validates the serialized filterTree against a given filterString
-   * The given expected filterString is compressed before to allow better readable code in the unit tests
-   * @param toBeCompr
-   * @return
-   */
-  public FilterValidator isCompr(final String toBeCompr) {
-    return is(compress(toBeCompr));
-  }
-
-  public FilterValidator is(final String expectedFilterAsString) {
-    try {
-      String actualFilterAsText = FilterTreeToText.Serialize((FilterOptionImpl) filter);
-      assertEquals(expectedFilterAsString, actualFilterAsText);
-    } catch (ExpressionVisitException e) {
-      fail("Exception occured while converting the filterTree into text" + "\n"
-          + " Exception: " + e.getMessage());
-    } catch (ODataApplicationException e) {
-      fail("Exception occured while converting the filterTree into text" + "\n"
-          + " Exception: " + e.getMessage());
-    }
-
-    return this;
-  }
-
-  // --- Helper ---
-
-  private String compress(final String expected) {
-    String ret = expected.replaceAll("\\s+", " ");
-    ret = ret.replaceAll("< ", "<");
-    ret = ret.replaceAll(" >", ">");
-    return ret;
-  }
-
-  public FilterValidator isType(final FullQualifiedName fullName) {
-    EdmType actualType = null;
-
-    if (curExpression instanceof MemberImpl) {
-      Member member = (Member) curExpression;
-      actualType = member.getType();
-    } else if (curExpression instanceof TypeLiteralImpl) {
-      TypeLiteralImpl typeLiteral = (TypeLiteralImpl) curExpression;
-      actualType = typeLiteral.getType();
-    }
-
-    if (actualType == null) {
-      fail("Current expression not typed");
-    }
-
-    FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-    assertEquals(fullName, actualName);
-    return this;
-  }
-
-  public FilterValidator left() {
-    if (!(curExpression instanceof BinaryImpl)) {
-      fail("Current expression not a binary operator");
-    }
-
-    curExpression = ((BinaryImpl) curExpression).getLeftOperand();
-
-    return this;
-  }
-
-  public FilterValidator root() {
-    if (filter != null) {
-      curExpression = filter.getExpression();
-    } else {
-      curExpression = rootExpression;
-    }
-
-    return this;
-  }
-
-  public FilterValidator right() {
-    if (!(curExpression instanceof BinaryImpl)) {
-      fail("Current expression is not a binary operator");
-    }
-
-    curExpression = ((BinaryImpl) curExpression).getRightOperand();
-
-    return this;
-
-  }
-
-  public FilterValidator isLiteral(final String literalText) {
-    if (!(curExpression instanceof LiteralImpl)) {
-      fail("Current expression is not a literal");
-    }
-
-    String actualLiteralText = ((LiteralImpl) curExpression).getText();
-    assertEquals(literalText, actualLiteralText);
-
-    return this;
-  }
-
-  public FilterValidator isMethod(final MethodCallKind methodKind, final int parameterCount) {
-    if (!(curExpression instanceof MethodCallImpl)) {
-      fail("Current expression is not a methodCall");
-    }
-
-    MethodCallImpl methodCall = (MethodCallImpl) curExpression;
-    assertEquals(methodKind, methodCall.getMethod());
-    assertEquals(parameterCount, methodCall.getParameters().size());
-
-    return this;
-  }
-
-  public FilterValidator isParameterText(final int parameterIndex, final String parameterText)
-      throws ExpressionVisitException, ODataApplicationException {
-
-    if (!(curExpression instanceof MethodCallImpl)) {
-      fail("Current expression is not a method");
-    }
-
-    MethodCallImpl methodCall = (MethodCallImpl) curExpression;
-
-    Expression parameter = methodCall.getParameters().get(parameterIndex);
-    String actualParameterText = FilterTreeToText.Serialize(parameter);
-    assertEquals(parameterText, actualParameterText);
-
-    return this;
-  }
-
-  public FilterValidator isBinary(final BinaryOperatorKind binaryOperator) {
-    if (!(curExpression instanceof BinaryImpl)) {
-      fail("Current expression is not a binary operator");
-    }
-
-    BinaryImpl binary = (BinaryImpl) curExpression;
-    assertEquals(binaryOperator, binary.getOperator());
-
-    return this;
-  }
-
-  public FilterValidator isTypedLiteral(final FullQualifiedName fullName) {
-    if (!(curExpression instanceof TypeLiteralImpl)) {
-      fail("Current expression not a typeLiteral");
-    }
-
-    isType(fullName);
-
-    return this;
-  }
-
-  public FilterValidator isMember() {
-    if (!(curExpression instanceof MemberImpl)) {
-      fail("Current expression not a member");
-    }
-
-    return this;
-  }
-
-  public FilterValidator isEnum(final FullQualifiedName nameenstring, final List<String> enumValues) {
-    if (!(curExpression instanceof EnumerationImpl)) {
-      fail("Current expression not a enumeration");
-    }
-
-    EnumerationImpl enumeration = (EnumerationImpl) curExpression;
-
-    FullQualifiedName actualName =
-        new FullQualifiedName(enumeration.getType().getNamespace(), enumeration.getType().getName());
-
-    // check name
-    assertEquals(nameenstring.toString(), actualName.toString());
-
-    // check values
-    int i = 0;
-    for (String item : enumValues) {
-      assertEquals(item, enumeration.getValues().get(i));
-      i++;
-    }
-
-    return this;
-  }
-
-  public FilterValidator isSortOrder(final int index, final boolean descending) {
-    assertEquals(descending, orderBy.getOrders().get(index).isDescending());
-    return this;
-  }
-
-  public FilterValidator goOrder(final int index) {
-    curExpression = orderBy.getOrders().get(index).getExpression();
-    return this;
-  }
-
-  public FilterValidator isExSyntax(final long errorID) {
-    assertEquals(UriParserSyntaxException.class, exception.getClass());
-    return this;
-  }
-
-  public FilterValidator isExSemantic(final long errorID) {
-    assertEquals(UriParserSemanticException.class, exception.getClass());
-    return this;
-  }
-
-  public FilterValidator isNull() {
-    if (!(curExpression instanceof LiteralImpl)) {
-      fail("Current expression is not a literal");
-    }
-
-    String actualLiteralText = ((LiteralImpl) curExpression).getText();
-    assertEquals("null", actualLiteralText);
-    return this;
-  }
-
-  public FilterValidator isTrue() {
-    if (!(curExpression instanceof LiteralImpl)) {
-      fail("Current expression is not a literal");
-    }
-
-    String actualLiteralText = ((LiteralImpl) curExpression).getText();
-    assertEquals("true", actualLiteralText);
-    return this;
-  }
-
-  public FilterValidator isFalse() {
-    if (!(curExpression instanceof LiteralImpl)) {
-      fail("Current expression is not a literal");
-    }
-
-    String actualLiteralText = ((LiteralImpl) curExpression).getText();
-    assertEquals("false", actualLiteralText);
-    return this;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java
deleted file mode 100644
index 4f143ca..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java
+++ /dev/null
@@ -1,82 +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.server.core.testutil;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.antlr.v4.runtime.Token;
-import org.antlr.v4.runtime.misc.NotNull;
-import org.antlr.v4.runtime.misc.Nullable;
-import org.antlr.v4.runtime.misc.Utils;
-import org.antlr.v4.runtime.tree.ErrorNode;
-import org.antlr.v4.runtime.tree.RuleNode;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.antlr.v4.runtime.tree.Tree;
-
-public class ParseTreeToText {
-
-  public static String getTreeAsText(final Tree contextTree, final String[] ruleNames) {
-    return toStringTree(contextTree, Arrays.asList(ruleNames));
-  }
-
-  private static String toStringTree(final Tree t, @Nullable final List<String> ruleNames) {
-
-    if (t.getChildCount() == 0) {
-      return Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
-    }
-
-    StringBuilder buf = new StringBuilder();
-    String s = Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
-    buf.append(s);
-    buf.append("(");
-
-    for (int i = 0; i < t.getChildCount(); i++) {
-      if (i > 0) {
-        buf.append(' ');
-      }
-      buf.append(toStringTree(t.getChild(i), ruleNames));
-    }
-    buf.append(")");
-    return buf.toString();
-  }
-
-  private static String getNodeText(@NotNull final Tree t, @Nullable final List<String> ruleNames) {
-    if (ruleNames != null) {
-      if (t instanceof RuleNode) {
-        int ruleIndex = ((RuleNode) t).getRuleContext().getRuleIndex();
-        return ruleNames.get(ruleIndex);
-      } else if (t instanceof ErrorNode) {
-        return t.toString();
-      } else if (t instanceof TerminalNode) {
-        Token symbol = ((TerminalNode) t).getSymbol();
-        if (symbol != null) {
-          String s = symbol.getText();
-          return s;
-        }
-      }
-    }
-    // no recog for rule names
-    Object payload = t.getPayload();
-    if (payload instanceof Token) {
-      return ((Token) payload).getText();
-    }
-    return t.getPayload().toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
deleted file mode 100644
index d5af0b6..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
+++ /dev/null
@@ -1,243 +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.server.core.testutil;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
-
-// TODO extend to test also exception which can occure while paring
-public class ParserValidator {
-
-  private String input = null;
-  private ParserRuleContext root;
-
-  int logLevel = 0;
-  private int lexerLogLevel = 0;
-
-  boolean allowFullContext;
-  boolean allowContextSensitifity;
-  boolean allowAmbiguity;
-
-  List<Exception> exceptions = new ArrayList<Exception>();
-  private Exception curException = null;
-
-  // --- Setup ---
-
-  public ParserValidator log(final int logLevel) {
-    this.logLevel = logLevel;
-    return this;
-  }
-
-  public ParserValidator lexerLog(final int logLevel) {
-    lexerLogLevel = logLevel;
-    return this;
-  }
-
-  /**
-   * TODO verify
-   * Used in fast LL Parsing:
-   * Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is
-   * required
-   * @return
-   */
-  public ParserValidator aFC() {
-    allowFullContext = true;
-    return this;
-  }
-
-  /**
-   * 
-   * TODO verify
-   * Used in fast LL Parsing:
-   * Allows ContextSensitifity Errors which occur often when using the slower full context parsing
-   * and indicate that there is a context sensitivity ( which may not be an error).
-   * @return
-   */
-  public ParserValidator aCS() {
-    allowContextSensitifity = true;
-    return this;
-  }
-
-  /**
-   * TODO verify
-   * Used in fast LL Parsing:
-   * Allows ambiguities
-   * @return
-   */
-  public ParserValidator aAM() {
-    allowAmbiguity = true;
-    return this;
-  }
-
-  // --- Execution ---
-
-  public ParserValidator run(final String uri) {
-    input = uri;
-
-    // just run a short lexer step. E.g. to print the tokens
-    if (lexerLogLevel > 0) {
-      (new TokenValidator()).log(lexerLogLevel).run(input);
-    }
-
-    /**/// root = parseInput(uri);
-
-    // if LOG > 0 - Write serialized tree
-    if (logLevel > 0) {
-      if (root != null) {
-        System.out.println(ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames()));
-      } else {
-        System.out.println("root == null");
-      }
-    }
-
-    // reset for next test
-    allowFullContext = false;
-    allowContextSensitifity = false;
-    allowAmbiguity = false;
-    logLevel = 0;
-
-    return this;
-  }
-
-  // --- Navigation ---
-
-  public ParserValidator exFirst() {
-    try {
-      // curWeakException = exceptions.get(0);
-    } catch (IndexOutOfBoundsException ex) {
-      // curWeakException = null;
-    }
-    return this;
-
-  }
-
-  public ParserValidator exLast() {
-    // curWeakException = exceptions.get(exceptions.size() - 1);
-    return this;
-  }
-
-  public ParserValidator exAt(final int index) {
-    try {
-      // curWeakException = exceptions.get(index);
-    } catch (IndexOutOfBoundsException ex) {
-      // curWeakException = null;
-    }
-    return this;
-  }
-
-  // --- Validation ---
-
-  public ParserValidator isText(final String expected) {
-
-    assertEquals(null, curException);
-    assertEquals(0, exceptions.size());
-
-    String actualTreeAsText = ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames());
-
-    assertEquals(expected, actualTreeAsText);
-    return this;
-  }
-
-  public ParserValidator isExeptionType(final Class<?> exClass) {
-    assertEquals(exClass, curException.getClass());
-    return this;
-  }
-
-  // --- Helper ---
-  /*
-   * private OdataRelativeUriEOFContext parseInput(final String input) {
-   * UriParserParser parser = null;
-   * UriLexerWithTrace lexer = null;
-   * OdataRelativeUriEOFContext ret = null;
-   * 
-   * // Use 2 stage approach to improve performance
-   * // see https://github.com/antlr/antlr4/issues/192
-   * // TODO verify this
-   * 
-   * // stage= 1
-   * try {
-   * curException = null;
-   * exceptions.clear();
-   * 
-   * // create parser
-   * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
-   * parser = new UriParserParser(new CommonTokenStream(lexer));
-   * 
-   * // write always a error message in case of syntax errors
-   * // parser.addErrorListener(new TestErrorHandler<Object>());
-   * // check error message if whether they are allowed or not
-   * // parser.addErrorListener(new ErrorCollector());
-   * 
-   * // bail out of parser at first syntax error. --> proceed in catch block with step 2
-   * parser.setErrorHandler(new BailErrorStrategy());
-   * 
-   * // user the faster SLL parsing
-   * parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
-   * 
-   * // parse
-   * if (logLevel > 0) {
-   * System.out.println("Step 1");
-   * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode());
-   * }
-   * ret = parser.odataRelativeUriEOF();
-   * 
-   * } catch (Exception exception) {
-   * curException = exception;
-   * try {
-   * // clear status
-   * curException = null;
-   * exceptions.clear();
-   * 
-   * // create parser
-   * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
-   * parser = new UriParserParser(new CommonTokenStream(lexer));
-   * 
-   * // write always a error message in case of syntax errors
-   * // parser.addErrorListener(new ErrorCollector(this));
-   * // check error message if whether they are allowed or not
-   * // parser.addErrorListener(new ErrorCollector(this));
-   * 
-   * // Used default error strategy
-   * parser.setErrorHandler(new DefaultErrorStrategy());
-   * 
-   * // User the slower SLL parsing
-   * parser.getInterpreter().setPredictionMode(PredictionMode.LL);
-   * 
-   * // parse
-   * if (logLevel > 1) {
-   * System.out.println("Step 2");
-   * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
-   * }
-   * ret = parser.odataRelativeUriEOF();
-   * 
-   * } catch (Exception exception1) {
-   * curException = exception1;
-   * // exceptionOnStage = 2;
-   * }
-   * }
-   * 
-   * return ret;
-   * }
-   */
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserWithLogging.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserWithLogging.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserWithLogging.java
deleted file mode 100644
index f639f22..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserWithLogging.java
+++ /dev/null
@@ -1,56 +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.server.core.testutil;
-
-import org.antlr.v4.runtime.DefaultErrorStrategy;
-import org.antlr.v4.runtime.DiagnosticErrorListener;
-import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
-import org.apache.olingo.odata4.server.core.uri.parser.Parser;
-
-public class ParserWithLogging extends Parser {
-  TestErrorLogger errorCollector1;
-  TestErrorLogger errorCollector2;
-
-  public ParserWithLogging() {
-    errorCollector1 = new TestErrorLogger("Stage 1", 1);
-    errorCollector2 = new TestErrorLogger("Stage 2", 1);
-  }
-
-  @Override
-  protected void addStage2ErrorStategy(final 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(final UriParserParser parser) {
-    // Log error to console
-    parser.removeErrorListeners();
-    parser.addErrorListener(errorCollector1);
-    parser.addErrorListener(new DiagnosticErrorListener());
-  }
-
-  @Override
-  protected void addStage2ErrorListener(final UriParserParser parser) {
-    // Log error to console
-    parser.removeErrorListeners();
-    parser.addErrorListener(errorCollector2);
-    parser.addErrorListener(new DiagnosticErrorListener());
-  }
-}


[6/9] git commit: [OLINGO-63] Uri Parser: add special handling for leading type filter in member, expand, select

Posted by il...@apache.org.
[OLINGO-63] Uri Parser: add special handling for leading type filter in member, expand, select


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/32467b8d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/32467b8d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/32467b8d

Branch: refs/heads/olingo169
Commit: 32467b8d6295efea354ae5e28c15f329c38bf8d1
Parents: 30ca8f0
Author: Sven Kobler <sv...@sap.com>
Authored: Thu Feb 20 12:26:16 2014 +0100
Committer: Sven Kobler <sv...@sap.com>
Committed: Thu Feb 20 12:26:44 2014 +0100

----------------------------------------------------------------------
 .../odata4/server/api/uri/UriInfoResource.java  |   4 +-
 .../api/uri/UriResourceStartingTypeFilter.java  |  29 -
 .../server/api/uri/queryoption/CountOption.java |  25 +
 .../server/api/uri/queryoption/ExpandItem.java  |   8 +-
 .../api/uri/queryoption/InlineCountOption.java  |  25 -
 .../server/api/uri/queryoption/SelectItem.java  |   5 +-
 .../api/uri/queryoption/expression/Member.java  |   6 +-
 .../odata4/server/core/uri/antlr/UriParser.g4   |   3 +-
 .../odata4/server/core/uri/UriInfoImpl.java     | 296 ++++++++++
 .../server/core/uri/UriParameterImpl.java       |  83 +++
 .../server/core/uri/UriParserException.java     |  36 --
 .../core/uri/UriParserSemanticException.java    |  37 --
 .../core/uri/UriParserSyntaxException.java      |  36 --
 .../server/core/uri/UriResourceActionImpl.java  |  77 +++
 .../uri/UriResourceComplexPropertyImpl.java     |  70 +++
 .../server/core/uri/UriResourceCountImpl.java   |  35 ++
 .../core/uri/UriResourceEntitySetImpl.java      |  67 +++
 .../core/uri/UriResourceFunctionImpl.java       | 111 ++++
 .../odata4/server/core/uri/UriResourceImpl.java |  39 ++
 .../server/core/uri/UriResourceItImpl.java      |  65 +++
 .../core/uri/UriResourceLambdaAllImpl.java      |  73 +++
 .../core/uri/UriResourceLambdaAnyImpl.java      |  72 +++
 .../core/uri/UriResourceLambdaVarImpl.java      |  70 +++
 .../uri/UriResourceNavigationPropertyImpl.java  |  63 ++
 .../uri/UriResourcePrimitivePropertyImpl.java   |  59 ++
 .../server/core/uri/UriResourceRefImpl.java     |  36 ++
 .../server/core/uri/UriResourceRootImpl.java    |  62 ++
 .../core/uri/UriResourceSingletonImpl.java      |  71 +++
 .../uri/UriResourceStartingTypeFilterImpl.java  |  68 +++
 .../server/core/uri/UriResourceTypedImpl.java   |  60 ++
 .../server/core/uri/UriResourceValueImpl.java   |  36 ++
 .../core/uri/UriResourceWithKeysImpl.java       |  99 ++++
 .../server/core/uri/apiimpl/UriInfoImpl.java    | 291 ---------
 .../core/uri/apiimpl/UriParameterImpl.java      |  83 ---
 .../core/uri/apiimpl/UriResourceActionImpl.java |  77 ---
 .../apiimpl/UriResourceComplexPropertyImpl.java |  70 ---
 .../core/uri/apiimpl/UriResourceCountImpl.java  |  35 --
 .../uri/apiimpl/UriResourceEntitySetImpl.java   |  67 ---
 .../uri/apiimpl/UriResourceFunctionImpl.java    | 111 ----
 .../core/uri/apiimpl/UriResourceImpl.java       |  39 --
 .../core/uri/apiimpl/UriResourceItImpl.java     |  65 ---
 .../uri/apiimpl/UriResourceLambdaAllImpl.java   |  73 ---
 .../uri/apiimpl/UriResourceLambdaAnyImpl.java   |  72 ---
 .../uri/apiimpl/UriResourceLambdaVarImpl.java   |  70 ---
 .../UriResourceNavigationPropertyImpl.java      |  63 --
 .../UriResourcePrimitivePropertyImpl.java       |  59 --
 .../core/uri/apiimpl/UriResourceRefImpl.java    |  36 --
 .../core/uri/apiimpl/UriResourceRootImpl.java   |  62 --
 .../uri/apiimpl/UriResourceSingletonImpl.java   |  71 ---
 .../UriResourceStartingTypeFilterImpl.java      |  68 ---
 .../core/uri/apiimpl/UriResourceTypedImpl.java  |  60 --
 .../core/uri/apiimpl/UriResourceValueImpl.java  |  36 --
 .../uri/apiimpl/UriResourceWithKeysImpl.java    |  99 ----
 .../odata4/server/core/uri/parser/Parser.java   |   6 +-
 .../odata4/server/core/uri/parser/RawUri.java   |   2 +-
 .../server/core/uri/parser/UriContext.java      |   2 +-
 .../server/core/uri/parser/UriDecoder.java      |   3 +-
 .../core/uri/parser/UriParseTreeVisitor.java    | 194 ++++--
 .../core/uri/parser/UriParserException.java     |  36 ++
 .../uri/parser/UriParserSemanticException.java  |  37 ++
 .../uri/parser/UriParserSyntaxException.java    |  36 ++
 .../core/uri/queryoption/CountOptionImpl.java   |   4 +-
 .../core/uri/queryoption/ExpandItemImpl.java    |  24 +-
 .../core/uri/queryoption/SelectItemImpl.java    |  17 +-
 .../uri/queryoption/expression/MemberImpl.java  |  23 +-
 .../server/core/testutil/ExpandValidator.java   | 221 -------
 .../server/core/testutil/FilterTreeToText.java  | 154 -----
 .../server/core/testutil/FilterValidator.java   | 518 ----------------
 .../server/core/testutil/ParseTreeToText.java   |  82 ---
 .../server/core/testutil/ParserValidator.java   | 243 --------
 .../server/core/testutil/ParserWithLogging.java |  56 --
 .../server/core/testutil/ResourceValidator.java | 571 ------------------
 .../server/core/testutil/TestErrorLogger.java   | 105 ----
 .../server/core/testutil/TokenValidator.java    | 194 ------
 .../server/core/testutil/UriLexerWithTrace.java |  85 ---
 .../server/core/testutil/UriValidator.java      | 245 --------
 .../odata4/server/core/testutil/Validator.java  |  23 -
 .../odata4/server/core/uri/RawUriTest.java      |   1 +
 .../odata4/server/core/uri/UriInfoImplTest.java |   3 -
 .../server/core/uri/UriParameterImplTest.java   |  22 +-
 .../core/uri/antlr/TestFullResourcePath.java    | 111 ++--
 .../odata4/server/core/uri/antlr/TestLexer.java |   2 +-
 .../server/core/uri/antlr/TestParser.java       |   2 +-
 .../core/uri/antlr/TestUriParserImpl.java       |  70 ++-
 .../core/uri/queryoption/QueryOptionTest.java   |   6 +-
 .../queryoption/expression/ExpressionTest.java  |  24 +-
 .../core/uri/testutil/ExpandValidator.java      | 233 ++++++++
 .../core/uri/testutil/FilterTreeToText.java     | 154 +++++
 .../core/uri/testutil/FilterValidator.java      | 534 +++++++++++++++++
 .../core/uri/testutil/ParseTreeToText.java      |  82 +++
 .../core/uri/testutil/ParserValidator.java      | 243 ++++++++
 .../core/uri/testutil/ParserWithLogging.java    |  56 ++
 .../core/uri/testutil/ResourceValidator.java    | 583 +++++++++++++++++++
 .../core/uri/testutil/TestErrorLogger.java      | 105 ++++
 .../core/uri/testutil/TokenValidator.java       | 194 ++++++
 .../core/uri/testutil/UriLexerWithTrace.java    |  85 +++
 .../server/core/uri/testutil/UriValidator.java  | 258 ++++++++
 .../server/core/uri/testutil/Validator.java     |  23 +
 98 files changed, 4638 insertions(+), 4467 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java
index 8d3a69a..8dca44f 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java
@@ -25,7 +25,7 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption;
-import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
@@ -45,7 +45,7 @@ public interface UriInfoResource {
 
   IdOption getIdOption();
 
-  InlineCountOption getInlineCountOption();
+  CountOption getInlineCountOption();
 
   OrderByOption getOrderByOption();
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java
deleted file mode 100644
index 1fb51c3..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java
+++ /dev/null
@@ -1,29 +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.server.api.uri;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-
-public interface UriResourceStartingTypeFilter extends UriResourcePartTyped {
-
-  EdmType getTypeFilterOnCollection();
-
-  EdmType getTypeFilterOnEntry();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java
new file mode 100644
index 0000000..70cb0fb
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public interface CountOption extends SystemQueryOption {
+
+  boolean getValue();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
index f1f9590..47b6a3e 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
@@ -18,6 +18,7 @@
  ******************************************************************************/
 package org.apache.olingo.odata4.server.api.uri.queryoption;
 
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
 import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
 
 public interface ExpandItem {
@@ -34,16 +35,19 @@ public interface ExpandItem {
 
   TopOption getTopOption();
 
-  InlineCountOption getInlineCountOption();
+  CountOption getInlineCountOption();
 
   SelectOption getSelectOption();
 
   ExpandOption getExpandOption();
 
-  UriInfoResource getResourceInfo();
+  UriInfoResource getResourcePath();
 
   boolean isStar();
 
   boolean isRef();
 
+  EdmType getStartTypeFilter();
+
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java
deleted file mode 100644
index cb0066f..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java
+++ /dev/null
@@ -1,25 +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.server.api.uri.queryoption;
-
-public interface InlineCountOption extends SystemQueryOption {
-
-  boolean getValue();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
index 04cef3e..f150f00 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
@@ -18,6 +18,7 @@
  ******************************************************************************/
 package org.apache.olingo.odata4.server.api.uri.queryoption;
 
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
 import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
 
@@ -29,6 +30,8 @@ public interface SelectItem {
 
   FullQualifiedName getAllOperationsInSchemaNameSpace();
 
-  UriInfoResource getResourceInfo();
+  UriInfoResource getResourcePath();
+
+  EdmType getStartTypeFilter();
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java
index 6670454..a764001 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java
@@ -23,10 +23,14 @@ import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
 
 public interface Member extends Expression {
 
-  public UriInfoResource getPath();
+  public UriInfoResource getResourcePath();
 
   public EdmType getType();
+  public EdmType getStartTypeFilter();
 
   public boolean isCollection();
 
+  
+
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
index 0b246cb..d94302f 100644
--- a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
+++ b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
@@ -347,7 +347,7 @@ odataIdentifier         : ODATAIDENTIFIER;
 primitiveLiteral    : nullrule
                     | booleanNonCase
                     | DECIMAL   //includes double and single literals
-                    | NANINFINITY
+                    | naninfinity
                     | INT       //includes int16/int32 and int64 literals
                     | BINARY  
                     | DATE
@@ -373,6 +373,7 @@ primitiveLiteral    : nullrule
                     | geometryPolygon
                     ;
 
+naninfinity         : NANINFINITY;
 
 nullrule            : NULLVALUE;
 booleanNonCase      : BOOLEAN | TRUE | FALSE;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
new file mode 100644
index 0000000..e527feb
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
@@ -0,0 +1,296 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.server.api.uri.UriInfo;
+import org.apache.olingo.odata4.server.api.uri.UriInfoAll;
+import org.apache.olingo.odata4.server.api.uri.UriInfoBatch;
+import org.apache.olingo.odata4.server.api.uri.UriInfoCrossjoin;
+import org.apache.olingo.odata4.server.api.uri.UriInfoEntityId;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.UriInfoMetadata;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.UriInfoService;
+import org.apache.olingo.odata4.server.api.uri.UriResource;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipTokenOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption;
+import org.apache.olingo.odata4.server.core.uri.queryoption.CountOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FormatOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.IdOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SearchOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipTokenOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SystemQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.TopOptionImpl;
+
+public class UriInfoImpl implements UriInfo {
+
+  private UriInfoKind kind;
+
+  private List<String> entitySetNames = new ArrayList<String>(); // for $entity
+  private EdmEntityType entityTypeCast; // for $entity
+
+  // Query options
+  private List<CustomQueryOptionImpl> customQueryOptions = new ArrayList<CustomQueryOptionImpl>();
+  private ExpandOptionImpl expandOption;
+  private FilterOptionImpl filterOption;
+  private FormatOptionImpl formatOption;
+  private IdOption idOption;
+  private CountOptionImpl inlineCountOption;
+  private OrderByOptionImpl orderByOption;
+  private SearchOptionImpl searchOption;
+  private SelectOptionImpl selectOption;
+  private SkipOptionImpl skipOption;
+  private SkipTokenOptionImpl skipTokenOption;
+  private TopOptionImpl topOption;
+
+  private String fragment;
+
+  private UriResource lastResourcePart;
+  private List<UriResource> pathParts = new ArrayList<UriResource>();
+
+  @Override
+  public UriInfoAll asUriInfoAll() {
+    return this;
+  }
+
+  @Override
+  public UriInfoBatch asUriInfoBatch() {
+    return this;
+  }
+
+  @Override
+  public UriInfoCrossjoin asUriInfoCrossjoin() {
+    return this;
+  }
+
+  @Override
+  public UriInfoEntityId asUriInfoEntityId() {
+    return this;
+  }
+
+  @Override
+  public UriInfoMetadata asUriInfoMetadata() {
+    return this;
+  }
+
+  @Override
+  public UriInfoResource asUriInfoResource() {
+    return this;
+  }
+
+  @Override
+  public List<String> getEntitySetNames() {
+    return Collections.unmodifiableList(entitySetNames);
+  }
+
+  public void addEntitySetName(final String entitySet) {
+    entitySetNames.add(entitySet);
+  }
+
+  @Override
+  public List<UriResource> getUriResourceParts() {
+    List<UriResource> returnList = new ArrayList<UriResource>();
+    for (UriResource item : pathParts) {
+      returnList.add(item);
+    }
+    return Collections.unmodifiableList(returnList);
+  }
+
+  public UriInfoImpl addResourcePart(final UriResourceImpl uriPathInfo) {
+    pathParts.add(uriPathInfo);
+    lastResourcePart = uriPathInfo;
+    return this;
+  }
+
+  @Override
+  public List<CustomQueryOption> getCustomQueryOptions() {
+    List<CustomQueryOption> retList = new ArrayList<CustomQueryOption>();
+    for (CustomQueryOptionImpl item : customQueryOptions) {
+      retList.add(item);
+    }
+    return retList;
+  }
+
+  @Override
+  public EdmEntityType getEntityTypeCast() {
+    return entityTypeCast;
+  }
+
+  public UriInfoImpl setEntityTypeCast(final EdmEntityType type) {
+    entityTypeCast = type;
+    return this;
+  }
+
+  @Override
+  public ExpandOption getExpandOption() {
+    return expandOption;
+  }
+
+  @Override
+  public FilterOption getFilterOption() {
+    return filterOption;
+  }
+
+  @Override
+  public FormatOption getFormatOption() {
+    return formatOption;
+  }
+
+  @Override
+  public IdOption getIdOption() {
+    return idOption;
+  }
+
+  @Override
+  public CountOption getInlineCountOption() {
+    return inlineCountOption;
+  }
+
+  @Override
+  public UriInfoKind getKind() {
+    return kind;
+  }
+
+  public UriInfoImpl setKind(final UriInfoKind kind) {
+    this.kind = kind;
+    return this;
+  }
+
+  public UriResource getLastResourcePart() {
+    return lastResourcePart;
+  }
+
+  @Override
+  public OrderByOption getOrderByOption() {
+    return orderByOption;
+  }
+
+  @Override
+  public SearchOption getSearchOption() {
+
+    return searchOption;
+  }
+
+  @Override
+  public SelectOption getSelectOption() {
+    return selectOption;
+  }
+
+  @Override
+  public SkipOption getSkipOption() {
+    return skipOption;
+  }
+
+  @Override
+  public SkipTokenOption getSkipTokenOption() {
+    return skipTokenOption;
+  }
+
+  @Override
+  public TopOption getTopOption() {
+    return topOption;
+  }
+
+  public UriInfoImpl setQueryOptions(final List<QueryOptionImpl> list) {
+
+    for (QueryOptionImpl item : list) {
+      if (item instanceof SystemQueryOptionImpl) {
+        setSystemQueryOption((SystemQueryOptionImpl) item);
+      } else if (item instanceof CustomQueryOptionImpl) {
+        addCustomQueryOption(item);
+      }
+    }
+    return this;
+  }
+
+  public void addCustomQueryOption(final QueryOptionImpl item) {
+    customQueryOptions.add((CustomQueryOptionImpl) item);
+  }
+
+  public UriInfoImpl setSystemQueryOption(final SystemQueryOptionImpl systemOption) {
+
+    if (systemOption.getKind() == SupportedQueryOptions.EXPAND) {
+      expandOption = (ExpandOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.FILTER) {
+      filterOption = (FilterOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.FORMAT) {
+      formatOption = (FormatOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.ID) {
+      idOption = (IdOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.INLINECOUNT) {
+      inlineCountOption = (CountOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.ORDERBY) {
+      orderByOption = (OrderByOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.SEARCH) {
+      searchOption = (SearchOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.SELECT) {
+      selectOption = (SelectOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.SKIP) {
+      skipOption = (SkipOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.SKIPTOKEN) {
+      skipTokenOption = (SkipTokenOptionImpl) systemOption;
+    } else if (systemOption.getKind() == SupportedQueryOptions.TOP) {
+      topOption = (TopOptionImpl) systemOption;
+    }
+    return this;
+  }
+
+  @Override
+  public UriInfoService asUriInfoService() {
+    return this;
+  }
+
+  @Override
+  public String getFragment() {
+    return fragment;
+  }
+
+  public UriInfoImpl setFragment(final String fragment) {
+    this.fragment = fragment;
+    return this;
+  }
+
+  public void removeResourcePart(int index) {
+    this.pathParts.remove(index);
+    
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
new file mode 100644
index 0000000..96e7162
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriParameter;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriParameterImpl implements UriParameter {
+  private String name;
+  private String text;
+  private String alias;
+  private Expression expression;
+  private String referencedProperty;
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  public UriParameterImpl setName(final String name) {
+    this.name = name;
+    return this;
+  }
+
+  @Override
+  public String getAlias() {
+    return alias;
+  }
+
+  public UriParameterImpl setAlias(final String alias) {
+    this.alias = alias;
+    return this;
+  }
+
+  @Override
+  public String getText() {
+    return text;
+  }
+
+  public UriParameterImpl setText(final String text) {
+    this.text = text;
+    return this;
+  }
+
+  @Override
+  public Expression getExression() {
+    return expression;
+  }
+
+  public UriParameterImpl setExpression(final ExpressionImpl expression) {
+    this.expression = expression;
+    return this;
+  }
+
+  @Override
+  public String getRefencedProperty() {
+    return referencedProperty;
+  }
+
+  public UriParameterImpl setRefencedProperty(final String referencedProperty) {
+    this.referencedProperty = referencedProperty;
+    return this;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java
deleted file mode 100644
index 826951c..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java
+++ /dev/null
@@ -1,36 +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.server.core.uri;
-
-//TODO Check name of this exception when implementing proper error handling
-public class UriParserException extends Exception {
-  /**
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  public UriParserException(final String message, final Throwable cause) {
-    super(message, cause);
-  }
-
-  public UriParserException(final String message) {
-    super(message, null);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java
deleted file mode 100644
index ad3e820..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java
+++ /dev/null
@@ -1,37 +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.server.core.uri;
-
-//TODO Check name of this exception when implementing proper error handling
-public class UriParserSemanticException extends UriParserException {
-
-  /**
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  public UriParserSemanticException(final String message, final Throwable cause) {
-    super(message, cause);
-  }
-
-  public UriParserSemanticException(final String message) {
-    super(message, null);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java
deleted file mode 100644
index 3125557..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java
+++ /dev/null
@@ -1,36 +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.server.core.uri;
-
-public class UriParserSyntaxException extends UriParserException {
-
-  /**
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  public UriParserSyntaxException(final String message, final Throwable cause) {
-    super(message, cause);
-  }
-
-  public UriParserSyntaxException(final String message) {
-    super(message, null);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
new file mode 100644
index 0000000..e4b1113
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceAction;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+public class UriResourceActionImpl extends UriResourceTypedImpl implements UriResourceAction {
+
+  protected EdmAction action;
+  protected EdmActionImport actionImport;
+
+  public UriResourceActionImpl() {
+    super(UriResourceKind.action);
+  }
+
+  @Override
+  public EdmAction getAction() {
+    return action;
+  }
+
+  public UriResourceActionImpl setAction(final EdmAction action) {
+    this.action = action;
+    return this;
+  }
+
+  @Override
+  public EdmActionImport getActionImport() {
+    return actionImport;
+  }
+
+  public UriResourceActionImpl setActionImport(final EdmActionImport actionImport) {
+    this.actionImport = actionImport;
+    setAction(actionImport.getAction());
+    return this;
+  }
+
+  @Override
+  public boolean isCollection() {
+    return action.getReturnType().isCollection();
+  }
+
+  @Override
+  public EdmType getType() {
+    return action.getReturnType().getType();
+  }
+
+  @Override
+  public String toString() {
+    if (actionImport != null) {
+      return actionImport.getName();
+    } else if (action != null) {
+      return action.getName();
+    }
+    return "";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
new file mode 100644
index 0000000..18f803f
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceComplexProperty;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+public class UriResourceComplexPropertyImpl extends UriResourceTypedImpl implements UriResourceComplexProperty {
+
+  protected EdmProperty property;
+
+  public UriResourceComplexPropertyImpl() {
+    super(UriResourceKind.complexProperty);
+  }
+
+  @Override
+  public EdmProperty getProperty() {
+    return property;
+  }
+
+  public UriResourceComplexPropertyImpl setProperty(final EdmProperty property) {
+    this.property = property;
+    return this;
+  }
+
+  @Override
+  public EdmComplexType getComplexType() {
+    return (EdmComplexType) getType();
+  }
+
+  @Override
+  public EdmComplexType getComplexTypeFilter() {
+    return (EdmComplexType) typeFilter;
+  }
+
+  @Override
+  public EdmType getType() {
+    return property.getType();
+  }
+
+  @Override
+  public boolean isCollection() {
+    return property.isCollection();
+  }
+
+  @Override
+  public String toString() {
+    return property.getName();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
new file mode 100644
index 0000000..179d174
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriResourceCount;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+public class UriResourceCountImpl extends UriResourceImpl implements UriResourceCount {
+
+  public UriResourceCountImpl() {
+    super(UriResourceKind.count);
+  }
+
+  @Override
+  public String toString() {
+    return "$count";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
new file mode 100644
index 0000000..8c1617a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+public class UriResourceEntitySetImpl extends UriResourceWithKeysImpl implements UriResourceEntitySet {
+  protected EdmEntitySet edmEntitySet = null;
+
+  public UriResourceEntitySetImpl() {
+    super(UriResourceKind.entitySet);
+  }
+
+  @Override
+  public EdmEntitySet getEntitySet() {
+    return edmEntitySet;
+  }
+
+  public UriResourceEntitySetImpl setEntitSet(final EdmEntitySet edmES) {
+    edmEntitySet = edmES;
+    return this;
+  }
+
+  @Override
+  public EdmEntityType getEntityType() {
+    return edmEntitySet.getEntityType();
+  }
+
+  @Override
+  public EdmType getType() {
+    return edmEntitySet.getEntityType();
+  }
+
+  @Override
+  public boolean isCollection() {
+    if (keyPredicates == null) {
+      return true;
+    }
+    return false;
+  }
+
+  @Override
+  public String toString() {
+    return edmEntitySet.getName();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
new file mode 100644
index 0000000..5600d8c
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriParameter;
+import org.apache.olingo.odata4.server.api.uri.UriResourceFunction;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+/**
+ * Covers Function imports and BoundFunction in URI
+ */
+public class UriResourceFunctionImpl extends UriResourceWithKeysImpl implements UriResourceFunction {
+
+  protected List<UriParameterImpl> parameters;
+  protected EdmFunction function;
+  protected EdmFunctionImport functionImport;
+  private boolean isParameterListFilled = false;
+
+  public UriResourceFunctionImpl() {
+    super(UriResourceKind.function);
+  }
+
+  @Override
+  public List<UriParameter> getParameters() {
+    List<UriParameter> retList = new ArrayList<UriParameter>();
+    for (UriParameterImpl item : parameters) {
+      retList.add(item);
+    }
+    return retList;
+  }
+
+  public UriResourceFunctionImpl setParameters(final List<UriParameterImpl> parameters) {
+    isParameterListFilled = true;
+    this.parameters = parameters;
+    return this;
+  }
+
+  @Override
+  public EdmFunction getFunction() {
+    return function;
+  }
+
+  public UriResourceFunctionImpl setFunction(final EdmFunction function) {
+    this.function = function;
+    return this;
+  }
+
+  @Override
+  public EdmFunctionImport getFunctionImport() {
+    return functionImport;
+  }
+
+  public UriResourceFunctionImpl setFunctionImport(final EdmFunctionImport edmFI,
+      final List<UriParameterImpl> parameters) {
+    functionImport = edmFI;
+
+    setParameters(parameters);
+
+    return this;
+  }
+
+  @Override
+  public EdmType getType() {
+    return function.getReturnType().getType();
+  }
+
+  @Override
+  public boolean isCollection() {
+    if (keyPredicates != null) {
+      return false;
+    }
+    return function.getReturnType().isCollection();
+  }
+
+  @Override
+  public String toString() {
+    if (functionImport != null) {
+      return functionImport.getName();
+    } else if (function != null) {
+      return function.getName();
+    }
+    return "";
+  }
+
+  public boolean isParameterListFilled() {
+    return isParameterListFilled;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java
new file mode 100644
index 0000000..c0b04c6
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriResource;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+/**
+ * Covers Functionimports and BoundFunction in URI
+ */
+public abstract class UriResourceImpl implements UriResource {
+  protected UriResourceKind kind;
+
+  public UriResourceImpl(final UriResourceKind kind) {
+    this.kind = kind;
+  }
+
+  @Override
+  public UriResourceKind getKind() {
+    return kind;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
new file mode 100644
index 0000000..4d91f1a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceIt;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+/**
+ * Covers Functionimports and BoundFunction in URI
+ */
+public class UriResourceItImpl extends UriResourceWithKeysImpl implements UriResourceIt {
+
+  private EdmType type;
+  private boolean isCollection;
+
+  public UriResourceItImpl() {
+    super(UriResourceKind.it);
+  }
+
+  @Override
+  public EdmType getType() {
+    return type;
+  }
+
+  public UriResourceItImpl setType(final EdmType type) {
+    this.type = type;
+    return this;
+  }
+
+  @Override
+  public boolean isCollection() {
+    if (keyPredicates != null) {
+      return false;
+    }
+    return isCollection;
+  }
+
+  public UriResourceItImpl setCollection(final boolean isCollection) {
+    this.isCollection = isCollection;
+    return this;
+  }
+
+  @Override
+  public String toString() {
+    return "$it";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
new file mode 100644
index 0000000..39ca238
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAll;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements UriResourceLambdaAll {
+  protected EdmProperty property;
+  private String lamdaVariable;
+  private ExpressionImpl expression;
+
+  public UriResourceLambdaAllImpl() {
+    super(UriResourceKind.lambdaAll);
+  }
+
+  @Override
+  public EdmType getType() {
+    return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+  }
+
+  @Override
+  public boolean isCollection() {
+    return false;
+  }
+
+  @Override
+  public String getLamdaVariable() {
+    return lamdaVariable;
+  }
+
+  public UriResourceLambdaAllImpl setLamdaVariable(final String lamdaVariable) {
+    this.lamdaVariable = lamdaVariable;
+    return this;
+  };
+
+  @Override
+  public Expression getExpression() {
+    return expression;
+  }
+
+  public UriResourceLambdaAllImpl setExpression(final ExpressionImpl expression) {
+    this.expression = expression;
+    return this;
+  };
+
+  @Override
+  public String toString() {
+    return "all";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
new file mode 100644
index 0000000..3a20c81
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAny;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements UriResourceLambdaAny {
+  protected EdmProperty property;
+  private String lamdaVariable;
+  private ExpressionImpl expression;
+
+  public UriResourceLambdaAnyImpl() {
+    super(UriResourceKind.lambdaAny);
+  }
+
+  @Override
+  public EdmType getType() {
+    return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+  }
+
+  @Override
+  public boolean isCollection() {
+    return false;
+  }
+
+  @Override
+  public String getLamdaVariable() {
+    return lamdaVariable;
+  }
+
+  public UriResourceLambdaAnyImpl setLamdaVariable(final String lamdaVariable) {
+    this.lamdaVariable = lamdaVariable;
+    return this;
+  };
+
+  @Override
+  public Expression getExpression() {
+    return expression;
+  }
+
+  public UriResourceLambdaAnyImpl setExpression(final ExpressionImpl expression) {
+    this.expression = expression;
+    return this;
+  }
+
+  @Override
+  public String toString() {
+    return "any";
+  };
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
new file mode 100644
index 0000000..e3154dc
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaRef;
+
+public class UriResourceLambdaVarImpl extends UriResourceTypedImpl implements UriResourceLambdaRef {
+
+  private EdmType type;
+  private boolean isCollection;
+  private String variableText;
+
+  public UriResourceLambdaVarImpl() {
+    super(UriResourceKind.lambdaVariable);
+  }
+
+  @Override
+  public String getVariableText() {
+    return variableText;
+  }
+
+  public UriResourceLambdaVarImpl setVariableText(final String variableText) {
+    this.variableText = variableText;
+    return this;
+  }
+
+  @Override
+  public EdmType getType() {
+    return type;
+  }
+
+  public UriResourceLambdaVarImpl setType(final EdmType type) {
+    this.type = type;
+    return this;
+
+  }
+
+  @Override
+  public boolean isCollection() {
+    return isCollection;
+  }
+
+  public UriResourceLambdaVarImpl setCollection(final boolean isCollection) {
+    this.isCollection = isCollection;
+    return this;
+  }
+
+  @Override
+  public String toString() {
+    return variableText;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
new file mode 100644
index 0000000..637f09a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceNavigation;
+
+public class UriResourceNavigationPropertyImpl extends UriResourceWithKeysImpl implements UriResourceNavigation {
+
+  protected EdmNavigationProperty navigationProperty;
+
+  public UriResourceNavigationPropertyImpl() {
+    super(UriResourceKind.navigationProperty);
+  }
+
+  @Override
+  public EdmNavigationProperty getProperty() {
+    return navigationProperty;
+  }
+
+  public UriResourceNavigationPropertyImpl setNavigationProperty(final EdmNavigationProperty property) {
+    navigationProperty = property;
+    return this;
+
+  }
+
+  @Override
+  public EdmType getType() {
+    return navigationProperty.getType();
+  }
+
+  @Override
+  public boolean isCollection() {
+    if (keyPredicates != null) {
+      return false;
+    }
+    return navigationProperty.isCollection();
+  }
+
+  @Override
+  public String toString() {
+    return navigationProperty.getName();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
new file mode 100644
index 0000000..3fd4139
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePrimitiveProperty;
+
+public class UriResourcePrimitivePropertyImpl extends UriResourceTypedImpl implements UriResourcePrimitiveProperty {
+
+  EdmProperty property;
+
+  public UriResourcePrimitivePropertyImpl() {
+    super(UriResourceKind.primitiveProperty);
+  }
+
+  @Override
+  public EdmProperty getProperty() {
+    return property;
+  }
+
+  public UriResourcePrimitivePropertyImpl setProperty(final EdmProperty property) {
+    this.property = property;
+    return this;
+  }
+
+  @Override
+  public EdmType getType() {
+    return property.getType();
+  }
+
+  @Override
+  public boolean isCollection() {
+    return property.isCollection();
+  }
+
+  @Override
+  public String toString() {
+    return property.getName();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
new file mode 100644
index 0000000..17cf8f3
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceRef;
+
+public class UriResourceRefImpl extends UriResourceImpl implements UriResourceRef {
+
+  public UriResourceRefImpl() {
+    super(UriResourceKind.ref);
+
+  }
+
+  @Override
+  public String toString() {
+    return "$ref";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
new file mode 100644
index 0000000..1d5f55d
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceRoot;
+
+public class UriResourceRootImpl extends UriResourceWithKeysImpl implements UriResourceRoot {
+
+  private EdmType type;
+  private boolean isCollection;
+
+  public UriResourceRootImpl() {
+    super(UriResourceKind.root);
+  }
+
+  @Override
+  public EdmType getType() {
+    return type;
+  }
+
+  public UriResourceRootImpl setType(final EdmType type) {
+    this.type = type;
+    return this;
+  }
+
+  @Override
+  public boolean isCollection() {
+    if (keyPredicates != null) {
+      return false;
+    }
+    return isCollection;
+  }
+
+  public UriResourceRootImpl setCollection(final boolean isCollection) {
+    this.isCollection = isCollection;
+    return this;
+  }
+
+  @Override
+  public String toString() {
+    return "$root";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
new file mode 100644
index 0000000..abb8964
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceSingleton;
+
+public class UriResourceSingletonImpl extends UriResourceTypedImpl implements UriResourceSingleton {
+
+  private EdmSingleton singleton;
+
+  public UriResourceSingletonImpl() {
+    super(UriResourceKind.singleton);
+  }
+
+  @Override
+  public EdmSingleton getSingleton() {
+    return singleton;
+  }
+
+  public UriResourceSingletonImpl setSingleton(final EdmSingleton singleton) {
+
+    this.singleton = singleton;
+    return this;
+  }
+
+  @Override
+  public EdmEntityType getEntityTypeFilter() {
+    return (EdmEntityType) typeFilter;
+  }
+
+  @Override
+  public EdmType getType() {
+    return singleton.getEntityType();
+  }
+
+  @Override
+  public EdmEntityType getEntityType() {
+    return singleton.getEntityType();
+  }
+
+  @Override
+  public boolean isCollection() {
+    return false;
+  }
+
+  @Override
+  public String toString() {
+    return singleton.getName();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
new file mode 100644
index 0000000..2fba96c
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 2 * Licensed to the Apache Software Foundation (ASF) under one
+ * 3 * or more contributor license agreements. See the NOTICE file
+ * 4 * distributed with this work for additional information
+ * 5 * regarding copyright ownership. The ASF licenses this file
+ * 6 * to you under the Apache License, Version 2.0 (the
+ * 7 * "License"); you may not use this file except in compliance
+ * 8 * with the License. You may obtain a copy of the License at
+ * 9 *
+ * 10 * http://www.apache.org/licenses/LICENSE-2.0
+ * 11 *
+ * 12 * Unless required by applicable law or agreed to in writing,
+ * 13 * software distributed under the License is distributed on an
+ * 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 15 * KIND, either express or implied. See the License for the
+ * 16 * specific language governing permissions and limitations
+ * 17 * under the License.
+ * 18
+ ******************************************************************************/
+
+package org.apache.olingo.odata4.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+public class UriResourceStartingTypeFilterImpl extends UriResourceWithKeysImpl {
+
+  private EdmType type;
+  private boolean isCollection;
+
+  public UriResourceStartingTypeFilterImpl() {
+    super(UriResourceKind.startingTypeFilter);
+  }
+
+  @Override
+  public UriResourceKind getKind() {
+    return kind;
+  }
+
+  @Override
+  public EdmType getType() {
+    return type;
+  }
+
+  public UriResourceStartingTypeFilterImpl setType(final EdmType type) {
+    this.type = type;
+    return this;
+  }
+
+  @Override
+  public boolean isCollection() {
+    if (keyPredicates != null) {
+      return false;
+    }
+    return isCollection;
+  }
+
+  public UriResourceStartingTypeFilterImpl setCollection(final boolean isCollection) {
+    this.isCollection = isCollection;
+    return this;
+  }
+
+  @Override
+  public String toString() {
+    return type.getNamespace() + "." + type.getName();
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/32467b8d/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
new file mode 100644
index 0000000..36f146e
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+
+public abstract class UriResourceTypedImpl extends UriResourceImpl implements UriResourcePartTyped {
+
+  protected EdmType typeFilter = null;
+
+  public UriResourceTypedImpl(final UriResourceKind kind) {
+    super(kind);
+  }
+
+  public EdmType getTypeFilter() {
+    return typeFilter;
+  }
+
+  public UriResourceTypedImpl setTypeFilter(final EdmStructuralType typeFilter) {
+    this.typeFilter = typeFilter;
+    return this;
+  }
+
+  @Override
+  public String toString(final boolean includeFilters) {
+    if (includeFilters) {
+      if (typeFilter != null) {
+        return toString() + "/" + getFQN(typeFilter).toString();
+      } else {
+        return toString();
+      }
+    }
+    return toString();
+  }
+
+  private FullQualifiedName getFQN(final EdmType type) {
+    return new FullQualifiedName(type.getNamespace(), type.getName());
+  }
+
+}