asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abdullah alamoudi (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Improve Test Classes
Date Fri, 26 Aug 2016 10:26:45 GMT
abdullah alamoudi has submitted this change and it was merged.

Change subject: Improve Test Classes
......................................................................


Improve Test Classes

This change enables ExecutionTestUtil to handle different
IntegrationUtil implementations. In addition, it enables mutation
of fields of SelectRuntimeFactory.

Change-Id: I0672ae13b9afce7965e651b543b0799e5ed84d06
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1112
Reviewed-by: Michael Blow <mblow@apache.org>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
---
M asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
M asterixdb/asterix-external-data/pom.xml
M asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java
M hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java
M hyracks-fullstack/algebricks/algebricks-data/src/main/java/org/apache/hyracks/algebricks/data/impl/BinaryBooleanInspectorImpl.java
M hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamSelectRuntimeFactory.java
6 files changed, 25 insertions(+), 23 deletions(-)

Approvals:
  Michael Blow: Looks good to me, approved
  Jenkins: Verified; No violations found; Verified



diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
index e17eb2f..63cb2ce 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -218,15 +218,16 @@
      */
     public static void main(String[] args) {
         AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil();
-        run(integrationUtil);
+        run(integrationUtil, false, false);
     }
 
-    protected static void run(final AsterixHyracksIntegrationUtil integrationUtil) {
+    protected static void run(final AsterixHyracksIntegrationUtil integrationUtil, boolean
cleanupOnStart,
+            boolean cleanupOnShutdown) {
         Runtime.getRuntime().addShutdownHook(new Thread() {
             @Override
             public void run() {
                 try {
-                    integrationUtil.deinit(false);
+                    integrationUtil.deinit(cleanupOnShutdown);
                 } catch (Exception e) {
                     e.printStackTrace();
                 }
@@ -235,7 +236,7 @@
         try {
             System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, "asterix-build-configuration.xml");
 
-            integrationUtil.init(false);
+            integrationUtil.init(cleanupOnStart);
             while (true) {
                 Thread.sleep(10000);
             }
diff --git a/asterixdb/asterix-external-data/pom.xml b/asterixdb/asterix-external-data/pom.xml
index d4fa801..c3cf3c4 100644
--- a/asterixdb/asterix-external-data/pom.xml
+++ b/asterixdb/asterix-external-data/pom.xml
@@ -296,12 +296,7 @@
     <dependency>
       <groupId>com.couchbase.client</groupId>
       <artifactId>core-io</artifactId>
-      <version>1.2.8</version>
-    </dependency>
-    <dependency>
-      <groupId>io.reactivex</groupId>
-      <artifactId>rxjava</artifactId>
-      <version>1.0.15</version>
+      <version>1.3.2</version>
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java
index 6729a28..a9a57d7 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryBooleanInspectorImpl.java
@@ -25,12 +25,14 @@
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class AqlBinaryBooleanInspectorImpl implements IBinaryBooleanInspector {
+    private static final AqlBinaryBooleanInspectorImpl INSTANCE = new AqlBinaryBooleanInspectorImpl();
     public static final IBinaryBooleanInspectorFactory FACTORY = new IBinaryBooleanInspectorFactory()
{
         private static final long serialVersionUID = 1L;
 
         @Override
         public IBinaryBooleanInspector createBinaryBooleanInspector(IHyracksTaskContext ctx)
{
-            return new AqlBinaryBooleanInspectorImpl();
+            // Stateless class. No need to construct an object per call
+            return INSTANCE;
         }
     };
 
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java
b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java
index 4a24e59..26ce137 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java
@@ -41,13 +41,13 @@
 
 public class SelectOperator extends AbstractLogicalOperator {
     private final Mutable<ILogicalExpression> condition;
-    private final boolean retainNull;
+    private final boolean retainMissing;
     private final LogicalVariable nullPlaceholderVar;
 
-    public SelectOperator(Mutable<ILogicalExpression> condition, boolean retainNull,
+    public SelectOperator(Mutable<ILogicalExpression> condition, boolean retainMissing,
             LogicalVariable nullPlaceholderVar) {
         this.condition = condition;
-        this.retainNull = retainNull;
+        this.retainMissing = retainMissing;
         this.nullPlaceholderVar = nullPlaceholderVar;
     }
 
@@ -61,7 +61,7 @@
     }
 
     public boolean getRetainMissing() {
-        return retainNull;
+        return retainMissing;
     }
 
     public LogicalVariable getMissingPlaceholderVariable() throws AlgebricksException {
diff --git a/hyracks-fullstack/algebricks/algebricks-data/src/main/java/org/apache/hyracks/algebricks/data/impl/BinaryBooleanInspectorImpl.java
b/hyracks-fullstack/algebricks/algebricks-data/src/main/java/org/apache/hyracks/algebricks/data/impl/BinaryBooleanInspectorImpl.java
index 65768dd..98b8d66 100644
--- a/hyracks-fullstack/algebricks/algebricks-data/src/main/java/org/apache/hyracks/algebricks/data/impl/BinaryBooleanInspectorImpl.java
+++ b/hyracks-fullstack/algebricks/algebricks-data/src/main/java/org/apache/hyracks/algebricks/data/impl/BinaryBooleanInspectorImpl.java
@@ -23,12 +23,14 @@
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class BinaryBooleanInspectorImpl implements IBinaryBooleanInspector {
+    private static final BinaryBooleanInspectorImpl INSTANCE = new BinaryBooleanInspectorImpl();
     public static final IBinaryBooleanInspectorFactory FACTORY = new IBinaryBooleanInspectorFactory()
{
         private static final long serialVersionUID = 1L;
 
         @Override
         public IBinaryBooleanInspector createBinaryBooleanInspector(IHyracksTaskContext ctx)
{
-            return new BinaryBooleanInspectorImpl();
+            // A stateless class. no need to create an instance per call
+            return INSTANCE;
         }
     };
 
diff --git a/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamSelectRuntimeFactory.java
b/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamSelectRuntimeFactory.java
index 1bc5d51..418ea23 100644
--- a/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamSelectRuntimeFactory.java
+++ b/hyracks-fullstack/algebricks/algebricks-runtime/src/main/java/org/apache/hyracks/algebricks/runtime/operators/std/StreamSelectRuntimeFactory.java
@@ -40,16 +40,13 @@
 public class StreamSelectRuntimeFactory extends AbstractOneInputOneOutputRuntimeFactory {
 
     private static final long serialVersionUID = 1L;
-
+    // Final
     private final IScalarEvaluatorFactory cond;
-
     private final IBinaryBooleanInspectorFactory binaryBooleanInspectorFactory;
-
-    private final boolean retainMissing;
-
-    private final int missingPlaceholderVariableIndex;
-
     private final IMissingWriterFactory missingWriterFactory;
+    // Mutable
+    private boolean retainMissing;
+    private int missingPlaceholderVariableIndex;
 
     /**
      * @param cond
@@ -71,6 +68,11 @@
         this.missingWriterFactory = missingWriterFactory;
     }
 
+    public void retainMissing(boolean retainMissing, int index) {
+        this.retainMissing = retainMissing;
+        this.missingPlaceholderVariableIndex = index;
+    }
+
     @Override
     public String toString() {
         return "stream-select " + cond.toString();

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1112
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0672ae13b9afce7965e651b543b0799e5ed84d06
Gerrit-PatchSet: 6
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <bamousaa@gmail.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mblow@apache.org>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message