Fix Expected Results File For Recovery Test Cases
Change-Id: Ic2125ad72e862e2d97605300378ff847524b4aaa
Reviewed-on: https://asterix-gerrit.ics.uci.edu/779
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
diff --git a/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java b/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
index 493fde7..e23837b 100644
--- a/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
+++ b/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
@@ -473,8 +473,7 @@
public void executeTest(TestCaseContext testCaseCtx, TestFileContext ctx, String statement,
boolean isDmlRecoveryTest, ProcessBuilder pb, CompilationUnit cUnit, MutableInt queryCount,
List<TestFileContext> expectedResultFileCtxs, File testFile, String actualPath) throws Exception {
- File qbcFile = null;
- File qarFile;
+ File qbcFile;
boolean failed = false;
File expectedResultFile;
switch (ctx.getType()) {
@@ -552,20 +551,19 @@
case "txnqbc": // qbc represents query before crash
resultStream = executeQuery(statement, OutputFormat.forCompilationUnit(cUnit),
"http://" + host + ":" + port + Servlets.AQL_QUERY.getPath(), cUnit.getParameter());
- qbcFile = new File(actualPath + File.separator
- + testCaseCtx.getTestCase().getFilePath().replace(File.separator, "_") + "_" + cUnit.getName()
- + "_qbc.adm");
+ qbcFile = getTestCaseQueryBeforeCrashFile(actualPath, testCaseCtx, cUnit);
qbcFile.getParentFile().mkdirs();
writeOutputToFile(qbcFile, resultStream);
break;
case "txnqar": // qar represents query after recovery
resultStream = executeQuery(statement, OutputFormat.forCompilationUnit(cUnit),
"http://" + host + ":" + port + Servlets.AQL_QUERY.getPath(), cUnit.getParameter());
- qarFile = new File(actualPath + File.separator
+ File qarFile = new File(actualPath + File.separator
+ testCaseCtx.getTestCase().getFilePath().replace(File.separator, "_") + "_" + cUnit.getName()
+ "_qar.adm");
qarFile.getParentFile().mkdirs();
writeOutputToFile(qarFile, resultStream);
+ qbcFile = getTestCaseQueryBeforeCrashFile(actualPath, testCaseCtx, cUnit);
runScriptAndCompareWithResult(testFile, new PrintWriter(System.err), qbcFile, qarFile);
break;
case "txneu": // eu represents erroneous update
@@ -652,7 +650,7 @@
}
break;
case "server": // (start <test server name> <port>
- // [<arg1>][<arg2>][<arg3>]...|stop (<port>|all))
+ // [<arg1>][<arg2>][<arg3>]...|stop (<port>|all))
try {
lines = statement.trim().split("\n");
String[] command = lines[lines.length - 1].trim().split(" ");
@@ -700,7 +698,7 @@
}
break;
case "lib": // expected format <dataverse-name> <library-name>
- // <library-directory>
+ // <library-directory>
// TODO: make this case work well with entity names containing spaces by
// looking for \"
lines = statement.split("\n");
@@ -794,4 +792,11 @@
}
}
}
+
+ private static File getTestCaseQueryBeforeCrashFile(String actualPath, TestCaseContext testCaseCtx,
+ CompilationUnit cUnit) {
+ return new File(
+ actualPath + File.separator + testCaseCtx.getTestCase().getFilePath().replace(File.separator, "_") + "_"
+ + cUnit.getName() + "_qbc.adm");
+ }
}