Index: test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java
===================================================================
--- test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java	(revision 5351)
+++ test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java	(revision 5352)
@@ -80,10 +80,10 @@
 	public static Test suite() 
 	{
 		TestSuite suite = new TestSuite();
-		/*suite.addTest(new CrudServiceTest("initialize"));
+		suite.addTest(new CrudServiceTest("initialize"));
 		suite.addTest(new CrudServiceTest("testSingletonAccessor"));
 		suite.addTest(new CrudServiceTest("testCreateAndGet"));
-		suite.addTest(new CrudServiceTest("testGetSystemMetadata"));*/
+		suite.addTest(new CrudServiceTest("testGetSystemMetadata"));
 		suite.addTest(new CrudServiceTest("testUpdate"));
 		//suite.addTest(new CrudServiceTest(""));
 		//suite.addTest(new CrudServiceTest(""));
@@ -105,27 +105,19 @@
 	        CrudService cs = CrudService.getInstance();
 	        AuthToken token = getToken();
             //create a doc
-            System.out.println("CST: creating document");
             Identifier id = createDoc(token, getTestDoc());
-            System.out.println("CST: document created.  Id: " + id.getValue());
             
             //get the doc and sysmetadata
-            System.out.println("CST: getting document with id " + id.getValue());
             String gotDoc = getDoc(token, id);
-            System.out.println("CST: getting sysmeta for doc with id " + id.getValue());
             SystemMetadata sm = getSystemMetadata(token, id);
             
             //update the doc
             gotDoc = gotDoc.replaceAll("XXX", "YYY");
-            System.out.println("CST: Changed test doc to " + gotDoc);
             Identifier newid = new Identifier();
             newid.setValue(generateDocumentId());
-            System.out.println("CST: Generated newid " + newid.getValue());
             StringBufferInputStream sbis = new StringBufferInputStream(gotDoc);
             SystemMetadata newsm = createSystemMetadata(newid, gotDoc);
-            System.out.println("CST: Created system metadata for new doc...updating newid: " + newid.getValue() + "  obsId: " + id.getValue());
             Identifier updatedid = cs.update(token, newid, sbis, id, newsm);
-            System.out.println("CST: Called update. Returned id " + updatedid.getValue());
             
             //get doc - check that it matches update
             String newdoc = getDoc(token, newid);
@@ -132,14 +124,12 @@
             assertTrue(gotDoc.equals(newdoc));
             
             //get sysmeta - check that ids and other fields are updated
-            System.out.println("CST: confirming obsoletedBy fields for sm doc with id " + id.getValue());
             SystemMetadata newnewsm = getSystemMetadata(token, id);
-            List obsoletedByList = newnewsm.getObsoletedByList();
-            assertTrue(obsoletedByList.size() == 1);
-            String obsBy = ((Identifier)obsoletedByList.get(0)).getValue();
-            System.out.println("CST: obsBy: "  + obsBy);
-            System.out.println("CST: id: " + id.getValue());
-            assertTrue(obsBy.equals(newid.getValue()));
+            assertTrue(newnewsm.getObsoletedBy(0).getValue().equals(newid.getValue()));
+            
+            //get the new sysmeta and make sure the obsoletes field is set
+            SystemMetadata newnewnewsm = getSystemMetadata(token, newid);
+            assertTrue(newnewnewsm.getObsolete(0).getValue().equals(id.getValue()));
         }
         catch(Exception e)
         {
@@ -204,10 +194,8 @@
 	        AuthToken token = getToken();
 	        //run create
 	        Identifier id = createDoc(token, getTestDoc());
-	        //run get
+            //compare the docs
             String gotDoc = getDoc(token, id);
-            System.out.println("got doc: " + gotDoc);
-            //compare the docs
             assertTrue(gotDoc.trim().equals(getTestDoc().trim()));
             
             try
@@ -255,7 +243,6 @@
 	private SystemMetadata getSystemMetadata(AuthToken token, Identifier id)
 	  throws Exception
 	{
-	    System.out.println("getting system metadata for id: " + id.getValue());
 	    CrudService cs = CrudService.getInstance();
 	    return cs.getSystemMetadata(token, id);
 	}
@@ -266,7 +253,6 @@
 	private String getDoc(AuthToken token, Identifier id)
 	  throws Exception
 	{
-	    System.out.println("getting doc for id " + id.getValue());
 	    CrudService cs = CrudService.getInstance();
 	    //try to get the same doc then compare them
         InputStream gotDocStream = cs.get(token, id);
@@ -278,7 +264,6 @@
             sb.append(new String(b, 0, numread));
             numread = gotDocStream.read(b, 0, 1024);
         }
-        System.out.println("returning doc for id " + id.getValue());
         return sb.toString();
 	}
 	
