Changed test framework bag parsing and prepared transition to java8
Change-Id: Ia9e75e0d3f607f6a033f10fc894c34e9f6bf87d8
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/220
Reviewed-by: Chris Hillery <ceej@lambda.nu>
Reviewed-by: Ian Maxon <imaxon@uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
index 11153fc..8bb78ac 100644
--- a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
+++ b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
@@ -16,18 +16,18 @@
import java.io.BufferedInputStream;
import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
-import java.io.FileWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -43,15 +43,10 @@
import org.apache.commons.io.IOUtils;
import org.json.JSONObject;
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-
import edu.uci.ics.asterix.common.config.GlobalConfig;
import edu.uci.ics.asterix.testframework.context.TestCaseContext;
import edu.uci.ics.asterix.testframework.context.TestCaseContext.OutputFormat;
import edu.uci.ics.asterix.testframework.context.TestFileContext;
-import edu.uci.ics.asterix.testframework.xml.ComparisonEnum;
import edu.uci.ics.asterix.testframework.xml.TestCase.CompilationUnit;
public class TestsUtils {
@@ -95,8 +90,8 @@
}
if (!equalStrings(lineExpected.split("Time")[0], lineActual.split("Time")[0])) {
- throw new Exception("Result for " + scriptFile + " changed at line " + num + ":\n< " + lineExpected + "\n> "
- + lineActual);
+ throw new Exception("Result for " + scriptFile + " changed at line " + num + ":\n< " + lineExpected
+ + "\n> " + lineActual);
}
++num;
@@ -128,13 +123,30 @@
String[] fields1 = row1.split(" ");
String[] fields2 = row2.split(" ");
+ boolean bagEncountered = false;
+ Set<String> bagElements1 = new HashSet<String>();
+ Set<String> bagElements2 = new HashSet<String>();
+
for (int j = 0; j < fields1.length; j++) {
if (j >= fields2.length) {
return false;
- }
- else if (fields1[j].equals(fields2[j])) {
+ } else if (fields1[j].equals(fields2[j])) {
+ if (fields1[j].equals("{{"))
+ bagEncountered = true;
+ if (fields1[j].startsWith("}}")) {
+ if (!bagElements1.equals(bagElements2))
+ return false;
+ bagEncountered = false;
+ bagElements1.clear();
+ bagElements2.clear();
+ }
continue;
} else if (fields1[j].indexOf('.') < 0) {
+ if (bagEncountered) {
+ bagElements1.add(fields1[j].replaceAll(",$", ""));
+ bagElements2.add(fields2[j].replaceAll(",$", ""));
+ continue;
+ }
return false;
} else {
// If the fields are floating-point numbers, test them
@@ -152,8 +164,7 @@
else {
return false;
}
- }
- catch (NumberFormatException ignored) {
+ } catch (NumberFormatException ignored) {
// Guess they weren't numbers - must simply not be equal
return false;
}
@@ -172,8 +183,7 @@
while ((len = resultStream.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
- }
- finally {
+ } finally {
out.close();
}
}
@@ -195,12 +205,10 @@
String errorBody = method.getResponseBodyAsString();
JSONObject result = new JSONObject(errorBody);
String[] errors = { result.getJSONArray("error-code").getString(0), result.getString("summary"),
- result.getString("stacktrace") };
+ result.getString("stacktrace") };
GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, errors[2]);
- throw new Exception("HTTP operation failed: " + errors[0] +
- "\nSTATUS LINE: " + method.getStatusLine() +
- "\nSUMMARY: " + errors[1] +
- "\nSTACKTRACE: " + errors[2]);
+ throw new Exception("HTTP operation failed: " + errors[0] + "\nSTATUS LINE: " + method.getStatusLine()
+ + "\nSUMMARY: " + errors[1] + "\nSTACKTRACE: " + errors[2]);
}
return statusCode;
}
diff --git a/asterix-doc/src/site/markdown/install.md b/asterix-doc/src/site/markdown/install.md
index bcc63f4..be92c0f 100644
--- a/asterix-doc/src/site/markdown/install.md
+++ b/asterix-doc/src/site/markdown/install.md
@@ -14,13 +14,13 @@
## <a id="PrerequisitesForInstallingAsterixDB">Prerequisites for Installing AsterixDB</a> <font size="4"><a href="#toc">[Back to TOC]</a></font> ##
Prerequisite:
- * [JDK7](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (Otherwise known as JDK 1.7).
+ * [JDK>=7](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (Otherwise known as JDK>=1.7).
To know the version of Java installed on your system, execute the following:
$ java -version
-If you have version as 1.7.0_x, similar to the output shown below, you are good to proceed.
+If your version is at least 1.7.0_x, similar to the output shown below, you are good to proceed.
java version "1.7.0_13"
@@ -35,7 +35,7 @@
* For Mac: [JDK 7 Mac Install](http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html)
JDK would be installed at /Library/Java/JavaVirtualMachines/jdk-version/Contents/Home .
-The java installation directory is referred as JAVA_HOME. Since we upgraded/installed Java, we need to ensure JAVA_HOME points to the installation directory of JDK 7. Modify your ~/.bash_profile (or ~/.bashrc) and define JAVA_HOME accordingly. After the modification, execute the following:
+The java installation directory is referred as JAVA_HOME. Since we upgraded/installed Java, we need to ensure JAVA_HOME points to the installation directory of JDK. Modify your ~/.bash_profile (or ~/.bashrc) and define JAVA_HOME accordingly. After the modification, execute the following:
$ java -version
diff --git a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/LexerNode.java b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/LexerNode.java
index 4ad8bca..ffaa29d 100644
--- a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/LexerNode.java
+++ b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/LexerNode.java
@@ -14,19 +14,24 @@
*/
package edu.uci.ics.asterix.lexergenerator;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
-import edu.uci.ics.asterix.lexergenerator.rules.*;
+import edu.uci.ics.asterix.lexergenerator.rules.Rule;
+import edu.uci.ics.asterix.lexergenerator.rules.RuleChar;
+import edu.uci.ics.asterix.lexergenerator.rules.RuleEpsilon;
+import edu.uci.ics.asterix.lexergenerator.rules.RulePartial;
public class LexerNode {
private static String TOKEN_PREFIX = "TOKEN_";
private LinkedHashMap<Rule, LexerNode> actions = new LinkedHashMap<Rule, LexerNode>();
private String finalTokenName;
- private Set<String> ongoingParsing = new HashSet<String>();
+ private List<String> ongoingParsing = new ArrayList<String>();
public LexerNode clone() {
LexerNode node = new LexerNode();