You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by am...@apache.org on 2016/04/03 13:56:05 UTC

incubator-asterixdb git commit: Fix Expected Results File For Recovery Test Cases

Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master c0fd38534 -> 981a49279


Fix Expected Results File For Recovery Test Cases

Change-Id: Ic2125ad72e862e2d97605300378ff847524b4aaa
Reviewed-on: https://asterix-gerrit.ics.uci.edu/779
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <ba...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/981a4927
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/981a4927
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/981a4927

Branch: refs/heads/master
Commit: 981a492796916781acee1955e2a897ba1b264b2f
Parents: c0fd385
Author: Murtadha Hubail <mh...@uci.edu>
Authored: Sun Apr 3 02:00:30 2016 -0700
Committer: abdullah alamoudi <ba...@gmail.com>
Committed: Sun Apr 3 04:50:30 2016 -0700

----------------------------------------------------------------------
 .../apache/asterix/test/aql/TestExecutor.java   | 21 ++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/981a4927/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
----------------------------------------------------------------------
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 class TestExecutor {
     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 @@ public class TestExecutor {
             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 @@ public class TestExecutor {
                 }
                 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 @@ public class TestExecutor {
                 }
                 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 @@ public class TestExecutor {
             }
         }
     }
+
+    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");
+    }
 }