You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/08/17 12:58:04 UTC

olingo-odata4 git commit: [OLINGO-730] Inline $search results in an 501 NOT IMPLEMENTED response code

Repository: olingo-odata4
Updated Branches:
  refs/heads/master 1dd3a583f -> 262cee8b7


[OLINGO-730] Inline $search results in an 501 NOT IMPLEMENTED response code


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

Branch: refs/heads/master
Commit: 262cee8b7e4ed892d14749506f8daf6c35d0c6ac
Parents: 1dd3a58
Author: Christian Holzer <c....@sap.com>
Authored: Mon Aug 17 12:57:07 2015 +0200
Committer: Christian Holzer <c....@sap.com>
Committed: Mon Aug 17 12:57:22 2015 +0200

----------------------------------------------------------------------
 .../ExpandWithSystemQueryOptionsITCase.java     | 21 ++++++++++++++++
 .../tecsvc/client/SystemQueryOptionITCase.java  | 20 +++++++++++++++-
 .../apache/olingo/server/api/ODataResponse.java |  3 ---
 .../olingo/server/core/uri/antlr/UriLexer.g4    |  7 +++++-
 .../olingo/server/core/uri/antlr/UriParser.g4   |  2 +-
 .../server/core/ODataExceptionHelper.java       |  2 ++
 .../olingo/server/core/uri/parser/Parser.java   |  5 ++--
 .../server/core/uri/parser/UriContext.java      |  3 ++-
 .../core/uri/parser/UriParseTreeVisitor.java    |  7 ++++++
 .../uri/parser/UriParserSemanticException.java  |  4 +++-
 .../server-core-exceptions-i18n.properties      |  1 +
 .../olingo/server/core/uri/antlr/TestLexer.java | 25 +++++++++++++++++++-
 .../core/uri/testutil/TestErrorLogger.java      |  2 +-
 .../core/uri/testutil/TokenValidator.java       |  4 ++--
 .../core/uri/testutil/UriLexerWithTrace.java    |  2 +-
 15 files changed, 93 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java
index d1bedbc..658bc08 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java
@@ -29,6 +29,7 @@ import java.util.Map;
 
 import org.apache.olingo.client.api.EdmEnabledODataClient;
 import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.ODataServerErrorException;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.ClientEntity;
@@ -456,6 +457,26 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase {
     assertEquals("1", fourthLevelEntites.get(0).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
   }
 
+  @Test
+  public void expandWithSearchQuery() {
+    final ODataClient client = getClient();
+    final Map<QueryOption, Object> expandOptions = new HashMap<QueryOption, Object>();
+    expandOptions.put(QueryOption.SEARCH, "abc");
+    expandOptions.put(QueryOption.FILTER, "PropertyInt16 eq 1");
+    
+    final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+        .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, expandOptions)
+        .build();
+
+    final ODataEntitySetRequest<ClientEntitySet> request = client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+    
+    try {
+      request.execute();
+    } catch(ODataServerErrorException e) {
+      assertEquals("HTTP/1.1 501 Not Implemented", e.getMessage());
+    }
+  }
+  
   private ODataRetrieveResponse<ClientEntitySet> buildRequest(final String entitySet, final String navigationProperty,
       final Map<QueryOption, Object> expandOptions) {
     return buildRequest(entitySet, navigationProperty, expandOptions, null);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
index 09c7cc6..1249903 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
@@ -25,6 +25,7 @@ import java.net.URI;
 
 import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.communication.ODataServerErrorException;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.ClientEntity;
@@ -307,7 +308,24 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
       assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
     }
   }
