You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2019/02/07 21:49:27 UTC
[asterixdb] branch master updated: [NO ISSUE][TEST] Test framework
refactoring, extract results w/ utf8
This is an automated email from the ASF dual-hosted git repository.
mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new e9375bd [NO ISSUE][TEST] Test framework refactoring, extract results w/ utf8
e9375bd is described below
commit e9375bd5fb92b274181a87cc1b79ff2dc46242db
Author: Michael Blow <mb...@apache.org>
AuthorDate: Thu Feb 7 11:00:48 2019 -0500
[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 <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
Tested-by: Michael Blow <mb...@apache.org>
---
.../java/org/apache/asterix/test/common/ResultExtractor.java | 3 +--
.../test/java/org/apache/asterix/test/common/TestExecutor.java | 8 ++++++++
.../apache/asterix/testframework/context/TestCaseContext.java | 9 ++++++++-
3 files changed, 17 insertions(+), 3 deletions(-)
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 @@ public class ResultExtractor {
}
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 class TestExecutor {
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 @@ public class TestExecutor {
}
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 class TestCaseContext {
}
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);