Index: test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java
===================================================================
--- test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java	(revision 5340)
+++ test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java	(revision 5341)
@@ -97,14 +97,24 @@
 		suite.addTest(new CrudServiceTest("initialize"));
 		suite.addTest(new CrudServiceTest("testSingletonAccessor"));
 		suite.addTest(new CrudServiceTest("testCreateAndGet"));
+		suite.addTest(new CrudServiceTest("testGetSystemMetadata"));
 		//suite.addTest(new CrudServiceTest(""));
 		//suite.addTest(new CrudServiceTest(""));
 		//suite.addTest(new CrudServiceTest(""));
-		//suite.addTest(new CrudServiceTest(""));
 		return suite;
 	}
 	
 	/**
+	 * public SystemMetadata getSystemMetadata(AuthToken token, Identifier guid)
+     *       throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, 
+     *       InvalidRequest, NotImplemented
+	 */
+	public void testGetSystemMetadata()
+	{
+	    
+	}
+	
+	/**
 	 * create(AuthToken token, Identifier guid, InputStream object, SystemMetadata sysmeta) 
      *   throws InvalidToken, ServiceFailure, NotAuthorized, IdentifierNotUnique, UnsupportedType, 
      *       InsufficientResources, InvalidSystemMetadata, NotImplemented
@@ -117,63 +127,12 @@
 	{
 	    try
 	    {
-	        Identifier id;
-            String testDoc;
-            AuthToken token;
-	        testDoc = "<?xml version=\"1.0\"?><test></test>\n";
+	        String testDoc = getTestDoc();
+	        CrudService cs = CrudService.getInstance();
+	        AuthToken token = getToken();
+	        //run create
+	        Identifier id = createDoc(token);
             
-            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);
-            token = new AuthToken(sessionid);
-            
-            id = new Identifier();
-            String docid = generateDocumentId();
-            id.setValue(docid);
-	                    
-            //create the system metadata then run the create method
-            StringBufferInputStream sbis = new StringBufferInputStream(testDoc);
-            SystemMetadata sm = new SystemMetadata();
-            //set the id
-            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");
-            Checksum checksum = new Checksum();
-            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");
-            sm.setSubmitter(p);
-            sm.setRightsHolder(p);
-            sm.setDateUploaded(new Date());
-            sm.setDateSysMetadataModified(new Date());
-            NodeReference nr = new NodeReference();
-            nr.setValue("metacat");
-            sm.setOriginMemberNode(nr);
-            sm.setAuthoritativeMemberNode(nr);
-            //create the doc
-            cs.create(token, id, sbis, sm);
-            
             //try to get the same doc then compare them
             InputStream gotDocStream = cs.get(token, id);
             StringBuffer sb = new StringBuffer();
@@ -213,6 +172,82 @@
 	{
 		assertTrue(1 == 1);
 	}
+	
+	private String getTestDoc()
+	{
+	    return "<?xml version=\"1.0\"?><test></test>\n";
+	}
+	
+	/**
+	 * authenticate and return a token
+	 */
+	private AuthToken getToken()
+	  throws Exception
+	{
+	    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;
+	}
+	
+	/**
+	 * create a doc and return its id
+	 */
+	private Identifier createDoc(AuthToken token) throws Exception
+	{
+	    Identifier id;
+        CrudService cs = CrudService.getInstance();
+        String testDoc = getTestDoc();
+        
+        id = new Identifier();
+        String docid = generateDocumentId();
+        id.setValue(docid);
+                    
+        //create the system metadata then run the create method
+        StringBufferInputStream sbis = new StringBufferInputStream(testDoc);
+        SystemMetadata sm = new SystemMetadata();
+        //set the id
+        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");
+        Checksum checksum = new Checksum();
+        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");
+        sm.setSubmitter(p);
+        sm.setRightsHolder(p);
+        sm.setDateUploaded(new Date());
+        sm.setDateSysMetadataModified(new Date());
+        NodeReference nr = new NodeReference();
+        nr.setValue("metacat");
+        sm.setOriginMemberNode(nr);
+        sm.setAuthoritativeMemberNode(nr);
+        //create the doc
+        cs.create(token, id, sbis, sm);
+        return id;
+	}
   
 	/**
 	 * produce an md5 checksum for item
