Project

General

Profile

« Previous | Next » 

Revision 26489b6c

Added by Patrick Plitzner about 10 years ago

  • completed implementation of querying for the original unit from a GBIF response

View differences:

cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/occurrence/gbif/GbifQueryServiceWrapperTest.java
42 42
            		"\"datasetKey\": \"26a49731-9457-45b2-9105-1b96063deb26\"," +
43 43
            		"\"publishingOrgKey\": \"07f617d0-c688-11d8-bf62-b8a03c50a862\"," +
44 44
            		"\"publishingCountry\": \"GB\"," +
45
            		"\"protocol\": \"DWC_ARCHIVE\"," +
45
            		"\"protocol\": \"BIOCASE\"," +
46 46
            		"\"lastCrawled\": \"2013-09-07T07:08:17.000+0000\"," +
47 47
                    "\"identifiers\": [ ],"+
48 48
                    "\"media\": [ ],"+
......
95 95
"]";
96 96

  
97 97
    @Test
98
    public void testJsonToCdmObject(){
98
    public void testJsonToCdmObject() throws URISyntaxException{
99 99
        Collection<GbifResponse> records = GbifJsonOccurrenceParser.parseJsonRecords(dummyJsonRecords);
100 100
        assertEquals("number of records found is incorrect", 1, records.size());
101 101
        GbifResponse gbifResponse = records.iterator().next();
102 102
        assertEquals("Locality is incorrect", LOCALITY_STRING, gbifResponse.getDerivedUnitFacade().getLocalityText());
103
        assertEquals("protocol is wrong", GbifDataSetProtocol.BIOCASE, gbifResponse.getDataSetProtocol());
104
        assertEquals("protocol is wrong", new URI("http://api.gbif.org/v0.9/dataset/26a49731-9457-45b2-9105-1b96063deb26/endpoint"), gbifResponse.getDataSetUri());
103 105
    }
104 106

  
105 107
    @Test
106 108
    public void testJsonOriginalDataSetUriParsing(){
107 109
        DataSetResponse response = GbifJsonOccurrenceParser.parseOriginalDataSetUri(dummyJsonDataset);
108
        assertEquals("Response key is incorrect!", "29596", response.getKey());
110
        assertEquals("Response unitId is incorrect! (Should be equal to catalogNumber)", "70875196", response.getUnitId());
109 111
        assertEquals("Response protocol is incorrect!", GbifDataSetProtocol.BIOCASE, response.getProtocol());
110 112
        assertEquals("Response endpoint is incorrect!", URI.create("http://www.flora-mv.de/biocase/pywrapper.cgi?dsa=hoeherePflanzen"), response.getEndpoint());
111 113
    }

Also available in: Unified diff