1) Fix Issue 198 (Metadata tests need to be rewritten - added additional tests, cleaned existing) 
2) Metadata tests now use the new test framework. 


git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@950 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta01.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta01.aql
new file mode 100644
index 0000000..5ce47ad
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta01.aql
@@ -0,0 +1,15 @@
+/*
+ * Description  : Create dataverse & query Metadata dataset Dataverse to verify.
+ * Expected Res : Success
+ * Date         : 15 Sep 2012
+ */
+
+drop dataverse testdv if exists;
+create dataverse testdv;
+
+write output to nc1:"mdtest/basic_meta01.adm";
+
+for $l in dataset('Metadata.Dataverse')
+return $l
+
+drop dataverse testdv;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta02.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta02.aql
new file mode 100644
index 0000000..8bfc240
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta02.aql
@@ -0,0 +1,22 @@
+/*
+ * Description  : Create dataset & query Metadata dataset Dataset to verify.
+ * Expected Res : Success
+ * Date         : 15 Sep 2012
+ */
+
+drop dataverse testdv if exists;
+create dataverse testdv;
+
+write output to nc1:"mdtest/basic_meta02.adm";
+
+create type testdv.testtype as open {
+id : int32
+}
+
+create dataset testdv.dst01(testtype) partitioned by key id;
+
+for $l in dataset('Metadata.Dataset')
+where $l.DataverseName = 'testdv' and $l.DatasetName = 'dst01'
+return $l
+
+drop dataverse testdv; 
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta03.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta03.aql
new file mode 100644
index 0000000..0b876f2
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta03.aql
@@ -0,0 +1,21 @@
+/*
+ * Description  : Create closed type &  query Metadata dataset Datatype to verify.
+ * Expected Res : Success
+ * Date         : 15 Sep 2012
+ */
+
+drop dataverse testdv if exists;
+create dataverse testdv;
+
+write output to nc1:"mdtest/basic_meta03.adm";
+
+create type testdv.testtype as closed {
+id : int32
+}
+
+for $l in dataset('Metadata.Datatype')
+where $l.DataverseName='testdv' and $l.DatatypeName='testtype'
+return $l
+
+drop dataverse testdv;
+
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta04.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta04.aql
new file mode 100644
index 0000000..b2e7304
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta04.aql
@@ -0,0 +1,20 @@
+/*
+ * Description  : Create open type & query Metadata dataset Datatype to verify.
+ * Expected Res : Success
+ * Date         : 15 Sep 2012
+ */
+
+drop dataverse testdv if exists;
+create dataverse testdv;
+
+write output to nc1:"mdtest/basic_meta04.adm";
+
+create type testdv.testtype as open {
+id : int32
+}
+
+for $l in dataset('Metadata.Datatype')
+where $l.DataverseName='testdv' and $l.DatatypeName='testtype'
+return $l
+
+drop dataverse testdv;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta05.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta05.aql
new file mode 100644
index 0000000..9eb129d
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta05.aql
@@ -0,0 +1,25 @@
+/*
+ * Description  : Create primary & secondary indexes & query Metadata dataset to verify.
+ * Expected Res : Success
+ * Date         : 15 Sep 2012
+ */
+
+drop dataverse testdv if exists;
+create dataverse testdv;
+
+write output to nc1:"mdtest/basic_meta05.adm";
+
+create type testdv.testtype as open {
+id : int32,
+name : string
+}
+
+create dataset testdv.t1(testtype) partitioned by key id;
+
+create index idx1 on testdv.t1(name);
+
+for $l in dataset('Metadata.Index')
+where $l.DataverseName='testdv' 
+return $l
+
+drop dataverse testdv;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta06.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta06.aql
new file mode 100644
index 0000000..6297561
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta06.aql
@@ -0,0 +1,19 @@
+/*
+ * Description  : Create AQL bodied UDFs and verify that there are related entries in metadata Function dataset
+ * Expected Res : Success
+ * Date         : Sep 17 2012
+ */
+
+drop dataverse testdv if exists;
+create dataverse testdv;
+
+write output to nc1:"mdtest/basic_meta06.adm";
+
+create function testdv.fun01(){
+"This is an AQL Bodied UDF"
+}
+
+for $l in dataset('Metadata.Function')
+return $l
+
+drop dataverse testdv;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta07.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta07.aql
new file mode 100644
index 0000000..6544bca
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta07.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : Verify default entries for Node dataset in Metadata dataverse
+ * Expected Res : Success
+ * Date         : Sep 17 2012
+ */
+
+// Please note this query was run on two nodes, i.e; two NCs
+
+write output to nc1:"mdtest/basic_meta07.adm";
+
+for $l in dataset('Metadata.Node')
+return $l
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta08.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta08.aql
new file mode 100644
index 0000000..a7d536f
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta08.aql
@@ -0,0 +1,12 @@
+/*
+ * Description  : Verify default entries for Nodegroup dataset in Metadata dataverse
+ * Expected Res : Success
+ * Date         : Sep 17 2012
+ */
+
+// Please note this query was run on two nodes, i.e; two NCs
+
+write output to nc1:"mdtest/basic_meta08.adm";
+
+for $l in dataset('Metadata.Nodegroup')
+return $l
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta09.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta09.aql
new file mode 100644
index 0000000..28a3794
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta09.aql
@@ -0,0 +1,33 @@
+/*
+ * Description  : Create internal dataset, insert data and query metadata Dataset to verify entries for that dataset.
+ * Expected Res : Success
+ * Date         : Sep 17 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+write output to nc1:"mdtest/basic_meta09.adm";
+
+create type test.testtype as open {
+id:int32
+}
+
+create dataset test.t1(testtype) partitioned by key id;
+
+insert into dataset test.t1({"id":123});
+insert into dataset test.t1({"id":133});
+insert into dataset test.t1({"id":223});
+insert into dataset test.t1({"id":127});
+insert into dataset test.t1({"id":423});
+insert into dataset test.t1({"id":183});
+insert into dataset test.t1({"id":193});
+insert into dataset test.t1({"id":129});
+insert into dataset test.t1({"id":373});
+insert into dataset test.t1({"id":282});
+
+for $l in dataset('Metadata.Dataset')
+where $l.DataverseName='test' and $l.DatasetName='t1'
+return $l
+
+drop dataverse test; 
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta10.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta10.aql
new file mode 100644
index 0000000..452dcc3
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta10.aql
@@ -0,0 +1,17 @@
+/*
+ * Description  : Create dataverse and drop that dataverse and verify dataverse entries in metadata
+ * Expected Res : Success
+ * Date         : Sep 17 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+drop dataverse test if exists;
+
+write output to nc1:"mdtest/basic_meta10.adm";
+
+count(
+for $l in dataset('Metadata.Dataverse')
+where $l.DataverseName='test'
+return $l
+)
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta11.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta11.aql
new file mode 100644
index 0000000..d781114
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta11.aql
@@ -0,0 +1,27 @@
+/*
+ * Description  : Create dataset and drop that dataset and query Metadata Dataset to verify the drop.
+ * Expected Res : Success
+ * Date         : Sep 17 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+write output to nc1:"mdtest/basic_meta11.adm";
+
+create type test.testtype as open {
+id : int32
+}
+
+create dataset test.dst01(testtype) partitioned by key id;
+
+drop dataset test.dst01;
+
+count(
+for $l in dataset('Metadata.Dataset')
+where $l.DataverseName='test' and $l.DatasetName='dst01'
+return $l
+)
+
+drop dataverse test;
+
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta12.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta12.aql
new file mode 100644
index 0000000..1de7ac5
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta12.aql
@@ -0,0 +1,27 @@
+/*
+ * Description  : Create secondary index and drop the secondary index and query metadata to verify drop index.
+ * Expected Res : Success 
+ * Date         : Sep 17 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+write output to nc1:"mdtest/basic_meta12.adm";
+
+create type test.testtype as open {
+id : int32,
+name : string
+}
+
+create dataset test.dst01(testtype) partitioned by key id;
+
+create index idx1 on test.dst01(name);
+
+drop index test.dst01.idx1;
+
+for $l in dataset('Metadata.Index')
+where $l.DatasetName = 'dst01'
+return $l
+
+drop dataverse test;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta13.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta13.aql
new file mode 100644
index 0000000..0c0f627
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta13.aql
@@ -0,0 +1,24 @@
+/*
+ * Description  : Create functions and drop that function and query metadata 
+ *              : to verify entries in Function dataset for the dropped UDF.
+ * Expected Res : Success
+ * Date         : Sep 17 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+write output to nc1:"mdtest/basic_meta13.adm";
+
+create function test.foo(){
+"drop this function"
+}
+
+drop function test.foo@0;
+
+count(
+for $l in dataset('Metadata.Function')
+where $l.DataverseName='test' and $l.Name='foo' and $l.Arity=0
+return $l);
+
+drop dataverse test;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta14.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta14.aql
new file mode 100644
index 0000000..9103614
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta14.aql
@@ -0,0 +1,27 @@
+/*
+ * Description      :  Test that a synthetically created content type is dropped with its parent type. 
+ *                     Guards against regression to issue 188.
+ * Expected Result  :  Success
+ */
+
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type FooType as closed {
+   bar: int32?
+};
+
+
+drop type FooType;
+
+write output to nc1:"mdtest/basic_meta14.adm";
+
+count(
+for $x in dataset('Metadata.Datatype')
+where $x.DataverseName='test'
+return $x
+)
+
+drop dataverse test;
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta15.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta15.aql
new file mode 100644
index 0000000..91827ef
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta15.aql
@@ -0,0 +1,11 @@
+/*
+ * Description  : Query Metadata dataset Adapter to verify to contents.
+ * Expected Res : Success
+ * Date         : 25 Nov 2012
+ */
+
+write output to nc1:"mdtest/basic_meta15.adm";
+
+for $l in dataset('Metadata.DatasourceAdapter')
+return $l
+
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta16.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta16.aql
new file mode 100644
index 0000000..8b69b4f
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta16.aql
@@ -0,0 +1,9 @@
+use dataverse Metadata;
+
+write output to nc1:"mdtest/basic_meta16.adm";
+
+for $c in dataset('Dataset')
+return $c
+
+
+
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta17.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta17.aql
new file mode 100644
index 0000000..2cd25ee
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta17.aql
@@ -0,0 +1,6 @@
+use dataverse Metadata;
+
+write output to nc1:"mdtest/basic_meta17.adm";
+     
+for $c in dataset('Datatype')
+return $c
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta18.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta18.aql
new file mode 100644
index 0000000..45f065a
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta18.aql
@@ -0,0 +1,6 @@
+use dataverse Metadata;
+
+write output to nc1:"mdtest/basic_meta18.adm";
+
+for $c in dataset('Dataverse')
+return $c
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta19.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta19.aql
new file mode 100644
index 0000000..21de582
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta19.aql
@@ -0,0 +1,7 @@
+use dataverse Metadata;
+
+write output to nc1:"mdtest/basic_meta19.adm";
+
+for $c in dataset('Index')
+where $c.DataverseName='Metadata'
+return $c
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta20.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta20.aql
new file mode 100644
index 0000000..259f23e
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta20.aql
@@ -0,0 +1,6 @@
+use dataverse Metadata;    
+
+write output to nc1:"mdtest/basic_meta20.adm";
+
+for $c in dataset('Node')
+return $c
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/meta21.aql b/asterix-app/src/test/resources/metadata/queries/basic/meta21.aql
new file mode 100644
index 0000000..b5f8110
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/meta21.aql
@@ -0,0 +1,6 @@
+use dataverse Metadata;
+
+write output to nc1:"mdtest/basic_meta21.adm";
+     
+for $c in dataset('Nodegroup')
+return $c
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/metadata_dataset.aql b/asterix-app/src/test/resources/metadata/queries/basic/metadata_dataset.aql
new file mode 100644
index 0000000..94f7a58
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/metadata_dataset.aql
@@ -0,0 +1,9 @@
+use dataverse Metadata;
+
+write output to nc1:"rttest/basic_metadata_dataset.adm";
+
+for $c in dataset('Dataset')
+return $c
+
+
+
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/metadata_datatype.aql b/asterix-app/src/test/resources/metadata/queries/basic/metadata_datatype.aql
new file mode 100644
index 0000000..4cc94de
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/metadata_datatype.aql
@@ -0,0 +1,6 @@
+use dataverse Metadata;
+
+write output to nc1:"rttest/basic_metadata_datatype.adm";
+     
+for $c in dataset('Datatype')
+return $c
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/metadata_dataverse.aql b/asterix-app/src/test/resources/metadata/queries/basic/metadata_dataverse.aql
new file mode 100644
index 0000000..d3edfed
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/metadata_dataverse.aql
@@ -0,0 +1,6 @@
+use dataverse Metadata;
+
+write output to nc1:"rttest/basic_metadata_dataverse.adm";
+
+for $c in dataset('Dataverse')
+return $c
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/metadata_index.aql b/asterix-app/src/test/resources/metadata/queries/basic/metadata_index.aql
new file mode 100644
index 0000000..cb78758
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/metadata_index.aql
@@ -0,0 +1,7 @@
+use dataverse Metadata;
+
+write output to nc1:"rttest/basic_metadata_index.adm";
+
+for $c in dataset('Index')
+where $c.DataverseName='Metadata'
+return $c
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/metadata_node.aql b/asterix-app/src/test/resources/metadata/queries/basic/metadata_node.aql
new file mode 100644
index 0000000..2d28ed6
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/metadata_node.aql
@@ -0,0 +1,6 @@
+use dataverse Metadata;    
+
+write output to nc1:"rttest/basic_metadata_node.adm";
+
+for $c in dataset('Node')
+return $c
diff --git a/asterix-app/src/test/resources/metadata/queries/basic/metadata_nodegroup.aql b/asterix-app/src/test/resources/metadata/queries/basic/metadata_nodegroup.aql
new file mode 100644
index 0000000..86615e6
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/basic/metadata_nodegroup.aql
@@ -0,0 +1,6 @@
+use dataverse Metadata;
+
+write output to nc1:"rttest/basic_metadata_nodegroup.adm";
+     
+for $c in dataset('Nodegroup')
+return $c