@@ -298,17 +283,13 @@
 	{
 	    CrudService cs = CrudService.getInstance();
         //login and get a sessionid
-        System.out.println("creating MetacatRestClient with url " + cs.getContextUrl());
         MetacatRestClient restClient = new MetacatRestClient(cs.getContextUrl());
         String username = PropertyService.getProperty("test.mcUser");
         String password = PropertyService.getProperty("test.mcPassword");
-        System.out.println("logging in with username: " + username + " and password " + password + " to context " + cs.getContextUrl());
         String response = restClient.login(username, password);
-        //System.out.println("response to login: " + response);
         String sessionid = restClient.getSessionId();
         SessionService sessionService = SessionService.getInstance();
         sessionService.registerSession(new SessionData(sessionid, username, new String[0], password, "CrudServiceLogin"));
-        System.out.println("sessionid: " + sessionid);
         AuthToken token = new AuthToken(sessionid);
         return token;
 	}
@@ -324,7 +305,6 @@
         id = new Identifier();
         String docid = generateDocumentId();
         id.setValue(docid);
-        System.out.println("creating doc with id " + id.getValue());            
         
         //create the system metadata then run the create method
         StringBufferInputStream sbis = new StringBufferInputStream(testDoc);
@@ -331,7 +311,6 @@
         SystemMetadata sm = createSystemMetadata(id, testDoc);
         //create the doc
         cs.create(token, id, sbis, sm);
-        System.out.println("document with id " + id.getValue() + " created.");
         return id;
 	}
 	
@@ -343,11 +322,8 @@
 	{
 	    SystemMetadata sm = new SystemMetadata();
         //set the id
-        System.out.println("creating system metadata object for document with id " + id.getValue());
         sm.setIdentifier(id);
-        System.out.println("sm id is " + id.getValue());
         sm.setObjectFormat(ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0"));
-        System.out.println("sm objectformat: " + sm.getObjectFormat());
         //create the checksum
         String checksumS = checksum(testDoc);
         ChecksumAlgorithm ca = ChecksumAlgorithm.convert("MD5");
@@ -355,10 +331,8 @@
         checksum.setValue(checksumS);
         checksum.setAlgorithm(ca);
         sm.setChecksum(checksum);
-        System.out.println("sm checksum is " + checksumS);
         //set the size
         sm.setSize(testDoc.getBytes().length);
-        System.out.println("sm size: " + testDoc.getBytes().length);
         //submitter
         Principal p = new Principal();
         p.setValue("joe");
Index: src/edu/ucsb/nceas/metacat/DocumentImpl.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 5351)
+++ src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 5352)
@@ -2566,7 +2566,6 @@
     	
         logMetacat.debug("DocumentImpl.write - conn usage count before writting: "
                 + conn.getUsageCount());
-        System.out.println("creating new accnum: " + accnum + " for action " + action);
         AccessionNumber ac = new AccessionNumber(accnum, action);
         String docid = ac.getDocid();
         String rev = ac.getRev();
Index: src/edu/ucsb/nceas/metacat/dataone/CrudService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/dataone/CrudService.java	(revision 5351)
+++ src/edu/ucsb/nceas/metacat/dataone/CrudService.java	(revision 5352)
@@ -327,9 +327,7 @@
                 
         try {
             IdentifierManager im = IdentifierManager.getInstance();
-            System.out.println("looking up systemmetadata id for guid " + guid.getValue());
             final String localId = im.getSystemMetadataId(guid.getValue());
-            System.out.println("localId: " + localId);
             
             // Read system metadata from metacat's db
             final InputStreamFromOutputStream<String> objectStream = 
@@ -387,28 +385,20 @@
             
             //find the old systemmetadata (sm.old) document id (the one linked to obsoletedGuid)
             SystemMetadata sm = getSystemMetadata(token, obsoletedGuid);
-            System.out.println("CS: got sm for obsoleteGuid: " + obsoletedGuid.getValue());
             //change sm.old's obsoletedBy field 
             List l = sm.getObsoletedByList();
             l.add(guid);
             sm.setObsoletedByList(l);
-            System.out.println("CS: set obsoletedBy to id: " + ((Identifier)l.get(0)).getValue());
             //update sm.old
-            System.out.println("CS: updating system metadata...");
             updateSystemMetadata(sm, sessionData);
-            System.out.println("CS: updated system metadata.");
+            
             //change the obsoletes field of the new systemMetadata (sm.new) to point to the id of the old one
-            System.out.println("CS: Adding obsoleteGuid to new sysmeta");
             sysmeta.addObsolete(obsoletedGuid);
             //insert sm.new
-            System.out.println("CS: inserting new sysmeta");
             insertSystemMetadata(sysmeta, sessionData);
-            //call update with sm.new.object.id for object
-            //System.out.println("CS: updating old sm");
-            //updateSystemMetadata(sm, sessionData);
-            System.out.println("CS: updating doc");
+            
+            //update the doc
             updateDocument(object, obsoletedGuid, guid, sessionData);
-            System.out.println("CS: Done updating document.");
             return guid;
         }
         catch(Exception e)
