Revision 6124
Added by Chris Jones almost 13 years ago
CrudServiceTest.java | ||
---|---|---|
34 | 34 |
import junit.framework.TestSuite; |
35 | 35 |
|
36 | 36 |
import org.apache.commons.io.IOUtils; |
37 |
import org.dataone.client.ObjectFormatCache; |
|
37 | 38 |
import org.dataone.service.exceptions.BaseException; |
38 | 39 |
import org.dataone.service.types.AuthToken; |
39 | 40 |
import org.dataone.service.types.Checksum; |
... | ... | |
131 | 132 |
//create the system metadata then run the create method |
132 | 133 |
StringBufferInputStream sbis = new StringBufferInputStream(testDoc); |
133 | 134 |
SystemMetadata sm = createSystemMetadata(id, testDoc, |
134 |
ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0"));
|
|
135 |
ObjectFormatCache.getFormat("eml://ecoinformatics.org/eml-2.1.0"));
|
|
135 | 136 |
//create the doc |
136 | 137 |
Identifier rGuid = cs.create(token, id, sbis, sm); |
137 | 138 |
|
... | ... | |
291 | 292 |
id.setValue(docid); |
292 | 293 |
String testDoc = getTestDoc(); |
293 | 294 |
StringBufferInputStream sbis = new StringBufferInputStream(testDoc); |
294 |
ObjectFormat of1 = ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0");
|
|
295 |
ObjectFormat of1 = ObjectFormatCache.getFormat("eml://ecoinformatics.org/eml-2.1.0");
|
|
295 | 296 |
SystemMetadata sm = createSystemMetadata(id, testDoc, of1); |
296 | 297 |
assertFalse(sm.getChecksum().getValue().startsWith("MD5")); |
297 | 298 |
//create the doc |
... | ... | |
310 | 311 |
id.setValue(docid); |
311 | 312 |
String testDoc = getTestDoc(); |
312 | 313 |
StringBufferInputStream sbis = new StringBufferInputStream(testDoc); |
313 |
ObjectFormat of1 = ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0");
|
|
314 |
ObjectFormat of1 = ObjectFormatCache.getFormat("eml://ecoinformatics.org/eml-2.1.0");
|
|
314 | 315 |
SystemMetadata sm = createSystemMetadata(id, testDoc, of1); |
315 | 316 |
assertFalse(sm.getChecksum().getValue().startsWith("MD5")); |
316 | 317 |
//create the doc |
... | ... | |
358 | 359 |
Date d1 = new Date(new Date().getTime() - 5000); |
359 | 360 |
CrudService cs = CrudService.getInstance(); |
360 | 361 |
AuthToken token = getToken(); |
361 |
ObjectFormat of1 = ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0");
|
|
362 |
ObjectFormat of1 = ObjectFormatCache.getFormat("eml://ecoinformatics.org/eml-2.1.0");
|
|
362 | 363 |
//create docs at different times |
363 | 364 |
|
364 | 365 |
Identifier id = new Identifier(); |
... | ... | |
479 | 480 |
{ |
480 | 481 |
CrudService cs = CrudService.getInstance(); |
481 | 482 |
AuthToken token = getToken(); |
482 |
ObjectFormat of1 = ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0");
|
|
483 |
ObjectFormat of2 = ObjectFormat.convert("eml://ecoinformatics.org/eml-2.0.0");
|
|
483 |
ObjectFormat of1 = ObjectFormatCache.getFormat("eml://ecoinformatics.org/eml-2.1.0");
|
|
484 |
ObjectFormat of2 = ObjectFormatCache.getFormat("eml://ecoinformatics.org/eml-2.0.0");
|
|
484 | 485 |
//create docs at different times |
485 | 486 |
Date d1 = new Date(); |
486 | 487 |
Identifier id1 = createDoc(token, getTestDoc(EML2_1_0), of1); |
... | ... | |
820 | 821 |
*/ |
821 | 822 |
public Identifier createDoc(AuthToken token, String testDoc) throws Exception |
822 | 823 |
{ |
823 |
return createDoc(token, testDoc, ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0"));
|
|
824 |
return createDoc(token, testDoc, ObjectFormatCache.getFormat("eml://ecoinformatics.org/eml-2.1.0"));
|
|
824 | 825 |
} |
825 | 826 |
|
826 | 827 |
/** |
... | ... | |
851 | 852 |
throws Exception |
852 | 853 |
{ |
853 | 854 |
return createSystemMetadata(id, testDoc, |
854 |
ObjectFormat.convert("eml://ecoinformatics.org/eml-2.1.0"));
|
|
855 |
ObjectFormatCache.getFormat("eml://ecoinformatics.org/eml-2.1.0"));
|
|
855 | 856 |
} |
856 | 857 |
|
857 | 858 |
/** |
Also available in: Unified diff
Merged in the D1_0_6_2_BRANCH changes that include the transition from ObjectFormat calls to ObjectFormatCache calls.