Index: test/edu/ucsb/nceas/metacattest/InlineDataAccessTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/InlineDataAccessTest.java	(revision 4678)
+++ test/edu/ucsb/nceas/metacattest/InlineDataAccessTest.java	(revision 4679)
@@ -203,14 +203,14 @@
 		if (onlineUrl1 != null) {
 			testDocument = testDocument
 					+ "<distribution scope=\"document\" id=\"InlineEntity1\">"
-					+ "<Inline><url function=\"download\">" + onlineUrl1
-					+ "</url></Inline></distribution>";
+					+ "<inline><url function=\"download\">" + onlineUrl1
+					+ "</url></inline></distribution>";
 		}
 		if (onlineUrl2 != null) {
 			testDocument = testDocument
 					+ "<distribution scope=\"document\" id=\"InlineEntity2\">"
-					+ "<Inline><url function=\"download\">" + onlineUrl2
-					+ "</url></Inline></distribution>";
+					+ "<inline><url function=\"download\">" + onlineUrl2
+					+ "</url></inline></distribution>";
 		}
 		testDocument += testEmlContactBlock;
 		
@@ -253,7 +253,7 @@
 
 		testDocument += "</eml:eml>";
 
-		debug("Returning following document" + testDocument);
+		debug("get201TestEmlDoc returning following document: " + testDocument);
 		return testDocument;
 	}
     
@@ -289,7 +289,7 @@
 				+ "        <numHeaderLines>1</numHeaderLines>"
 				+ "        <attributeOrientation>column</attributeOrientation>"
 				+ "        <simpleDelimited>"
-				+ "          <fieldDelimiter>\t</fieldDelimiter>"
+				+ "          <fieldDelimiter>,</fieldDelimiter>"
 				+ "        </simpleDelimited>"
 				+ "      </textFormat>"
 				+ "    </dataFormat>";
@@ -312,8 +312,8 @@
 		}
 		if (onlineUrl1 != null) {
 			testDocument = testDocument
-					+ "<distribution><Inline><url function=\"download\">" + onlineUrl1
-					+ "</url></Inline>";
+					+ "<distribution><inline><url function=\"download\">" + onlineUrl1
+					+ "</url></inline>";
 			if (onlineAccessBlock1 != null) {
 				testDocument += onlineAccessBlock1;
 			}
@@ -321,8 +321,8 @@
 		}
 		if (onlineUrl2 != null) {
 			testDocument = testDocument
-					+ "<distribution><Inline><url function=\"download\">" + onlineUrl2
-					+ "</url></Inline>";
+					+ "<distribution><inline><url function=\"download\">" + onlineUrl2
+					+ "</url></inline>";
 			if (onlineAccessBlock2 != null) {
 				testDocument += onlineAccessBlock2;
 			}
@@ -354,7 +354,7 @@
 			+ "  </attributeList>"
 			+ "</dataTable></dataset></eml:eml>";
 
-		debug("Returning following document" + testDocument);
+		debug("get210TestEmlDoc returning following document: " + testDocument);
 		return testDocument;
 	}
 
@@ -509,6 +509,8 @@
 			testdocument = get210TestEmlDoc("Testing insert", testEmlInlineBlock1,
 					null, null, null, null, null, null, null, null);
 
+			debug("testdocument: " + testdocument);
+			
 			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
 			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, true);
 
@@ -872,6 +874,7 @@
 
 			// ///////Case 1./////////////////////
 			// insert an inline document - read only
+			debug("Case 1:");
 			m.login(username, password);
 			newdocid = generateDocid();
 
@@ -915,10 +918,13 @@
 
 			// ///////Case 2./////////////////////
 			// insert an inline document - write only
+			debug("Case 2:");
 			m.login(username, password);
 			newdocid = generateDocid();
 
 			// insert a document which gives read access to the inline document
+			debug("Inserting doc: " + newdocid + ".1, which allows document level" 
+					+ " write access for " + anotheruser + " and expect SUCCESS");
 			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
 					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
 							true, false, true, false, false), null, null, null, null);