@@ -584,7 +574,6 @@
         String localId = insertDocument(xml, sysMetaGuid, sessionData);
         //insert the system metadata doc id into the identifiers table to 
         //link it to the data or metadata document
-        System.out.println("mapping systemmetadata id to docid in im.insertSystemMetadata");
         IdentifierManager.getInstance().createSystemMetadataMapping(sysmeta.getIdentifier().getValue(), sysMetaGuid.getValue());
     }
     
@@ -596,17 +585,12 @@
     {
         try
         {
-            System.out.println("Updating SystemMetadata with id " + sm.getIdentifier().getValue());
             String smId = IdentifierManager.getInstance().getSystemMetadataId(sm.getIdentifier().getValue());
-            System.out.println("smId: " + smId);
             sm.setDateSysMetadataModified(new Date());
             String xml = new String(serializeSystemMetadata(sm).toByteArray());
             Identifier id = new Identifier();
             id.setValue(smId);
-            System.out.println("updating sysmeta doc with new id " + id.getValue());
             String localId = updateDocument(xml, id, null, sessionData);
-            System.out.println("new updated localId: " + localId);
-            System.out.println("CS: updateDocument returned localId: " + localId);
             IdentifierManager.getInstance().updateSystemMetadataMapping(sm.getIdentifier().getValue(), localId);
         }
         catch(Exception e)
@@ -706,7 +690,6 @@
         action[0] = insertOrUpdate;
         params.put("action", action);
         String[] docid = new String[1];
-        System.out.println(insertOrUpdate + "ing with localId " + localId);
         docid[0] = localId;
         params.put("docid", docid);
         String[] doctext = new String[1];
Index: src/edu/ucsb/nceas/metacat/IdentifierManager.java
===================================================================
--- src/edu/ucsb/nceas/metacat/IdentifierManager.java	(revision 5351)
+++ src/edu/ucsb/nceas/metacat/IdentifierManager.java	(revision 5352)
@@ -245,7 +245,7 @@
 
             // Execute the insert statement
             String query = "update systemmetadata set (docid, rev) = (?, ?) where guid='" + guid + "'";
-            System.out.println("query: " + query + " for params: (guid:" + guid + ", docid=" + docid + ", rev=" + rev + ")");
+            //System.out.println("query: " + query + " for params: (guid:" + guid + ", docid=" + docid + ", rev=" + rev + ")");
             PreparedStatement stmt = dbConn.prepareStatement(query);
             stmt.setString(1, docid);
             stmt.setInt(2, rev);
@@ -300,7 +300,7 @@
       int rev = 0;
       
       String query = "select guid, docid, rev from " + type + " where guid = ?";
-      System.out.println("query: " + query + " for params: (" + guid + ")");
+      //System.out.println("query: " + query + " for params: (" + guid + ")");
       
       DBConnection dbConn = null;
       int serialNumber = -1;
@@ -361,7 +361,7 @@
 
             // Execute the insert statement
             String query = "insert into " + type + " (guid, docid, rev) values (?, ?, ?)";
-            System.out.println("query: " + query + " for params: (" + guid + ", " + docid + ", " + rev + ")");
+            //System.out.println("query: " + query + " for params: (" + guid + ", " + docid + ", " + rev + ")");
             PreparedStatement stmt = dbConn.prepareStatement(query);
             stmt.setString(1, guid);
             stmt.setString(2, docid);
