1
|
package org.bgbm.biovel.drf.checklist;
|
2
|
|
3
|
import java.util.Iterator;
|
4
|
import java.util.List;
|
5
|
|
6
|
import javax.xml.bind.JAXBException;
|
7
|
|
8
|
import org.bgbm.biovel.drf.client.ServiceProviderInfo;
|
9
|
import org.bgbm.biovel.drf.input.DRFCSVInputParser;
|
10
|
import org.bgbm.biovel.drf.input.DRFInputException;
|
11
|
import org.bgbm.biovel.drf.tnr.msg.TnrMsg;
|
12
|
import org.bgbm.biovel.drf.utils.BiovelUtils;
|
13
|
import org.bgbm.biovel.drf.utils.JSONUtils;
|
14
|
import org.bgbm.biovel.drf.utils.TnrMsgException;
|
15
|
import org.bgbm.biovel.drf.utils.TnrMsgUtils;
|
16
|
import org.junit.BeforeClass;
|
17
|
import org.junit.Test;
|
18
|
|
19
|
public class Species2000ColClientTest {
|
20
|
|
21
|
private static DRFCSVInputParser parser;
|
22
|
|
23
|
private static ServiceProviderInfo ci;
|
24
|
|
25
|
@BeforeClass
|
26
|
public static void setup() {
|
27
|
parser = new DRFCSVInputParser();
|
28
|
|
29
|
ci = new ServiceProviderInfo(Species2000ColClient.ID,
|
30
|
Species2000ColClient.LABEL,
|
31
|
Species2000ColClient.URL,
|
32
|
Species2000ColClient.DATA_AGR_URL, ServiceProviderInfo.DEFAULT_SEARCH_MODE);
|
33
|
}
|
34
|
|
35
|
@Test
|
36
|
public void convertChecklistInfoToJson() throws DRFChecklistException {
|
37
|
String checklistInfoJson = JSONUtils.convertObjectToJson(ci);
|
38
|
System.out.println("Json : " + checklistInfoJson);
|
39
|
}
|
40
|
|
41
|
@Test
|
42
|
public void nameCompleteTest() throws DRFChecklistException, DRFInputException, JAXBException, TnrMsgException {
|
43
|
|
44
|
parser = new DRFCSVInputParser();
|
45
|
List<TnrMsg> tnrMsgs = parser.parse(BiovelUtils.getResourceAsString("/org/bgbm/biovel/drf/tnr/nameCompleteOnly.csv","UTF-8"));
|
46
|
|
47
|
Species2000ColClient scc = new Species2000ColClient();
|
48
|
Iterator<TnrMsg> tnrMsgItr = tnrMsgs.iterator();
|
49
|
while(tnrMsgItr.hasNext()) {
|
50
|
TnrMsg tnrMsg = tnrMsgItr.next();
|
51
|
TnrMsgUtils.updateWithSearchMode(tnrMsg, SearchMode.scientificNameExact);
|
52
|
scc.queryChecklist(tnrMsg);
|
53
|
String outputXML = TnrMsgUtils.convertTnrMsgToXML(tnrMsg);
|
54
|
System.out.println(outputXML);
|
55
|
}
|
56
|
}
|
57
|
}
|
58
|
|