Revision 9351
Added by Jing Tao over 9 years ago
test/edu/ucsb/nceas/metacat/dataone/CNodeServiceTest.java | ||
---|---|---|
119 | 119 |
suite.addTest(new CNodeServiceTest("testGetSID")); |
120 | 120 |
suite.addTest(new CNodeServiceTest("testListViews")); |
121 | 121 |
suite.addTest(new CNodeServiceTest("testUpdateSystemMetadata")); |
122 |
suite.addTest(new CNodeServiceTest("testArchive")); |
|
122 | 123 |
|
123 | 124 |
return suite; |
124 | 125 |
} |
... | ... | |
1424 | 1425 |
assertTrue(result2.getArchived() ==true); |
1425 | 1426 |
} |
1426 | 1427 |
|
1428 |
public void testArchive() throws Exception { |
|
1429 |
Session session = getCNSession(); |
|
1430 |
Identifier guid = new Identifier(); |
|
1431 |
guid.setValue("testArchive." + System.currentTimeMillis()); |
|
1432 |
InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8")); |
|
1433 |
SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object); |
|
1434 |
Identifier pid = CNodeService.getInstance(request).create(session, guid, object, sysmeta); |
|
1435 |
CNodeService.getInstance(request).archive(session, guid); |
|
1436 |
SystemMetadata result = CNodeService.getInstance(request).getSystemMetadata(session, guid); |
|
1437 |
assertTrue(result.getArchived()); |
|
1438 |
} |
|
1439 |
|
|
1427 | 1440 |
public Session getMNSessionFromCN() throws NotImplemented, ServiceFailure { |
1428 | 1441 |
Session session = new Session(); |
1429 | 1442 |
Subject subject = null; |
test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java | ||
---|---|---|
176 | 176 |
suite.addTest(new MNodeServiceTest("testListViews")); |
177 | 177 |
suite.addTest(new MNodeServiceTest("testUpdateSystemMetadata")); |
178 | 178 |
suite.addTest(new MNodeServiceTest("testUpdateObsoletesAndObsoletedBy")); |
179 |
suite.addTest(new MNodeServiceTest("testArchive")); |
|
179 | 180 |
|
180 | 181 |
return suite; |
181 | 182 |
|
... | ... | |
465 | 466 |
} |
466 | 467 |
|
467 | 468 |
} |
469 |
|
|
470 |
public void testArchive() throws Exception { |
|
471 |
Session session = getTestSession(); |
|
472 |
Identifier guid = new Identifier(); |
|
473 |
guid.setValue("testUpdate." + System.currentTimeMillis()); |
|
474 |
InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8")); |
|
475 |
SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), object); |
|
476 |
Identifier pid = MNodeService.getInstance(request).create(session, guid, object, sysmeta); |
|
477 |
MNodeService.getInstance(request).archive(session, guid); |
|
478 |
SystemMetadata result = MNodeService.getInstance(request).getSystemMetadata(session, guid); |
|
479 |
assertTrue(result.getArchived()); |
|
480 |
} |
|
468 | 481 |
|
469 | 482 |
/** |
470 | 483 |
* Test object updating |
Also available in: Unified diff
Add the testArchive method.