Repository: olingo-odata4 Updated Branches: refs/heads/master e18c6fa18 -> 243708f16
OLINGO-1245: allow to define a full boolean expression with surrounding 'not' logical operator with parens surrounding the boolean expression Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/243708f1 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/243708f1 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/243708f1 Branch: refs/heads/master Commit: 243708f168218ac1c8ad34d7a0bb089904eb951c Parents: e18c6fa Author: Ramesh Reddy <[email protected]> Authored: Fri Aug 3 11:07:08 2018 -0500 Committer: Ramesh Reddy <[email protected]> Committed: Fri Aug 3 11:07:08 2018 -0500 ---------------------------------------------------------------------- .../org/apache/olingo/server/core/uri/parser/ExpressionParser.java | 2 +- .../apache/olingo/server/core/uri/parser/ExpressionParserTest.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/243708f1/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpressionParser.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpressionParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpressionParser.java index ff61fc8..ed0af1c 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpressionParser.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/ExpressionParser.java @@ -313,7 +313,7 @@ public class ExpressionParser { } return new UnaryImpl(UnaryOperatorKind.MINUS, expression, getType(expression)); } else if (tokenizer.next(TokenKind.NotOperator)) { - final Expression expression = parseExprPrimary(); + final Expression expression = parseExprValue(); checkType(expression, EdmPrimitiveTypeKind.Boolean); checkNoCollection(expression); return new UnaryImpl(UnaryOperatorKind.NOT, expression, getType(expression)); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/243708f1/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java ---------------------------------------------------------------------- diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java index c267754..6985e51 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/ExpressionParserTest.java @@ -171,7 +171,9 @@ public class ExpressionParserTest { @Test public void filterUnaryOperators() throws Exception { testFilter.runOnETAllPrim("not PropertyBoolean").is("<not <PropertyBoolean>>"); + testFilter.runOnETAllPrim("not (PropertyBoolean)").is("<not <PropertyBoolean>>"); testFilter.runOnETAllPrim("-PropertyInt16 eq PropertyInt16").is("<<- <PropertyInt16>> eq <PropertyInt16>>"); + testFilter.runOnETAllPrim("not (PropertyString eq null)").is("<not <<PropertyString> eq <null>>>"); } @Test
