Index: test/query.xml
===================================================================
--- test/query.xml	(revision 1790)
+++ test/query.xml	(revision 1791)
@@ -12,7 +12,7 @@
     <querygroup operator="UNION">
       <querygroup operator="UNION">
         <queryterm searchmode="contains" casesensitive="false">
-          <value>Coweeta</value>
+          <value>Jones</value>
         </queryterm>
       </querygroup>
     </querygroup>
Index: test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java
===================================================================
--- test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java	(revision 1790)
+++ test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java	(revision 1791)
@@ -34,6 +34,12 @@
 import java.io.Reader;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Date;
+import java.util.SimpleTimeZone;
+import java.util.TimeZone;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -47,11 +53,13 @@
 {
     private String metacatUrl = 
         "http://knb.ecoinformatics.org/knb/servlet/metacat";
+        //"http://dev.nceas.ucsb.edu/tao/servlet/metacat";
     private String username = "@mcuser@";
     private String password = "@mcpassword@";
     private String failpass = "uidfnkj43987yfdn";
     private String docid = "jones.204.22";
-    private String newdocid = "@newdocid@";
+    private String prefix = "test";
+    private String newdocid = null;
     private String testfile = "test/jones.204.22.xml";
     private String queryFile = "test/query.xml";
     //private String docid = "Gramling.61.26";
@@ -67,6 +75,7 @@
     public MetacatClientTest(String name)
     {
         super(name);
+        newdocid = generateDocid();
     }
 
     /**
@@ -77,8 +86,6 @@
         try {
             FileReader fr = new FileReader(testfile);
             testdocument = IOUtil.getAsString(fr, true);
-            //StringBuffer buf = IOUtil.getAsStringBuffer(fr, true);
-            //testdocument = buf.toString();
         } catch (IOException ioe) {
             fail("Can't read test data to run the test: " + testfile);
         }
@@ -159,11 +166,10 @@
     {
         try {
             m.login(username, password);
-            Reader r = m.read(docid);
+            Reader r = m.read(newdocid+".1");
             String doc = IOUtil.getAsString(r, true);
             System.err.println(doc);
             assertTrue(doc.equals(testdocument));
-
         } catch (MetacatAuthException mae) {
             fail("Authorization failed:\n" + mae.getMessage());
         } catch (MetacatInaccessibleException mie) {
@@ -182,7 +188,7 @@
             FileReader fr = new FileReader(queryFile);
             Reader r = m.query(fr);
             String result = IOUtil.getAsString(r, true);
-            assertTrue(result.indexOf("obfs.100.3")!=-1);
+            assertTrue(result.indexOf("jones.204.22")!=-1);
         } catch (MetacatInaccessibleException mie) {
             fail("Metacat Inaccessible:\n" + mie.getMessage());
         } catch (Exception e) {
@@ -196,11 +202,18 @@
     public void insert()
     {
         try {
+            String identifier = newdocid + ".1";
             m.login(username, password);
-            String response = m.insert(newdocid, 
+            String response = m.insert(identifier, 
                     new StringReader(testdocument), null);
+            System.err.println(
+                DateFormat.getDateTimeInstance().format(new Date()));
+            //Thread.sleep(20000);
+            System.err.println(
+                DateFormat.getDateTimeInstance().format(new Date()));
             assertTrue(response.indexOf("<success>") != -1);
-            assertTrue(response.indexOf(newdocid) != -1);
+            assertTrue(response.indexOf(identifier) != -1);
+            System.err.println(response);
 
         } catch (MetacatAuthException mae) {
             fail("Authorization failed:\n" + mae.getMessage());
@@ -214,4 +227,32 @@
             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();
+    }
 }
Index: build.xml
===================================================================
--- build.xml	(revision 1790)
+++ build.xml	(revision 1791)
@@ -195,8 +195,6 @@
       <property name="srcdir" value="./src" />
       <property name="testdir" value="./test" />
       <property name="testtorun" value="MetacatClientTest" />
-      <property name="newdocid" value="foombj.102.1"/>
-      <filter token="newdocid" value="${newdocid}"/>
       <property name="junittestsdir" value="./test/edu/ucsb/nceas/metacattest" />
       <property name="junitnettestsdir" value="./test/edu/ucsb/nceas/metacatnettest" />
       <property name="build.dir" value="./build"/>
@@ -488,6 +486,7 @@
       <javac srcdir="${build.tests}"
              destdir="${build.tests}"
              classpath="${cpath}:${build.dir}/${name}.jar"
+             debug="on"
        includes="**/*.java" />
 
       <jar jarfile="${build.dir}/${name}-junittests.jar"
