Search in sources :

Example 1 with GeoEntryCreator

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

the class GeoNamesCatalogIndexerTest method setUp.

@Before
public void setUp() throws Exception {
    geoEntryCreator = mock(GeoEntryCreator.class);
    when(geoEntryCreator.createGeoEntry(anyString(), anyString())).thenReturn(GEO_ENTRY);
    geoEntryExtractor = new GeoNamesFileExtractor();
    geoEntryExtractor.setGeoEntryCreator(geoEntryCreator);
    catalogFramework = mock(CatalogFramework.class);
    uuidGenerator = mock(UuidGenerator.class);
    createResponse = mock(CreateResponse.class);
    when(createResponse.getCreatedMetacards()).thenReturn(Collections.singletonList(METACARD));
    when(catalogFramework.create(any(CreateRequest.class))).thenReturn(createResponse);
    when(uuidGenerator.generateUuid()).thenReturn(UUID.randomUUID().toString());
    catalogProvider = mock(CatalogProvider.class);
    DeleteResponse deleteResponse = mock(DeleteResponse.class);
    when(deleteResponse.getDeletedMetacards()).thenReturn(Collections.singletonList(METACARD));
    when(catalogProvider.delete(any(DeleteRequest.class))).thenReturn(deleteResponse);
    queryResponse = mock(QueryResponse.class);
    when(queryResponse.getResults()).thenReturn(Collections.singletonList(new ResultImpl(new MetacardImpl())));
    when(catalogFramework.query(any(QueryRequest.class))).thenReturn(queryResponse);
    progressCallback = progress -> {
    };
    geoNamesCatalogIndexer = new GeoNamesCatalogIndexer(catalogFramework, uuidGenerator, new GeoEntryAttributes(), new GeotoolsFilterBuilder(), Collections.singletonList(catalogProvider));
}
Also used : UuidGenerator(org.codice.ddf.platform.util.uuidgenerator.UuidGenerator) QueryRequest(ddf.catalog.operation.QueryRequest) GeoEntryAttributes(org.codice.ddf.spatial.geocoding.GeoEntryAttributes) CreateResponse(ddf.catalog.operation.CreateResponse) CreateRequest(ddf.catalog.operation.CreateRequest) ResultImpl(ddf.catalog.data.impl.ResultImpl) GeoEntryCreator(org.codice.ddf.spatial.geocoding.GeoEntryCreator) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) DeleteResponse(ddf.catalog.operation.DeleteResponse) CatalogProvider(ddf.catalog.source.CatalogProvider) QueryResponse(ddf.catalog.operation.QueryResponse) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) GeoNamesFileExtractor(org.codice.ddf.spatial.geocoding.extract.GeoNamesFileExtractor) CatalogFramework(ddf.catalog.CatalogFramework) DeleteRequest(ddf.catalog.operation.DeleteRequest) Before(org.junit.Before)

Aggregations

CatalogFramework (ddf.catalog.CatalogFramework)1 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1 ResultImpl (ddf.catalog.data.impl.ResultImpl)1 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)1 CreateRequest (ddf.catalog.operation.CreateRequest)1 CreateResponse (ddf.catalog.operation.CreateResponse)1 DeleteRequest (ddf.catalog.operation.DeleteRequest)1 DeleteResponse (ddf.catalog.operation.DeleteResponse)1 QueryRequest (ddf.catalog.operation.QueryRequest)1 QueryResponse (ddf.catalog.operation.QueryResponse)1 CatalogProvider (ddf.catalog.source.CatalogProvider)1 UuidGenerator (org.codice.ddf.platform.util.uuidgenerator.UuidGenerator)1 GeoEntryAttributes (org.codice.ddf.spatial.geocoding.GeoEntryAttributes)1 GeoEntryCreator (org.codice.ddf.spatial.geocoding.GeoEntryCreator)1 GeoNamesFileExtractor (org.codice.ddf.spatial.geocoding.extract.GeoNamesFileExtractor)1 Before (org.junit.Before)1