abdullah alamoudi has submitted this change and it was merged.

Change subject: [NO ISSUE][TEST] Improve extensibility of test framework
......................................................................


[NO ISSUE][TEST] Improve extensibility of test framework

Change-Id: Ibaa9722cbc46a2eced6295fa6b896f38fa3c9e50
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2753
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
---
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
M 
asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
M 
asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestFileContext.java
3 files changed, 27 insertions(+), 4 deletions(-)

Approvals:
  Anon. E. Moose #1000171: 
  Till Westmann: Looks good to me, approved
  Jenkins: Verified; No violations found; ; Verified



diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index 3c51775..5aff17f 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -30,7 +30,6 @@
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.math.BigDecimal;
 import java.net.Inet4Address;
 import java.net.InetSocketAddress;
 import java.net.Socket;
@@ -97,8 +96,6 @@
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
-
-import com.fasterxml.jackson.databind.util.RawValue;
 import org.junit.Assert;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -107,6 +104,7 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.util.RawValue;
 
 public class TestExecutor {
 
@@ -1909,8 +1907,9 @@
         }
     }
 
-    abstract static class TestLoop extends Exception {
+    public abstract static class TestLoop extends Exception {
 
+        private static final long serialVersionUID = 1L;
         private final String target;
 
         TestLoop(String target) {
@@ -1920,6 +1919,7 @@
         static TestLoop createLoop(String target, final int count) {
             LOGGER.info("Starting loop '" + count + " times back to '" + 
target + "'...");
             return new TestLoop(target) {
+                private static final long serialVersionUID = 1L;
                 int remainingLoops = count;
 
                 @Override
@@ -1935,6 +1935,7 @@
         static TestLoop createLoop(String target, long duration, TimeUnit 
unit) {
             LOGGER.info("Starting loop for " + unit.toSeconds(duration) + "s 
back to '" + target + "'...");
             return new TestLoop(target) {
+                private static final long serialVersionUID = 1L;
                 long endTime = unit.toMillis(duration) + 
System.currentTimeMillis();
 
                 @Override
diff --git 
a/asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
 
b/asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
index 4735c67..4357f14 100644
--- 
a/asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
+++ 
b/asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
@@ -22,7 +22,9 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.regex.Pattern;
 
 import org.apache.asterix.testframework.template.TemplateHelper;
@@ -105,6 +107,7 @@
     private TestGroup[] testGroups;
 
     private TestCase testCase;
+    private Map<String, Object> kv;
 
     public TestCaseContext(File tsRoot, TestSuite testSuite, TestGroup[] 
testGroups, TestCase testCase) {
         this.tsRoot = tsRoot;
@@ -133,6 +136,18 @@
         return testCase.getRepeat().intValue();
     }
 
+    public void put(String key, Object object) {
+        if (kv == null) {
+            kv = new HashMap<>();
+        }
+        kv.put(key, object);
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> T get(String key) {
+        return (T) kv.get(key);
+    }
+
     public List<TestFileContext> getFilesInDir(String basePath, String 
dirName, boolean withType) {
         List<TestFileContext> testFileCtxs = new ArrayList<>();
 
diff --git 
a/asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestFileContext.java
 
b/asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestFileContext.java
index 7a53a9e..3ae6dcd 100644
--- 
a/asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestFileContext.java
+++ 
b/asterixdb/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestFileContext.java
@@ -67,6 +67,13 @@
         return 0;
     }
 
+    public TestFileContext copy() {
+        TestFileContext copy = new TestFileContext(file);
+        copy.setSeqNum(Integer.toString(seqNum));
+        copy.setType(type);
+        return copy;
+    }
+
     @Override
     public String toString() {
         return String.valueOf(seqNum) + ":" + type + ":" + file;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibaa9722cbc46a2eced6295fa6b896f38fa3c9e50
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <bamou...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: abdullah alamoudi <bamou...@gmail.com>

Reply via email to