You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/07/08 10:15:01 UTC
[07/12] olingo-odata4 git commit: [OLINGO-631] Updated AntLR to
version 4.5 and resolved Java8 compilation errors
[OLINGO-631] Updated AntLR to version 4.5 and resolved Java8 compilation
errors
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/eae41fc7
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/eae41fc7
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/eae41fc7
Branch: refs/heads/OLINGO-708_AsyncSupportTec
Commit: eae41fc7c80eb9436daf86af6688ddfe3c6c0dc0
Parents: de64c31
Author: Christian Holzer <c....@sap.com>
Authored: Mon Jul 6 14:07:06 2015 +0200
Committer: Christian Holzer <c....@sap.com>
Committed: Mon Jul 6 17:45:51 2015 +0200
----------------------------------------------------------------------
.../apache/olingo/fit/v4/BatchTestITCase.java | 16 +++------
.../olingo/server/core/uri/antlr/UriLexer.g4 | 16 ++++-----
.../olingo/server/core/uri/antlr/UriParser.g4 | 2 +-
.../olingo/server/core/uri/antlr/TestLexer.java | 35 +++++++++++++++++---
pom.xml | 10 +++++-
5 files changed, 53 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eae41fc7/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
index 5007c2c..db196c3 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
@@ -239,7 +240,7 @@ public class BatchTestITCase extends AbstractTestITCase {
@Test
@SuppressWarnings("unchecked")
- public void changesetWithReference() throws EdmPrimitiveTypeException {
+ public void changesetWithReference() throws Exception {
// create your request
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
request.setAccept(ACCEPT);
@@ -262,17 +263,8 @@ public class BatchTestITCase extends AbstractTestITCase {
// add update request: link CustomerInfo(17) to the new customer
final ClientEntity customerChanges = client.getObjectFactory().newEntity(order.getTypeName());
customerChanges.addLink(client.getObjectFactory().newEntitySetNavigationLink(
- "OrderDetails",
- client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("OrderDetails").
- appendKeySegment(new HashMap<String, Object>() {
- private static final long serialVersionUID = 3109256773218160485L;
-
- {
- put("OrderID", 7);
- put("ProductID", 5);
- }
- }).build()));
-
+ "OrderDetails", new URI(testStaticServiceRootURL + "/OrderDetails(OrderID=7,ProductID=5)")));
+
final ODataEntityUpdateRequest<ClientEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eae41fc7/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 f74e721..a74fd2f 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
@@ -112,13 +112,13 @@ REF : '$ref';
COUNT : '$count';
//inlined query parameters ( e.g. $skip)
-TOP_I : '$top' -> type(TOP);
-SKIP_I : '$skip' -> type(SKIP);
-FILTER_I : '$filter' -> type(FILTER);
-ORDERBY_I: '$orderby' -> type(ORDERBY);
-SELECT_I : '$select' -> type(SELECT);
-EXPAND_I : '$expand' -> type(EXPAND);
-LEVELS_I : '$levels' -> type(LEVELS);
+TOP_I : '$top' -> type(TOP);
+SKIP_QO_I : '$skip' -> type(SKIP_QO);
+FILTER_I : '$filter' -> type(FILTER);
+ORDERBY_I : '$orderby' -> type(ORDERBY);
+SELECT_I : '$select' -> type(SELECT);
+EXPAND_I : '$expand' -> type(EXPAND);
+LEVELS_I : '$levels' -> type(LEVELS);
MAX: 'max';
ROOT : '$root/';
@@ -254,7 +254,7 @@ FILTER : '$filter' -> pushMode(DEFAULT_MODE)
ORDERBY : '$orderby' -> pushMode(DEFAULT_MODE);
EXPAND : '$expand' -> pushMode(DEFAULT_MODE);
SELECT : '$select' -> pushMode(DEFAULT_MODE);
-SKIP : '$skip' -> pushMode(DEFAULT_MODE);
+SKIP_QO : '$skip' -> pushMode(DEFAULT_MODE);
SKIPTOKEN : '$skiptoken' -> pushMode(MODE_SYSTEM_QUERY_REST);
TOP : '$top' -> pushMode(DEFAULT_MODE);
LEVELS_q : '$levels' -> type(LEVELS), pushMode(DEFAULT_MODE);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eae41fc7/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 7efc14c..e7572dc 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
@@ -144,7 +144,7 @@ orderList : vlOI+=orderByItem ( WSP* COMMA WSP* vlOI+=orderByItem )*;
orderByItem : vC=commonExpr ( WSP ( vA=ASC | vD=DESC ) )?;
-skip : SKIP EQ INT;
+skip : SKIP_QO EQ INT;
top : TOP EQ INT;
//format : FORMAT EQ ( ATOM | JSON | XML | PCHARS SLASH PCHARS);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eae41fc7/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 4b32be5..e529eae 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
@@ -69,9 +69,9 @@ public class TestLexer {
public void testQueryOptionsTokens() {
test.globalMode(UriLexer.MODE_QUERY);
- test.run("$skip=1").isAllText("$skip=1").isType(UriLexer.SKIP);
- test.run("$skip=2").isAllText("$skip=2").isType(UriLexer.SKIP);
- test.run("$skip=123").isAllText("$skip=123").isType(UriLexer.SKIP);
+ test.run("$skip=1").isAllText("$skip=1").isType(UriLexer.SKIP_QO);
+ test.run("$skip=2").isAllText("$skip=2").isType(UriLexer.SKIP_QO);
+ test.run("$skip=123").isAllText("$skip=123").isType(UriLexer.SKIP_QO);
test.run("$top=1").isAllText("$top=1").isType(UriLexer.TOP);
test.run("$top=2").isAllText("$top=2").isType(UriLexer.TOP);
@@ -97,7 +97,34 @@ public class TestLexer {
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
+ public void testQueryOptionsDefaultMode() {
+ // First set query mode, than use expand(switches to default mode) and use nested system query options
+ test.globalMode(UriLexer.MODE_QUERY);
+ 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($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);
+
+ test.run("$expand=ABC($expand=DEF($skip=1))").isAllText("$expand=ABC($expand=DEF($skip=1))")
+ .at(8).isType(UriLexer.SKIP_QO);
+ test.run("$expand=ABC($expand=DEF($skip=2))").isAllText("$expand=ABC($expand=DEF($skip=2))")
+ .at(8).isType(UriLexer.SKIP_QO);
+ test.run("$expand=ABC($expand=DEF($skip=123))").isAllText("$expand=ABC($expand=DEF($skip=123))")
+ .at(8).isType(UriLexer.SKIP_QO);
+
+ test.run("$expand=ABC($expand=DEF($top=1))").isAllText("$expand=ABC($expand=DEF($top=1))")
+ .at(8).isType(UriLexer.TOP);
+ test.run("$expand=ABC($expand=DEF($top=2))").isAllText("$expand=ABC($expand=DEF($top=2))")
+ .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);
+ }
+
// ;------------------------------------------------------------------------------
// ; 4. Expressions
// ;------------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eae41fc7/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7c867e4..92d14a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,7 @@
<jackson.version>2.4.2</jackson.version>
<aalto-xml.version>0.9.10</aalto-xml.version>
- <antlr.version>4.1</antlr.version>
+ <antlr.version>4.5</antlr.version>
<android.platform.version>4.1.1.4</android.platform.version>
<stax.api.version>1.0-2</stax.api.version>
@@ -403,6 +403,14 @@
</plugin>
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
+ <version>1.5</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-filtering</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
<executions>
<execution>
<goals>