cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/3] cayenne git commit: CAY-2270 Update function support in expression parser
Date Thu, 16 Mar 2017 13:17:42 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 8ef8f1221 -> e56a93f4f


http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/main/jjtree/org/apache/cayenne/exp/parser/ExpressionParser.jjt
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/jjtree/org/apache/cayenne/exp/parser/ExpressionParser.jjt
b/cayenne-server/src/main/jjtree/org/apache/cayenne/exp/parser/ExpressionParser.jjt
index ebc881b..f61c692 100644
--- a/cayenne-server/src/main/jjtree/org/apache/cayenne/exp/parser/ExpressionParser.jjt
+++ b/cayenne-server/src/main/jjtree/org/apache/cayenne/exp/parser/ExpressionParser.jjt
@@ -142,6 +142,8 @@ void conditionExpression() : {}
 		<NULL> #Scalar(0)
 	|
     	aggregateExpression()
+    |
+        dateTimeFunction()
 }
 
 void stringParameter() : {}
@@ -375,6 +377,26 @@ void sum() #Sum : { }
 	<SUM> "(" numericExpression() ")"
 }
 
+void dateTimeFunction() : { }
+{
+    currentDate() | currentTime() | currentTimestamp()
+}
+
+void currentDate() #CurrentDate : {}
+{
+    <CURRENT_DATE> "(" ")"
+}
+
+void currentTime() #CurrentTime : {}
+{
+    <CURRENT_TIME> "(" ")"
+}
+
+void currentTimestamp() #CurrentTimestamp : {}
+{
+    <CURRENT_TIMESTAMP> "(" ")"
+}
+
 
 TOKEN_MGR_DECLS:
 {
@@ -465,38 +487,38 @@ TOKEN : {
     |   <FALSE: "false" | "FALSE" >
 }
 
-TOKEN [ IGNORE_CASE ]: /* aggregates */
+TOKEN : /* aggregates */
 {
-	<AVG: "AVG" >
-	|	<MIN: "MIN" >
-	|	<MAX: "MAX" >
-	|	<SUM: "SUM" >
-	|	<COUNT: "COUNT" >
+	<AVG: "avg" >
+	|	<MIN: "min" >
+	|	<MAX: "max" >
+	|	<SUM: "sum" >
+	|	<COUNT: "count" >
 }
 
-TOKEN [ IGNORE_CASE ]: /* functions returning strings */
+TOKEN : /* functions returning strings */
 {
-	<CONCAT: "CONCAT" >
-	|	<SUBSTRING: "SUBSTRING" >
-	|	<TRIM: "TRIM" >
-	|	<LOWER: "LOWER" >
-	|	<UPPER: "UPPER" >
+	<CONCAT: "concat" >
+	|	<SUBSTRING: "substring" >
+	|	<TRIM: "trim" >
+	|	<LOWER: "lower" >
+	|	<UPPER: "upper" >
 }
 
-TOKEN [ IGNORE_CASE ]: /* functions returning numerics */
+TOKEN : /* functions returning numerics */
 {
-	<LENGTH: "LENGTH" >
-	|	<LOCATE: "LOCATE" >
-	|	<ABS: "ABS" >
-	|	<SQRT: "SQRT" >
-	|	<MOD: "MOD" >
+	<LENGTH: "length" >
+	|	<LOCATE: "locate" >
+	|	<ABS: "abs" >
+	|	<SQRT: "sqrt" >
+	|	<MOD: "mod" >
 }
 
-TOKEN [ IGNORE_CASE ]: /* functions returning datetime */
+TOKEN : /* functions returning datetime */
 {
-	<CURRENT_DATE: "CURRENT_DATE" >
-	|	<CURRENT_TIME: "CURRENT_TIME" >
-	|	<CURRENT_TIMESTAMP: "CURRENT_TIMESTAMP" >
+	<CURRENT_DATE: "currentDate" >
+	|	<CURRENT_TIME: "currentTime" >
+	|	<CURRENT_TIMESTAMP: "currentTimestamp" | "now" >
 }
 
 void namedParameter() :

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java
index 9fc6ac2..5e541f0 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionFactoryTest.java
@@ -475,7 +475,7 @@ public class ExpressionFactoryTest {
 
 	@Test
 	public void testFuncExp() {
-		Expression e = ExpressionFactory.exp("TRIM(abc.xyz)");
+		Expression e = ExpressionFactory.exp("trim(abc.xyz)");
 		assertEquals(ASTTrim.class, e.getClass());
 	}
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAbsTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAbsTest.java b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAbsTest.java
index c5c88d1..8723a2b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAbsTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAbsTest.java
@@ -46,7 +46,7 @@ public class ASTAbsTest {
 
     @Test
     public void parseTest() throws Exception {
-        String expString = "ABS(xyz)";
+        String expString = "abs(xyz)";
         Expression exp = ExpressionFactory.exp(expString);
 
         assertTrue(exp instanceof ASTAbs);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAggregateTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAggregateTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAggregateTest.java
index 67ce3d0..f6e57c3 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAggregateTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTAggregateTest.java
@@ -46,7 +46,7 @@ public class ASTAggregateTest {
 
     @Test
     public void testAvgParse() throws Exception {
-        String expressionString = "AVG(artistName)";
+        String expressionString = "avg(artistName)";
         Expression exp = ExpressionFactory.exp(expressionString);
         assertTrue(exp instanceof ASTAvg);
         assertEquals(1, exp.getOperandCount());
@@ -63,7 +63,7 @@ public class ASTAggregateTest {
 
     @Test
     public void testCountExpParse() throws Exception {
-        String expressionString = "COUNT(artistName)";
+        String expressionString = "count(artistName)";
         Expression exp = ExpressionFactory.exp(expressionString);
         assertTrue(exp instanceof ASTCount);
         assertEquals(1, exp.getOperandCount());
@@ -74,7 +74,7 @@ public class ASTAggregateTest {
 
     @Test
     public void testCountAsteriskParse() throws Exception {
-        String expressionString = "COUNT(*)";
+        String expressionString = "count(*)";
         Expression exp = ExpressionFactory.exp(expressionString);
         assertTrue(exp instanceof ASTCount);
         assertEquals(1, exp.getOperandCount());
@@ -91,7 +91,7 @@ public class ASTAggregateTest {
 
     @Test
     public void testMinParse() throws Exception {
-        String expressionString = "MIN(artistName)";
+        String expressionString = "min(artistName)";
         Expression exp = ExpressionFactory.exp(expressionString);
         assertTrue(exp instanceof ASTMin);
         assertEquals(1, exp.getOperandCount());
@@ -108,7 +108,7 @@ public class ASTAggregateTest {
 
     @Test
     public void testMaxParse() throws Exception {
-        String expressionString = "MAX(artistName)";
+        String expressionString = "max(artistName)";
         Expression exp = ExpressionFactory.exp(expressionString);
         assertTrue(exp instanceof ASTMax);
         assertEquals(1, exp.getOperandCount());
@@ -125,7 +125,7 @@ public class ASTAggregateTest {
 
     @Test
     public void testSumParse() throws Exception {
-        String expressionString = "SUM(artistName)";
+        String expressionString = "sum(artistName)";
         Expression exp = ExpressionFactory.exp(expressionString);
         assertTrue(exp instanceof ASTSum);
         assertEquals(1, exp.getOperandCount());

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTConcatTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTConcatTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTConcatTest.java
index d951327..f0c80eb 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTConcatTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTConcatTest.java
@@ -51,7 +51,7 @@ public class ASTConcatTest {
 
     @Test
     public void testParseConcat() throws Exception {
-        Expression exp = ExpressionFactory.exp("CONCAT(artistName, ' ', 'test')");
+        Expression exp = ExpressionFactory.exp("concat(artistName, ' ', 'test')");
         assertEquals(ASTConcat.class, exp.getClass());
         assertEquals(3, exp.getOperandCount());
 
@@ -65,7 +65,7 @@ public class ASTConcatTest {
 
     @Test
     public void parseTest() throws Exception {
-        String expString = "CONCAT(xyz , \" \" , abc)";
+        String expString = "concat(xyz , \" \" , abc)";
         Expression exp = ExpressionFactory.exp(expString);
 
         assertTrue(exp instanceof ASTConcat);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallDateIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallDateIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallDateIT.java
index 6110eb1..11a5687 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallDateIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallDateIT.java
@@ -125,4 +125,28 @@ public class ASTFunctionCallDateIT extends ServerCase {
 
         assertNotEquals(res1, res2);
     }
+
+    @Test
+    public void testASTCurrentDateParse() {
+        Expression exp = ExpressionFactory.exp("dateColumn > currentDate()");
+        DateTestEntity res = ObjectSelect.query(DateTestEntity.class, exp).selectOne(context);
+        assertNotNull(res);
+    }
+
+    @Test
+    public void testASTCurrentTimeParse() {
+        Expression exp = ExpressionFactory.exp("timeColumn > currentTime()");
+        DateTestEntity res = ObjectSelect.query(DateTestEntity.class, exp).selectOne(context);
+        if(!unitDbAdapter.supportsTimeSqlType()) {
+            return;
+        }
+        assertNotNull(res);
+    }
+
+    @Test
+    public void testASTCurrentTimestampParse() {
+        Expression exp = ExpressionFactory.exp("timestampColumn > now()");
+        DateTestEntity res = ObjectSelect.query(DateTestEntity.class, exp).selectOne(context);
+        assertNotNull(res);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallMathIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallMathIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallMathIT.java
index 9033ab9..a5ab9fd 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallMathIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallMathIT.java
@@ -86,25 +86,25 @@ public class ASTFunctionCallMathIT extends ServerCase {
 
     @Test
     public void testASTAbsParse() {
-        Expression exp = ExpressionFactory.exp("ABS(-3)");
+        Expression exp = ExpressionFactory.exp("abs(-3)");
         assertEquals(3.0, exp.evaluate(new Object()));
     }
 
     @Test
     public void testASTSqrtParse() {
-        Expression exp = ExpressionFactory.exp("SQRT(16)");
+        Expression exp = ExpressionFactory.exp("sqrt(16)");
         assertEquals(4.0, exp.evaluate(new Object()));
     }
 
     @Test
     public void testASTModParse() {
-        Expression exp = ExpressionFactory.exp("MOD(11,2)");
+        Expression exp = ExpressionFactory.exp("mod(11,2)");
         assertEquals(1.0, exp.evaluate(new Object()));
     }
 
     @Test
     public void testComplexParse() {
-        Expression exp = ExpressionFactory.exp("10 - MOD(SQRT(ABS(-9)), 2)");
+        Expression exp = ExpressionFactory.exp("10 - mod(sqrt(abs(-9)), 2)");
         assertEquals(BigDecimal.valueOf(9L), exp.evaluate(new Object()));
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallStringIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallStringIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallStringIT.java
index 47d6373..57e3254 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallStringIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTFunctionCallStringIT.java
@@ -156,43 +156,43 @@ public class ASTFunctionCallStringIT extends ServerCase {
 
     @Test
     public void testASTConcatParse() {
-        Expression exp = ExpressionFactory.exp("CONCAT('abc', 'def')");
+        Expression exp = ExpressionFactory.exp("concat('abc', 'def')");
         assertEquals("abcdef", exp.evaluate(new Object()));
     }
 
     @Test
     public void testASTSubstringParse() {
-        Expression exp = ExpressionFactory.exp("SUBSTRING('123456789', 3, 2)");
+        Expression exp = ExpressionFactory.exp("substring('123456789', 3, 2)");
         assertEquals("34", exp.evaluate(new Object()));
     }
 
     @Test
     public void testASTTrimParse() {
-        Expression exp = ExpressionFactory.exp("TRIM(' abc ')");
+        Expression exp = ExpressionFactory.exp("trim(' abc ')");
         assertEquals("abc", exp.evaluate(new Object()));
     }
 
     @Test
     public void testASTLowerParse() {
-        Expression exp = ExpressionFactory.exp("LOWER('AbC')");
+        Expression exp = ExpressionFactory.exp("lower('AbC')");
         assertEquals("abc", exp.evaluate(new Object()));
     }
 
     @Test
     public void testASTUpperParse() {
-        Expression exp = ExpressionFactory.exp("UPPER('aBc')");
+        Expression exp = ExpressionFactory.exp("upper('aBc')");
         assertEquals("ABC", exp.evaluate(new Object()));
     }
 
     @Test
     public void testASTLocateParse() {
-        Expression exp = ExpressionFactory.exp("LOCATE('Bc', 'aBc')");
+        Expression exp = ExpressionFactory.exp("locate('Bc', 'aBc')");
         assertEquals(2, exp.evaluate(new Object()));
     }
 
     @Test
     public void testComplexParse() {
-        Expression exp = ExpressionFactory.exp("LOCATE(UPPER('Bc'), UPPER('aBc')) = LENGTH(SUBSTRING(TRIM(LOWER(CONCAT('
  abc', 'def   '))), 3, 2))");
+        Expression exp = ExpressionFactory.exp("locate(upper('Bc'), upper('aBc')) = length(substring(trim(lower(concat('
  abc', 'def   '))), 3, 2))");
         assertEquals(true, exp.evaluate(new Object()));
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLengthTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLengthTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLengthTest.java
index dde6dc0..4d21abb 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLengthTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLengthTest.java
@@ -19,6 +19,8 @@
 
 package org.apache.cayenne.exp.parser;
 
+import org.apache.cayenne.exp.Expression;
+import org.apache.cayenne.exp.ExpressionFactory;
 import org.apache.cayenne.testdo.testmap.Artist;
 import org.junit.Test;
 
@@ -42,4 +44,14 @@ public class ASTLengthTest {
         assertEquals(9, res);
     }
 
+    @Test
+    public void parseTest() throws Exception {
+        String expString = "length(xyz)";
+        Expression exp = ExpressionFactory.exp(expString);
+
+        assertTrue(exp instanceof ASTLength);
+        String toString = exp.toString();
+        assertEquals(expString, toString);
+    }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLocateTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLocateTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLocateTest.java
index 9e1a0e8..5a58dd4 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLocateTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLocateTest.java
@@ -54,7 +54,7 @@ public class ASTLocateTest {
 
     @Test
     public void parseTest() throws Exception {
-        String expString = "LOCATE(\"xyz\" , abc , 4)";
+        String expString = "locate(\"xyz\" , abc , 4)";
         Expression exp = ExpressionFactory.exp(expString);
 
         assertTrue(exp instanceof ASTLocate);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLowerTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLowerTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLowerTest.java
index 96a6671..a45dd00 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLowerTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTLowerTest.java
@@ -47,7 +47,7 @@ public class ASTLowerTest {
 
     @Test
     public void parseTest() throws Exception {
-        String expString = "LOWER(xyz)";
+        String expString = "lower(xyz)";
         Expression exp = ExpressionFactory.exp(expString);
 
         assertTrue(exp instanceof ASTLower);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTModTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTModTest.java b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTModTest.java
index 0f9febd..e25e93a 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTModTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTModTest.java
@@ -46,7 +46,7 @@ public class ASTModTest {
 
     @Test
     public void parseTest() throws Exception {
-        String expString = "MOD(xyz , 3)";
+        String expString = "mod(xyz , 3)";
         Expression exp = ExpressionFactory.exp(expString);
 
         assertTrue(exp instanceof ASTMod);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSqrtTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSqrtTest.java b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSqrtTest.java
index 13c015b..7ed1b69 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSqrtTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSqrtTest.java
@@ -45,7 +45,7 @@ public class ASTSqrtTest {
 
     @Test
     public void parseTest() throws Exception {
-        String expString = "SQRT(xyz)";
+        String expString = "sqrt(xyz)";
         Expression exp = ExpressionFactory.exp(expString);
 
         assertTrue(exp instanceof ASTSqrt);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSubstringTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSubstringTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSubstringTest.java
index 2b35ab0..2917c0c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSubstringTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTSubstringTest.java
@@ -49,7 +49,7 @@ public class ASTSubstringTest {
 
     @Test
     public void parseTest() throws Exception {
-        String expString = "SUBSTRING(xyz , 2 , 3)";
+        String expString = "substring(xyz , 2 , 3)";
         Expression exp = ExpressionFactory.exp(expString);
 
         assertTrue(exp instanceof ASTSubstring);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTTrimTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTTrimTest.java b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTTrimTest.java
index 65b94ea..b66ea6b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTTrimTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTTrimTest.java
@@ -46,7 +46,7 @@ public class ASTTrimTest {
 
     @Test
     public void parseTest() throws Exception {
-        String expString = "TRIM(xyz)";
+        String expString = "trim(xyz)";
         Expression exp = ExpressionFactory.exp(expString);
 
         assertTrue(exp instanceof ASTTrim);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTUpperTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTUpperTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTUpperTest.java
index 375fe8d..3a17731 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTUpperTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ASTUpperTest.java
@@ -47,7 +47,7 @@ public class ASTUpperTest {
 
     @Test
     public void parseTest() throws Exception {
-        String expString = "UPPER(xyz)";
+        String expString = "upper(xyz)";
         Expression exp = ExpressionFactory.exp(expString);
 
         assertTrue(exp instanceof ASTUpper);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ExpressionCollectionEvaluationIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ExpressionCollectionEvaluationIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ExpressionCollectionEvaluationIT.java
index 685a7d4..b788a27 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ExpressionCollectionEvaluationIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/parser/ExpressionCollectionEvaluationIT.java
@@ -74,32 +74,32 @@ public class ExpressionCollectionEvaluationIT extends ServerCase {
 
     @Test
     public void testSubstringWithCollection() {
-        testExpression("SUBSTRING(paintingArray.paintingTitle, 1, 1)", String.class);
+        testExpression("substring(paintingArray.paintingTitle, 1, 1)", String.class);
     }
 
     @Test
     public void testTrimWithCollection() {
-        testExpression("TRIM(paintingArray.paintingTitle)", String.class);
+        testExpression("trim(paintingArray.paintingTitle)", String.class);
     }
 
     @Test
     public void testUpperWithCollection() {
-        testExpression("UPPER(paintingArray.paintingTitle)", String.class);
+        testExpression("upper(paintingArray.paintingTitle)", String.class);
     }
 
     @Test
     public void testLowerWithCollection() {
-        testExpression("LOWER(paintingArray.paintingTitle)", String.class);
+        testExpression("lower(paintingArray.paintingTitle)", String.class);
     }
 
     @Test
     public void testLengthWithCollection() {
-        testExpression("LENGTH(paintingArray.paintingTitle)", Integer.class);
+        testExpression("length(paintingArray.paintingTitle)", Integer.class);
     }
 
     @Test
     public void testConcatWithCollection() {
-        testExpression("CONCAT(paintingArray.paintingTitle, ' ', 'xyz')", String.class);
+        testExpression("concat(paintingArray.paintingTitle, ' ', 'xyz')", String.class);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e56a93f4/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index e168b10..9f5e3c3 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -18,6 +18,7 @@ CAY-2258 DI: type-safe binding of List and Map
 CAY-2266 Move EventBridge implementations into autoloadable modules
 CAY-2267 Contribute lifecycle events listeners via DI
 CAY-2259 QueryCache: support for referencing type-safe caches
+CAY-2270 Update function support in expression parser
 
 Bug Fixes:
 


Mime
View raw message