Search in sources :

Example 6 with ExtractionCallback

use of org.codice.ddf.spatial.geocoding.GeoEntryExtractor.ExtractionCallback in project ddf by codice.

the class GeoNamesFileExtractorTest method testFileExtractionStreaming.

private void testFileExtractionStreaming(final String fileLocation) throws GeoEntryExtractionException, GeoNamesRemoteDownloadException, GeoEntryIndexingException {
    final ExtractionCallback extractionCallback = mock(ExtractionCallback.class);
    final ArgumentCaptor<GeoEntry> geoEntryArgumentCaptor = ArgumentCaptor.forClass(GeoEntry.class);
    geoNamesFileExtractor.pushGeoEntriesToExtractionCallback(fileLocation, extractionCallback);
    verify(extractionCallback, atLeastOnce()).updateProgress(anyInt());
    verify(extractionCallback, times(3)).extracted(geoEntryArgumentCaptor.capture());
    final List<GeoEntry> capturedGeoEntryList = geoEntryArgumentCaptor.getAllValues();
    verifyGeoEntryList(capturedGeoEntryList);
}
Also used : GeoEntry(org.codice.ddf.spatial.geocoding.GeoEntry) ExtractionCallback(org.codice.ddf.spatial.geocoding.GeoEntryExtractor.ExtractionCallback)

Aggregations

ExtractionCallback (org.codice.ddf.spatial.geocoding.GeoEntryExtractor.ExtractionCallback)6 GeoEntry (org.codice.ddf.spatial.geocoding.GeoEntry)5 GeoEntryExtractionException (org.codice.ddf.spatial.geocoding.GeoEntryExtractionException)3 GeoEntryIndexingException (org.codice.ddf.spatial.geocoding.GeoEntryIndexingException)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 GeoEntryExtractor (org.codice.ddf.spatial.geocoding.GeoEntryExtractor)2 GeoEntryIndexer (org.codice.ddf.spatial.geocoding.GeoEntryIndexer)2 GeoNamesRemoteDownloadException (org.codice.ddf.spatial.geocoding.GeoNamesRemoteDownloadException)2 ProgressCallback (org.codice.ddf.spatial.geocoding.ProgressCallback)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 IOException (java.io.IOException)1 IndexWriter (org.apache.lucene.index.IndexWriter)1 SpatialStrategy (org.apache.lucene.spatial.SpatialStrategy)1 RecursivePrefixTreeStrategy (org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy)1 GeohashPrefixTree (org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree)1 SpatialPrefixTree (org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree)1 Directory (org.apache.lucene.store.Directory)1