Search in sources :

Example 1 with FeatureIndexer

use of org.codice.ddf.spatial.geocoding.FeatureIndexer in project ddf by codice.

the class GazetteerUpdateCommandTest method testFeatureIndexing.

@Test
public void testFeatureIndexing() throws Exception {
    String resource = "example.geojson";
    final FeatureExtractor featureExtractor = spy(new FeatureExtractor() {

        @Override
        public void pushFeaturesToExtractionCallback(String resource, ExtractionCallback extractionCallback) throws FeatureExtractionException {
        /* stub */
        }
    });
    final FeatureIndexer featureIndexer = spy(new FeatureIndexer() {

        @Override
        public void updateIndex(String resource, FeatureExtractor featureExtractor, boolean create, IndexCallback callback) throws FeatureExtractionException, FeatureIndexingException {
        /* stub */
        }
    });
    gazetteerUpdateCommand.setResource(resource);
    gazetteerUpdateCommand.setFeatureExtractor(featureExtractor);
    gazetteerUpdateCommand.setFeatureIndexer(featureIndexer);
    gazetteerUpdateCommand.executeWithSubject();
    verify(featureIndexer, times(1)).updateIndex(eq(resource), eq(featureExtractor), eq(false), any(FeatureIndexer.IndexCallback.class));
}
Also used : FeatureExtractor(org.codice.ddf.spatial.geocoding.FeatureExtractor) FeatureIndexingException(org.codice.ddf.spatial.geocoding.FeatureIndexingException) FeatureExtractionException(org.codice.ddf.spatial.geocoding.FeatureExtractionException) Matchers.containsString(org.hamcrest.Matchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ExtractionCallback(org.codice.ddf.spatial.geocoding.GeoEntryExtractor.ExtractionCallback) FeatureIndexer(org.codice.ddf.spatial.geocoding.FeatureIndexer) Test(org.junit.Test)

Aggregations

FeatureExtractionException (org.codice.ddf.spatial.geocoding.FeatureExtractionException)1 FeatureExtractor (org.codice.ddf.spatial.geocoding.FeatureExtractor)1 FeatureIndexer (org.codice.ddf.spatial.geocoding.FeatureIndexer)1 FeatureIndexingException (org.codice.ddf.spatial.geocoding.FeatureIndexingException)1 ExtractionCallback (org.codice.ddf.spatial.geocoding.GeoEntryExtractor.ExtractionCallback)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1