Revision 6327
Added by ben leinfelder over 13 years ago
test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
import java.io.ByteArrayInputStream; |
29 | 29 |
import java.io.InputStream; |
30 |
import java.io.StringBufferInputStream; |
|
31 | 30 |
import java.io.UnsupportedEncodingException; |
32 |
import java.security.MessageDigest; |
|
33 | 31 |
import java.text.SimpleDateFormat; |
34 | 32 |
import java.util.Calendar; |
35 | 33 |
import java.util.Date; |
... | ... | |
56 | 54 |
import org.dataone.service.types.Event; |
57 | 55 |
import org.dataone.service.types.Identifier; |
58 | 56 |
import org.dataone.service.types.Log; |
57 |
import org.dataone.service.types.MonitorList; |
|
58 |
import org.dataone.service.types.Node; |
|
59 | 59 |
import org.dataone.service.types.ObjectFormat; |
60 | 60 |
import org.dataone.service.types.ObjectList; |
61 | 61 |
import org.dataone.service.types.Permission; |
... | ... | |
110 | 110 |
suite.addTest(new MNodeServiceTest("testGetSystemMetadata")); |
111 | 111 |
suite.addTest(new MNodeServiceTest("testDescribe")); |
112 | 112 |
suite.addTest(new MNodeServiceTest("testListObjects")); |
113 |
// suite.addTest(new MNodeServiceTest("testSynchronizationFailed")); |
|
113 | 114 |
// MNCore tests |
114 | 115 |
suite.addTest(new MNodeServiceTest("testPing")); |
115 | 116 |
suite.addTest(new MNodeServiceTest("testGetLogRecords")); |
116 |
// suite.addTest(new MNodeServiceTest("testGetOperationStatistics")); |
|
117 |
// suite.addTest(new MNodeServiceTest("testGetCapabilities")); |
|
117 |
suite.addTest(new MNodeServiceTest("testGetOperationStatistics")); |
|
118 |
suite.addTest(new MNodeServiceTest("testGetCapabilities")); |
|
119 |
// suite.addTest(new MNodeServiceTest("testGetObjectStatistics")); |
|
120 |
// suite.addTest(new MNodeServiceTest("testGetStatus")); |
|
118 | 121 |
// MNAuthorization tests |
119 | 122 |
suite.addTest(new MNodeServiceTest("testIsAuthorized")); |
120 | 123 |
suite.addTest(new MNodeServiceTest("testSetAccessPolicy")); |
121 | 124 |
// MNreplication tests |
122 | 125 |
// suite.addTest(new MNodeServiceTest("testReplicate")); |
123 |
// suite.addTest(new MNodeServiceTest("testSynchronizationFailed")); |
|
124 | 126 |
|
125 | 127 |
|
126 | 128 |
return suite; |
... | ... | |
620 | 622 |
} |
621 | 623 |
|
622 | 624 |
public void testGetCapabilities() { |
623 |
fail("Not yet implemented"); |
|
625 |
try { |
|
626 |
Node node = MNodeService.getInstance().getCapabilities(); |
|
627 |
assertNotNull(node); |
|
628 |
// TODO: should probably test other parts of the node information |
|
629 |
} catch (Exception e) { |
|
630 |
e.printStackTrace(); |
|
631 |
fail("Probably not yet implemented: " + e.getMessage()); |
|
632 |
} |
|
633 |
|
|
624 | 634 |
} |
625 | 635 |
|
626 | 636 |
public void testGetOperationStatistics() { |
627 |
fail("Not yet implemented"); |
|
637 |
try { |
|
638 |
Session session = getTestSession(); |
|
639 |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
640 |
Date startTime = sdf.parse("2010-01-01"); |
|
641 |
Date endTime = new Date(); |
|
642 |
MonitorList monitorList = |
|
643 |
MNodeService.getInstance().getOperationStatistics( |
|
644 |
session, |
|
645 |
startTime, |
|
646 |
endTime, |
|
647 |
session.getSubject(), |
|
648 |
Event.READ, |
|
649 |
null //formatId |
|
650 |
); |
|
651 |
|
|
652 |
assertNotNull(monitorList); |
|
653 |
// TODO: should probably test other parts of the information |
|
654 |
} catch (Exception e) { |
|
655 |
e.printStackTrace(); |
|
656 |
fail("Probably not yet implemented: " + e.getMessage()); |
|
657 |
} |
|
628 | 658 |
} |
629 | 659 |
|
630 | 660 |
public void testPing() { |
Also available in: Unified diff
wire-up the getCapabilities() and getOperationStatistics() methods for when they are actually implemented (tests fail now)