[NO ISSUE][TEST] Test framework refactoring, extract results w/ utf8

Change-Id: Ib7347cd9c94c9377e6b8223ea1aaee59f923a3be
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3152
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
Tested-by: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/ResultExtractor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/ResultExtractor.java
index 412cf03..8b61508 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/ResultExtractor.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/ResultExtractor.java
@@ -19,7 +19,6 @@
 package org.apache.asterix.test.common;
 
 import java.io.InputStream;
-import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.EnumSet;
 import java.util.HashMap;
@@ -108,7 +107,7 @@
     }
 
     private static InputStream extract(InputStream resultStream, EnumSet<ResultField> resultFields) throws Exception {
-        final String resultStr = IOUtils.toString(resultStream, Charset.defaultCharset());
+        final String resultStr = IOUtils.toString(resultStream, StandardCharsets.UTF_8);
         final PrettyPrinter singleLine = new SingleLinePrettyPrinter();
         final ObjectNode result = OBJECT_MAPPER.readValue(resultStr, ObjectNode.class);
 
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 282d83d..aed65e6 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
@@ -1620,6 +1620,11 @@
 
     public void executeTest(String actualPath, TestCaseContext testCaseCtx, ProcessBuilder pb,
             boolean isDmlRecoveryTest, TestGroup failedGroup) throws Exception {
+        executeTest(actualPath, testCaseCtx, pb, isDmlRecoveryTest, failedGroup, null);
+    }
+
+    public void executeTest(String actualPath, TestCaseContext testCaseCtx, ProcessBuilder pb,
+            boolean isDmlRecoveryTest, TestGroup failedGroup, TestGroup passedGroup) throws Exception {
         MutableInt queryCount = new MutableInt(0);
         int numOfErrors = 0;
         int numOfFiles = 0;
@@ -1679,6 +1684,9 @@
                     }
                     LOGGER.info(
                             "[TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName() + " PASSED ");
+                    if (passedGroup != null) {
+                        passedGroup.getTestCase().add(testCaseCtx.getTestCase());
+                    }
                 }
             }
         }
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 7d0e3bf..859e0bf 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
@@ -252,9 +252,16 @@
         }
 
         public List<TestCaseContext> build(File tsRoot, String tsXMLFilePath) throws Exception {
-            File tsFile = new File(tsRoot, tsXMLFilePath);
+            return build(tsRoot, new File(tsRoot, tsXMLFilePath));
+        }
+
+        public List<TestCaseContext> build(File tsRoot, File tsFile) throws Exception {
             TestSuiteParser tsp = new TestSuiteParser();
             TestSuite ts = tsp.parse(tsFile);
+            return build(tsRoot, ts);
+        }
+
+        public List<TestCaseContext> build(File tsRoot, TestSuite ts) throws Exception {
             List<TestCaseContext> tccs = new ArrayList<>();
             List<TestGroup> tgPath = new ArrayList<>();
             addContexts(tsRoot, ts, tgPath, ts.getTestGroup(), tccs);