Added basic testing. This fix is ready for review.

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix-fix-issue-9@278 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-btree-secondary-index-nullable.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-btree-secondary-index-nullable.aql
new file mode 100644
index 0000000..a35c8e5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-btree-secondary-index-nullable.aql
@@ -0,0 +1,42 @@
+/* 
+ * Test case Name  : scan-delete-btree-secondary-index-nullable.aql
+ * Description     : This test is intended to test deletion from secondary btree indexes that are built on nullable fields 
+ * Expected Result : Success
+ * Date            : May 12 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as closed {
+  number: int32, 
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int32, 
+  name: string,
+  age: int32?,
+  address: AddressType?,
+  interests: {{string}},
+  children: [ { name: string, age: int32? } ]
+}
+
+create dataset Customers(CustomerType) partitioned by key cid;
+
+load dataset Customers 
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/semistructured/co1k/customer.adm"),("format"="adm"));
+
+create index age_index on Customers(age);
+
+delete $c from dataset Customers where $c.cid>=200;
+
+write output to nc1:"rttest/dml_scan-delete-btree-secondary-index-nullable.adm";
+
+for $c in dataset('Customers')
+where $c.age < 20
+order by $c.cid
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index-nullable.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index-nullable.aql
new file mode 100644
index 0000000..fc30529
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/scan-delete-rtree-secondary-index-nullable.aql
@@ -0,0 +1,39 @@
+/* 
+ * Test case Name  : scan-delete-rtree-secondary-index-nullable.aql
+ * Description     : This test is intended to test deletion from secondary rtree indexes that are built on nullable fields 
+ * Expected Result : Success
+ * Date            : May 12 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+  id: int32,
+  point: point?,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle
+}
+
+create dataset MyData(MyRecord)
+  partitioned by key id;
+
+load dataset MyData 
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialDataNulls.json"),("format"="adm")) pre-sorted;
+
+create index rtree_index_point on MyData(point) type rtree;
+
+delete $m from dataset MyData where $m.id>10;
+
+write output to nc1:"rttest/dml_scan-delete-rtree-secondary-index-nullable.adm";
+
+for $o in dataset('MyData')
+where spatial-intersect($o.point, create-polygon(create-point(0.0,1.0), create-point(0.0,4.0), create-point(12.0,4.0), create-point(12.0,1.0)))
+order by $o.id
+return {"id":$o.id}
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-btree-secondary-index-nullable.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-btree-secondary-index-nullable.aql
new file mode 100644
index 0000000..d5d22d3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-btree-secondary-index-nullable.aql
@@ -0,0 +1,55 @@
+/* 
+ * Test case Name  : scan-delete-btree-secondary-index-nullable.aql
+ * Description     : This test is intended to test insertion into secondary btree indexes that are built on nullable fields 
+ * Expected Result : Success
+ * Date            : May 12 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as closed {
+  number: int32, 
+  street: string,
+  city: string
+}
+
+create type CustomerType as closed {
+  cid: int32, 
+  name: string,
+  age: int32?,
+  address: AddressType?,
+  interests: {{string}},
+  children: [ { name: string, age: int32? } ]
+}
+
+create dataset Customers(CustomerType) partitioned by key cid;
+create dataset CustomersMini(CustomerType) partitioned by key cid;
+
+load dataset Customers 
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/semistructured/co1k/customer.adm"),("format"="adm"));
+
+create index age_index on CustomersMini(age);
+
+insert into dataset CustomersMini
+(
+	for $c in dataset('Customers')
+	where $c.cid < 200	
+	return {
+	  "cid": $c.cid,
+  	  "name": $c.name,
+  	  "age": $c.age,
+  	  "address": $c.address,
+  	  "interests": $c.interests,
+  	  "children": $c.children
+	}	
+);
+
+write output to nc1:"rttest/dml_scan-insert-btree-secondary-index-nullable.adm";
+
+for $c in dataset('CustomersMini')
+where $c.age < 20
+order by $c.cid
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index-nullable.aql b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index-nullable.aql
new file mode 100644
index 0000000..161439a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/scan-insert-rtree-secondary-index-nullable.aql
@@ -0,0 +1,54 @@
+/* 
+ * Test case Name  : scan-insert-rtree-secondary-index-nullable.aql
+ * Description     : This test is intended to test insertion into secondary rtree indexes that are built on nullable fields 
+ * Expected Result : Success
+ * Date            : May 12 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as closed {
+  id: int32,
+  point: point?,
+  kwds: string,
+  line1: line,
+  line2: line,
+  poly1: polygon,
+  poly2: polygon,
+  rec: rectangle
+}
+
+create type MyMiniRecord as closed {
+  id: int32,
+  point: point?
+}
+
+create dataset MyData(MyRecord)
+  partitioned by key id;
+
+load dataset MyData 
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialDataNulls.json"),("format"="adm")) pre-sorted;
+
+create dataset MyMiniData(MyMiniRecord)
+  partitioned by key id;
+
+create index rtree_index_point on MyMiniData(point) type rtree;
+
+insert into dataset MyMiniData
+(
+	for $m in dataset('MyData')
+	return {
+		"id": $m.id,
+		"point": $m.point
+	}
+);
+
+write output to nc1:"rttest/dml_scan-insert-rtree-secondary-index-nullable.adm";
+
+for $o in dataset('MyMiniData')
+where spatial-intersect($o.point, create-polygon(create-point(0.0,1.0), create-point(0.0,4.0), create-point(12.0,4.0), create-point(12.0,1.0)))
+order by $o.id
+return {"id":$o.id}