Project

General

Profile

« Previous | Next » 

Revision 10318

Added by Jing Tao over 7 years ago

Make the checksum match during the create method.

View differences:

test/edu/ucsb/nceas/metacat/dataone/RegisterDOITest.java
60 60
 */
61 61
public class RegisterDOITest extends D1NodeServiceTest {
62 62

  
63
	private static final String EMLFILEPATH = "test/tao.14563.1.xml";
63 64
	
64
	
65 65
	/**
66 66
	 * Set up the test fixtures
67 67
	 * 
......
143 143
  	
144 144
	public void testMintAndCreateForEML() {
145 145
		printTestHeader("testMintAndCreateForEML");
146
		String emlFile = "test/tao.14563.1.xml";
146
		String emlFile = EMLFILEPATH;
147 147
		InputStream content = null;
148 148
		try {
149 149
		    content = new FileInputStream(emlFile);
......
197 197
			InputStream object = null;
198 198
			boolean isMetadata = false;
199 199
			if (inputStream != null) {
200
				sysmeta = createSystemMetadata(guid, session.getSubject(), null);
201
				object = inputStream;
200
				sysmeta = createSystemMetadata(guid, session.getSubject(), inputStream);
201
				inputStream.close();
202
				object = new FileInputStream(EMLFILEPATH);
202 203
		        sysmeta.setFormatId(ObjectFormatCache.getInstance().getFormat("eml://ecoinformatics.org/eml-2.1.0").getFormatId());
203 204
		        isMetadata = true;
204 205
			} else {
205 206
				object = new ByteArrayInputStream("test".getBytes("UTF-8"));
206 207
				sysmeta = createSystemMetadata(guid, session.getSubject(), object);
208
				object = new ByteArrayInputStream("test".getBytes("UTF-8"));
207 209
			}
208 210

  
209 211
			Identifier pid = MNodeService.getInstance(request).create(session, guid, object, sysmeta);
......
317 319
				content = new FileInputStream(emlFile);
318 320
	            
319 321
	            // create the initial version without DOI
320
	            SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
322
	            SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), content);
323
	            content.close();
321 324
	            sysmeta.setFormatId(ObjectFormatCache.getInstance().getFormat("eml://ecoinformatics.org/eml-2.1.0").getFormatId());
325
	            content = new FileInputStream(emlFile);
322 326
	            Identifier pid = MNodeService.getInstance(request).create(session, guid, content, sysmeta);
327
	            content.close();
323 328
	            assertEquals(guid.getValue(), pid.getValue());
324 329

  
325 330
	            // now publish it

Also available in: Unified diff