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>
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();