HAWQ-964. Update unittests and remove @Test from example code
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/f3668dcc Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/f3668dcc Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/f3668dcc Branch: refs/heads/HAWQ-964 Commit: f3668dcca2d5862247ba4d5e8e17e7bd2778aba8 Parents: 545f8aa Author: Kavinder Dhaliwal <[email protected]> Authored: Mon Sep 19 14:51:10 2016 -0700 Committer: Kavinder Dhaliwal <[email protected]> Committed: Tue Sep 20 09:45:44 2016 -0700 ---------------------------------------------------------------------- .../apache/hawq/pxf/api/FilterParserTest.java | 71 ++++++++++---------- .../hive/HiveORCSearchArgumentExample.java | 1 - 2 files changed, 35 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/f3668dcc/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java ---------------------------------------------------------------------- diff --git a/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java b/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java index 83bb2dc..a129a4b 100644 --- a/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java +++ b/pxf/pxf-api/src/test/java/org/apache/hawq/pxf/api/FilterParserTest.java @@ -288,40 +288,65 @@ public class FilterParserTest { @Test public void parseLogicalAndOperator() throws Exception { - filter = "l0"; - Object op = "filter with 1 AND operator"; + filter = "a1c0o5a2c3o2l0"; + + Object firstOp = "first operation HDOP_EQ"; + Object secondOp = "second operation HDOP_GT"; + Object lastOp = "filter with 2 operations connected by AND"; + + when(filterBuilder.build(eq(Operation.HDOP_EQ), + any(), + any())).thenReturn(firstOp); + + when(filterBuilder.build(eq(Operation.HDOP_GT), + any(), + any())).thenReturn(secondOp); when(filterBuilder.build(eq(LogicalOperation.HDOP_AND), any(), - any())).thenReturn(op); + any())).thenReturn(lastOp); Object result = filterParser.parse(filter); - assertEquals(op, result); + assertEquals(lastOp, result); } @Test public void parseLogicalOrOperator() throws Exception { - filter = "l1"; + filter = "a1c0o5a2c3o2l1"; + + Object firstOp = "first operation HDOP_EQ"; + Object secondOp = "second operation HDOP_GT"; + Object lastOp = "filter with 1 OR operator"; - Object op = "filter with 1 OR operator"; + when(filterBuilder.build(eq(Operation.HDOP_EQ), + any(), + any())).thenReturn(firstOp); + + when(filterBuilder.build(eq(Operation.HDOP_GT), + any(), + any())).thenReturn(secondOp); when(filterBuilder.build(eq(LogicalOperation.HDOP_OR), any(), - any())).thenReturn(op); + any())).thenReturn(lastOp); Object result = filterParser.parse(filter); - assertEquals(op, result); + assertEquals(lastOp, result); } @Test public void parseLogicalNotOperator() throws Exception { - filter = "l2"; + filter = "a1c0o5l2"; + Object firstOp = "first operation HDOP_EQ"; Object op = "filter with NOT operator"; - when(filterBuilder.build(eq(LogicalOperation.HDOP_NOT), + when(filterBuilder.build(eq(Operation.HDOP_EQ), any(), + any())).thenReturn(firstOp); + + when(filterBuilder.build(eq(LogicalOperation.HDOP_NOT), any())).thenReturn(op); Object result = filterParser.parse(filter); @@ -344,31 +369,6 @@ public class FilterParserTest { } @Test - public void parseLogicalOperatorWithExpressions() throws Exception { - filter = "a1c\"first\"o5a2c2o2l0"; - Object firstOp = "first operation HDOP_EQ"; - Object secondOp = "second operation HDOP_GT"; - Object lastOp = "filter with 2 operations connected by AND"; - - when(filterBuilder.build(eq(Operation.HDOP_EQ), - any(), - any())).thenReturn(firstOp); - - - when(filterBuilder.build(eq(Operation.HDOP_GT), - any(), - any())).thenReturn(secondOp); - - when(filterBuilder.build(eq(LogicalOperation.HDOP_AND), - any(), - any())).thenReturn(lastOp); - - - Object result = filterParser.parse(filter); - assertEquals(lastOp, result); - } - - @Test public void parseLogicalOperatorNotExpression() throws Exception { filter = "a1c\"first\"o5a2c2o2l0l2"; Object firstOp = "first operation HDOP_EQ"; @@ -396,7 +396,6 @@ public class FilterParserTest { assertEquals(lastOp, result); } - /* * Helper functions */ http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/f3668dcc/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/HiveORCSearchArgumentExample.java ---------------------------------------------------------------------- diff --git a/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/HiveORCSearchArgumentExample.java b/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/HiveORCSearchArgumentExample.java index a520b94..d884022 100644 --- a/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/HiveORCSearchArgumentExample.java +++ b/pxf/pxf-hive/src/test/java/org/apache/hawq/pxf/plugins/hive/HiveORCSearchArgumentExample.java @@ -13,7 +13,6 @@ import java.util.List; public class HiveORCSearchArgumentExample { - @Test public void buildLogicalOperationTree() throws Exception { /* Predicate pushdown configuration */
