Till Westmann has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1184

Change subject: TestExecutor exceptions fail ParserTestExecutor
......................................................................

TestExecutor exceptions fail ParserTestExecutor

Change-Id: I56788342d70dacaf4a21e837a4b27fc9972ade99
---
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
M 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by-exception_01/order-by-exception_01.4.query.sqlpp
M 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by/order-by.4.query.sqlpp
M 
asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.4.ast
M 
asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
A 
asterixdb/asterix-common/src/test/java/org/apache/asterix/test/base/ComparisonException.java
6 files changed, 25 insertions(+), 12 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/84/1184/1

diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
index 05a7dce..290e899 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
@@ -48,6 +48,7 @@
 import org.apache.asterix.metadata.declared.AqlMetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.test.aql.TestExecutor;
+import org.apache.asterix.test.base.ComparisonException;
 import org.apache.asterix.testframework.context.TestCaseContext;
 import org.apache.asterix.testframework.context.TestFileContext;
 import org.apache.asterix.testframework.xml.TestCase.CompilationUnit;
@@ -98,6 +99,9 @@
                         }
                         throw new Exception("Test \"" + testFile + "\" 
FAILED!", e);
                     } else {
+                        if (e instanceof ComparisonException) {
+                            throw e;
+                        }
                         LOGGER.info("[TEST]: " + 
testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName()
                                 + " failed as expected: " + e.getMessage());
                         System.err.println("...but that was expected.");
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by-exception_01/order-by-exception_01.4.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by-exception_01/order-by-exception_01.4.query.sqlpp
index 774c80f..f953098 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by-exception_01/order-by-exception_01.4.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by-exception_01/order-by-exception_01.4.query.sqlpp
@@ -22,5 +22,5 @@
 
 select element user
 from  TwitterUsers as user
-order by user.`screen-name`
+order by user.`screen-name` desc
 ;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by/order-by.4.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by/order-by.4.query.sqlpp
index 774c80f..f953098 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by/order-by.4.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/range-hints/order-by/order-by.4.query.sqlpp
@@ -22,5 +22,5 @@
 
 select element user
 from  TwitterUsers as user
-order by user.`screen-name`
+order by user.`screen-name` desc
 ;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.4.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.4.ast
index e4b5374..9c74363 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.4.ast
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/range-hints/order-by/order-by.4.ast
@@ -13,5 +13,5 @@
     Variable [ Name=$user ]
     Field=screen-name
   ]
-  ASC
+  DESC
 
diff --git 
a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
 
b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
index d0594d2..0e01e76 100644
--- 
a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
+++ 
b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
@@ -44,6 +44,7 @@
 
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.utils.ServletUtil.Servlets;
+import org.apache.asterix.test.base.ComparisonException;
 import org.apache.asterix.test.server.ITestServer;
 import org.apache.asterix.test.server.TestServerProvider;
 import org.apache.asterix.testframework.context.TestCaseContext;
@@ -138,7 +139,7 @@
                     if (lineExpected.isEmpty()) {
                         continue;
                     }
-                    throw new Exception(
+                    throw new ComparisonException(
                             "Result for " + scriptFile + " changed at line " + 
num + ":\n< " + lineExpected + "\n> ");
                 }
 
@@ -146,19 +147,19 @@
                 String[] lineSplitsExpected = lineExpected.split("Time");
                 String[] lineSplitsActual = lineActual.split("Time");
                 if (lineSplitsExpected.length != lineSplitsActual.length) {
-                    throw new Exception("Result for " + scriptFile + " changed 
at line " + num + ":\n< " + lineExpected
-                            + "\n> " + lineActual);
+                    throw new ComparisonException("Result for " + scriptFile + 
" changed at line " + num + ":\n< "
+                            + lineExpected + "\n> " + lineActual);
                 }
                 if (!equalStrings(lineSplitsExpected[0], lineSplitsActual[0], 
regex)) {
-                    throw new Exception("Result for " + scriptFile + " changed 
at line " + num + ":\n< " + lineExpected
-                            + "\n> " + lineActual);
+                    throw new ComparisonException("Result for " + scriptFile + 
" changed at line " + num + ":\n< "
+                            + lineExpected + "\n> " + lineActual);
                 }
 
                 for (int i = 1; i < lineSplitsExpected.length; i++) {
                     String[] splitsByCommaExpected = 
lineSplitsExpected[i].split(",");
                     String[] splitsByCommaActual = 
lineSplitsActual[i].split(",");
                     if (splitsByCommaExpected.length != 
splitsByCommaActual.length) {
-                        throw new Exception("Result for " + scriptFile + " 
changed at line " + num + ":\n< "
+                        throw new ComparisonException("Result for " + 
scriptFile + " changed at line " + num + ":\n< "
                                 + lineExpected + "\n> " + lineActual);
                     }
                     for (int j = 1; j < splitsByCommaExpected.length; j++) {
@@ -168,8 +169,8 @@
                             continue;
                         }
                         if (!equalStrings(splitsByCommaExpected[j], 
splitsByCommaActual[j], regex)) {
-                            throw new Exception("Result for " + scriptFile + " 
changed at line " + num + ":\n< "
-                                    + lineExpected + "\n> " + lineActual);
+                            throw new ComparisonException("Result for " + 
scriptFile + " changed at line " + num
+                                    + ":\n< " + lineExpected + "\n> " + 
lineActual);
                         }
                     }
                 }
@@ -178,7 +179,8 @@
             }
             lineActual = readerActual.readLine();
             if (lineActual != null) {
-                throw new Exception("Result for " + scriptFile + " changed at 
line " + num + ":\n< \n> " + lineActual);
+                throw new ComparisonException(
+                        "Result for " + scriptFile + " changed at line " + num 
+ ":\n< \n> " + lineActual);
             }
         } catch (Exception e) {
             System.err.println("Actual results file: " + 
actualFile.toString());
diff --git 
a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/base/ComparisonException.java
 
b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/base/ComparisonException.java
new file mode 100644
index 0000000..930c2c9
--- /dev/null
+++ 
b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/base/ComparisonException.java
@@ -0,0 +1,7 @@
+package org.apache.asterix.test.base;
+
+public class ComparisonException extends Exception {
+    public ComparisonException(String message) {
+        super(message);
+    }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I56788342d70dacaf4a21e837a4b27fc9972ade99
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <ti...@apache.org>

Reply via email to