@@ -929,11 +935,15 @@
 			m.login(anotheruser, anotherpassword);
 
 			// try to read the document and the inline data
+			debug("Try to read:" + newdocid + ".1 as user: " + anotheruser 
+					+ " and expect FAILURE since write access does not imply read access");
 			readDocid(newdocid + ".1", FAILURE, true);
 			readInlineDataWhichEqualsDoc(newdocid + ".1.1", testEmlInlineBlock1, FAILURE,
 					true);
 
 			// try to update the inline data
+			debug("Updating doc: " + newdocid + ".2, with new inline data." 
+					+ " as: " + anotheruser + " and expect SUCCESS");
 			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing update",
 					testEmlInlineBlock2, null, null, null, getAccessBlock(anotheruser,
 							true, false, true, false, false), null, null, null, null);
@@ -956,94 +966,96 @@
 			deleteDocid(newdocid + ".2", SUCCESS, false);
 			m.logout();
 
-//			// ///////Case 3./////////////////////
-//			// insert an inline document - change permission only
-//			m.login(username, password);
-//			newdocid = generateDocid();
-//
-//			// insert a document which gives read access to the inline document
-//			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
-//					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
-//							true, false, false, true, false), null, null, null, null);
-//			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
-//			m.logout();
-//
-//			// login as another user
-//			m.login(anotheruser, anotherpassword);
-//
-//			// try to read the document and the inline data
-//			readDocid(newdocid + ".1", FAILURE, true);
-//			readInlineDataWhichEqualsDoc(newdocid + ".1.1", testEmlInlineBlock1, FAILURE,
-//					true);
-//
-//			// try to update the inline data
-//			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing update",
-//					testEmlInlineBlock2, null, null, null, getAccessBlock(anotheruser,
-//							true, false, false, true, false), null, null, null, null);
-//			Thread.sleep(2000);
-//			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
-//
-//			// try to set the permissions for the inline data
-//			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
-//					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
-//							true, false, false, false, true), null, null, null, null);
-//			// ERRRRRRRRRRRR
-//			// updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
-//
-//			// try to delete the document
-//			deleteDocid(newdocid + ".1", FAILURE, true);
-//			m.logout();
-//
-//			// delete the document
-//			m.login(username, password);
-//			deleteDocid(newdocid + ".1", SUCCESS, false);
-//			m.logout();
-//
-//			// ///////Case 4./////////////////////
-//			// insert an inline document - change permission only
-//			m.login(username, password);
-//			newdocid = generateDocid();
-//
-//			// insert a document which gives read access to the inline document
-//			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
-//					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
-//							true, false, false, false, true), null, null, null, null);
-//			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
-//			m.logout();
-//
-//			// login as another user
-//			m.login(anotheruser, anotherpassword);
-//
-//			// try to read the document and the inline data
-//			readDocid(newdocid + ".1", SUCCESS, false);
-//			readInlineDataWhichEqualsDoc(newdocid + ".1.1", testEmlInlineBlock1, SUCCESS,
-//					false);
-//
-//			// try to update the inline data
-//			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing update",
-//					testEmlInlineBlock2, null, null, null, getAccessBlock(anotheruser,
-//							true, false, false, false, true), null, null, null, null);
-//			Thread.sleep(2000);
-//			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
-//
-//			// try to set the permissions for the inline data
-//			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
-//					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
-//							true, true, true, true, false), null, null, null, null);
-//			Thread.sleep(2000);
-//			updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
-//
-//			// try to delete the document
-//			// sleep needed only in case of inline data - jing said that
-//			// somehow the thread writing data to xml_index takes too much time
-//			// when used with inline data. hence if delete is requested too soon
-//			// database gives an error of xml_index records left with FK to
-//			// xml_document record which is going to be deleted.
-//			Thread.sleep(10000);
-//
-//			deleteDocid(newdocid + ".3", SUCCESS, false);
-//			m.logout();
+			// ///////Case 3./////////////////////
+			// insert an inline document - change permission only
+			debug("Case 3:");
+			m.login(username, password);
+			newdocid = generateDocid();
 
