use of ddf.catalog.operation.QueryResponse in project ddf by codice.
the class GazetteerQueryCatalogTest method testQueryInvalidStringAttributeOnMetacard.
@Test
public void testQueryInvalidStringAttributeOnMetacard() throws Exception {
Metacard metacard = generateGeoNamesMetacard();
metacard.setAttribute(new AttributeImpl(Core.TITLE, 1L));
QueryResponse queryResponse = generateQueryResponseFromMetacard(metacard);
when(catalogFramework.query(any(QueryRequest.class))).thenReturn(queryResponse);
List<GeoEntry> geoEntryList = queryCatalog.query(QUERY_STRING, 1);
GeoEntry geoEntry = geoEntryList.get(0);
assertThat(geoEntry.getName(), nullValue());
}
use of ddf.catalog.operation.QueryResponse in project ddf by codice.
the class GazetteerQueryCatalogTest method testQueryNoCountryCodeOnMetacard.
@Test
public void testQueryNoCountryCodeOnMetacard() throws Exception {
Metacard metacard = generateGeoNamesMetacard();
metacard.setAttribute(new AttributeImpl(Location.COUNTRY_CODE, ""));
QueryResponse queryResponse = generateQueryResponseFromMetacard(metacard);
when(catalogFramework.query(any(QueryRequest.class))).thenReturn(queryResponse);
List<GeoEntry> geoEntryList = queryCatalog.query(QUERY_STRING, 1);
assertThat(geoEntryList.size(), is(1));
GeoEntry geoEntry = geoEntryList.get(0);
assertThat(geoEntry.getCountryCode(), nullValue());
}
use of ddf.catalog.operation.QueryResponse in project ddf by codice.
the class GazetteerQueryCatalogTest method testQueryInvalidLocationOnMetacard.
@Test
public void testQueryInvalidLocationOnMetacard() throws Exception {
Metacard metacard = generateGeoNamesMetacard();
metacard.setAttribute(new AttributeImpl(Core.LOCATION, BAD_WKT));
QueryResponse queryResponse = generateQueryResponseFromMetacard(metacard);
when(catalogFramework.query(any(QueryRequest.class))).thenReturn(queryResponse);
List<GeoEntry> geoEntryList = queryCatalog.query(QUERY_STRING, 1);
assertThat(geoEntryList.size(), is(1));
GeoEntry geoEntry = geoEntryList.get(0);
assertThat(geoEntry.getLatitude(), nullValue());
assertThat(geoEntry.getLongitude(), nullValue());
}
use of ddf.catalog.operation.QueryResponse in project ddf by codice.
the class GazetteerQueryCatalogTest method testGetNearestCitiesInvalidLocation.
@Test
public void testGetNearestCitiesInvalidLocation() throws Exception {
Metacard metacard = generateGeoNamesMetacard();
metacard.setAttribute(new AttributeImpl(Core.LOCATION, BAD_WKT));
QueryResponse queryResponse = generateQueryResponseFromMetacard(metacard);
when(catalogFramework.query(any(QueryRequest.class))).thenReturn(queryResponse);
List<NearbyLocation> nearbyLocations = queryCatalog.getNearestCities(NEAR_BOSTON_WKT, RADIUS_IN_KM, MAX_RESULTS);
assertThat(nearbyLocations.size(), is(0));
}
use of ddf.catalog.operation.QueryResponse in project ddf by codice.
the class GazetteerQueryCatalogTest method testGetNearestCitiesMissingTitle.
@Test
public void testGetNearestCitiesMissingTitle() throws Exception {
Metacard metacard = generateGeoNamesMetacard();
metacard.setAttribute(new AttributeImpl(Core.TITLE, ""));
QueryResponse queryResponse = generateQueryResponseFromMetacard(metacard);
when(catalogFramework.query(any(QueryRequest.class))).thenReturn(queryResponse);
List<NearbyLocation> nearbyLocations = queryCatalog.getNearestCities(NEAR_BOSTON_WKT, RADIUS_IN_KM, MAX_RESULTS);
assertThat(nearbyLocations.size(), is(0));
}
Aggregations