Project

General

Profile

« Previous | Next » 

Revision 5746

Added by berkley almost 14 years ago

added semi-colon id test

View differences:

test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java
108 108
		suite.addTest(new CrudServiceTest("testChecksum"));
109 109
		suite.addTest(new CrudServiceTest("testDescribe"));
110 110
		suite.addTest(new CrudServiceTest("testDelete"));
111
		suite.addTest(new CrudServiceTest("testSemiColonsInIdentifiers"));
111 112
		return suite;
112 113
	}
113 114
	
114 115
	/**
116
	 * test for the use of semi colons in identifiers
117
	 * in response to https://redmine.dataone.org/issues/1143
118
	 */
119
	public void testSemiColonsInIdentifiers()
120
	{
121
	    try
122
        {
123
            CrudService cs = CrudService.getInstance();
124
            AuthToken token = getToken();
125
            String testDoc = getTestDoc();
126
            
127
            Identifier id = new Identifier();
128
            id.setValue("someid:xyz:fff." + new Date().getTime());
129
            String docid = generateDocumentId();
130
            
131
            //create the system metadata then run the create method
132
            StringBufferInputStream sbis = new StringBufferInputStream(testDoc);
133
            SystemMetadata sm = createSystemMetadata(id, testDoc, 
134
                    ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0"));
135
            //create the doc
136
            Identifier rGuid = cs.create(token, id, sbis, sm);
137
            
138
            System.out.println("ID: " + rGuid.getValue());
139
            assertTrue(rGuid.toString().equals(id.toString())); 
140
            System.out.println("created doc with id " + id.getValue());
141
        }
142
        catch(Exception e)
143
        {
144
            fail("Unexpected error in testDescribe: " + e.getMessage());
145
        }
146
	}
147
	
148
	/**
115 149
	 * test the delete function
116 150
	 */
117 151
	public void testDelete()
......
373 407
	        Date toDate = new Date();
374 408
	        Log lrs = cs.getLogRecords(token, fromDate, toDate, null);
375 409
	        assertNotNull(lrs);
410
	        System.out.println("log entry size: " + lrs.sizeLogEntryList());
376 411
	        assertTrue(lrs.sizeLogEntryList() == 1);
377 412
	        LogEntry lrLogEvent = lrs.getLogEntry(0);
378 413
	        assertTrue(lrLogEvent.getEvent().name().equals("CREATE"));
src/edu/ucsb/nceas/metacat/dataone/CrudService.java
130 130
            String server = PropertyService.getProperty("server.name");
131 131
            String port = PropertyService.getProperty("server.httpPort");
132 132
            String context = PropertyService.getProperty("application.context");
133
            metacatUrl = "http://" + server + ":" + port + "/" + context;
133
            metacatUrl = "http://" + server + ":" + port + "/" + context + "/d1";
134 134
            logMetacat.debug("Initializing CrudService with url " + metacatUrl);
135 135
        }
136 136
        catch(Exception e)

Also available in: Unified diff