+			// insert a document which gives read access to the inline document
+			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
+					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
+							true, false, false, true, false), null, null, null, null);
+			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			m.logout();
+
+			// login as another user
+			m.login(anotheruser, anotherpassword);
+
+			// try to read the document and the inline data
+			readDocid(newdocid + ".1", FAILURE, true);
+			readInlineDataWhichEqualsDoc(newdocid + ".1.1", testEmlInlineBlock1, FAILURE,
+					true);
+
+			// try to update the inline data
+			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing update",
+					testEmlInlineBlock2, null, null, null, getAccessBlock(anotheruser,
+							true, false, false, true, false), null, null, null, null);
+			Thread.sleep(2000);
+			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
+
+			// try to set the permissions for the inline data
+			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
+					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
+							true, false, false, false, true), null, null, null, null);
+			// ERRRRRRRRRRRR
+			// updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+
+			// try to delete the document
+			deleteDocid(newdocid + ".1", FAILURE, true);
+			m.logout();
+
+			// delete the document
+			m.login(username, password);
+			deleteDocid(newdocid + ".1", SUCCESS, false);
+			m.logout();
+
+			// ///////Case 4./////////////////////
+			// insert an inline document - change permission only
+			debug("Case 4:");
+			m.login(username, password);
+			newdocid = generateDocid();
+
+			// insert a document which gives read access to the inline document
+			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
+					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
+							true, false, false, false, true), null, null, null, null);
+			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			m.logout();
+
+			// login as another user
+			m.login(anotheruser, anotherpassword);
+
+			// try to read the document and the inline data
+			readDocid(newdocid + ".1", SUCCESS, false);
+			readInlineDataWhichEqualsDoc(newdocid + ".1.1", testEmlInlineBlock1, SUCCESS,
+					false);
+
+			// try to update the inline data
+			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing update",
+					testEmlInlineBlock2, null, null, null, getAccessBlock(anotheruser,
+							true, false, false, false, true), null, null, null, null);
+			Thread.sleep(2000);
+			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+
+			// try to set the permissions for the inline data
+			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
+					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
+							true, true, true, true, false), null, null, null, null);
+			Thread.sleep(2000);
+			updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
+
+			// try to delete the document
+			// sleep needed only in case of inline data - jing said that
+			// somehow the thread writing data to xml_index takes too much time
+			// when used with inline data. hence if delete is requested too soon
+			// database gives an error of xml_index records left with FK to
+			// xml_document record which is going to be deleted.
+			Thread.sleep(10000);
+
+			deleteDocid(newdocid + ".3", SUCCESS, false);
+			m.logout();
+
 		} catch (MetacatAuthException mae) {
 			fail("Authorization failed:\n" + mae.getMessage());
 		} catch (MetacatInaccessibleException mie) {
@@ -1466,41 +1478,41 @@
 	 * metadata and no access for data
 	 */
     public void inlineData201CasesTest_5() {
-		debug("\nRunning: inlineDataCasesTest_5()");
+		debug("\nRunning: inlineData201CasesTest_5()");
 		try {
 
-//			m.login(username, password);
-//
-//			/////////Case 1
-//			debug("Case 1:");
-//			testdocument = get201TestEmlDoc("InlineDataAccessTest: Doing insert",
-//					null, null, null, null, null, getAccessBlock(anotheruser, true, true,
-//							false, false, false), null, null, null);
-//			newdocid = generateDocid();
-//
-//			// try to insert the wrong document.  This document is wrong because
-//			// it has an access block but no distribution.
-//			insertDocid(newdocid + ".1", testdocument, FAILURE, false);
-//			m.logout();
-//
-//			/////////Case 2
-//			debug("Case 2:");
-//			m.login(username, password);
-//			testdocument = get201TestEmlDoc("InlineDataAccessTest: Doing insert",
-//					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
-//							true, true, true, false, false), null, null, null, null);
-//			newdocid = generateDocid();
-//			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
-//			m.logout();
-//
-//			m.login(anotheruser, anotherpassword);
-//			testdocument = get201TestEmlDoc("InlineDataAccessTest: Doing insert",
-//					null, null, null, null, getAccessBlock(anotheruser, true, true, true,
-//							false, false), null, null, null, null);
-//			/// ERRRRRRRRRRRR
-//			Thread.sleep(2000);
-//			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+			m.login(username, password);
 
+			/////////Case 1
+			debug("Case 1:");
+			testdocument = get201TestEmlDoc("InlineDataAccessTest: Doing insert",
+					null, null, null, null, null, getAccessBlock(anotheruser, true, true,
+							false, false, false), null, null, null);
+			newdocid = generateDocid();
+
+			// try to insert the wrong document.  This document is wrong because
+			// it has an access block but no distribution.
+			insertDocid(newdocid + ".1", testdocument, FAILURE, false);
+			m.logout();
+
+			/////////Case 2
+			debug("Case 2:");
+			m.login(username, password);
+			testdocument = get201TestEmlDoc("InlineDataAccessTest: Doing insert",
+					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
+							true, true, true, false, false), null, null, null, null);
+			newdocid = generateDocid();
+			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			m.logout();
+
+			m.login(anotheruser, anotherpassword);
+			testdocument = get201TestEmlDoc("InlineDataAccessTest: Doing insert",
+					null, null, null, null, getAccessBlock(anotheruser, true, true, true,
+							false, false), null, null, null, null);
+			/// ERRRRRRRRRRRR
+			Thread.sleep(2000);
+			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+
 			/////////Case 3
 			debug("Case 3:");
 			// insert a document
@@ -1549,25 +1561,9 @@
 	 * metadata and no access for data
 	 */
     public void inlineData210CasesTest_5() {
-		debug("\nRunning: inlineDataCasesTest_5()");
+		debug("\nRunning: inlineData210CasesTest_5()");
 		try {
 
-			// Removed test case 1 since there is no way to create a document in 
-			// 2.1.0 that has a distribution access element without the distritribution
-			// section.
-//			m.login(username, password);
-//
-//			/////////Case 1
-//			debug("Case 1:");
-//			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
-//					null, null, null, null, null, getAccessBlock(anotheruser, true, true,
-//							false, false, false), null, null, null);
-//			newdocid = generateDocid();
-//
-//			// try to insert the wrong document
-//			insertDocid(newdocid + ".1", testdocument, FAILURE, false);
-//			m.logout();
-
 			/////////Case 2
 			debug("Case 2:");
 			m.login(username, password);
@@ -1607,7 +1603,7 @@
 			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
 
 			// try to update the rules for inline data
-			// / ERRRRRRRRRRRR it lets you do that
+			// shouldn't succeed
 			testdocument = get210TestEmlDoc("InlineDataAccessTest: Doing insert",
 					testEmlInlineBlock1, null, null, null, getAccessBlock(anotheruser,
 							true, false, false, false, true), getAccessBlock(anotheruser,
@@ -1632,7 +1628,7 @@
 	 * inserted and updated, do access rules apply to the old document
 	 */
       public void inlineData201CasesTest_6() {
-		debug("\nRunning: inlineDataCasesTest_6()");
+		debug("\nRunning: inlineData201CasesTest_6()");
 		try {
 
 			// insert the document
@@ -1682,7 +1678,7 @@
 	 * inserted and updated, do access rules apply to the old document
 	 */
 	public void inlineData210CasesTest_6() {
-		debug("\nRunning: inlineDataCasesTest_6()");
+		debug("\nRunning: inlineData210CasesTest_6()");
 		try {
 
 			// insert the document
