Code review by Sattam
Fix for isse 314: Semicolons treated finicky-ily in CREATE FUNCTION


git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization@1708 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf28/udf28.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf28/udf28.1.ddl.aql
new file mode 100644
index 0000000..62bbd54
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf28/udf28.1.ddl.aql
@@ -0,0 +1,18 @@
+/*
+ * Description  : Create UDF and terminate the statement with a ';'
+ * Expected Res : Success
+ * Date         : Sep 6th 2012
+ */
+
+// this test is not giving expected results.
+// issue 194 reported to track this
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create function test.f1(){
+100
+};
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf28/udf28.2.query.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf28/udf28.2.query.aql
new file mode 100644
index 0000000..2e2e27c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf28/udf28.2.query.aql
@@ -0,0 +1,10 @@
+/*
+ * Description  : Create a UDF but use ';' for terminating the create function statement. Look up metadata
+ * Expected Res : Success
+ * Date         : Apr 5th 2013
+ */
+
+use dataverse test;
+for $x in dataset Metadata.Function
+where $x.DataverseName='test'
+return $x
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf29/udf29.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf29/udf29.1.ddl.aql
new file mode 100644
index 0000000..edede00
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf29/udf29.1.ddl.aql
@@ -0,0 +1,16 @@
+/*
+ * Description  : Declare UDF and terminate the statement with a ';'
+ * Expected Res : Success
+ * Date         : Apr 10th 2013
+ */
+
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+declare function test.f1(){
+100
+};
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf29/udf29.2.query.aql b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf29/udf29.2.query.aql
new file mode 100644
index 0000000..2f9e763
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/user-defined-functions/udf29/udf29.2.query.aql
@@ -0,0 +1,9 @@
+/*
+ * Description  : Declare a UDF but use ';' for terminating the declare function statement. Invoke the function
+ * Expected Res : Success
+ * Date         : Apr 10th 2013
+ */
+
+use dataverse test;
+let $x:=f1()
+return $x
diff --git a/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf28/udf28.1.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf28/udf28.1.adm
new file mode 100644
index 0000000..b106dbe
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf28/udf28.1.adm
@@ -0,0 +1 @@
+{ "DataverseName": "test", "Name": "f1", "Arity": "0", "Params": [  ], "ReturnType": "VOID", "Definition": "100", "Language": "AQL", "Kind": "SCALAR" }
diff --git a/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf29/udf29.1.adm b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf29/udf29.1.adm
new file mode 100644
index 0000000..29d6383
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/user-defined-functions/udf29/udf29.1.adm
@@ -0,0 +1 @@
+100
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 980b900..90fe557 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -4038,6 +4038,16 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf28">
+        <output-dir compare="Text">udf28</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
+      <compilation-unit name="udf29">
+        <output-dir compare="Text">udf29</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="user-defined-functions">
       <compilation-unit name="f01">
         <output-dir compare="Text">f01</output-dir>
         <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>