Revision 5405
Added by berkley over 14 years ago
test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java | ||
---|---|---|
87 | 87 |
public static Test suite() |
88 | 88 |
{ |
89 | 89 |
TestSuite suite = new TestSuite(); |
90 |
/*suite.addTest(new CrudServiceTest("initialize"));
|
|
90 |
suite.addTest(new CrudServiceTest("initialize")); |
|
91 | 91 |
suite.addTest(new CrudServiceTest("testSingletonAccessor")); |
92 | 92 |
suite.addTest(new CrudServiceTest("testCreateAndGet")); |
93 | 93 |
suite.addTest(new CrudServiceTest("testGetSystemMetadata")); |
... | ... | |
96 | 96 |
suite.addTest(new CrudServiceTest("testAccessControl")); |
97 | 97 |
suite.addTest(new CrudServiceTest("testGenerateMissingSystemMetadata")); |
98 | 98 |
suite.addTest(new CrudServiceTest("testGetLogRecords")); |
99 |
suite.addTest(new CrudServiceTest("testChecksumError"));*/
|
|
99 |
suite.addTest(new CrudServiceTest("testChecksumError")); |
|
100 | 100 |
suite.addTest(new CrudServiceTest("testPublicAccess")); |
101 | 101 |
return suite; |
102 | 102 |
} |
... | ... | |
114 | 114 |
ObjectList ol = cs.listObjects(token, null, null, null); |
115 | 115 |
System.out.println("ol: " + ol.sizeObjectInfoList()); |
116 | 116 |
assertTrue(ol.sizeObjectInfoList() > 0); |
117 |
|
|
118 |
ObjectInfo oi = ol.getObjectInfo(0); |
|
119 |
String s = getDoc(token, oi.getIdentifier()); |
|
120 |
assertNotNull(s); |
|
121 |
|
|
122 |
try |
|
123 |
{ //try a create with the public auth. should fail |
|
124 |
Identifier id = new Identifier(); |
|
125 |
String docid = generateDocumentId(); |
|
126 |
id.setValue(docid); |
|
127 |
String testDoc = getTestDoc(); |
|
128 |
StringBufferInputStream sbis = new StringBufferInputStream(testDoc); |
|
129 |
ObjectFormat of1 = ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0"); |
|
130 |
SystemMetadata sm = createSystemMetadata(id, testDoc, of1); |
|
131 |
assertFalse(sm.getChecksum().getValue().startsWith("MD5")); |
|
132 |
//create the doc |
|
133 |
Identifier idC = cs.create(token, id, sbis, sm); |
|
134 |
fail("Should have thrown an auth exception"); |
|
135 |
} |
|
136 |
catch(Exception e) |
|
137 |
{ |
|
138 |
|
|
139 |
} |
|
117 | 140 |
} |
118 | 141 |
catch(Exception e) |
119 | 142 |
{ |
Also available in: Unified diff
added a failure test to the testPublicAccess test. This test should allow public gets and listObjects but not public creates