-
+  
+  @Test
+  public void testNegativeSearch() {
+    ODataClient client = getClient();
+    URI uri = client.newURIBuilder(SERVICE_URI)
+        .appendEntitySetSegment(ES_ALL_PRIM)
+        .search("ABC")
+        .build();
+    try {
+      client.getRetrieveRequestFactory()
+      .getEntitySetRequest(uri)
+      .execute();
+      fail();
+    } catch (ODataServerErrorException e) {
+      assertEquals("HTTP/1.1 501 Not Implemented", e.getMessage());
+    }
+  }
+  
   @Override
   protected ODataClient getClient() {
     ODataClient odata = ODataClientFactory.getClient();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
index c0e0825..a53b1e4 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
@@ -20,9 +20,6 @@ package org.apache.olingo.server.api;
 
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4 b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4
index ff3db0b..8092276 100644
--- a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4
+++ b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4
@@ -340,7 +340,12 @@ WSP_sqc             : WS_sqc+ -> type(WSP);
 QUOTATION_MARK_sqc  : '\u0022';
 
 SEARCHWORD          : ('a'..'z'|'A'..'Z')+;
-SEARCHPHRASE        : QUOTATION_MARK_sqc ~["]* QUOTATION_MARK_sqc -> popMode;
+SEARCHPHRASE        : QUOTATION_MARK_sqc ~["]* QUOTATION_MARK_sqc;
+
+// Follow Set
+CLOSE_qs            : ')' -> popMode, type(CLOSE);   
+SEMI_qs             : ';' -> popMode, type(SEMI);   
+AMP_qs              : '&' -> popMode, type(AMP);
 
 //;==============================================================================
 mode MODE_STRING;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4 b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4
index 93a4ee1..198d1ba 100644
--- a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4
+++ b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4
@@ -115,7 +115,7 @@ expandPathExtension : OPEN vlEO+=expandOption                        ( SEMI vlEO
                     ;  
 
 expandCountOption   : filter
-                    | search
+                    | searchInline
                     ;
 
 expandRefOption     : expandCountOption

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
index d6ed039..8c48d5f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
@@ -48,6 +48,8 @@ public class ODataExceptionHelper {
     if (UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND.equals(e.getMessageKey())
         || UriParserSemanticException.MessageKeys.PROPERTY_NOT_IN_TYPE.equals(e.getMessageKey())) {
       serverError.setStatusCode(HttpStatusCode.NOT_FOUND.getStatusCode());
+    } else if(UriParserSemanticException.MessageKeys.NOT_IMPLEMENTED.equals(e.getMessageKey())) {
+      serverError.setStatusCode(HttpStatusCode.NOT_IMPLEMENTED.getStatusCode());
     } else {
       serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode());
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
index e0d77c3..b2dfff8 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
@@ -211,7 +211,8 @@ public class Parser {
 
             systemOption = (OrderByOptionImpl) uriParseTreeVisitor.visitOrderByEOF(ctxOrderByExpression);
           } else if (option.name.equals(SystemQueryOptionKind.SEARCH.toString())) {
-            throw new RuntimeException("System query option '$search' not implemented!");
+            throw new UriParserSemanticException("System query option '$search' not implemented!", 
+                UriParserSemanticException.MessageKeys.NOT_IMPLEMENTED, "System query option '$search");
           } else if (option.name.equals(SystemQueryOptionKind.SELECT.toString())) {
             SelectEOFContext ctxSelectEOF =
                 (SelectEOFContext) parseRule(option.value, ParserEntryRules.Select);
@@ -475,7 +476,7 @@ public class Parser {
       int index = token.getType();
       out.append("\"").append(token.getText()).append("\"").append("     ");
       if (index != -1) {
-        out.append(UriLexer.tokenNames[index]);
+        out.append(UriLexer.VOCABULARY.getDisplayName(index));
       } else {
         out.append(index);
       }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
index 348364f..a6b9bff 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
@@ -66,7 +66,8 @@ public class UriContext {
   
   //CHECKSTYLE:OFF (Maven checkstyle)
   /**
-   * Set to true in method xxx  right before calling {@link  org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor#readResourcePathSegment}
+   * Set to true in method {@link UriParseTreeVisitor#visitExpandPath} right before 
+   * calling {@link  org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor#readResourcePathSegment}
    * After reading the path the variable is set back to false
    * 
    * readResourcePathSegment handles all navigation properties, it depends on the context if key predicates are allowed or not.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
index 16816bd..7da3f11 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
@@ -154,6 +154,7 @@ import org.apache.olingo.server.core.uri.antlr.UriParserParser.QueryOptionContex
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.QueryOptionsContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.RootExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.RoundMethodCallExprContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.SearchSpecialTokenContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.SecondMethodCallExprContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectContext;
 import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectEOFContext;
@@ -2391,4 +2392,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
     alias.setParameter("@" + ctx.odataIdentifier().getChild(0).getText());
     return alias;
   }
+  
+  @Override
+  public Object visitSearchSpecialToken(final SearchSpecialTokenContext ctx) {
+    throw wrap(new UriParserSemanticException("System query option '$search' not implemented!", 
+                UriParserSemanticException.MessageKeys.NOT_IMPLEMENTED, "System query option '$search"));
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java
index c1b171e..75744c9 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java
@@ -73,7 +73,9 @@ public class UriParserSemanticException extends UriParserException {
     NOT_FOR_ENTITY_TYPE,
     PREVIOUS_PART_TYPED,
     /** parameter: resource_name */
-    RESOURCE_NOT_FOUND;
+    RESOURCE_NOT_FOUND,
+    /** parameter: not implemented part */
+    NOT_IMPLEMENTED;
 
     @Override
     public String getKey() {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
index fbb4d62..312b324 100644
--- a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
+++ b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
@@ -63,6 +63,7 @@ UriParserSemanticException.COMPLEX_PROPERTY_OF_ENTITY_TYPE_EXPECTED=A complex pr
 UriParserSemanticException.NOT_FOR_ENTITY_TYPE=Not allowed for entity type.
 UriParserSemanticException.PREVIOUS_PART_TYPED=The previous part is typed.
 UriParserSemanticException.RESOURCE_NOT_FOUND=Cannot find EntitySet, Singleton, ActionImport or FunctionImport with name '%1$s'.
+UriParserSemanticException.NOT_IMPLEMENTED=%1$s is not implemented!
 
 UriValidationException.UNSUPPORTED_QUERY_OPTION=The query option '%1$s' is not supported.
 UriValidationException.UNSUPPORTED_URI_KIND=The URI kind '%1$s' is not supported.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
index e529eae..6df6759 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
@@ -96,6 +96,8 @@ public class TestLexer {
     test.run("$search=\"ABC\"").isAllText("$search=\"ABC\"").isType(UriLexer.SEARCH);
     test.run("$search=ABC").isAllText("$search=ABC").isType(UriLexer.SEARCH);
     test.run("$search=\"A%20B%20C\"").isAllText("$search=\"A%20B%20C\"").isType(UriLexer.SEARCH);
+    test.run("$search=Test Test").isAllText("$search=Test Test").isType(UriLexer.SEARCH);
+    test.run("$search=Test&$filter=ABC eq 1").isAllText("$search=Test&$filter=ABC eq 1").isType(UriLexer.SEARCH);
   }
   
   @Test
@@ -105,7 +107,10 @@ public class TestLexer {
     test.run("$expand=ABC($skip=1)").isAllText("$expand=ABC($skip=1)").at(4).isType(UriLexer.SKIP_QO);
     test.run("$expand=ABC($skip=2)").isAllText("$expand=ABC($skip=2)").at(4).isType(UriLexer.SKIP_QO);
     test.run("$expand=ABC($skip=123)").isAllText("$expand=ABC($skip=123)").at(4).isType(UriLexer.SKIP_QO);
-    
+    test.run("$expand=ABC($search=abc)").isAllText("$expand=ABC($search=abc)").at(4).isType(UriLexer.SEARCH_INLINE);
+    test.run("$expand=ABC($search=\"123\")").isAllText("$expand=ABC($search=\"123\")")
+                                            .at(4).isType(UriLexer.SEARCH_INLINE)
+                                            .at(6).isType(UriLexer.SEARCHPHRASE);
     test.run("$expand=ABC($top=1)").isAllText("$expand=ABC($top=1)").at(4).isType(UriLexer.TOP);
     test.run("$expand=ABC($top=2)").isAllText("$expand=ABC($top=2)").at(4).isType(UriLexer.TOP);
     test.run("$expand=ABC($top=123)").isAllText("$expand=ABC($top=123)").at(4).isType(UriLexer.TOP);
@@ -123,6 +128,24 @@ public class TestLexer {
                                                 .at(8).isType(UriLexer.TOP);
     test.run("$expand=ABC($expand=DEF($top=123))").isAllText("$expand=ABC($expand=DEF($top=123))")
                                                   .at(8).isType(UriLexer.TOP);
+    test.run("$expand=ABC($expand=DEF($search=Test Test))").isAllText("$expand=ABC($expand=DEF($search=Test Test))")
+                                                        .at(8).isType(UriLexer.SEARCH_INLINE)
+                                                        .at(10).isType(UriLexer.SEARCHWORD)
+                                                        .at(12).isType(UriLexer.SEARCHWORD);
+    test.run("$expand=ABC($expand=DEF($search=\"Test\" \"Test\"))")
+                .isAllText("$expand=ABC($expand=DEF($search=\"Test\" \"Test\"))")
+                .at(8).isType(UriLexer.SEARCH_INLINE)
+                .at(10).isType(UriLexer.SEARCHPHRASE)
+                .at(12).isType(UriLexer.SEARCHPHRASE);
+    test.run("$expand=ABC($expand=DEF($search=\"Test\" \"Test\";$filter=PropertyInt16 eq 0;$orderby=PropertyInt16))")
+                .isAllText("$expand=ABC($expand=DEF($search=\"Test\" \"Test\";$filter=PropertyInt16 " + 
+                           "eq 0;$orderby=PropertyInt16))")
+                .at(8).isType(UriLexer.SEARCH_INLINE)
+                .at(10).isType(UriLexer.SEARCHPHRASE)
+                .at(12).isType(UriLexer.SEARCHPHRASE)
+                .at(13).isType(UriLexer.SEMI)
+                .at(14).isType(UriLexer.FILTER)
+                .at(22).isType(UriLexer.ORDERBY);
   }
   
   // ;------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java
index 7d6604f..76b0d38 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java
@@ -92,7 +92,7 @@ class TestErrorLogger implements ANTLRErrorListener {
 
       String lexerTokenName = "";
       try {
-        lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+        lexerTokenName = UriLexer.VOCABULARY.getDisplayName(e.getOffendingToken().getType());
       } catch (ArrayIndexOutOfBoundsException es) {
         lexerTokenName = "token error";
       }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java
index 596f0d4..3ec6229 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java
@@ -145,7 +145,7 @@ public class TokenValidator {
   }
 
   public TokenValidator isType(final int expected) {
-    assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
+    assertEquals(UriLexer.VOCABULARY.getDisplayName(expected), UriLexer.VOCABULARY.getDisplayName(curToken.getType()));
     return this;
   }
 
@@ -180,7 +180,7 @@ public class TokenValidator {
       }
       int index = token.getType();
       if (index != -1) {
-        out += "\"" + token.getText() + "\"" + "     " + UriLexer.tokenNames[index] + nL;
+        out += "\"" + token.getText() + "\"" + "     " + UriLexer.VOCABULARY.getDisplayName(index) + nL;
       } else {
         out += "\"" + token.getText() + "\"" + "     " + index + nL;
       }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/262cee8b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
index 3d4cb0f..c067394 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
@@ -45,7 +45,7 @@ public class UriLexerWithTrace extends UriLexer {
       if (tokenType == -1) {
         out += "-1/EOF";
       } else {
-        out += UriLexer.tokenNames[tokenType];
+        out += UriLexer.VOCABULARY.getDisplayName(tokenType);
       }
       System.out.println("Lexer.emit(...):" + out);
     }