pending deletes
diff --git a/asterix-aql/src/main/java/edu/uci/ics/asterix/aql/expression/BeginFeedStatement.java b/asterix-aql/src/main/java/edu/uci/ics/asterix/aql/expression/BeginFeedStatement.java
index 422ca79..0ff261f 100644
--- a/asterix-aql/src/main/java/edu/uci/ics/asterix/aql/expression/BeginFeedStatement.java
+++ b/asterix-aql/src/main/java/edu/uci/ics/asterix/aql/expression/BeginFeedStatement.java
@@ -53,7 +53,7 @@
builder.append(" let $y:=(" + function.getFunctionBody() + ")" + " return $y");
} else {
builder.append(" (" + " for $x in feed-ingest ('" + datasetName + "') ");
- builder.append(" let $y:=" + function.getName() + "(" + "$x" + ")");
+ builder.append(" let $y:=" + dataset.getDataverseName() + "." + function.getName() + "(" + "$x" + ")");
builder.append(" return $y");
}
diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index 5f5915c..e234bb8 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -816,7 +816,9 @@
FunctionSignature appliedFunction=null;
String dataverse;
String functionName;
+ String libraryName;
int arity;
+ Triple<String,String,String> functionCallComponents = null;
}
{
"using"
@@ -829,11 +831,18 @@
}
("apply" "function"
- {
- nameComponents = getDotSeparatedPair();
- dataverse = nameComponents.first != null ? nameComponents.first.getValue() : defaultDataverse;
- functionName = nameComponents.second.getValue();
- }
+ (
+ ( functionCallComponents = getFunctionCallComponents() )
+ {
+ dataverse = functionCallComponents.first == null ? defaultDataverse : functionCallComponents.first;
+ libraryName = functionCallComponents.second;
+ functionName = functionCallComponents.third;
+ if(libraryName != null){
+ functionName = libraryName + ":" + functionName;
+ }
+ }
+ )
+
("@" <INTEGER_LITERAL>
{
arity = Integer.parseInt(token.image);
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 be002fd..7e9b08f 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
@@ -11,6 +11,8 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
@@ -33,353 +35,394 @@
public class TestsUtils {
- private static final String EXTENSION_AQL_RESULT = "adm";
- private static final Logger LOGGER = Logger.getLogger(TestsUtils.class.getName());
+ private static final String EXTENSION_AQL_RESULT = "adm";
+ private static final Logger LOGGER = Logger.getLogger(TestsUtils.class
+ .getName());
+ private static Method managixExecuteMethod = null;
- /**
- * Probably does not work well with symlinks.
- */
- public static boolean deleteRec(File path) {
- if (path.isDirectory()) {
- for (File f : path.listFiles()) {
- if (!deleteRec(f)) {
- return false;
- }
- }
- }
- return path.delete();
- }
+ /**
+ * Probably does not work well with symlinks.
+ */
+ public static boolean deleteRec(File path) {
+ if (path.isDirectory()) {
+ for (File f : path.listFiles()) {
+ if (!deleteRec(f)) {
+ return false;
+ }
+ }
+ }
+ return path.delete();
+ }
- public static void runScriptAndCompareWithResult(File scriptFile, PrintWriter print, File expectedFile,
- File actualFile) throws Exception {
- BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile),
- "UTF-8"));
- BufferedReader readerActual = new BufferedReader(
- new InputStreamReader(new FileInputStream(actualFile), "UTF-8"));
- String lineExpected, lineActual;
- int num = 1;
- try {
- while ((lineExpected = readerExpected.readLine()) != null) {
- lineActual = readerActual.readLine();
- // Assert.assertEquals(lineExpected, lineActual);
- if (lineActual == null) {
- if (lineExpected.isEmpty()) {
- continue;
- }
- throw new Exception("Result for " + scriptFile + " changed at line " + num + ":\n< " + lineExpected
- + "\n> ");
- }
+ public static void runScriptAndCompareWithResult(File scriptFile,
+ PrintWriter print, File expectedFile, File actualFile)
+ throws Exception {
+ BufferedReader readerExpected = new BufferedReader(
+ new InputStreamReader(new FileInputStream(expectedFile),
+ "UTF-8"));
+ BufferedReader readerActual = new BufferedReader(new InputStreamReader(
+ new FileInputStream(actualFile), "UTF-8"));
+ String lineExpected, lineActual;
+ int num = 1;
+ try {
+ while ((lineExpected = readerExpected.readLine()) != null) {
+ lineActual = readerActual.readLine();
+ // Assert.assertEquals(lineExpected, lineActual);
+ if (lineActual == null) {
+ if (lineExpected.isEmpty()) {
+ continue;
+ }
+ throw new Exception("Result for " + scriptFile
+ + " changed at line " + num + ":\n< "
+ + lineExpected + "\n> ");
+ }
- if (!equalStrings(lineExpected.split("Timestamp")[0], lineActual.split("Timestamp")[0])) {
- fail("Result for " + scriptFile + " changed at line " + num + ":\n< " + lineExpected + "\n> "
- + lineActual);
- }
+ if (!equalStrings(lineExpected.split("Timestamp")[0],
+ lineActual.split("Timestamp")[0])) {
+ fail("Result for " + scriptFile + " changed at line " + num
+ + ":\n< " + lineExpected + "\n> " + lineActual);
+ }
- ++num;
- }
- lineActual = readerActual.readLine();
- // Assert.assertEquals(null, lineActual);
- if (lineActual != null) {
- throw new Exception("Result for " + scriptFile + " changed at line " + num + ":\n< \n> " + lineActual);
- }
- // actualFile.delete();
- } finally {
- readerExpected.close();
- readerActual.close();
- }
+ ++num;
+ }
+ lineActual = readerActual.readLine();
+ // Assert.assertEquals(null, lineActual);
+ if (lineActual != null) {
+ throw new Exception("Result for " + scriptFile
+ + " changed at line " + num + ":\n< \n> " + lineActual);
+ }
+ // actualFile.delete();
+ } finally {
+ readerExpected.close();
+ readerActual.close();
+ }
- }
+ }
- private static boolean equalStrings(String s1, String s2) {
- String[] rowsOne = s1.split("\n");
- String[] rowsTwo = s2.split("\n");
+ private static boolean equalStrings(String s1, String s2) {
+ String[] rowsOne = s1.split("\n");
+ String[] rowsTwo = s2.split("\n");
- for (int i = 0; i < rowsOne.length; i++) {
- String row1 = rowsOne[i];
- String row2 = rowsTwo[i];
+ for (int i = 0; i < rowsOne.length; i++) {
+ String row1 = rowsOne[i];
+ String row2 = rowsTwo[i];
- if (row1.equals(row2))
- continue;
+ if (row1.equals(row2))
+ continue;
- String[] fields1 = row1.split(" ");
- String[] fields2 = row2.split(" ");
+ String[] fields1 = row1.split(" ");
+ String[] fields2 = row2.split(" ");
- for (int j = 0; j < fields1.length; j++) {
- if (fields1[j].equals(fields2[j])) {
- continue;
- } else if (fields1[j].indexOf('.') < 0) {
- return false;
- } else {
- fields1[j] = fields1[j].split(",")[0];
- fields2[j] = fields2[j].split(",")[0];
- Double double1 = Double.parseDouble(fields1[j]);
- Double double2 = Double.parseDouble(fields2[j]);
- float float1 = (float) double1.doubleValue();
- float float2 = (float) double2.doubleValue();
+ for (int j = 0; j < fields1.length; j++) {
+ if (fields1[j].equals(fields2[j])) {
+ continue;
+ } else if (fields1[j].indexOf('.') < 0) {
+ return false;
+ } else {
+ fields1[j] = fields1[j].split(",")[0];
+ fields2[j] = fields2[j].split(",")[0];
+ Double double1 = Double.parseDouble(fields1[j]);
+ Double double2 = Double.parseDouble(fields2[j]);
+ float float1 = (float) double1.doubleValue();
+ float float2 = (float) double2.doubleValue();
- if (Math.abs(float1 - float2) == 0)
- continue;
- else {
- return false;
- }
- }
- }
- }
- return true;
- }
+ if (Math.abs(float1 - float2) == 0)
+ continue;
+ else {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
- public static String aqlExtToResExt(String fname) {
- int dot = fname.lastIndexOf('.');
- return fname.substring(0, dot + 1) + EXTENSION_AQL_RESULT;
- }
+ public static String aqlExtToResExt(String fname) {
+ int dot = fname.lastIndexOf('.');
+ return fname.substring(0, dot + 1) + EXTENSION_AQL_RESULT;
+ }
- public static void writeResultsToFile(File actualFile, JSONObject result) throws IOException, JSONException {
- BufferedWriter writer = new BufferedWriter(new FileWriter(actualFile));
- Results res = new Results(result);
- for (String line : res) {
- writer.write(line);
- writer.newLine();
- }
- writer.close();
- }
+ public static void writeResultsToFile(File actualFile, JSONObject result)
+ throws IOException, JSONException {
+ BufferedWriter writer = new BufferedWriter(new FileWriter(actualFile));
+ Results res = new Results(result);
+ for (String line : res) {
+ writer.write(line);
+ writer.newLine();
+ }
+ writer.close();
+ }
- public static class Results implements Iterable<String> {
- private final JSONArray chunks;
+ public static class Results implements Iterable<String> {
+ private final JSONArray chunks;
- public Results(JSONObject result) throws JSONException {
- chunks = result.getJSONArray("results");
- }
+ public Results(JSONObject result) throws JSONException {
+ chunks = result.getJSONArray("results");
+ }
- public Iterator<String> iterator() {
- return new ResultIterator(chunks);
- }
- }
+ public Iterator<String> iterator() {
+ return new ResultIterator(chunks);
+ }
+ }
- public static class ResultIterator implements Iterator<String> {
- private final JSONArray chunks;
+ public static class ResultIterator implements Iterator<String> {
+ private final JSONArray chunks;
- private int chunkCounter = 0;
- private int recordCounter = 0;
+ private int chunkCounter = 0;
+ private int recordCounter = 0;
- public ResultIterator(JSONArray chunks) {
- this.chunks = chunks;
- }
+ public ResultIterator(JSONArray chunks) {
+ this.chunks = chunks;
+ }
- @Override
- public boolean hasNext() {
- JSONArray resultArray;
- try {
- resultArray = chunks.getJSONArray(chunkCounter);
- if (resultArray.getString(recordCounter) != null) {
- return true;
- }
- } catch (JSONException e) {
- return false;
- }
- return false;
- }
+ @Override
+ public boolean hasNext() {
+ JSONArray resultArray;
+ try {
+ resultArray = chunks.getJSONArray(chunkCounter);
+ if (resultArray.getString(recordCounter) != null) {
+ return true;
+ }
+ } catch (JSONException e) {
+ return false;
+ }
+ return false;
+ }
- @Override
- public String next() throws NoSuchElementException {
- JSONArray resultArray;
- String item = "";
+ @Override
+ public String next() throws NoSuchElementException {
+ JSONArray resultArray;
+ String item = "";
- try {
- resultArray = chunks.getJSONArray(chunkCounter);
- item = resultArray.getString(recordCounter);
- if (item == null) {
- throw new NoSuchElementException();
- }
- item = item.trim();
+ try {
+ resultArray = chunks.getJSONArray(chunkCounter);
+ item = resultArray.getString(recordCounter);
+ if (item == null) {
+ throw new NoSuchElementException();
+ }
+ item = item.trim();
- recordCounter++;
- if (recordCounter >= resultArray.length()) {
- chunkCounter++;
- recordCounter = 0;
- }
- } catch (JSONException e) {
- throw new NoSuchElementException(e.getMessage());
- }
- return item;
- }
+ recordCounter++;
+ if (recordCounter >= resultArray.length()) {
+ chunkCounter++;
+ recordCounter = 0;
+ }
+ } catch (JSONException e) {
+ throw new NoSuchElementException(e.getMessage());
+ }
+ return item;
+ }
- @Override
- public void remove() {
- throw new NotImplementedException();
- }
- }
+ @Override
+ public void remove() {
+ throw new NotImplementedException();
+ }
+ }
- // Executes Query and returns results as JSONArray
- public static JSONObject executeQuery(String str) throws Exception {
+ // Executes Query and returns results as JSONArray
+ public static JSONObject executeQuery(String str) throws Exception {
- final String url = "http://localhost:19101/query";
+ final String url = "http://localhost:19101/query";
- // Create an instance of HttpClient.
- HttpClient client = new HttpClient();
+ // Create an instance of HttpClient.
+ HttpClient client = new HttpClient();
- // Create a method instance.
- GetMethod method = new GetMethod(url);
+ // Create a method instance.
+ GetMethod method = new GetMethod(url);
- method.setQueryString(new NameValuePair[] { new NameValuePair("query", str) });
+ method.setQueryString(new NameValuePair[] { new NameValuePair("query",
+ str) });
- // Provide custom retry handler is necessary
- method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
+ // Provide custom retry handler is necessary
+ method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
+ new DefaultHttpMethodRetryHandler(3, false));
- JSONObject result = null;
+ JSONObject result = null;
- try {
- // Execute the method.
- int statusCode = client.executeMethod(method);
+ try {
+ // Execute the method.
+ int statusCode = client.executeMethod(method);
- // Check if the method was executed successfully.
- if (statusCode != HttpStatus.SC_OK) {
- System.err.println("Method failed: " + method.getStatusLine());
- }
+ // Check if the method was executed successfully.
+ if (statusCode != HttpStatus.SC_OK) {
+ System.err.println("Method failed: " + method.getStatusLine());
+ }
- // Read the response body as String.
- String responseBody = method.getResponseBodyAsString();
+ // Read the response body as String.
+ String responseBody = method.getResponseBodyAsString();
- result = new JSONObject(responseBody);
- } catch (Exception e) {
- System.out.println(e.getMessage());
- e.printStackTrace();
- }
- return result;
- }
+ result = new JSONObject(responseBody);
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ e.printStackTrace();
+ }
+ return result;
+ }
- // To execute Update statements
- // Insert and Delete statements are executed here
- public static void executeUpdate(String str) throws Exception {
- final String url = "http://localhost:19101/update";
+ // To execute Update statements
+ // Insert and Delete statements are executed here
+ public static void executeUpdate(String str) throws Exception {
+ final String url = "http://localhost:19101/update";
- // Create an instance of HttpClient.
- HttpClient client = new HttpClient();
+ // Create an instance of HttpClient.
+ HttpClient client = new HttpClient();
- // Create a method instance.
- GetMethod method = new GetMethod(url);
+ // Create a method instance.
+ GetMethod method = new GetMethod(url);
- method.setQueryString(new NameValuePair[] { new NameValuePair("statements", str) });
+ method.setQueryString(new NameValuePair[] { new NameValuePair(
+ "statements", str) });
- // Provide custom retry handler is necessary
- method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
+ // Provide custom retry handler is necessary
+ method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
+ new DefaultHttpMethodRetryHandler(3, false));
- // Execute the method.
- int statusCode = client.executeMethod(method);
+ // Execute the method.
+ int statusCode = client.executeMethod(method);
- // Check if the method was executed successfully.
- if (statusCode != HttpStatus.SC_OK) {
- System.err.println("Method failed: " + method.getStatusLine());
- }
- }
+ // Check if the method was executed successfully.
+ if (statusCode != HttpStatus.SC_OK) {
+ System.err.println("Method failed: " + method.getStatusLine());
+ }
+ }
- // To execute DDL and Update statements
- // create type statement
- // create dataset statement
- // create index statement
- // create dataverse statement
- // create function statement
- public static void executeDDL(String str) throws Exception {
- final String url = "http://localhost:19101/ddl";
+ // To execute DDL and Update statements
+ // create type statement
+ // create dataset statement
+ // create index statement
+ // create dataverse statement
+ // create function statement
+ public static void executeDDL(String str) throws Exception {
+ final String url = "http://localhost:19101/ddl";
- // Create an instance of HttpClient.
- HttpClient client = new HttpClient();
+ // Create an instance of HttpClient.
+ HttpClient client = new HttpClient();
- // Create a method instance.
- GetMethod method = new GetMethod(url);
+ // Create a method instance.
+ GetMethod method = new GetMethod(url);
- method.setQueryString(new NameValuePair[] { new NameValuePair("ddl", str) });
+ method.setQueryString(new NameValuePair[] { new NameValuePair("ddl",
+ str) });
- // Provide custom retry handler is necessary
- method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
+ // Provide custom retry handler is necessary
+ method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
+ new DefaultHttpMethodRetryHandler(3, false));
- // Execute the method.
- int statusCode = client.executeMethod(method);
+ // Execute the method.
+ int statusCode = client.executeMethod(method);
- // Check if the method was executed successfully.
- if (statusCode != HttpStatus.SC_OK) {
- System.err.println("Method failed: " + method.getStatusLine());
- }
- }
+ // Check if the method was executed successfully.
+ if (statusCode != HttpStatus.SC_OK) {
+ System.err.println("Method failed: " + method.getStatusLine());
+ }
+ }
- // Method that reads a DDL/Update/Query File
- // and returns the contents as a string
- // This string is later passed to REST API for execution.
- public static String readTestFile(File testFile) throws Exception {
- BufferedReader reader = new BufferedReader(new FileReader(testFile));
- String line = null;
- StringBuilder stringBuilder = new StringBuilder();
- String ls = System.getProperty("line.separator");
+ // Method that reads a DDL/Update/Query File
+ // and returns the contents as a string
+ // This string is later passed to REST API for execution.
+ public static String readTestFile(File testFile) throws Exception {
+ BufferedReader reader = new BufferedReader(new FileReader(testFile));
+ String line = null;
+ StringBuilder stringBuilder = new StringBuilder();
+ String ls = System.getProperty("line.separator");
- while ((line = reader.readLine()) != null) {
- stringBuilder.append(line);
- stringBuilder.append(ls);
- }
+ while ((line = reader.readLine()) != null) {
+ stringBuilder.append(line);
+ stringBuilder.append(ls);
+ }
- return stringBuilder.toString();
- }
+ return stringBuilder.toString();
+ }
- public static void executeTest(String actualPath, TestCaseContext testCaseCtx)throws Exception {
+ public static void executeManagixCommand(String command)
+ throws ClassNotFoundException, NoSuchMethodException,
+ SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ if (managixExecuteMethod == null) {
+ Class clazz = Class
+ .forName("edu.uci.ics.asterix.installer.test.AsterixInstallerIntegrationUtil");
+ managixExecuteMethod = clazz.getMethod("executeCommand",
+ String.class);
+ }
+ managixExecuteMethod.invoke(null, command);
+ }
- File testFile;
- File expectedResultFile;
- String statement;
- List<TestFileContext> expectedResultFileCtxs;
- List<TestFileContext> testFileCtxs;
+ public static void executeTest(String actualPath,
+ TestCaseContext testCaseCtx) throws Exception {
- int queryCount = 0;
- JSONObject result;
+ File testFile;
+ File expectedResultFile;
+ String statement;
+ List<TestFileContext> expectedResultFileCtxs;
+ List<TestFileContext> testFileCtxs;
- List<CompilationUnit> cUnits = testCaseCtx.getTestCase().getCompilationUnit();
- for (CompilationUnit cUnit : cUnits) {
- LOGGER.info("[TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName());
+ int queryCount = 0;
+ JSONObject result;
- testFileCtxs = testCaseCtx.getTestFiles(cUnit);
- expectedResultFileCtxs = testCaseCtx.getExpectedResultFiles(cUnit);
+ List<CompilationUnit> cUnits = testCaseCtx.getTestCase()
+ .getCompilationUnit();
+ for (CompilationUnit cUnit : cUnits) {
+ LOGGER.info("[TEST]: " + testCaseCtx.getTestCase().getFilePath()
+ + "/" + cUnit.getName());
- for (TestFileContext ctx : testFileCtxs) {
- testFile = ctx.getFile();
- statement = TestsUtils.readTestFile(testFile);
- try {
- switch (ctx.getType()) {
- case "ddl":
- TestsUtils.executeDDL(statement);
- break;
- case "update":
- TestsUtils.executeUpdate(statement);
- break;
- case "query":
- result = TestsUtils.executeQuery(statement);
- if (!cUnit.getExpectedError().isEmpty()) {
- if (!result.has("error")) {
- throw new Exception("Test \"" + testFile + "\" FAILED!");
- }
- } else {
- expectedResultFile = expectedResultFileCtxs.get(queryCount).getFile();
+ testFileCtxs = testCaseCtx.getTestFiles(cUnit);
+ expectedResultFileCtxs = testCaseCtx.getExpectedResultFiles(cUnit);
- File actualFile = new File(actualPath + File.separator
- + testCaseCtx.getTestCase().getFilePath().replace(File.separator, "_") + "_"
- + cUnit.getName() + ".adm");
+ for (TestFileContext ctx : testFileCtxs) {
+ testFile = ctx.getFile();
+ statement = TestsUtils.readTestFile(testFile);
+ try {
+ switch (ctx.getType()) {
+ case "ddl":
+ TestsUtils.executeDDL(statement);
+ break;
+ case "update":
+ TestsUtils.executeUpdate(statement);
+ break;
+ case "query":
+ result = TestsUtils.executeQuery(statement);
+ if (!cUnit.getExpectedError().isEmpty()) {
+ if (!result.has("error")) {
+ throw new Exception("Test \"" + testFile
+ + "\" FAILED!");
+ }
+ } else {
+ expectedResultFile = expectedResultFileCtxs.get(
+ queryCount).getFile();
- File actualResultFile = testCaseCtx.getActualResultFile(cUnit, new File(actualPath));
- actualResultFile.getParentFile().mkdirs();
+ File actualFile = new File(actualPath
+ + File.separator
+ + testCaseCtx.getTestCase().getFilePath()
+ .replace(File.separator, "_") + "_"
+ + cUnit.getName() + ".adm");
- TestsUtils.writeResultsToFile(actualFile, result);
+ File actualResultFile = testCaseCtx
+ .getActualResultFile(cUnit, new File(
+ actualPath));
+ actualResultFile.getParentFile().mkdirs();
- TestsUtils.runScriptAndCompareWithResult(testFile, new PrintWriter(System.err),
- expectedResultFile, actualFile);
- }
- queryCount++;
- break;
- default:
- throw new IllegalArgumentException("No statements of type " + ctx.getType());
- }
- } catch (Exception e) {
- if (cUnit.getExpectedError().isEmpty()) {
- throw new Exception("Test \"" + testFile + "\" FAILED!", e);
- }
- }
- }
- }
+ TestsUtils.writeResultsToFile(actualFile, result);
- }
+ TestsUtils.runScriptAndCompareWithResult(testFile,
+ new PrintWriter(System.err),
+ expectedResultFile, actualFile);
+ }
+ queryCount++;
+ break;
+ case "mgx":
+ executeManagixCommand(statement);
+ break;
+ default:
+ throw new IllegalArgumentException(
+ "No statements of type " + ctx.getType());
+ }
+ } catch (Exception e) {
+ if (cUnit.getExpectedError().isEmpty()) {
+ throw new Exception(
+ "Test \"" + testFile + "\" FAILED!", e);
+ }
+ }
+ }
+ }
+
+ }
}
diff --git a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java
index b8880e8..06102b1 100644
--- a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java
+++ b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java
@@ -30,7 +30,7 @@
private static final String LIBRARY_NAME = "testlib";
private static final String LIBRARY_DATAVERSE = "externallibtest";
- private static final String PATH_BASE = "src/test/resources/integrationts/";
+ private static final String PATH_BASE = "src/test/resources/integrationts/library";
private static final String PATH_ACTUAL = "ittest/";
private static final String LIBRARY_PATH = "asterix-external-data"
+ File.separator + "target" + File.separator
@@ -75,6 +75,7 @@
setUp();
new AsterixExternalLibraryIT().test();
} catch (Exception e) {
+ e.printStackTrace();
LOGGER.info("TEST CASES FAILED");
} finally {
tearDown();
diff --git a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java
index e8ea641..8d934a4 100644
--- a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java
+++ b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java
@@ -48,9 +48,8 @@
private static final String CC_IP_ADDRESS = "127.0.0.1";
private static final int DEFAULT_HYRACKS_CC_CLIENT_PORT = 1098;
private static IHyracksClientConnection hcc;
-
- private static final Logger LOGGER = Logger.getLogger(AsterixInstallerIntegrationUtil.class.getName());
+ private static final Logger LOGGER = Logger.getLogger(AsterixInstallerIntegrationUtil.class.getName());
public static void deinit() throws Exception {
deleteInstance();
@@ -208,4 +207,8 @@
cmdHandler.processCommand(command.split(" "));
}
+ public static void executeCommand(String command) throws Exception {
+ cmdHandler.processCommand(command.split(" "));
+ }
+
}
diff --git a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixLifecycleIT.java b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixLifecycleIT.java
index 4363272..4d9a62a 100644
--- a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixLifecycleIT.java
+++ b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixLifecycleIT.java
@@ -1,7 +1,10 @@
package edu.uci.ics.asterix.installer.test;
+import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
+import java.util.logging.Logger;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -14,15 +17,24 @@
import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
import edu.uci.ics.asterix.installer.model.AsterixRuntimeState;
import edu.uci.ics.asterix.installer.service.ServiceProvider;
+import edu.uci.ics.asterix.test.aql.TestsUtils;
+import edu.uci.ics.asterix.testframework.context.TestCaseContext;
+
public class AsterixLifecycleIT {
private static final int NUM_NC = 1;
private static final CommandHandler cmdHandler = new CommandHandler();
+ private static final String PATH_BASE = "src/test/resources/integrationts/lifecycle";
+ private static final String PATH_ACTUAL = "ittest/";
+ private static final Logger LOGGER = Logger.getLogger(AsterixLifecycleIT.class.getName());
+ private static List<TestCaseContext> testCaseCollection;
@BeforeClass
public static void setUp() throws Exception {
AsterixInstallerIntegrationUtil.init();
+ TestCaseContext.Builder b = new TestCaseContext.Builder();
+ testCaseCollection = b.build(new File(PATH_BASE));
}
@AfterClass
@@ -86,4 +98,24 @@
}
}
+ @Test
+ public void test() throws Exception {
+ for (TestCaseContext testCaseCtx : testCaseCollection) {
+ TestsUtils.executeTest(PATH_ACTUAL, testCaseCtx);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ try {
+ setUp();
+ new AsterixLifecycleIT().test();
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOGGER.info("TEST CASES FAILED");
+ } finally {
+ tearDown();
+ }
+ }
+
+
}
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/feed_ingest.1.ddl.aql b/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/feed_ingest.1.ddl.aql
deleted file mode 100644
index 2b47fff..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/feed_ingest.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Description : Create a feed dataset that uses the feed simulator adapter.
- The feed simulator simulates feed from a file in the local fs.
- Associate with the feed an external user-defined function. The UDF
- finds topics in each tweet. A topic is identified by a #.
- Begin ingestion and apply external user defined function
- * Expected Res : Success
- * Date : 23rd Apr 2013
- */
-use dataverse externallibtest;
-
-create type TweetType as closed {
- id: string,
- username : string,
- location : string,
- text : string,
- timestamp : string
- topics : {{string}}?
-}
-
-create feed dataset TweetFeed(TweetType)
-using "edu.uci.ics.asterix.tools.external.data.RateControlledFileSystemBasedAdapterFactory"
-(("output-type-name"="TweetType"),("fs"="localfs"),("path"="nc1://data/twitter/obamatweets.adm"),("format"="adm"),("tuple-interval"="10"))
-apply function testlib:parseTweet@1
-primary key id;
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/feed_ingest.2.update.aql b/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/feed_ingest.2.update.aql
deleted file mode 100644
index b7e03ec..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/feed_ingest.2.update.aql
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Description : Create a feed dataset that uses the feed simulator adapter.
- The feed simulator simulates feed from a file in the local fs.
- Associate with the feed an external user-defined function. The UDF
- finds topics in each tweet. A topic is identified by a #.
- Begin ingestion and apply external user defined function
- * Expected Res : Success
- * Date : 23rd Apr 2013
- */
-use dataverse externallibtest;
-
-begin feed TweetFeed;
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/feed_ingest.3.query.aql b/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/feed_ingest.3.query.aql
deleted file mode 100644
index fd36fbc..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/feed_ingest.3.query.aql
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Description : Create a feed dataset that uses the feed simulator adapter.
- The feed simulator simulates feed from a file in the local fs.
- Associate with the feed an external user-defined function. The UDF
- finds topics in each tweet. A topic is identified by a #.
- Begin ingestion and apply external user defined function
- * Expected Res : Success
- * Date : 23rd Apr 2013
- */
-use dataverse externallibtest;
-
-for $x in dataset TweetFeed
-return $x
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/ingest.2.query.aql b/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/ingest.2.query.aql
deleted file mode 100644
index 4f1bdc6..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-feeds/ingest_feed/ingest.2.query.aql
+++ /dev/null
@@ -1,4 +0,0 @@
-use dataverse externallibtest;
-
-let $x:=testlib:mysum(3,4)
-return $x
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-functions/mysum/mysum.1.query.aql b/asterix-installer/src/test/resources/integrationts/queries/library-functions/mysum/mysum.1.query.aql
deleted file mode 100644
index 4f1bdc6..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-functions/mysum/mysum.1.query.aql
+++ /dev/null
@@ -1,4 +0,0 @@
-use dataverse externallibtest;
-
-let $x:=testlib:mysum(3,4)
-return $x
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-functions/toUpper/toUpper.1.ddl.aql b/asterix-installer/src/test/resources/integrationts/queries/library-functions/toUpper/toUpper.1.ddl.aql
deleted file mode 100644
index c5311ba..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-functions/toUpper/toUpper.1.ddl.aql
+++ /dev/null
@@ -1,7 +0,0 @@
-use dataverse externallibtest;
-
-create type TextType as closed {
-id: int32,
-text: string
-};
-
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-functions/toUpper/toUpper.2.query.aql b/asterix-installer/src/test/resources/integrationts/queries/library-functions/toUpper/toUpper.2.query.aql
deleted file mode 100644
index ba33dcc..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-functions/toUpper/toUpper.2.query.aql
+++ /dev/null
@@ -1,5 +0,0 @@
-use dataverse externallibtest;
-
-let $input:={"id": 1, "text":"university of california, irvine"}
-let $x:=testlib:toUpper($input)
-return $x
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-metadata/dataverseDataset/dataverseDataset.1.query.aql b/asterix-installer/src/test/resources/integrationts/queries/library-metadata/dataverseDataset/dataverseDataset.1.query.aql
deleted file mode 100644
index 25d42f4..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-metadata/dataverseDataset/dataverseDataset.1.query.aql
+++ /dev/null
@@ -1,2 +0,0 @@
-for $x in dataset Metadata.Dataverse
-return $x
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-metadata/functionDataset/functionDataset.1.query.aql b/asterix-installer/src/test/resources/integrationts/queries/library-metadata/functionDataset/functionDataset.1.query.aql
deleted file mode 100644
index fa9b4ca..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-metadata/functionDataset/functionDataset.1.query.aql
+++ /dev/null
@@ -1,2 +0,0 @@
-for $x in dataset Metadata.Function
-return $x
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library-metadata/libraryDataset/libraryDataset.1.query.aql b/asterix-installer/src/test/resources/integrationts/queries/library-metadata/libraryDataset/libraryDataset.1.query.aql
deleted file mode 100644
index 5a46092..0000000
--- a/asterix-installer/src/test/resources/integrationts/queries/library-metadata/libraryDataset/libraryDataset.1.query.aql
+++ /dev/null
@@ -1,2 +0,0 @@
-for $x in dataset Metadata.Library
-return $x
diff --git a/asterix-installer/src/test/resources/integrationts/results/library-functions/mysum/mysum.1.adm b/asterix-installer/src/test/resources/integrationts/results/library-functions/mysum/mysum.1.adm
deleted file mode 100644
index 7f8f011..0000000
--- a/asterix-installer/src/test/resources/integrationts/results/library-functions/mysum/mysum.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/asterix-installer/src/test/resources/integrationts/results/library-functions/toUpper/toUpper.1.adm b/asterix-installer/src/test/resources/integrationts/results/library-functions/toUpper/toUpper.1.adm
deleted file mode 100644
index def28bc..0000000
--- a/asterix-installer/src/test/resources/integrationts/results/library-functions/toUpper/toUpper.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "id": 1, "text": "UNIVERSITY OF CALIFORNIA, IRVINE" }
diff --git a/asterix-installer/src/test/resources/integrationts/results/library-metadata/dataverseDataset/dataverseDataset.1.adm b/asterix-installer/src/test/resources/integrationts/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
deleted file mode 100644
index 9a2c7ec..0000000
--- a/asterix-installer/src/test/resources/integrationts/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-{ "DataverseName": "Metadata", "DataFormat": "edu.uci.ics.asterix.runtime.formats.NonTaggedDataFormat", "Timestamp": "Mon Apr 22 23:36:36 PDT 2013", "PendingOp": 0 }
-{ "DataverseName": "externallibtest", "DataFormat": "edu.uci.ics.asterix.runtime.formats.NonTaggedDataFormat", "Timestamp": "Mon Apr 22 23:36:55 PDT 2013", "PendingOp": 0 }
diff --git a/asterix-installer/src/test/resources/integrationts/results/library-metadata/functionDataset/functionDataset.1.adm b/asterix-installer/src/test/resources/integrationts/results/library-metadata/functionDataset/functionDataset.1.adm
deleted file mode 100644
index 6334aaa..0000000
--- a/asterix-installer/src/test/resources/integrationts/results/library-metadata/functionDataset/functionDataset.1.adm
+++ /dev/null
@@ -1,8 +0,0 @@
-{ "DataverseName": "externallibtest", "Name": "testlib:allTypes", "Arity": "1", "Params": [ "AllType" ], "ReturnType": "AllType", "Definition": "edu.uci.ics.asterix.external.library.AllTypesFactory
- ", "Language": "JAVA", "Kind": "SCALAR" }
-{ "DataverseName": "externallibtest", "Name": "testlib:mysum", "Arity": "2", "Params": [ "AINT32", "AINT32" ], "ReturnType": "AINT32", "Definition": "edu.uci.ics.asterix.external.library.SumFactory
- ", "Language": "JAVA", "Kind": "SCALAR" }
-{ "DataverseName": "externallibtest", "Name": "testlib:parseTweet", "Arity": "1", "Params": [ "TweetType" ], "ReturnType": "TweetType", "Definition": "edu.uci.ics.asterix.external.library.ParseTweetFactory
- ", "Language": "JAVA", "Kind": "SCALAR" }
-{ "DataverseName": "externallibtest", "Name": "testlib:toUpper", "Arity": "1", "Params": [ "TextType" ], "ReturnType": "TextType", "Definition": "edu.uci.ics.asterix.external.library.UpperCaseFactory
- ", "Language": "JAVA", "Kind": "SCALAR" }
diff --git a/asterix-installer/src/test/resources/integrationts/results/library-metadata/libraryDataset/libraryDataset.1.adm b/asterix-installer/src/test/resources/integrationts/results/library-metadata/libraryDataset/libraryDataset.1.adm
deleted file mode 100644
index 573db0c..0000000
--- a/asterix-installer/src/test/resources/integrationts/results/library-metadata/libraryDataset/libraryDataset.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "DataverseName": "externallibtest", "Name": "testlib", "Timestamp": "Mon Apr 22 23:36:55 PDT 2013" }
diff --git a/asterix-installer/src/test/resources/integrationts/testsuite.xml b/asterix-installer/src/test/resources/integrationts/testsuite.xml
deleted file mode 100644
index df1322d..0000000
--- a/asterix-installer/src/test/resources/integrationts/testsuite.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<test-suite xmlns="urn:xml.testframework.asterix.ics.uci.edu" ResultOffsetPath="results" QueryOffsetPath="queries" QueryFileExtension=".aql">
- <test-group name="library-functions">
- <test-case FilePath="library-functions">
- <compilation-unit name="mysum">
- <output-dir compare="Text">mysum</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="library-functions">
- <compilation-unit name="toUpper">
- <output-dir compare="Text">toUpper</output-dir>
- </compilation-unit>
- </test-case>
- </test-group>
- <test-group name="library-metadata">
- <test-case FilePath="library-metadata">
- <compilation-unit name="functionDataset">
- <output-dir compare="Text">functionDataset</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="library-metadata">
- <compilation-unit name="libraryDataset">
- <output-dir compare="Text">libraryDataset</output-dir>
- </compilation-unit>
- </test-case>
- <test-case FilePath="library-metadata">
- <compilation-unit name="dataverseDataset">
- <output-dir compare="Text">dataverseDataset</output-dir>
- </compilation-unit>
- </test-case>
- </test-group>
-</test-suite>
-