Revision 6594
Added by Chris Jones about 13 years ago
test/edu/ucsb/nceas/metacat/dataone/CNodeServiceTest.java | ||
---|---|---|
336 | 336 |
guid.setValue("testSetOwner." + System.currentTimeMillis()); |
337 | 337 |
InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8")); |
338 | 338 |
SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object); |
339 |
long serialVersion = 1L; |
|
339 | 340 |
// save it |
340 | 341 |
Identifier retGuid = CNodeService.getInstance(request).registerSystemMetadata(session, guid, sysmeta); |
341 | 342 |
assertEquals(guid.getValue(), retGuid.getValue()); |
342 | 343 |
Subject rightsHolder = new Subject(); |
343 | 344 |
rightsHolder.setValue("newUser"); |
344 | 345 |
// set it |
345 |
Identifier retPid = CNodeService.getInstance(request).setOwner(session, guid, rightsHolder); |
|
346 |
Identifier retPid = CNodeService.getInstance(request).setOwner(session, guid, rightsHolder, serialVersion);
|
|
346 | 347 |
assertEquals(guid, retPid); |
347 | 348 |
// get it |
348 | 349 |
sysmeta = CNodeService.getInstance(request).getSystemMetadata(session, guid); |
... | ... | |
364 | 365 |
guid.setValue("testSetAccessPolicy." + System.currentTimeMillis()); |
365 | 366 |
InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8")); |
366 | 367 |
SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object); |
368 |
long serialVersion = 1L; |
|
369 |
|
|
367 | 370 |
// save it |
368 | 371 |
Identifier retGuid = CNodeService.getInstance(request).registerSystemMetadata(session, guid, sysmeta); |
369 | 372 |
assertEquals(guid.getValue(), retGuid.getValue()); |
... | ... | |
375 | 378 |
accessRule.addSubject(publicSubject); |
376 | 379 |
accessPolicy.addAllow(accessRule); |
377 | 380 |
// set it |
378 |
boolean result = CNodeService.getInstance(request).setAccessPolicy(session, guid, accessPolicy ); |
|
381 |
boolean result = CNodeService.getInstance(request).setAccessPolicy(session, guid, accessPolicy, serialVersion );
|
|
379 | 382 |
assertTrue(result); |
380 | 383 |
// check it |
381 | 384 |
result = CNodeService.getInstance(request).isAuthorized(session, guid, Permission.WRITE); |
... | ... | |
427 | 430 |
guid.setValue("testReplicationPolicy." + System.currentTimeMillis()); |
428 | 431 |
InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8")); |
429 | 432 |
SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object); |
433 |
long serialVersion = 1L; |
|
434 |
|
|
430 | 435 |
// save it |
431 | 436 |
Identifier retGuid = CNodeService.getInstance(request).registerSystemMetadata(session, guid, sysmeta); |
432 | 437 |
assertEquals(guid.getValue(), retGuid.getValue()); |
... | ... | |
436 | 441 |
node.setValue("testNode"); |
437 | 442 |
policy.addPreferredMemberNode(node ); |
438 | 443 |
// set it |
439 |
boolean result = CNodeService.getInstance(request).setReplicationPolicy(session, guid, policy); |
|
444 |
boolean result = CNodeService.getInstance(request).setReplicationPolicy(session, guid, policy, serialVersion);
|
|
440 | 445 |
assertTrue(result); |
441 | 446 |
// get it |
442 | 447 |
sysmeta = CNodeService.getInstance(request).getSystemMetadata(session, guid); |
... | ... | |
458 | 463 |
guid.setValue("testReplicationStatus." + System.currentTimeMillis()); |
459 | 464 |
InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8")); |
460 | 465 |
SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object); |
466 |
long serialVersion = 1L; |
|
461 | 467 |
Replica replica = new Replica(); |
462 | 468 |
NodeReference replicaMemberNode = new NodeReference(); |
463 | 469 |
replicaMemberNode.setValue("testNode"); |
... | ... | |
470 | 476 |
assertEquals(guid.getValue(), retGuid.getValue()); |
471 | 477 |
// set it |
472 | 478 |
ReplicationStatus status = ReplicationStatus.COMPLETED; |
473 |
boolean result = CNodeService.getInstance(request).setReplicationStatus(session, guid, replicaMemberNode, status); |
|
479 |
boolean result = CNodeService.getInstance(request).setReplicationStatus(session, guid, replicaMemberNode, status, serialVersion);
|
|
474 | 480 |
assertTrue(result); |
475 | 481 |
// get it |
476 | 482 |
sysmeta = CNodeService.getInstance(request).getSystemMetadata(session, guid); |
Also available in: Unified diff
Update CNodeService test to include serialVersion in it's calls as appropriate.