r4508 - trunk/test/edu/ucsb/nceas/metacattest

daigle at ecoinformatics.org daigle at ecoinformatics.org
Tue Nov 4 16:01:18 PST 2008


Author: daigle
Date: 2008-11-04 16:01:17 -0800 (Tue, 04 Nov 2008)
New Revision: 4508

Modified:
   trunk/test/edu/ucsb/nceas/metacattest/AccessControlTest.java
Log:
Stripped out common eml document creation elements and put into the MCTestCase base class

Modified: trunk/test/edu/ucsb/nceas/metacattest/AccessControlTest.java
===================================================================
--- trunk/test/edu/ucsb/nceas/metacattest/AccessControlTest.java	2008-11-04 23:59:43 UTC (rev 4507)
+++ trunk/test/edu/ucsb/nceas/metacattest/AccessControlTest.java	2008-11-05 00:01:17 UTC (rev 4508)
@@ -25,304 +25,26 @@
 
 package edu.ucsb.nceas.metacattest;
 
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.SimpleTimeZone;
-import java.util.TimeZone;
 import java.util.Vector;
 
 import edu.ucsb.nceas.MCTestCase;
-import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
-import edu.ucsb.nceas.metacat.client.Metacat;
 import edu.ucsb.nceas.metacat.client.MetacatAuthException;
 import edu.ucsb.nceas.metacat.client.MetacatException;
-import edu.ucsb.nceas.metacat.client.MetacatFactory;
 import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
-import edu.ucsb.nceas.metacat.service.PropertyService;
-import edu.ucsb.nceas.utilities.IOUtil;
-import edu.ucsb.nceas.utilities.PropertyNotFoundException;
 import junit.framework.Test;
 import junit.framework.TestSuite;
