Revision 4cad2e2b
Added by Andreas Müller over 13 years ago
cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/bci/BciServiceTest.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.cdm.ext.bci; |
5 | 5 |
|
6 |
import static org.junit.Assert.*; |
|
7 |
|
|
8 |
import java.net.MalformedURLException; |
|
9 |
import java.net.URL; |
|
10 | 6 |
import java.util.List; |
11 | 7 |
|
8 |
import org.junit.Assert; |
|
12 | 9 |
import org.junit.Before; |
13 |
import org.junit.BeforeClass; |
|
14 | 10 |
import org.junit.Test; |
15 |
import org.junit.Assert; |
|
16 | 11 |
|
17 | 12 |
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; |
18 | 13 |
import eu.etaxonomy.cdm.ext.ipni.IIpniService; |
19 |
import eu.etaxonomy.cdm.ext.ipni.IIpniService.DelimitedFormat; |
|
20 |
import eu.etaxonomy.cdm.model.agent.Person; |
|
21 |
import eu.etaxonomy.cdm.model.common.Extension; |
|
22 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
23 | 14 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
24 | 15 |
|
25 | 16 |
/** |
... | ... | |
52 | 43 |
} |
53 | 44 |
|
54 | 45 |
@Test |
55 |
public void testGetCollections(){ |
|
46 |
public void testGetCollectionsByCode(){
|
|
56 | 47 |
ICdmApplicationConfiguration config = null; |
57 | 48 |
List<Collection> collectionList = service1.getCollectionsByCode("BG", config); |
58 | 49 |
//expected web service result: urn:lsid:biocol.org:col:15727 http://biocol.org/urn:lsid:biocol.org:col:15727 University of Bergen Herbarium |
... | ... | |
62 | 53 |
//title cache |
63 | 54 |
Assert.assertEquals("Name for BG should be 'University of Bergen Herbarium'", "University of Bergen Herbarium", collection.getName()); |
64 | 55 |
Assert.assertEquals("LSID should be urn:lsid:biocol.org:col:15727", "urn:lsid:biocol.org:col:15727", collection.getLsid().getLsid()); |
65 |
System.out.println(collection.getLsid().getObject()); |
|
66 |
System.out.println(collection.getLsid().getNamespace()); |
|
67 |
System.out.println(collection.getLsid().getRevision()); |
|
68 | 56 |
|
69 |
// //alternative names |
|
70 |
// Assert.assertEquals("One extension for the alternative name should exist", 1, author.getExtensions().size()); |
|
71 |
// Extension alternativeName = author.getExtensions().iterator().next(); |
|
72 |
// Assert.assertEquals("Alternative name should be ", "Greuter, Werner Rodolfo", alternativeName.getValue()); |
|
73 |
// //dates |
|
74 |
// String year = author.getLifespan().getYear(); |
|
75 |
// Assert.assertNotNull("Year should be not null", year); |
|
76 |
// Assert.assertEquals("Year should be 1938", "1938", year); |
|
77 |
// |
|
78 |
// authorList = service1.getAuthors(null, "Greu*", null, null, null, config); |
|
79 |
// //29367-1%1.1%Greuet%Claude%Greuet%A%%>Greuet, Claude |
|
80 |
// //20000981-1%1.1%Greuning%J.V. van%Greuning%M%1993%>Greuning, J.V. van |
|
81 |
// //3379-1%1.1%Greuter%Werner Rodolfo%Greuter%PS%1938-%>Greuter, Werner Rodolfo |
|
82 |
// Assert.assertEquals("There should be exactly 3 result for 'Greu*'. But maybe this changes over time", 3, authorList.size()); |
|
83 |
// |
|
84 |
// |
|
85 |
//// for (Person person : authorList){ |
|
86 |
//// System.out.println(person.getTitleCache() + "; " + person.getNomenclaturalTitle()); |
|
87 |
//// } |
|
88 |
//// |
|
89 |
// authorList = service1.getAuthors(null, "Greuter", null, null, DelimitedFormat.MINIMAL, config); |
|
90 |
// Assert.assertEquals("There should be exactly 1 result for 'Greuter'", 1, authorList.size()); |
|
91 |
// author = authorList.get(0); |
|
92 |
// Assert.assertTrue("No alternative names should exist in the minimal version", author.getExtensions().isEmpty()); |
|
93 |
|
|
57 |
collectionList = service1.getCollectionsByCode("CM", config); |
|
58 |
Assert.assertEquals("There should be exactly 3 result for 'CM'. If not try http://www.biocol.org/rest/lookup/code/CM", 3, collectionList.size()); |
|
94 | 59 |
|
95 | 60 |
} |
96 | 61 |
|
Also available in: Unified diff
cleaned BciServiceTest