metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject incubator-metron git commit: METRON-724 Account for `in` grammar in Stellar Documentation and Unit Tests (ottobackwards) closes apache/incubator-metron#457
Date Fri, 17 Feb 2017 21:24:31 GMT
Repository: incubator-metron
Updated Branches:
  refs/heads/master 29646550c -> 22ea8e320


METRON-724 Account for `in` grammar in Stellar Documentation and Unit Tests (ottobackwards)
closes apache/incubator-metron#457


Project: http://git-wip-us.apache.org/repos/asf/incubator-metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-metron/commit/22ea8e32
Tree: http://git-wip-us.apache.org/repos/asf/incubator-metron/tree/22ea8e32
Diff: http://git-wip-us.apache.org/repos/asf/incubator-metron/diff/22ea8e32

Branch: refs/heads/master
Commit: 22ea8e3205c0f2bfe6c538dc2f10e90f92ff597c
Parents: 2964655
Author: ottobackwards <ottobackwards@gmail.com>
Authored: Fri Feb 17 15:43:29 2017 -0500
Committer: Otto Fowler <otto@apache.org>
Committed: Fri Feb 17 15:43:29 2017 -0500

----------------------------------------------------------------------
 metron-platform/metron-common/README.md         |  4 ++--
 .../metron/common/stellar/StellarTest.java      | 21 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/22ea8e32/metron-platform/metron-common/README.md
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/README.md b/metron-platform/metron-common/README.md
index 872b320..067bf8d 100644
--- a/metron-platform/metron-common/README.md
+++ b/metron-platform/metron-common/README.md
@@ -35,9 +35,9 @@ The following keywords need to be single quote escaped in order to be used
in St
 |               |               |             |             |             |
 | :-----------: | :-----------: | :---------: | :---------: | :---------: |
 | not           | else          | exists      | if          | then        |
-| and           | or            | ==          | !=          | \<          |
+| and           | or            | in          | ==          | !=          |
 | \<=           | \>            | \>=         | \+          | \-          |
-| ?             | \*            | /           | ,           |             |
+| \<            | ?             | \*          | /           | ,           |
 
 Using parens such as: "foo" : "\<ok\>" requires escaping; "foo": "\'\<ok\>\'"
 

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/22ea8e32/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarTest.java
b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarTest.java
index dabf293..6ff3d8a 100644
--- a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarTest.java
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarTest.java
@@ -21,6 +21,7 @@ package org.apache.metron.common.stellar;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.metron.common.dsl.ParseException;
 import org.apache.metron.common.dsl.Stellar;
 import org.apache.metron.common.dsl.StellarFunction;
 import org.junit.Assert;
@@ -288,6 +289,26 @@ public class StellarTest {
   }
 
   @Test
+  public void testInNotIN(){
+    HashMap variables = new HashMap<>();
+    boolean thrown = false;
+    try{
+      run("in in ['','in']" ,variables );
+    }catch(ParseException pe) {
+      thrown = true;
+    }
+    Assert.assertTrue(thrown);
+    thrown = false;
+
+    try{
+      Assert.assertEquals(true,run("'in' in ['','in']" ,variables ));
+    }catch(ParseException pe) {
+      thrown = true;
+    }
+    Assert.assertFalse(thrown);
+  }
+
+  @Test
   public void testHappyPath() {
     String query = "TO_UPPER(TRIM(foo))";
     Assert.assertEquals("CASEY", run(query, ImmutableMap.of("foo", "casey ")));


Mime
View raw message