Revision 6605
Added by Chris Jones about 13 years ago
test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java | ||
---|---|---|
39 | 39 |
import org.apache.commons.io.IOUtils; |
40 | 40 |
import org.dataone.configuration.Settings; |
41 | 41 |
import org.dataone.service.util.Constants; |
42 |
import org.dataone.service.util.DateTimeMarshaller; |
|
42 | 43 |
import org.dataone.service.exceptions.IdentifierNotUnique; |
43 | 44 |
import org.dataone.service.exceptions.InsufficientResources; |
44 | 45 |
import org.dataone.service.exceptions.InvalidRequest; |
... | ... | |
762 | 763 |
|
763 | 764 |
} |
764 | 765 |
|
766 |
public void testSystemMetadataChanged() { |
|
767 |
printTestHeader("testSystemMetadataChanged"); |
|
768 |
try { |
|
769 |
Session session = getTestSession(); |
|
770 |
|
|
771 |
// create the object |
|
772 |
Identifier pid = new Identifier(); |
|
773 |
pid.setValue("testSystemMetadataChanged." + System.currentTimeMillis()); |
|
774 |
InputStream object = new ByteArrayInputStream("test".getBytes("UTF-8")); |
|
775 |
SystemMetadata sysmeta = createSystemMetadata(pid, session.getSubject(), object); |
|
776 |
Identifier retPid = MNodeService.getInstance(request).create(session, pid, object, sysmeta); |
|
777 |
assertEquals(retPid.getValue(), pid.getValue()); |
|
778 |
|
|
779 |
// pretend the system metadata changed on the CN |
|
780 |
MNodeService.getInstance(request).systemMetadataChanged(session, |
|
781 |
retPid, 5000L, Calendar.getInstance().getTime()); |
|
782 |
|
|
783 |
} catch (Exception e) { |
|
784 |
if (e instanceof NotAuthorized) { |
|
785 |
// only CN subjects can call this |
|
786 |
// TODO: use a CN certificate in the tests |
|
787 |
} else { |
|
788 |
fail("Unexpected error: " + e.getMessage()); |
|
789 |
|
|
790 |
} |
|
791 |
} |
|
792 |
|
|
793 |
} |
|
794 |
|
|
765 | 795 |
public void testGetLogRecords() { |
766 | 796 |
printTestHeader("testLogRecords"); |
767 | 797 |
|
Also available in: Unified diff
Add a test for systemMetadataChanged. This should be fleshed out more so that the test uses a CN certificate.