You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by ma...@apache.org on 2017/06/26 17:27:34 UTC

[13/18] metron git commit: METRON-980: Short circuit operations for Stellar closes apache/metron#606

http://git-wip-us.apache.org/repos/asf/metron/blob/30d0e2a6/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/FloatLiteralEvaluatorTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/FloatLiteralEvaluatorTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/FloatLiteralEvaluatorTest.java
index 4f7117a..f9ecff1 100644
--- a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/FloatLiteralEvaluatorTest.java
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/FloatLiteralEvaluatorTest.java
@@ -48,8 +48,8 @@ public class FloatLiteralEvaluatorTest {
   public void verifyHappyPathEvaluation() throws Exception {
     when(context.getText()).thenReturn("100f");
 
-    Token<? extends Number> evaluated = evaluator.evaluate(context);
-    assertEquals(new Token<>(100f, Float.class), evaluated);
+    Token<? extends Number> evaluated = evaluator.evaluate(context, null);
+    assertEquals(new Token<>(100f, Float.class, null), evaluated);
 
     verify(context).getText();
     verifyNoMoreInteractions(context);
@@ -60,7 +60,7 @@ public class FloatLiteralEvaluatorTest {
     exception.expect(NumberFormatException.class);
 
     when(context.getText()).thenReturn("");
-    evaluator.evaluate(context);
+    evaluator.evaluate(context, null);
   }
 
   @Test
@@ -68,7 +68,7 @@ public class FloatLiteralEvaluatorTest {
     exception.expect(IllegalArgumentException.class);
     exception.expectMessage("Cannot evaluate a context that is null.");
 
-    evaluator.evaluate(null);
+    evaluator.evaluate(null, null);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/30d0e2a6/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/IntLiteralEvaluatorTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/IntLiteralEvaluatorTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/IntLiteralEvaluatorTest.java
index 2fd081f..bef23d1 100644
--- a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/IntLiteralEvaluatorTest.java
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/IntLiteralEvaluatorTest.java
@@ -48,8 +48,8 @@ public class IntLiteralEvaluatorTest {
   public void verifyHappyPathEvaluation() throws Exception {
     when(context.getText()).thenReturn("100");
 
-    Token<? extends Number> evaluated = evaluator.evaluate(context);
-    assertEquals(new Token<>(100, Integer.class), evaluated);
+    Token<? extends Number> evaluated = evaluator.evaluate(context, null);
+    assertEquals(new Token<>(100, Integer.class, null), evaluated);
 
     verify(context).getText();
     verifyNoMoreInteractions(context);
@@ -60,7 +60,7 @@ public class IntLiteralEvaluatorTest {
     exception.expect(NumberFormatException.class);
 
     when(context.getText()).thenReturn("");
-    evaluator.evaluate(context);
+    evaluator.evaluate(context, null);
   }
 
   @Test
@@ -68,7 +68,7 @@ public class IntLiteralEvaluatorTest {
     exception.expect(IllegalArgumentException.class);
     exception.expectMessage("Cannot evaluate a context that is null.");
 
-    evaluator.evaluate(null);
+    evaluator.evaluate(null, null);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/30d0e2a6/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/LongLiteralEvaluatorTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/LongLiteralEvaluatorTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/LongLiteralEvaluatorTest.java
index 21f75d4..e9c3aa7 100644
--- a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/LongLiteralEvaluatorTest.java
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/LongLiteralEvaluatorTest.java
@@ -49,8 +49,8 @@ public class LongLiteralEvaluatorTest {
   public void verifyHappyPathEvaluation() throws Exception {
     when(context.getText()).thenReturn("100L");
 
-    Token<? extends Number> evaluated = evaluator.evaluate(context);
-    assertEquals(new Token<>(100L, Long.class), evaluated);
+    Token<? extends Number> evaluated = evaluator.evaluate(context, null);
+    assertEquals(new Token<>(100L, Long.class, null), evaluated);
 
     verify(context).getText();
     verifyNoMoreInteractions(context);
@@ -62,7 +62,7 @@ public class LongLiteralEvaluatorTest {
     exception.expectMessage("Invalid format for long. Failed trying to parse a long with the following value: ");
 
     when(context.getText()).thenReturn("");
-    evaluator.evaluate(context);
+    evaluator.evaluate(context, null);
   }
 
   @Test
@@ -70,6 +70,6 @@ public class LongLiteralEvaluatorTest {
     exception.expect(IllegalArgumentException.class);
     exception.expectMessage("Cannot evaluate a context that is null.");
 
-    evaluator.evaluate(null);
+    evaluator.evaluate(null, null);
   }
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/30d0e2a6/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/NumberLiteralEvaluatorTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/NumberLiteralEvaluatorTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/NumberLiteralEvaluatorTest.java
index 8317737..2065e6d 100644
--- a/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/NumberLiteralEvaluatorTest.java
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/evaluators/NumberLiteralEvaluatorTest.java
@@ -60,36 +60,36 @@ public class NumberLiteralEvaluatorTest {
   @Test
   public void verifyIntLiteralContextIsProperlyEvaluated() throws Exception {
     StellarParser.IntLiteralContext context = mock(StellarParser.IntLiteralContext.class);
-    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap);
+    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap, null);
 
-    verify(intLiteralContextNumberEvaluator).evaluate(context);
+    verify(intLiteralContextNumberEvaluator).evaluate(context, null);
     verifyZeroInteractions(doubleLiteralContextNumberEvaluator, floatLiteralContextNumberEvaluator, longLiteralContextNumberEvaluator);
   }
 
   @Test
   public void verifyDoubleLiteralContextIsProperlyEvaluated() throws Exception {
     StellarParser.DoubleLiteralContext context = mock(StellarParser.DoubleLiteralContext.class);
-    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap);
+    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap, null);
 
-    verify(doubleLiteralContextNumberEvaluator).evaluate(context);
+    verify(doubleLiteralContextNumberEvaluator).evaluate(context, null);
     verifyZeroInteractions(intLiteralContextNumberEvaluator, floatLiteralContextNumberEvaluator, longLiteralContextNumberEvaluator);
   }
 
   @Test
   public void verifyFloatLiteralContextIsProperlyEvaluated() throws Exception {
     StellarParser.FloatLiteralContext context = mock(StellarParser.FloatLiteralContext.class);
-    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap);
+    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap, null);
 
-    verify(floatLiteralContextNumberEvaluator).evaluate(context);
+    verify(floatLiteralContextNumberEvaluator).evaluate(context, null);
     verifyZeroInteractions(doubleLiteralContextNumberEvaluator, intLiteralContextNumberEvaluator, longLiteralContextNumberEvaluator);
   }
 
   @Test
   public void verifyLongLiteralContextIsProperlyEvaluated() throws Exception {
     StellarParser.LongLiteralContext context = mock(StellarParser.LongLiteralContext.class);
-    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap);
+    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap, null);
 
-    verify(longLiteralContextNumberEvaluator).evaluate(context);
+    verify(longLiteralContextNumberEvaluator).evaluate(context, null);
     verifyZeroInteractions(doubleLiteralContextNumberEvaluator, floatLiteralContextNumberEvaluator, intLiteralContextNumberEvaluator);
   }
 
@@ -100,7 +100,7 @@ public class NumberLiteralEvaluatorTest {
     exception.expect(ParseException.class);
     exception.expectMessage("Does not support evaluation for type " + context.getClass());
 
-    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap);
+    NumberLiteralEvaluator.INSTANCE.evaluate(context, instanceMap, null);
 
     verifyZeroInteractions(longLiteralContextNumberEvaluator, doubleLiteralContextNumberEvaluator, floatLiteralContextNumberEvaluator, intLiteralContextNumberEvaluator);
   }