Project

General

Profile

« Previous | Next » 

Revision 6504

use an actual data object (bytes of "test") when generating system metadata so that the checksum is a valid checksum

View differences:

test/edu/ucsb/nceas/metacat/dataone/CNodeServiceTest.java
115 115
            Session session = getTestSession();
116 116
			Identifier guid = new Identifier();
117 117
			guid.setValue("testRegisterSystemMetadata." + System.currentTimeMillis());
118
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
118
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
119
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
119 120
			Identifier retGuid = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
120 121
			assertEquals(guid.getValue(), retGuid.getValue());
121 122
			return retGuid;
......
135 136
            Session session = getTestSession();
136 137
			Identifier guid = new Identifier();
137 138
			guid.setValue("testGetSystemMetadata." + System.currentTimeMillis());
138
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
139
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
140
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
139 141
			Identifier retGuid = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
140 142
			assertEquals(guid.getValue(), retGuid.getValue());
141 143
			// get it
......
217 219
            Session session = getTestSession();
218 220
			Identifier guid = new Identifier();
219 221
			guid.setValue("testAssertRelation." + System.currentTimeMillis());
220
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
222
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
223
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
221 224
			Identifier describePid = new Identifier();
222 225
			describePid.setValue("describePid." + System.currentTimeMillis());
223 226
			sysmeta.setObsoletes(describePid);
......
225 228
			Identifier retGuid = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
226 229
			assertEquals(guid.getValue(), retGuid.getValue());
227 230
			// save the other
228
			SystemMetadata describeSysmeta = createSystemMetadata(describePid, session.getSubject(), null);
231
			InputStream object2 = new ByteArrayInputStream("test".getBytes("UTF-8"));
232
			SystemMetadata describeSysmeta = createSystemMetadata(describePid, session.getSubject(), object2);
229 233
			Identifier retDescribePid = CNodeService.getInstance().registerSystemMetadata(session, describePid, describeSysmeta);
230 234
			assertEquals(describePid.getValue(), retDescribePid.getValue());
231 235
			// check it
......
244 248
            Session session = getTestSession();
245 249
			Identifier guid = new Identifier();
246 250
			guid.setValue("testChecksum." + System.currentTimeMillis());
247
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
251
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
252
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
248 253
			// save it
249 254
			Identifier retGuid = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
250 255
			assertEquals(guid.getValue(), retGuid.getValue());
......
295 300
            Session session = getTestSession();
296 301
			Identifier guid = new Identifier();
297 302
			guid.setValue("testSearch." + System.currentTimeMillis());
298
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
303
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
304
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
299 305
			
300 306
			// save it
301 307
			Identifier retGuid = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
......
325 331
            Session session = getTestSession();
326 332
			Identifier guid = new Identifier();
327 333
			guid.setValue("testSetOwner." + System.currentTimeMillis());
328
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
334
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
335
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
329 336
			// save it
330 337
			Identifier retGuid = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
331 338
			assertEquals(guid.getValue(), retGuid.getValue());
......
352 359
            Session session = getTestSession();
353 360
			Identifier guid = new Identifier();
354 361
			guid.setValue("testSetAccessPolicy." + System.currentTimeMillis());
355
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
362
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
363
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
356 364
			// save it
357 365
			Identifier retGuid = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
358 366
			assertEquals(guid.getValue(), retGuid.getValue());
......
381 389
            Session session = getTestSession();
382 390
			Identifier guid = new Identifier();
383 391
			guid.setValue("testIsAuthorized." + System.currentTimeMillis());
384
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
392
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
393
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
385 394
			// save it
386 395
			Identifier retGuid = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
387 396
			assertEquals(guid.getValue(), retGuid.getValue());
......
413 422
            Session session = getTestSession();
414 423
			Identifier guid = new Identifier();
415 424
			guid.setValue("testReplicationPolicy." + System.currentTimeMillis());
416
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
425
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
426
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
417 427
			// save it
418 428
			Identifier retGuid = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
419 429
			assertEquals(guid.getValue(), retGuid.getValue());
......
443 453
            Session session = getTestSession();
444 454
			Identifier guid = new Identifier();
445 455
			guid.setValue("testReplicationStatus." + System.currentTimeMillis());
446
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
456
			InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8"));
457
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object);
447 458
			Replica replica = new Replica();
448 459
			NodeReference replicaMemberNode = new NodeReference();
449 460
			replicaMemberNode.setValue("testNode");

Also available in: Unified diff