Project

General

Profile

« Previous | Next » 

Revision 5380

Added by berkley over 14 years ago

made the test functional so that it checks that missing system metadata will be created.

View differences:

test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java
109 109
	    {
110 110
	        CrudService cs = CrudService.getInstance();
111 111
	        AuthToken token = getToken();
112
	        //create a document with no system metadata
113
	        String testDoc = getTestDoc();
114
	        Identifier id = new Identifier();
115
	        String docid = generateDocumentId();
116
	        id.setValue(docid);
117
	        
118
	        cs.insertOrUpdateDocument(testDoc, id, cs.getSessionData(token), "insert");
119
	        //try to get its system metadata, should fail
120
	        try
121
	        {
122
	            getSystemMetadata(token, id);
123
	            fail("call to getSystemMetadata should have failed.");
124
	        }
125
	        catch(Exception e)
126
	        {}
127
	        
128
	        //generate missing system metadata
112 129
	        cs.generateMissingSystemMetadata(token);
130
	        //try to get system metadata again, should succeed
131
	        getSystemMetadata(token, id);
113 132
	    }
114 133
	    catch(Exception e)
115 134
	    {
src/edu/ucsb/nceas/metacat/dataone/CrudService.java
737 737
     * If the session has expired or is invalid, the 'public' session will
738 738
     * be returned, giving the user anonymous access.
739 739
     */
740
    private static SessionData getSessionData(AuthToken token) {
740
    protected static SessionData getSessionData(AuthToken token) {
741 741
        SessionData sessionData = null;
742 742
        String sessionId = "PUBLIC";
743 743
        if (token != null) {
......
994 994
    /**
995 995
     * insert a document, return the id of the document that was inserted
996 996
     */
997
    private String insertOrUpdateDocument(String xml, Identifier guid, SessionData sessionData, String insertOrUpdate) 
997
    protected String insertOrUpdateDocument(String xml, Identifier guid, SessionData sessionData, String insertOrUpdate) 
998 998
        throws ServiceFailure {
999 999
        logMetacat.debug("Starting to insert xml document...");
1000 1000
        IdentifierManager im = IdentifierManager.getInstance();

Also available in: Unified diff