-import java.io.File;
+// import java.io.File;
 
 /**
  * A JUnit test for testing Access Control in Metacat
  */
 public class AccessControlTest extends MCTestCase {
 
-	private static String metacatUrl;
-	private static String username;
-	private static String password;
-	private static String anotheruser;
-	private static String anotherpassword;
-	static {
-		try {
-			metacatUrl = PropertyService.getProperty("test.metacatUrl");
-			username = PropertyService.getProperty("test.mcUser");
-			password = PropertyService.getProperty("test.mcPassword");
-			anotheruser = PropertyService.getProperty("test.mcAnotherUser");
-			anotherpassword = PropertyService.getProperty("test.mcAnotherPassword");
-		} catch (PropertyNotFoundException pnfe) {
-			System.err.println("Could not get property in static block: "
-					+ pnfe.getMessage());
-		}
-	}
-
-	private String prefix = "test";
 	private String newdocid = null;
-	private String testdocument = "";
 	private String onlineDocid;
 	private String onlinetestdatafile1 = "test/onlineDataFile1";
-//	private String onlinetestdatafile2 = "test/onlineDataFile2";
-	private static final String ALLOWFIRST = "allowFirst";
-	private static final String DENYFIRST = "denyFirst";
 
-	private Metacat m;
-
 	/**
-	 * These variables are for eml-2.0.1 only. For other eml versions, this
-	 * function might have to modified
-	 */
-	private String testEml_200_Header = "<?xml version=\"1.0\"?><eml:eml"
-		+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.0\""
-		+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
-		+ " packageId=\"eml.1.1\" system=\"knb\""
-		+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.0 eml.xsd\""
-		+ " scope=\"system\">";
-	
-	private String testEml_201_Header = "<?xml version=\"1.0\"?><eml:eml"
-		+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.1\""
-		+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
-		+ " packageId=\"eml.1.1\" system=\"knb\""
-		+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.1 eml.xsd\""
-		+ " scope=\"system\">";
-	
-	private String testEml_210_Header = "<?xml version=\"1.0\"?><eml:eml"
-			+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.1.0\""
-			+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
-			+ " packageId=\"eml.1.1\" system=\"knb\""
-			+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.1.0 eml.xsd\""
-			+ " scope=\"system\">";
-
-	private String testEmlCreatorBlock = "<creator scope=\"document\">                                       "
-			+ " <individualName>                                                  "
-			+ "    <surName>Smith</surName>                                       "
-			+ " </individualName>                                                 "
-			+ "</creator>                                                         ";
-
-	private String testEmlContactBlock = "<contact scope=\"document\">                                       "
-			+ " <individualName>                                                  "
-			+ "    <surName>Jackson</surName>                                     "
-			+ " </individualName>                                                 "
-			+ "</contact>                                                         ";
-
-	private String testEmlInlineBlock1 = "<inline>                                                           "
-			+ "  <admin>                                                          "
-			+ "    <contact>                                                      "
-			+ "      <name>Operator</name>                                        "
-			+ "      <institution>PSI</institution>                               "
-			+ "    </contact>                                                     "
-			+ "  </admin>                                                         "
-			+ "</inline>                                                          ";
-
-	private String testEmlInlineBlock2 = "<inline>                                                           "
-			+ "  <instrument>                                                     "
-			+ "    <instName>LCQ</instName>                                       "
-			+ "    <source type=\"ESI\"></source>                                 "
-			+ "    <detector type=\"EM\"></detector>                              "
-			+ "  </instrument>                                                    "
-			+ "</inline>                                                          ";
-
-	/*
-	 * Retrus an access block base on params passed and the defaul perm order -
-	 * allow first
-	 */
-	private String getAccessBlock(String principal, boolean grantAccess, boolean read,
-			boolean write, boolean changePermission, boolean all) {
-		return getAccessBlock(principal, grantAccess, read, write, changePermission, all,
-				ALLOWFIRST);
-	}
-
-	/**
-	 * This function returns an access block based on the params passed
-	 */
-	private String getAccessBlock(String principal, boolean grantAccess, boolean read,
-			boolean write, boolean changePermission, boolean all, String permOrder) {
-		String accessBlock = "<access "
-				+ "authSystem=\"ldap://ldap.ecoinformatics.org:389/dc=ecoinformatics,dc=org\""
-				+ " order=\"" + permOrder + "\"" + " scope=\"document\"" + ">";
-
-		accessBlock += generateOneAccessRule(principal, grantAccess, read, write,
-				changePermission, all);
-		accessBlock += "</access>";
-
-		return accessBlock;
-
-	}
-
-	/*
-	 * Gets eml access block base on given acccess rules and perm order
-	 */
-	private String getAccessBlock(Vector<String> accessRules, String permOrder) {
-		String accessBlock = "<access "
-				+ "authSystem=\"ldap://ldap.ecoinformatics.org:389/dc=ecoinformatics,dc=org\""
-				+ " order=\"" + permOrder + "\"" + " scope=\"document\"" + ">";
-		// adding rules
-		if (accessRules != null && !accessRules.isEmpty()) {
-			for (int i = 0; i < accessRules.size(); i++) {
-				String rule = (String) accessRules.elementAt(i);
-				accessBlock += rule;
-
-			}
-		}
-		accessBlock += "</access>";
-		return accessBlock;
-	}
-
-	/*
-	 * Generates a access rule for given parameter. Note this xml portion
-	 * doesn't include <access></access>
-	 */
-	private String generateOneAccessRule(String principal, boolean grantAccess,
-			boolean read, boolean write, boolean changePermission, boolean all) {
-		String accessBlock = "";
-
-		if (grantAccess) {
-			accessBlock = "<allow>";
-		} else {
-			accessBlock = "<deny>";
-		}
-
-		accessBlock = accessBlock + "<principal>" + principal + "</principal>";
-
-		if (all) {
-			accessBlock += "<permission>all</permission>";
-		} else {
-			if (read) {
-				accessBlock += "<permission>read</permission>";
-			}
-			if (write) {
-				accessBlock += "<permission>write</permission>";
-			}
-			if (changePermission) {
-				accessBlock += "<permission>changePermission</permission>";
-			}
-		}
-
-		if (grantAccess) {
-			accessBlock += "</allow>";
-		} else {
-			accessBlock += "</deny>";
-		}
-		return accessBlock;
-
-	}
-
-	/**
-	 * This function returns a valid eml document with no access rules 
-	 */
-	private String getTestEmlDoc(String title, String emlVersion, String inlineData1,
-			String inlineData2, String onlineUrl1, String onlineUrl2,
-			String docAccessBlock, String inlineAccessBlock1, String inlineAccessBlock2,
-			String onlineAccessBlock1, String onlineAccessBlock2) {
-
-		debug("getTestEmlDoc(): title=" + title + " inlineData1=" + inlineData1
-				+ " inlineData2=" + inlineData2 + " onlineUrl1=" + onlineUrl1
-				+ " onlineUrl2=" + onlineUrl2 + " docAccessBlock=" + docAccessBlock
-				+ " inlineAccessBlock1=" + inlineAccessBlock1 + " inlineAccessBlock2="
-				+ inlineAccessBlock2 + " onlineAccessBlock1=" + onlineAccessBlock1
-				+ " onlineAccessBlock2=" + onlineAccessBlock2);
-		String testDocument = "";
-		String header;
-		if (emlVersion == EML2_0_0) {
-			header = testEml_200_Header;
-		} else if (emlVersion == EML2_0_1) {
-			header = testEml_201_Header;
-		} else {
-			header = testEml_210_Header;
-		}
-		testDocument += header;
-		
-		// if this is a 2.1.0+ document, the document level access block sits
-		// at the same level and before the dataset element.
-		if (docAccessBlock != null && emlVersion.equals(EML2_1_0)) {
-			testDocument += docAccessBlock;
-		}
-		
-		testDocument += "<dataset scope=\"document\"><title>"
-				+ title + "</title>" + testEmlCreatorBlock;
-
-		if (inlineData1 != null) {
-			testDocument = testDocument
-					+ "<distribution scope=\"document\" id=\"inlineEntity1\">"
-					+ inlineData1 + "</distribution>";
-		}
-		if (inlineData2 != null) {
-			testDocument = testDocument
-					+ "<distribution scope=\"document\" id=\"inlineEntity2\">"
-					+ inlineData2 + "</distribution>";
-		}
-		if (onlineUrl1 != null) {
-			testDocument = testDocument
-					+ "<distribution scope=\"document\" id=\"onlineEntity1\">"
-					+ "<online><url function=\"download\">" + onlineUrl1
-					+ "</url></online></distribution>";
-		}
-		if (onlineUrl2 != null) {
-			testDocument = testDocument
-					+ "<distribution scope=\"document\" id=\"onlineEntity2\">"
-					+ "<online><url function=\"download\">" + onlineUrl2
-					+ "</url></online></distribution>";
-		}
-		testDocument += testEmlContactBlock;
-
-		// if this is a 2.0.X document, the document level access block sits
-		// inside the dataset element.
-		if (docAccessBlock != null && 
-				(emlVersion.equals(EML2_0_0) || emlVersion.equals(EML2_0_1))) {
-			testDocument += docAccessBlock;
-		}
-
-		testDocument += "</dataset>";
-
-		if (inlineAccessBlock1 != null) {
-			testDocument += "<additionalMetadata>";
-			testDocument += "<describes>inlineEntity1</describes>";
-			testDocument += inlineAccessBlock1;
-			testDocument += "</additionalMetadata>";
-		}
-
-		if (inlineAccessBlock2 != null) {
-			testDocument += "<additionalMetadata>";
-			testDocument += "<describes>inlineEntity2</describes>";
-			testDocument += inlineAccessBlock2;
-			testDocument += "</additionalMetadata>";
-		}
-
-		if (onlineAccessBlock1 != null) {
-			testDocument += "<additionalMetadata>";
-			testDocument += "<describes>onlineEntity1</describes>";
-			testDocument += onlineAccessBlock1;
-			testDocument += "</additionalMetadata>";
-		}
-
-		if (onlineAccessBlock2 != null) {
-			testDocument += "<additionalMetadata>";
-			testDocument += "<describes>onlineEntity2</describes>";
-			testDocument += onlineAccessBlock2;
-			testDocument += "</additionalMetadata>";
-		}
-
-		testDocument += "</eml:eml>";
-
-		// System.out.println("Returning following document" + testDocument);
-		return testDocument;
-	}
-
-	/**
 	 * Constructor to build the test
 	 * 
 	 * @param name
@@ -330,20 +52,15 @@
 	 */
 	public AccessControlTest(String name) {
 		super(name);
-		newdocid = generateDocid();
+		newdocid = generateDocumentId();
 	}
 
 	/**
 	 * Establish a testing framework by initializing appropriate objects
 	 */
-	public void setUp() {
-		try {
-			debug("Test Metacat: " + metacatUrl);
-			m = MetacatFactory.createMetacatConnection(metacatUrl);
-		} catch (MetacatInaccessibleException mie) {
-			System.err.println("Metacat is: " + metacatUrl);
-			fail("Metacat connection failed." + mie.getMessage());
-		}
+	public void setUp() throws Exception {
+		metacatConnectionNeeded = true;
+		super.setUp();
 	}
 
 	/**
@@ -439,7 +156,7 @@
 		try {
 			debug("\nRunning: test201AllowFirst test");
 			String emlVersion = EML2_0_1;
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 			// ====1 inserts a document with access rules (allowFirst) - allow
 			// READ rule for another user,
 			// deny READ rule for public.
@@ -458,7 +175,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -466,17 +183,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".1", FAILURE, true);
+			deleteDocumentId(newdocid + ".1", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -498,7 +215,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -506,17 +223,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".3", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".3", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".2", FAILURE, true);
+			deleteDocumentId(newdocid + ".2", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -537,7 +254,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -545,17 +262,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".3", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".3", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".3", FAILURE, true);
+			deleteDocumentId(newdocid + ".3", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -578,7 +295,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
 			m.logout();
 			debug("logging out");
 			// login as another user
@@ -586,17 +303,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
 			// fails to update this document
-			updateDocid(newdocid + ".5", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".5", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".5", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".5", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".4", FAILURE, true);
+			deleteDocumentId(newdocid + ".4", FAILURE, true);
 			// logout
 			m.logout();
 
@@ -618,7 +335,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -626,17 +343,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".7", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".7", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".6", FAILURE, true);
+			deleteDocumentId(newdocid + ".6", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -662,7 +379,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".7", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -670,17 +387,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".7", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".7", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".8", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".8", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".8", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".8", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".7", FAILURE, true);
+			deleteDocumentId(newdocid + ".7", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -706,7 +423,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".8", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".8", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -714,17 +431,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".8", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".8", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".9", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".9", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".9", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".9", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".8", FAILURE, true);
+			deleteDocumentId(newdocid + ".8", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -749,7 +466,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".9", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".9", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -757,17 +474,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".9", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".9", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".10", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".10", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".9", FAILURE, true);
+			deleteDocumentId(newdocid + ".9", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -793,7 +510,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -801,17 +518,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeed to read this document
-			readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
 			// fails to update this document
-			updateDocid(newdocid + ".11", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".11", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".10", FAILURE, true);
+			deleteDocumentId(newdocid + ".10", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -837,7 +554,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -845,17 +562,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".11", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".11", testdocument, FAILURE, true);
 			// succeed to update this document
-			updateDocid(newdocid + ".12", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".12", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".13", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".13", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".12", FAILURE, true);
+			deleteDocumentId(newdocid + ".12", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -928,7 +645,7 @@
 		try {
 			debug("\nRunning: test210AllowFirst test");
 			String emlVersion = EML2_1_0;
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 			// ====1 inserts a document with access rules (allowFirst) - allow
 			// READ rule for another user,
 			// deny READ rule for public.
@@ -947,7 +664,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -955,17 +672,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".1", FAILURE, true);
+			deleteDocumentId(newdocid + ".1", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -987,7 +704,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -995,17 +712,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".3", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".3", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".2", FAILURE, true);
+			deleteDocumentId(newdocid + ".2", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1026,7 +743,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1034,17 +751,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".3", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".3", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".3", FAILURE, true);
+			deleteDocumentId(newdocid + ".3", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1067,7 +784,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
 			m.logout();
 			debug("logging out");
 			// login as another user
@@ -1075,17 +792,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
 			// fails to update this document
-			updateDocid(newdocid + ".5", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".5", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".5", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".5", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".4", FAILURE, true);
+			deleteDocumentId(newdocid + ".4", FAILURE, true);
 			// logout
 			m.logout();
 
@@ -1107,7 +824,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1115,17 +832,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".7", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".7", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".6", FAILURE, true);
+			deleteDocumentId(newdocid + ".6", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1151,7 +868,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".7", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1159,17 +876,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".7", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".7", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".8", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".8", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".8", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".8", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".7", FAILURE, true);
+			deleteDocumentId(newdocid + ".7", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1195,7 +912,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".8", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".8", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1203,17 +920,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".8", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".8", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".9", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".9", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".9", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".9", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".8", FAILURE, true);
+			deleteDocumentId(newdocid + ".8", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1238,7 +955,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".9", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".9", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1246,17 +963,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".9", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".9", testdocument, FAILURE, true);
 			// fails to update this document
-			updateDocid(newdocid + ".10", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".10", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".9", FAILURE, true);
+			deleteDocumentId(newdocid + ".9", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1282,7 +999,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1290,17 +1007,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeed to read this document
-			readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
 			// fails to update this document
-			updateDocid(newdocid + ".11", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".11", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".10", FAILURE, true);
+			deleteDocumentId(newdocid + ".10", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1326,7 +1043,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1334,17 +1051,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// fails to read this document
-			readDocidWhichEqualsDoc(newdocid + ".11", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".11", testdocument, FAILURE, true);
 			// succeed to update this document
-			updateDocid(newdocid + ".12", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".12", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".13", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".13", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".12", FAILURE, true);
+			deleteDocumentId(newdocid + ".12", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1418,7 +1135,7 @@
 		debug("\nRunning: test201DenyFirst()");
 		String emlVersion = EML2_0_1;
 		try {
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 			// ====1 inserts a document with access rules (denyFirst) - allow
 			// READ rule for another user,
 			// deny READ rule for public.
@@ -1437,7 +1154,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1445,17 +1162,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
 			// fails to update this document
-			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".1", FAILURE, true);
+			deleteDocumentId(newdocid + ".1", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1477,7 +1194,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1485,17 +1202,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".2", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".3", FAILURE, true);
+			deleteDocumentId(newdocid + ".3", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1516,7 +1233,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1524,22 +1241,22 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
 			// succeed to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true, true,
 							true, true), null, null, null, null);
-			updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
 			// succeeds to delete the document
-			deleteDocid(newdocid + ".6", SUCCESS, false);
+			deleteDocumentId(newdocid + ".6", SUCCESS, false);
 			// logout
 			debug("logging out");
 			m.logout();
 
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 			// ====4 The user updates this documents with access rules
 			// (denyFirst) - allow READ and WRITE
 			// rule for another user, deny WRITE rule for public.
@@ -1558,7 +1275,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1566,17 +1283,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".3", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".2", FAILURE, true);
+			deleteDocumentId(newdocid + ".2", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1599,7 +1316,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1607,17 +1324,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
 			// succeed to update this document
-			updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".12", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".12", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".12", FAILURE, true);
+			deleteDocumentId(newdocid + ".12", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1643,7 +1360,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".13", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".13", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1651,17 +1368,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
 			// fails to update this document
-			updateDocid(newdocid + ".14", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".14", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".14", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".14", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".13", FAILURE, true);
+			deleteDocumentId(newdocid + ".13", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1687,7 +1404,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".14", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".14", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1695,17 +1412,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".15", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".15", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".16", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".16", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".15", FAILURE, true);
+			deleteDocumentId(newdocid + ".15", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1730,7 +1447,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".16", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".16", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1738,22 +1455,22 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".17", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".17", testdocument, SUCCESS, false);
 			// succeeds to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true, true,
 							true, true), null, null, null, null);
-			updateDocid(newdocid + ".18", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".18", testdocument, SUCCESS, false);
 			// succeeds to delete the document
-			deleteDocid(newdocid + ".18", SUCCESS, false);
+			deleteDocumentId(newdocid + ".18", SUCCESS, false);
 			// logout
 			debug("logging out");
 			m.logout();
 
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 			// ====9 The user updates this documents with access rules
 			// (denyFirst) - allow READ and WRITE
 			// rule for another user, deny WRITE rule for a group
@@ -1775,7 +1492,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1783,17 +1500,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeed to read this document
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".20", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".20", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".21", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".21", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".20", FAILURE, true);
+			deleteDocumentId(newdocid + ".20", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1819,7 +1536,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".21", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".21", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1827,17 +1544,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".21", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".21", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".22", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".22", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".23", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".23", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".22", FAILURE, true);
+			deleteDocumentId(newdocid + ".22", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1911,7 +1628,7 @@
 		debug("\nRunning: test210DenyFirst()");
 		String emlVersion = EML2_1_0;
 		try {
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 			// ====1 inserts a document with access rules (denyFirst) - allow
 			// READ rule for another user,
 			// deny READ rule for public.
@@ -1930,7 +1647,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1938,17 +1655,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
 			// fails to update this document
-			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".1", FAILURE, true);
+			deleteDocumentId(newdocid + ".1", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -1970,7 +1687,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -1978,17 +1695,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".2", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".3", FAILURE, true);
+			deleteDocumentId(newdocid + ".3", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -2009,7 +1726,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -2017,22 +1734,22 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
 			// succeed to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true, true,
 							true, true), null, null, null, null);
-			updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
 			// succeeds to delete the document
-			deleteDocid(newdocid + ".6", SUCCESS, false);
+			deleteDocumentId(newdocid + ".6", SUCCESS, false);
 			// logout
 			debug("logging out");
 			m.logout();
 
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 			// ====4 The user updates this documents with access rules
 			// (denyFirst) - allow READ and WRITE
 			// rule for another user, deny WRITE rule for public.
@@ -2051,7 +1768,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -2059,17 +1776,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".3", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".2", FAILURE, true);
+			deleteDocumentId(newdocid + ".2", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -2092,7 +1809,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -2100,17 +1817,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
 			// succeed to update this document
-			updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".12", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".12", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".12", FAILURE, true);
+			deleteDocumentId(newdocid + ".12", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -2136,7 +1853,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".13", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".13", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -2144,17 +1861,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
 			// fails to update this document
-			updateDocid(newdocid + ".14", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".14", testdocument, FAILURE, true);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".14", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".14", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".13", FAILURE, true);
+			deleteDocumentId(newdocid + ".13", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -2180,7 +1897,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".14", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".14", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -2188,17 +1905,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".15", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".15", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".16", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".16", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".15", FAILURE, true);
+			deleteDocumentId(newdocid + ".15", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -2223,7 +1940,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".16", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".16", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -2231,22 +1948,22 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".17", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".17", testdocument, SUCCESS, false);
 			// succeeds to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true, true,
 							true, true), null, null, null, null);
-			updateDocid(newdocid + ".18", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".18", testdocument, SUCCESS, false);
 			// succeeds to delete the document
-			deleteDocid(newdocid + ".18", SUCCESS, false);
+			deleteDocumentId(newdocid + ".18", SUCCESS, false);
 			// logout
 			debug("logging out");
 			m.logout();
 
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 			// ====9 The user updates this documents with access rules
 			// (denyFirst) - allow READ and WRITE
 			// rule for another user, deny WRITE rule for a group
@@ -2268,7 +1985,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -2276,17 +1993,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeed to read this document
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".20", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".20", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".21", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".21", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".20", FAILURE, true);
+			deleteDocumentId(newdocid + ".20", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -2312,7 +2029,7 @@
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			updateDocid(newdocid + ".21", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".21", testdocument, SUCCESS, false);
 			debug("logging out");
 			m.logout();
 			// login as another user
@@ -2320,17 +2037,17 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			// succeeds to read this document
-			readDocidWhichEqualsDoc(newdocid + ".21", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".21", testdocument, SUCCESS, false);
 			// succeeds to update this document
-			updateDocid(newdocid + ".22", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".22", testdocument, SUCCESS, false);
 			// fails to update access part
 			testdocument = getTestEmlDoc(
 					"Testing user can not read, write and delete a document", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".23", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".23", testdocument, FAILURE, true);
 			// fails to delete the document
-			deleteDocid(newdocid + ".22", FAILURE, true);
+			deleteDocumentId(newdocid + ".22", FAILURE, true);
 			// logout
 			debug("logging out");
 			m.logout();
@@ -2358,7 +2075,7 @@
 			debug("\nRunning: document201Test()");
 			String emlVersion = EML2_0_1;
 
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
@@ -2369,21 +2086,21 @@
 					+ "<dataset scope=\"document\"><title>submitting eml200</title>"
 					+ testEmlCreatorBlock + testEmlContactBlock + "</dataset></eml:eml>";
 
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 
 			// read the document
-			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
 
 			// update it with 2.0.1 document
 			testdocument = getTestEmlDoc("Updating eml200 with eml201", emlVersion, null,
 					null, null, null, null, null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
 
 			debug("logging out");
 			m.logout();
 
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
@@ -2392,17 +2109,17 @@
 			// insert a document
 			testdocument = getTestEmlDoc("Testing insert", emlVersion, null, null, null,
 					null, null, null, null, null, null);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 
 			// read the document
-			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
 
 			// update the document
 			testdocument = getTestEmlDoc("Testing update", emlVersion, null, null, null,
 					null, null, null, null, null, null);
 			Thread.sleep(10000);
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
 
 			// ///////////////////////////
 			// check what the another user can do
@@ -2414,9 +2131,9 @@
 
 			// check if the user mentioned is able to read/update/delete the
 			// document
-			readDocidWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
-			updateDocid(newdocid + ".3", testdocument, FAILURE, true);
-			deleteDocid(newdocid + ".2", FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
+			deleteDocumentId(newdocid + ".2", FAILURE, true);
 
 			// ///////////////////////////
 			// update the document access control - read only
@@ -2428,8 +2145,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, false,
 							false, false), null, null, null, null);
-			updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2438,22 +2155,22 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			debug(testdocument);
-			readDocidWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 
 			// or the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 
 			// or delete the document
-			deleteDocid(newdocid + ".3", FAILURE, true);
+			deleteDocumentId(newdocid + ".3", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2465,8 +2182,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, true,
 							false, false), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
 			// System.out.println(testdocument);
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2474,22 +2191,22 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".4", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, FAILURE, true);
 
 			// should be able to update the document
 
 			// System.out.println(testdocument);
-			updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
 
 			// but not the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, true,
 							false, true), null, null, null, null);
-			updateDocid(newdocid + ".6", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".6", testdocument, FAILURE, true);
 
 			// try to delete the document
-			deleteDocid(newdocid + ".5", FAILURE, true);
-			// deleteDocid(newdocid + ".4", FAILURE, true);
+			deleteDocumentId(newdocid + ".5", FAILURE, true);
+			// deleteDocumentId(newdocid + ".4", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2501,8 +2218,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							true, false), null, null, null, null);
-			updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".6", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".6", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2510,24 +2227,24 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".6", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".6", testdocument, FAILURE, true);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, true, false), null, null, null, null);
-			updateDocid(newdocid + ".7", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".7", testdocument, FAILURE, true);
 
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
 			// ERRRRRRRROR
-			// updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
+			// updateDocumentId(newdocid + ".7", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			// deleteDocid(newdocid + ".7", FAILURE, true);
-			deleteDocid(newdocid + ".6", FAILURE, true);
+			// deleteDocumentId(newdocid + ".7", FAILURE, true);
+			deleteDocumentId(newdocid + ".6", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2539,8 +2256,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, true,
 							false, false), null, null, null, null);
-			updateDocid(newdocid + ".8", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".8", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2548,19 +2265,19 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
 
 			// should be able to update the document
-			updateDocid(newdocid + ".9", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".9", testdocument, SUCCESS, false);
 
 			// but cant chg the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
-			updateDocid(newdocid + ".10", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
 
 			// try to delete the document
-			deleteDocid(newdocid + ".9", FAILURE, true);
+			deleteDocumentId(newdocid + ".9", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2572,8 +2289,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, false,
 							true, false), null, null, null, null);
-			updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2581,22 +2298,22 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, true, false), null, null, null, null);
-			updateDocid(newdocid + ".11", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
 
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
-			// updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
+			// updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			// deleteDocid(newdocid + ".11", FAILURE, true);
-			deleteDocid(newdocid + ".10", FAILURE, true);
+			// deleteDocumentId(newdocid + ".11", FAILURE, true);
+			deleteDocumentId(newdocid + ".10", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2608,8 +2325,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, false,
 							true, false), null, null, null, null);
-			updateDocid(newdocid + ".12", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".12", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2617,23 +2334,23 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, true, false), null, null, null, null);
-			updateDocid(newdocid + ".13", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".13", testdocument, FAILURE, true);
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, false, true), null, null, null, null);
 			// ERRRRRRRRRRRRRRRR
-			// updateDocid(newdocid + ".13", testdocument, SUCCESS, false);
+			// updateDocumentId(newdocid + ".13", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			// deleteDocid(newdocid + ".13", FAILURE, true);
-			deleteDocid(newdocid + ".12", FAILURE, true);
+			// deleteDocumentId(newdocid + ".13", FAILURE, true);
+			deleteDocumentId(newdocid + ".12", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2645,8 +2362,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, true, true,
 							false), null, null, null, null);
-			updateDocid(newdocid + ".14", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".14", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2654,24 +2371,24 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, false, true), null, null, null, null);
-			updateDocid(newdocid + ".15", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".15", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".15", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".15", testdocument, SUCCESS, false);
 
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".16", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".16", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			deleteDocid(newdocid + ".16", FAILURE, true);
+			deleteDocumentId(newdocid + ".16", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2683,8 +2400,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
-			updateDocid(newdocid + ".17", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".17", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2692,24 +2409,24 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, false, true), null, null, null, null);
-			updateDocid(newdocid + ".18", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".18", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".18", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".18", testdocument, SUCCESS, false);
 
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".19", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".19", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".19", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".19", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			deleteDocid(newdocid + ".19", FAILURE, true);
+			deleteDocumentId(newdocid + ".19", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2717,7 +2434,7 @@
 			// delete the document
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			deleteDocid(newdocid + ".19", SUCCESS, false);
+			deleteDocumentId(newdocid + ".19", SUCCESS, false);
 			debug("logging out");
 			m.logout();
 		} catch (MetacatAuthException mae) {
@@ -2745,7 +2462,7 @@
 			debug("\nRunning: document210Test()");
 			String emlVersion = EML2_1_0;
 
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
@@ -2756,27 +2473,27 @@
 					+ "<dataset scope=\"document\"><title>submitting eml200</title>"
 					+ testEmlCreatorBlock + testEmlContactBlock + "</dataset></eml:eml>";
 
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 
 			// read the document
-			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
 
 			// update it with 2.0.1 document
 			testdocument = getTestEmlDoc("Updating eml200 with eml201", EML2_0_1, null,
 					null, null, null, null, null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
 
 			// update it with 2.1.0 document
 			testdocument = getTestEmlDoc("Updating eml201 with eml210", emlVersion, null,
 					null, null, null, null, null, null, null, null);
-			updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
 
 			debug("logging out");
 			m.logout();
 
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
@@ -2785,17 +2502,17 @@
 			// insert a document
 			testdocument = getTestEmlDoc("Testing insert", emlVersion, null, null, null,
 					null, null, null, null, null, null);
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
 
 			// read the document
-			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
 
 			// update the document
 			testdocument = getTestEmlDoc("Testing update", emlVersion, null, null, null,
 					null, null, null, null, null, null);
 			Thread.sleep(10000);
-			updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
 
 			// ///////////////////////////
 			// check what the another user can do
@@ -2807,9 +2524,9 @@
 
 			// check if the user mentioned is able to read/update/delete the
 			// document
-			readDocidWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
-			updateDocid(newdocid + ".3", testdocument, FAILURE, true);
-			deleteDocid(newdocid + ".2", FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
+			deleteDocumentId(newdocid + ".2", FAILURE, true);
 
 			// ///////////////////////////
 			// update the document access control - read only
@@ -2821,8 +2538,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, false,
 							false, false), null, null, null, null);
-			updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2831,22 +2548,22 @@
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
 			debug(testdocument);
-			readDocidWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 
 			// or the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
 
 			// or delete the document
-			deleteDocid(newdocid + ".3", FAILURE, true);
+			deleteDocumentId(newdocid + ".3", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2858,8 +2575,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, true,
 							false, false), null, null, null, null);
-			updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
 			// System.out.println(testdocument);
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2867,22 +2584,22 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".4", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, FAILURE, true);
 
 			// should be able to update the document
 
 			// System.out.println(testdocument);
-			updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
 
 			// but not the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, true,
 							false, true), null, null, null, null);
-			updateDocid(newdocid + ".6", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".6", testdocument, FAILURE, true);
 
 			// try to delete the document
-			deleteDocid(newdocid + ".5", FAILURE, true);
-			// deleteDocid(newdocid + ".4", FAILURE, true);
+			deleteDocumentId(newdocid + ".5", FAILURE, true);
+			// deleteDocumentId(newdocid + ".4", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2894,8 +2611,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							true, false), null, null, null, null);
-			updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".6", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".6", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2903,24 +2620,24 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".6", testdocument, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".6", testdocument, FAILURE, true);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, true, false), null, null, null, null);
-			updateDocid(newdocid + ".7", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".7", testdocument, FAILURE, true);
 
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
 			// ERRRRRRRROR
-			// updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
+			// updateDocumentId(newdocid + ".7", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			// deleteDocid(newdocid + ".7", FAILURE, true);
-			deleteDocid(newdocid + ".6", FAILURE, true);
+			// deleteDocumentId(newdocid + ".7", FAILURE, true);
+			deleteDocumentId(newdocid + ".6", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2932,8 +2649,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, true,
 							false, false), null, null, null, null);
-			updateDocid(newdocid + ".8", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".8", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2941,19 +2658,19 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
 
 			// should be able to update the document
-			updateDocid(newdocid + ".9", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".9", testdocument, SUCCESS, false);
 
 			// but cant chg the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
-			updateDocid(newdocid + ".10", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
 
 			// try to delete the document
-			deleteDocid(newdocid + ".9", FAILURE, true);
+			deleteDocumentId(newdocid + ".9", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -2965,8 +2682,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, false,
 							true, false), null, null, null, null);
-			updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -2974,22 +2691,22 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, true, false), null, null, null, null);
-			updateDocid(newdocid + ".11", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
 
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
-			// updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
+			// updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			// deleteDocid(newdocid + ".11", FAILURE, true);
-			deleteDocid(newdocid + ".10", FAILURE, true);
+			// deleteDocumentId(newdocid + ".11", FAILURE, true);
+			deleteDocumentId(newdocid + ".10", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -3001,8 +2718,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, false,
 							true, false), null, null, null, null);
-			updateDocid(newdocid + ".12", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".12", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -3010,23 +2727,23 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, true, false), null, null, null, null);
-			updateDocid(newdocid + ".13", testdocument, FAILURE, true);
+			updateDocumentId(newdocid + ".13", testdocument, FAILURE, true);
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, false, true), null, null, null, null);
 			// ERRRRRRRRRRRRRRRR
-			// updateDocid(newdocid + ".13", testdocument, SUCCESS, false);
+			// updateDocumentId(newdocid + ".13", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			// deleteDocid(newdocid + ".13", FAILURE, true);
-			deleteDocid(newdocid + ".12", FAILURE, true);
+			// deleteDocumentId(newdocid + ".13", FAILURE, true);
+			deleteDocumentId(newdocid + ".12", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -3038,8 +2755,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, true, true, true,
 							false), null, null, null, null);
-			updateDocid(newdocid + ".14", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".14", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -3047,24 +2764,24 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, false, true), null, null, null, null);
-			updateDocid(newdocid + ".15", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".15", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".15", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".15", testdocument, SUCCESS, false);
 
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".16", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".16", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			deleteDocid(newdocid + ".16", FAILURE, true);
+			deleteDocumentId(newdocid + ".16", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -3076,8 +2793,8 @@
 			testdocument = getTestEmlDoc("Testing update access block", emlVersion, null,
 					null, null, null, getAccessBlock(anotheruser, true, false, false,
 							false, true), null, null, null, null);
-			updateDocid(newdocid + ".17", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".17", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
 
 			// check if the user mentioned is able to read the document
 			debug("logging out");
@@ -3085,24 +2802,24 @@
 			debug("logging in as: anotheruser=" + anotheruser + " anotherpassword="
 					+ anotherpassword);
 			m.login(anotheruser, anotherpassword);
-			readDocidWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
 
 			// should not be able to update the document
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, false,
 							false, false, true), null, null, null, null);
-			updateDocid(newdocid + ".18", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".18", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".18", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".18", testdocument, SUCCESS, false);
 
 			// but can chg the permissions
 			testdocument = getTestEmlDoc("Testing update from another user", emlVersion,
 					null, null, null, null, getAccessBlock(anotheruser, true, true,
 							false, false, false), null, null, null, null);
-			updateDocid(newdocid + ".19", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".19", testdocument, SUCCESS, false);
+			updateDocumentId(newdocid + ".19", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".19", testdocument, SUCCESS, false);
 
 			// try to delete the document
-			deleteDocid(newdocid + ".19", FAILURE, true);
+			deleteDocumentId(newdocid + ".19", FAILURE, true);
 
 			debug("logging out");
 			m.logout();
@@ -3110,7 +2827,7 @@
 			// delete the document
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
-			deleteDocid(newdocid + ".19", SUCCESS, false);
+			deleteDocumentId(newdocid + ".19", SUCCESS, false);
 			debug("logging out");
 			m.logout();
 		} catch (MetacatAuthException mae) {
@@ -3141,62 +2858,62 @@
 
 			String accessBlock = getAccessBlock(anotheruser, true, true, false, false,
 					false);
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
 
-			onlineDocid = generateDocid();
-			uploadDocid(onlineDocid + ".1", onlinetestdatafile1, SUCCESS, false);
+			onlineDocid = generateDocumentId();
+			uploadDocumentId(onlineDocid + ".1", onlinetestdatafile1, SUCCESS, false);
 
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock1, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, null, null, null, null, null);
 
 			// insert a document - get the docid
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
 
 			// logoutand login as other user
 			debug("logging out");
 			m.logout();
 
 			// read the document
-			readDocidWhichEqualsDoc(newdocid + ".1", null, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", null, FAILURE, true);
 
 			// update the document
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// update the inline data
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock2, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, null, null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// update the online data
-			uploadDocid(onlineDocid + ".2", onlinetestdatafile1, FAILURE, false);
+			uploadDocumentId(onlineDocid + ".2", onlinetestdatafile1, FAILURE, false);
 
 			// update the document access control
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock1, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, accessBlock, null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// update the document access control for inline data
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock1, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, null, accessBlock, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// update the document access control for online data
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock1, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, null, null, null, accessBlock, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// delete the document
-			deleteDocid(newdocid + ".2", FAILURE, true);
+			deleteDocumentId(newdocid + ".2", FAILURE, true);
 			debug("logging out");
 			m.logout();
 		} catch (MetacatAuthException mae) {
@@ -3229,62 +2946,62 @@
 
 			String accessBlock = getAccessBlock(anotheruser, true, true, false, false,
 					false);
-			newdocid = generateDocid();
+			newdocid = generateDocumentId();
 
 			// login
 			debug("logging in as: username=" + username + " password=" + password);
 			m.login(username, password);
 
-			onlineDocid = generateDocid();
-			uploadDocid(onlineDocid + ".1", onlinetestdatafile1, SUCCESS, false);
+			onlineDocid = generateDocumentId();
+			uploadDocumentId(onlineDocid + ".1", onlinetestdatafile1, SUCCESS, false);
 
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock1, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, null, null, null, null, null);
 
 			// insert a document - get the docid
-			insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
-			readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
+			insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
 
 			// logoutand login as other user
 			debug("logging out");
 			m.logout();
 
 			// read the document
-			readDocidWhichEqualsDoc(newdocid + ".1", null, FAILURE, true);
+			readDocumentIdWhichEqualsDoc(newdocid + ".1", null, FAILURE, true);
 
 			// update the document
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// update the inline data
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock2, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, null, null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// update the online data
-			uploadDocid(onlineDocid + ".2", onlinetestdatafile1, FAILURE, false);
+			uploadDocumentId(onlineDocid + ".2", onlinetestdatafile1, FAILURE, false);
 
 			// update the document access control
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock1, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, accessBlock, null, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// update the document access control for inline data
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock1, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, null, accessBlock, null, null, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// update the document access control for online data
 			testdocument = getTestEmlDoc("Testing insert", emlVersion,
 					testEmlInlineBlock1, null, "ecogrid://knb/" + onlineDocid + ".1",
 					null, null, null, null, accessBlock, null);
-			updateDocid(newdocid + ".2", testdocument, FAILURE, false);
+			updateDocumentId(newdocid + ".2", testdocument, FAILURE, false);
 
 			// delete the document
-			deleteDocid(newdocid + ".2", FAILURE, true);
+			deleteDocumentId(newdocid + ".2", FAILURE, true);
 			debug("logging out");
 			m.logout();
 		} catch (MetacatAuthException mae) {
@@ -3298,238 +3015,4 @@
 		}
 
 	}
-
-	/**
-	 * Insert a document into metacat. The expected result is passed as result
-	 */
-
-	private String insertDocid(String docid, String docText, boolean result,
-			boolean expectKarmaException) {
-		debug("insertDocid(): docid=" + docid + " expectedResult=" + result
-				+ " expectKarmaException=" + expectKarmaException);
-		String response = null;
-		try {
-			response = m.insert(docid, new StringReader(testdocument), null);
-			if (result) {
-				assertTrue(response, (response.indexOf("<success>") != -1));
-				assertTrue(response, response.indexOf(docid) != -1);
-			} else {
-				assertTrue(response, (response.indexOf("<success>") == -1));
-			}
-			debug("insertDocid():  response=" + response);
-		} catch (MetacatInaccessibleException mie) {
-			fail("Metacat Inaccessible:\n" + mie.getMessage());
-		} catch (InsufficientKarmaException ike) {
-			if (!expectKarmaException) {
-				fail("Insufficient karma:\n" + ike.getMessage());
-			}
-		} catch (MetacatException me) {
-			fail("Metacat Error:\n" + me.getMessage());
-		} catch (Exception e) {
-			fail("General exception:\n" + e.getMessage());
-		}
-		return response;
-	}
-
-	/**
-	 * Insert a document into metacat. The expected result is passed as result
-	 */
-
-	private String uploadDocid(String docid, String filePath, boolean result,
-			boolean expectedKarmaException) {
-		debug("uploadDocid(): docid=" + docid + " filePath=" + filePath
-				+ " expectedResult=" + result + " expectedKarmaException="
-				+ expectedKarmaException);
-		String response = null;
-		try {
-			response = m.upload(docid, new File(filePath));
-			if (result) {
-				assertTrue(response, (response.indexOf("<success>") != -1));
-				assertTrue(response, response.indexOf(docid) != -1);
-			} else {
-				assertTrue(response, (response.indexOf("<success>") == -1));
-			}
-			debug("uploadDocid():  response=" + response);
-		} catch (MetacatInaccessibleException mie) {
-			fail("Metacat Inaccessible:\n" + mie.getMessage());
-		} catch (InsufficientKarmaException ike) {
-			if (!expectedKarmaException) {
-				fail("Insufficient karma:\n" + ike.getMessage());
-			}
-		} catch (MetacatException me) {
-			if (result) {
-				fail("Metacat Error:\n" + me.getMessage());
-			} else {
-				debug("Metacat Error:\n" + me.getMessage());
-			}
-		} catch (Exception e) {
-			fail("General exception:\n" + e.getMessage());
-		}
-		return response;
-	}
-
-	/**
-	 * Update a document in metacat. The expected result is passed as result
-	 */
-	private String updateDocid(String docid, String docText, boolean result,
-			boolean expectedKarmaFailure) {
-		debug("updateDocid(): docid=" + docid + " expectedResult=" + result
-				+ " expectedKarmaFailure=" + expectedKarmaFailure);
-		String response = null;
-		try {
-			response = m.update(docid, new StringReader(testdocument), null);
-
-			if (result) {
-				assertTrue(response, (response.indexOf("<success>") != -1));
-				assertTrue(response, response.indexOf(docid) != -1);
-			} else {
-				assertTrue(response, (response.indexOf("<success>") == -1));
-			}
-			debug("updateDocid(): response=" + response);
-		} catch (MetacatInaccessibleException mie) {
-			fail("Metacat Inaccessible:\n" + mie.getMessage());
-		} catch (InsufficientKarmaException ike) {
-			if (!expectedKarmaFailure) {
-				fail("Insufficient karma:\n" + ike.getMessage());
-			}
-		} catch (MetacatException me) {
-			if (result) {
-				fail("Metacat Error:\n" + me.getMessage());
-			} else {
-				debug("Metacat Error:\n" + me.getMessage());
-			}
-		} catch (Exception e) {
-			fail("General exception:\n" + e.getMessage());
-		}
-
-		return response;
-	}
-
-	/**
-	 * Delete a document into metacat. The expected result is passed as result
-	 */
-	private void deleteDocid(String docid, boolean result, boolean expectedKarmaFailure) {
-		debug("deleteDocid(): docid=" + docid + " expectedResult=" + result
-				+ " expectedKarmaFailure=" + expectedKarmaFailure);
-		try {
-			Thread.sleep(5000);
-			String response = m.delete(docid);
-			if (result) {
-				assertTrue(response, response.indexOf("<success>") != -1);
-			} else {
-				assertTrue(response, response.indexOf("<success>") == -1);
-			}
-			debug("deleteDocid():  response=" + response);
-		} catch (MetacatInaccessibleException mie) {
-			fail("Metacat Inaccessible:\n" + mie.getMessage());
-		} catch (InsufficientKarmaException ike) {
-			if (!expectedKarmaFailure) {
-				fail("Insufficient karma:\n" + ike.getMessage());
-			}
-		} catch (MetacatException me) {
-			if (result) {
-				fail("Metacat Error:\n" + me.getMessage());
-			} else {
-				debug("Metacat Error:\n" + me.getMessage());
-			}
-		} catch (Exception e) {
-			fail("General exception:\n" + e.getMessage());
-		}
-	}
-
-//	/**
-//	 * Read a document from metacat. The expected result is passed as result
-//	 */
-//	private void readDocid(String docid, boolean result, boolean expectedKarmaFailure) {
-//		debug("readDocid(): docid=" + docid + " expectedResult=" + result
-//				+ " expectedKarmaFailure=" + expectedKarmaFailure);
-//		try {
-//			Reader r = m.read(docid);
-//			String response = IOUtil.getAsString(r, true);
-//
-//			if (!result) {
-//				assertTrue(response, response.indexOf("<success>") == -1);
-//			}
-//			debug("readDocid():  response=" + response);
-//		} catch (MetacatInaccessibleException mie) {
-//			fail("Metacat Inaccessible:\n" + mie.getMessage());
-//		} catch (InsufficientKarmaException ike) {
-//			if (!expectedKarmaFailure) {
-//				fail("Insufficient karma:\n" + ike.getMessage());
-//			}
-//		} catch (MetacatException me) {
-//			fail("Metacat Error:\n" + me.getMessage());
-//		} catch (Exception e) {
-//			fail("General exception:\n" + e.getMessage());
-//		}
-//	}
-
-	/**
-	 * Read a document from metacat and check if it is equal to a given string.
-	 * The expected result is passed as result
-	 */
-
-	private void readDocidWhichEqualsDoc(String docid, String testDoc, boolean result,
-			boolean expectedKarmaFailure) {
-		debug("readDocidWhichEqualsDoc(): docid=" + docid + " expectedResult=" + result
-				+ " expectedKarmaFailure=" + expectedKarmaFailure);
-		try {
-			Reader r = m.read(docid);
-			String doc = IOUtil.getAsString(r, true);
-			if (result) {
-
-				if (!testDoc.equals(doc)) {
-					System.out.println("doc ***********************");
-					System.out.println(doc);
-					System.out.println("end doc ***********************");
-					System.out.println("testDoc ***********************");
-					System.out.println(testDoc);
-					System.out.println("end testDoc ***********************");
-				}
-
-				assertTrue(testDoc.equals(doc));
-			} else {
-				assertTrue(doc.indexOf("<error>") != -1);
-			}
-			debug("readDocidWhichEqualsDoc():  doc=" + doc);
-		} catch (MetacatInaccessibleException mie) {
-			fail("Metacat Inaccessible:\n" + mie.getMessage());
-		} catch (InsufficientKarmaException ike) {
-			if (!expectedKarmaFailure) {
-				fail("Insufficient karma:\n" + ike.getMessage());
-			}
-		} catch (MetacatException me) {
-			fail("Metacat Error:\n" + me.getMessage());
-		} catch (Exception e) {
-			fail("General exception:\n" + e.getMessage());
-		}
-
-	}
-
-	/**
-	 * Create a hopefully unique docid for testing insert and update. Does not
-	 * include the 'revision' part of the id.
-	 * 
-	 * @return a String docid based on the current date and time
-	 */
-	private String generateDocid() {
-		StringBuffer docid = new StringBuffer(prefix);
-		docid.append(".");
-
-		// Create a calendar to get the date formatted properly
-		String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
-		SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
-		pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
-		pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
-		Calendar calendar = new GregorianCalendar(pdt);
-		Date trialTime = new Date();
-		calendar.setTime(trialTime);
-		docid.append(calendar.get(Calendar.YEAR));
-		docid.append(calendar.get(Calendar.DAY_OF_YEAR));
-		docid.append(calendar.get(Calendar.HOUR_OF_DAY));
-		docid.append(calendar.get(Calendar.MINUTE));
-		docid.append(calendar.get(Calendar.SECOND));
-
-		return docid.toString();
-	}
 }



More information about the Metacat-cvs mailing list